// Learn TypeScript: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html import EventName, { EventLabel, PopType } from "../EventName/EventName"; import { Global } from "../Global"; import LocalData from "../LocalData"; import SDKManager from "../SDKManager"; import MyComponent, { ButtonLock } from "../Template/MyComponent"; const { ccclass, property } = cc._decorator; @ccclass export default class Gold extends MyComponent { Label: cc.Label = null onLoad(): void { this.Label = this.node.getComponentInChildren(cc.Label) } start() { this.regEvent(EventName.changeGold, this.UpdataGold, this) } UpdataGold() { this.Label.string = LocalData.getInstance().getGold().toString() } @ButtonLock(1, null) ClickGold() { let temp: PopType = new PopType() temp.string = EventLabel.OpenVideo temp.Title = '提示' temp.OK = () => { let OPenVideo: PopType = new PopType() OPenVideo.OK = () => { LocalData.getInstance().setGold(Global.adReward, '+') } SDKManager.instance.OPenVideo(OPenVideo) } temp.Fail = () => { } this.Pop(temp) } // update (dt) {} }