unLock_view.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { _decorator, Component, Label, Node, Animation } from 'cc';
  2. import { base_ui } from '../fw/base_ui';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('unLock_view')
  5. export class unLock_view extends base_ui {
  6. @property(Node) btn_close:Node = null
  7. @property(Node) btn_look_video:Node = null
  8. @property(Node) lab_look_video:Node = null
  9. private max_count:number = 3
  10. start() {
  11. this.onButtonListen(this.btn_close, ()=>{
  12. this.stopBtnLookVideoAni()
  13. this.close()
  14. })
  15. let count = 0
  16. this.onButtonListen(this.btn_look_video, ()=>{
  17. if(count>=this.max_count) {
  18. return
  19. }
  20. count++
  21. this.lab_look_video.getComponent(Label).string = '看视频' + count + '/' + this.max_count
  22. })
  23. this.playBtnLookVideoAni()
  24. }
  25. private playBtnLookVideoAni() {
  26. this.btn_look_video.getComponent(Animation).play()
  27. }
  28. private stopBtnLookVideoAni() {
  29. this.btn_look_video.getComponent(Animation).stop()
  30. }
  31. }