| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- const {ccclass, property} = cc._decorator;
- /**结算面板 */
- @ccclass
- export default class Account extends cc.Component {
- private icon_win:cc.Node;
- private icon_fail:cc.Node;
- private scoreLabel:cc.Label;
- private btn_continue:cc.Node;
- private btn_restart:cc.Node;
- private btn_rank:cc.Node;
- private btn_share:cc.Node;
- /**动态分数值 */
- private raisingScore:number = 0;
- public onLoad():void{
- this.icon_win = this.node.getChildByName('win');
- this.icon_fail = this.node.getChildByName('fail');
- this.scoreLabel = this.node.getChildByName('score').getChildByName('label').getComponent(cc.Label);
- this.btn_continue = this.node.getChildByName('continue');
- this.btn_restart = this.node.getChildByName('restart');
- this.btn_rank = this.node.getChildByName('rank');
- this.btn_share = this.node.getChildByName('share');
- this.btn_restart.on(cc.Node.EventType.TOUCH_END,this.restart,this);
- this.btn_continue.on(cc.Node.EventType.TOUCH_END,this.continue,this);
- this.btn_rank.on(cc.Node.EventType.TOUCH_END,this.showRank,this);
- this.btn_share.on(cc.Node.EventType.TOUCH_END,this.share,this);
- }
- public update():void{
- this.scoreLabel.string = Math.floor(this.raisingScore).toString();
- }
- public showResult(win:boolean):void{
- win?this.icon_win.active=true:this.icon_fail.active=true;
- }
- public showScore(score:number):void{
- let tween = new cc.Tween();
- tween.target(this);
- tween.to(1,{raisingScore:score},null);
- tween.start();
- }
- private restart():void{
- cc.audioEngine.playEffect(cc.loader.getRes('audio/btn',cc.AudioClip),false);
- window.gameMgr.background.removeAllChildren(true);
- window.gameMgr.startGame();
- }
- private continue():void{
- cc.audioEngine.playEffect(cc.loader.getRes('audio/btn',cc.AudioClip),false);
- alert('此功能尚未开放');
- }
- private showRank():void{
- cc.audioEngine.playEffect(cc.loader.getRes('audio/btn',cc.AudioClip),false);
- alert('此功能尚未开放');
- }
- private share():void{
- cc.audioEngine.playEffect(cc.loader.getRes('audio/btn',cc.AudioClip),false);
- alert('此功能尚未开放');
- }
- }
|