QipaoPanel.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { GameData } from "../../../game/data/GameData";
  2. /** 气泡界面 */
  3. const { ccclass, property } = cc._decorator;
  4. @ccclass
  5. export default class QipaoPanel extends cc.Component {
  6. @property({ type: cc.Animation, displayName: '气泡动画' })
  7. airshipAni: cc.Animation = null;
  8. showRedNum = 0;
  9. countDown = 0;
  10. start() {
  11. this.airshipAni.node.active = false;
  12. }
  13. protected update(dt: number): void {
  14. if (gData.gameData.configs.ServerConfig) {
  15. if (gData.gameData.adShowConfig.average_ecpm < gData.gameData.configs.ServerConfig.FlyswitchECPM) {
  16. this.airshipAni.node.active = false
  17. return;
  18. }
  19. }
  20. if (this.showRedNum < 1) {
  21. this.countDown += dt;
  22. if (this.countDown >= 30) {
  23. this.countDown = 0;
  24. this.showRedNum++;
  25. this.airshipAni.node.active = true
  26. this.airshipAni.setCurrentTime(0, 'airship')
  27. this.airshipAni.play()
  28. }
  29. }
  30. }
  31. }