You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
74 lines
2.2 KiB
// 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 { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import Common5 from "../../Platform/th/Common5";
|
|
import List from "../../Platform/th/List";
|
|
import LevelUpManager from "../Manager/LevelUpManager";
|
|
import ZaoCanManager from "../Manager/ZaoCanManager";
|
|
import { Npc_Direct } from "./ZaoCanDian";
|
|
import ZaoCanDianYeWuitemNode from "./ZaoCanDianYeWuitemNode";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class ZaoCanDianYeWu extends cc.Component {
|
|
@property(cc.Label)
|
|
dp_name: cc.Label = null;
|
|
|
|
@property(cc.Label)
|
|
jcLabel: cc.Label = null;
|
|
|
|
@property(List)
|
|
listZc: List = null; //早餐
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
dataListZc = []
|
|
|
|
// onLoad () {}
|
|
|
|
start() {
|
|
this.init()
|
|
EventMgr.onEvent_custom(ryw_Event.refreshZaoCan, () => {
|
|
this.init()
|
|
// this.node.removeFromParent()
|
|
// this.node.destroy()
|
|
}, this)
|
|
}
|
|
|
|
init() {
|
|
// this.dp_name.string = LevelUpManager.getChengHao()
|
|
this.jcLabel.string = `${Math.ceil(ZaoCanManager.getAllZaoCanJiaCheng() * 100)}%`
|
|
this.setListZaoCan()
|
|
}
|
|
|
|
setListZaoCan() {
|
|
let zaocanConfig = ZaoCanManager.getManagerConfigDateHaveJiaCheng()
|
|
this.dataListZc = []
|
|
for (let i = 0; i < zaocanConfig.length; i++) {
|
|
this.dataListZc.push(i)
|
|
}
|
|
|
|
this.listZc.numItems = this.dataListZc.length;
|
|
}
|
|
|
|
onListZaoCanGridRender(item: cc.Node, idx: number) {
|
|
let index = this.dataListZc[idx]
|
|
let zaocanConfig = ZaoCanManager.getManagerConfigDateHaveJiaCheng()
|
|
let _zaocanItem: ZaoCanDianYeWuitemNode = item.getComponent(ZaoCanDianYeWuitemNode)
|
|
_zaocanItem.setViewDate(zaocanConfig[index])
|
|
}
|
|
|
|
onTouchClose() {
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|
|
|