// 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 AppPlatform from "../../FrameWork/Util/AppPlatform"; import Common5 from "../../Platform/th/Common5"; import UiBase from "../GameBase/UiBase"; import ZaoCanManager from "../Manager/ZaoCanManager"; const { ccclass, property } = cc._decorator; @ccclass export default class ZaoCanDianUnLock extends UiBase { @property(cc.Sprite) sp: cc.Sprite = null; @property(cc.RichText) richtext: cc.RichText = null; @property(cc.Label) lab1: cc.Label = null; @property(cc.Label) lab2: cc.Label = null; // LIFE-CYCLE CALLBACKS: // onLoad () {} sureCallFunc = null adCallFunc = null closeFunc = null start() { } setViewData(id, sureCallFunc?, adCallFunc?) { let config = ZaoCanManager.getManagerConfigDate()[id] Common5.getSpriteFrameFromBundle("ZaoCanDian", "res/icon/" + config.zaocan, this.sp) this.richtext.string = `恭喜解锁${config.zaocan}` this.lab1.string = `该早点秒赚加成:${config.jiacheng * 100}%` this.lab2.string = "当前总秒赚加成:" + `${Math.ceil(ZaoCanManager.getAllZaoCanJiaCheng() * 100)}%` this.sureCallFunc = sureCallFunc this.adCallFunc = adCallFunc } onTouchClose() { this.sureCallFunc && this.sureCallFunc() this.closeUi() } // update (dt) {} }