12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- var baseLayer = require('BaseLayer');
- import SoundMgr from "../base/SoundMgr";
- cc.Class({
- extends: baseLayer,
- properties: {
- labPhone: cc.EditBox,
- labCode: cc.EditBox,
- maskCode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- start () {
- this.codeTime = 60;
- },
- onClickCode(){
- SoundMgr.playClick();
- this.maskCode.active = true;
- this.refreshMaskS();
- this.schedule(()=>{
- this.refreshMaskS();
- }, 1, cc.macro.REPEAT_FOREVER)
- },
- refreshMaskS(){
- this.maskCode.getChildByName('lab').getComponent(cc.Label).string = `${this.codeTime}s`;
- this.codeTime -= 1;
- if(this.codeTime < 0){
- this.codeTime = 60;
- this.unscheduleAllCallbacks();
- this.maskCode.active = false;
- }
- },
- onClickSubmit(){
- SoundMgr.playClick();
- },
- });
|