table_store.ts 915 B

1234567891011121314151617181920212223242526272829303132
  1. import { _decorator, Component, Node } from 'cc';
  2. import { TableUtil } from './TableUtil';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('table_store')
  5. export class table_store {
  6. static readonly TableName: string = "store";
  7. static get(id: number): table_store { return TableUtil.getTable(table_store, id) };
  8. static getList(): table_store[] { return TableUtil.getTables(table_store,5) };
  9. private data: any;
  10. init(id: number) {
  11. var table = TableUtil.get(table_store.TableName);
  12. this.data = table[id];
  13. if (!this.data) console.error("配置表" + table_store.TableName + "没有ID:" + id);
  14. this.id = id;
  15. }
  16. /** 编号【KEY】 */
  17. id: number = 0;
  18. get type(): number { return this.data.type }
  19. get cost(): number { return this.data.cost }
  20. get num(): number { return this.data.num }
  21. get name(): string { return this.data.name }
  22. }