CellMgr.ts 715 B

12345678910111213141516171819202122232425262728293031
  1. import { Component,Node } from "cc";
  2. import { IGamePlayer } from "../../module_basic/shared/protocols/public/game/GameTypeDef";
  3. export type CellType = {
  4. node:Node,
  5. player:IGamePlayer,
  6. }
  7. export class CellMgr {
  8. private static _inst: CellMgr;
  9. public static get inst(): CellMgr {
  10. if (!this._inst) {
  11. this._inst = new CellMgr();
  12. }
  13. return this._inst;
  14. }
  15. private _cellList: CellType[] = [];
  16. public addCell(cell: CellType) {
  17. this._cellList.push(cell);
  18. }
  19. public removeCell(cell: CellType) {
  20. this._cellList.splice(this._cellList.indexOf(cell), 1);
  21. }
  22. public get cellList(): CellType[] {
  23. return this._cellList;
  24. }
  25. }