| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 | 
							- // Learn cc.Class:
 
- //  - https://docs.cocos.com/creator/manual/en/scripting/class.html
 
- // Learn Attribute:
 
- //  - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
 
- // Learn life-cycle callbacks:
 
- //  - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
 
- cc.Class({
 
-     extends: cc.Component,
 
-     properties: {
 
-         time: cc.Label,
 
-         countdown: 3, 
 
-         
 
-         show:cc.Node,
 
-         dialog:cc.Node,
 
-         text:cc.Label,
 
-         two:0,
 
-         showTitle:"",
 
-         startAudio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-         startFiveAudio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-         callback:null,
 
-         start3Audio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-         start2Audio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-         start1Audio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-         start0Audio: {
 
-             default: null,
 
-             type: cc.AudioClip
 
-         },
 
-     },
 
-     // LIFE-CYCLE CALLBACKS:
 
-     // onLoad () {},
 
-     start () {
 
-         this.time.string = 3;           //  场景文本框为 显示5
 
-         this.countdown = 3;
 
-         
 
-         let audioId = cc.audioEngine.playEffect(this.start3Audio, false);
 
-         cc.audioEngine.setVolume(audioId, 1);
 
-         if (this.countdown > 0) {
 
-            this.callback = this.schedule(function () {    // 计时器将每隔 1s 执行一次。
 
-               
 
-                 this.DoSomething();
 
-                 
 
-                 if(this.countdown==0){
 
-                     this.time.destroy();
 
-                     
 
-                     this.setElse()
 
-                     
 
-                 }   
 
-             }, 1);
 
-         }
 
-         
 
-         // this.text.string = "起拍价5W"          //  场景文本框为 显示5
 
-         // this.countdown = 0;
 
-         // if (this.countdown >= 0) {
 
-             
 
-         // }
 
-     },
 
-     setElse(){
 
-         this.schedule(function () { 
 
-                // 计时器将每隔 1s 执行一次。
 
-             this.textChane();   
 
-         }, 1)
 
-         
 
-        
 
-     
 
-     },
 
-     DoSomething() {  
 
-         var audioId              // 倒计时算法
 
-         if (this.countdown >= 1) {
 
-             this.countdown = this.countdown - 1;
 
-             this.time.string = this.countdown; 
 
-             if(this.countdown == 2){
 
-                 audioId = cc.audioEngine.playEffect(this.start2Audio, false);
 
-                 cc.audioEngine.setVolume(audioId, 1);
 
-             }else if(this.countdown == 1){
 
-                 audioId = cc.audioEngine.playEffect(this.start1Audio, false);
 
-                 cc.audioEngine.setVolume(audioId, 1);
 
-             }else if(this.countdown == 0){
 
-                 audioId = cc.audioEngine.playEffect(this.start0Audio, false);
 
-                 cc.audioEngine.setVolume(audioId, 1);
 
-             }
 
-             //场景中文本框显示 
 
-            console.log(this.countdown,"set")
 
-         }else{
 
-             this.unschedule(this.callback)
 
-             return 
 
-         }
 
-     },
 
-     textChane(){
 
-         this.two = this.two + 1;
 
-         console.log(this.two)
 
-         if(this.two == 1){
 
-             this.show.active = true
 
-             let audioId = cc.audioEngine.playEffect(this.startFiveAudio, false);
 
-             cc.audioEngine.setVolume(audioId, 1);
 
-         }else if(this.two==3){
 
-             this.text.string = '现在拍卖开始!'; 
 
-             let audioId = cc.audioEngine.playEffect(this.startAudio, false);
 
-             cc.audioEngine.setVolume(audioId, 1);
 
-         }else if(this.two==4){
 
-             this.node.destroy();
 
-             this.show.active = false
 
-             this.dialog.active = true
 
-         }   
 
-         
 
-     }
 
-     // update (dt) {},
 
- });
 
 
  |