import ViewBase from "./ViewBase"; import Common from "../common/Common"; import Define from "../common/Define"; import UIManager from "../manager/UIManager"; import UserInfo from "../UserInfo"; import WXHelper from "../common/WXHelper"; // Learn TypeScript: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/typescript.html // - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/typescript.html // Learn Attribute: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html // - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html // - [English] http://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html const {ccclass, property} = cc._decorator; @ccclass export default class OffLineRewardViewCtr extends ViewBase { @property(cc.Label) textGold: cc.Label = null; @property(cc.Node) btn_getReward: cc.Node = null; @property(cc.Node) btn_vedio: cc.Node = null; @property(cc.Node) btn_eventSwallow: cc.Node = null; @property(cc.Node) node_bg: cc.Node = null; //点击点击事件 //只调用一次 addEvent(){ Common.addClickEvent(this.btn_getReward,this.onClick.bind(this)); Common.addClickEvent(this.btn_vedio,this.onClick.bind(this)); Common.addClickEvent(this.btn_eventSwallow,this.onClick.bind(this),false); } onClick(tag:string){ if(tag == "btn_getReward"){ UIManager.getInstance().showView(Define.viewMain); UIManager.getInstance().hideView(Define.viewOffLineReward) Common.isShowGoldFlyEffect = true; //奖励金币 UserInfo.saveGoldData(Common.offLineRewardCount); // }else if(tag == "btn_vedio"){ // WXHelper.showVideo(function(state){ // if(state == 1){ // UserInfo.saveGoldData(Common.offLineRewardCount*2); // Common.isShowGoldFlyEffect = true; // UIManager.getInstance().showView(Define.viewMain); // UIManager.getInstance().hideView(Define.viewOffLineReward) // } // }.bind(this)) } } refreshView(isFristRefresh:boolean = false){ this.textGold.string = Common.getShowNumber(Common.offLineRewardCount).toString(); if(WXHelper.isLoadVideoSuccessful){ this.btn_vedio.active = true this.node_bg.height = 450 }else{ this.btn_vedio.active = false this.node_bg.height = 380 } } showActionCallBack(){ //这里播放特效 } //只调用一次 initView(){ this.showActionType = Define.up; } }