import { _decorator, Component, Node } from 'cc'; import { TableUtil } from './TableUtil'; const { ccclass, property } = _decorator; @ccclass('table_task') export class table_task { static readonly TableName: string = "task"; static get(id: number): table_task { return TableUtil.getTable(table_task, id) }; static getList(): table_task[] { return TableUtil.getTables(table_task,5) }; private data: any; init(id: number) { var table = TableUtil.get(table_task.TableName); this.data = table[id]; if (!this.data) console.error("配置表" + table_task.TableName + "没有ID:" + id); this.id = id; } /** 编号【KEY】 */ id: number = 0; get goal(): number { return this.data.goal } get type(): number { return this.data.type } get num(): number { return this.data.num } get name(): string { return this.data.name } }