import AudioManager from "./AudioManager"; import LoadManager from "./LoadManager"; import LocalData from "./LocalData"; import { ButtonLock } from "./Template/MyComponent"; const { ccclass, property } = cc._decorator; @ccclass export default class Hall extends cc.Component { //最高纪录 @property(cc.Label) MaxRecordLabel: cc.Label = null; // //金币 // @property(cc.Label) // GoldLabel: cc.Label = null; @property(cc.Node) UIParentNode: cc.Node = null; start() { this.init() AudioManager.instance.playHallBg() if (cc.sys.platform == cc.sys.WECHAT_GAME) { let Editer = this.node.getChildByName("UI").getChildByName("Editer") Editer.active=false } } init() { // LocalData.getInstance().setGold(99, '+') // LocalData.getInstance().setMaxRecord(99, '=') // this.GoldLabel.string = LocalData.getInstance().getGold().toString() this.MaxRecordLabel.string = LocalData.getInstance().getMaxRecord().toString() } @ButtonLock(1, null) ClickSet() { cc.log('ClickSet'); (async () => { const url = "res/Pop/Set" let Prefab = await LoadManager.instance.LoadAssets(url); if (cc.isValid(Prefab)) { let a = cc.instantiate(Prefab); // a.setPosition(0,0) this.UIParentNode.addChild(a) this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0) } })(); } @ButtonLock(1, null) ClickFuLi() { cc.log('ClickFuLi'); } @ButtonLock(1, null) ClickMeiRiJiangLi() { return cc.log('ClickMeiRiJiangLi'); (async () => { const url = "res/Pop/Sign" let Prefab = await LoadManager.instance.LoadAssets(url); if (cc.isValid(Prefab)) { let a = cc.instantiate(Prefab); this.UIParentNode.addChild(a) this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0) } })(); } @ButtonLock(1, null) ClickRank() { cc.log('ClickRank'); } @ButtonLock(1, null) ClickShop() { cc.log('ClickShop'); (async () => { const url = "res/Pop/Shop" let Prefab = await LoadManager.instance.LoadAssets(url); if (cc.isValid(Prefab)) { let a = cc.instantiate(Prefab); this.UIParentNode.addChild(a) this.scheduleOnce(() => { a.setPosition(cc.v2(0, 0)) }, 0) } })(); } @ButtonLock(1, null) ClickStart() { cc.log('ClickStart'); cc.director.loadScene("Game") } @ButtonLock(1, null) ClickBjq() { cc.log('ClickGold'); cc.director.loadScene("Editer") } }