import { AudioMgr, GameViewType } from "../../main/ViewManage"; import ViewObject from "../../main/ViewObject"; import { ReveData } from "../../util/CHttp"; import RedPoint from "../data/RedPoint"; import Home from "./Home"; import ShopView from "./shop/ShopView"; const { ccclass, property } = cc._decorator; @ccclass export default class TopMenu extends ViewObject { @property(cc.Label) lbPower: cc.Label = null; @property(cc.Label) lbCoin: cc.Label = null; @property(cc.Label) lbDiamond: cc.Label = null; @property(cc.Node) mEmailNode: cc.Node = null; home: Home = null; onEnable() { this.refresh(); } refresh() { let role = this.main.player.role; this.lbCoin.string = '' + role.money; this.lbDiamond.string = '' + role.gold; this.lbPower.string = role.power + '/30'; } forbidBtn(value: boolean) { this.lbCoin.node.parent.getComponent(cc.Button).interactable = value; this.lbDiamond.node.parent.getComponent(cc.Button).interactable = value; this.lbPower.node.parent.getComponent(cc.Button).interactable = value; } /** * 设置 */ public onclickSet() { this.main.playerEffectByPath(AudioMgr.click); this.main.viewManage.loadFunc(GameViewType.tap_set, (viewObject: ViewObject) => { viewObject.show(); }); } /** * 商城 */ public openShop(eventTouch: cc.Event.EventTouch, data: string) { this.main.playerEffectByPath(AudioMgr.click); this.main.startLoad(); this.main.viewManage.loadFunc(GameViewType.tap_shop, (viewObject: ViewObject) => { let shopView = viewObject as ShopView; shopView.init(Number(data)); shopView.show(); }); } /** * 邮件 */ public onclickMail() { this.main.playerEffectByPath(AudioMgr.click); this.main.startLoad(); RedPoint.removeRed(this.mEmailNode); this.main.viewManage.loadFunc(GameViewType.email, (viewObject: ViewObject) => { viewObject.show(); }); } }