cc.Class({ extends: cc.Component, properties: { PayPage: { default: null, type: cc.Node, serializable: true, }, Tip_AfterPay: { default: null, type: cc.Node, serializable: true, }, Tip_AfterPayText:'', KeyboardBG: { default: null, type: cc.Node, serializable: true, }, NumKeysLayout: { default: null, type: cc.Node, serializable: true, }, KeyboardIsOpened:true, OpenOrCloseIMG: { default: null, type: cc.Node, serializable: true, }, PasswordLayout: { default: null, type: cc.Node, serializable: true, }, SumOfKeys:0, }, start () { }, PayPageInit(Tip_AfterPayText,PayPrice){ this.PayPage.getChildByName('Label_Price').getComponent(cc.Label).string = PayPrice.toString(); this.Tip_AfterPayText = Tip_AfterPayText; this.KeyboardBG.active = true; this.NumKeysLayout.active = true; this.OpenOrCloseIMG.angle = -90; this.KeyboardIsOpened = true; this.SumOfKeys = 0; for(var i = 0;i<6;i++){ this.PasswordLayout.children[i].active = false; } }, PayPageCloseBtnOnClick(){ this.PayPage.active = false; }, KeyOnClick_OpenOrCloseBtn(){ if(this.KeyboardIsOpened == true){ this.KeyboardBG.active = false; this.NumKeysLayout.active = false; this.OpenOrCloseIMG.angle = 90; this.KeyboardIsOpened = false; }else{ this.KeyboardBG.active = true; this.NumKeysLayout.active = true; this.OpenOrCloseIMG.angle = -90; this.KeyboardIsOpened = true; } }, KeyOnClick_NumKey(){ if(this.SumOfKeys<6){ this.PasswordLayout.children[this.SumOfKeys].active = true; this.SumOfKeys += 1; if(this.SumOfKeys == 6){ this.scheduleOnce(function() { this.PayPage.active = false; this.Tip_AfterPay.getChildByName('TipText').getComponent(cc.Label).string = this.Tip_AfterPayText; this.Tip_AfterPay.active = true; var animCtrl = this.Tip_AfterPay.getComponent(cc.Animation); animCtrl.play(); }, 0.1); } } }, KeyOnClick_RevokeKey(){ if(this.SumOfKeys>0){ this.SumOfKeys -= 1; this.PasswordLayout.children[this.SumOfKeys].active = false; } } });