咸鱼的反击
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.
xianyudefanji/assets/Scripts/ZaoCanDian/ZaoCanDianYeWu.ts

75 lines
2.2 KiB

2 months ago
// 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
2 months ago
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
2 months ago
import Common5 from "../../Platform/th/Common5";
import List from "../../Platform/th/List";
2 months ago
import LevelUpManager from "../Manager/LevelUpManager";
2 months ago
import ZaoCanManager from "../Manager/ZaoCanManager";
import { Npc_Direct } from "./ZaoCanDian";
2 months ago
import ZaoCanDianYeWuitemNode from "./ZaoCanDianYeWuitemNode";
2 months ago
const { ccclass, property } = cc._decorator;
@ccclass
export default class ZaoCanDianYeWu extends cc.Component {
2 months ago
@property(cc.Label)
dp_name: cc.Label = null;
@property(cc.Label)
jcLabel: cc.Label = null;
2 months ago
@property(List)
listZc: List = null; //早餐
// LIFE-CYCLE CALLBACKS:
dataListZc = []
// onLoad () {}
start() {
2 months ago
this.init()
EventMgr.onEvent_custom(ryw_Event.refreshZaoCan, () => {
this.init()
2 months ago
// this.node.removeFromParent()
// this.node.destroy()
2 months ago
}, this)
}
2 months ago
2 months ago
init() {
// this.dp_name.string = LevelUpManager.getChengHao()
this.jcLabel.string = `${Math.ceil(ZaoCanManager.getAllZaoCanJiaCheng() * 100)}%`
this.setListZaoCan()
2 months ago
}
setListZaoCan() {
2 months ago
let zaocanConfig = ZaoCanManager.getManagerConfigDateHaveJiaCheng()
2 months ago
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]
2 months ago
let zaocanConfig = ZaoCanManager.getManagerConfigDateHaveJiaCheng()
let _zaocanItem: ZaoCanDianYeWuitemNode = item.getComponent(ZaoCanDianYeWuitemNode)
2 months ago
_zaocanItem.setViewDate(zaocanConfig[index])
}
2 months ago
onTouchClose() {
this.node.removeFromParent()
this.node.destroy()
}
2 months ago
// update (dt) {}
}