123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- import UEBase from "../../frameWork/compment/UEBase";
- import UECube from "./UECube";
- const { ccclass, property } = cc._decorator;
- export interface I_CellData {
- zIndex: number;
- ueCube: UECube;
- }
- @ccclass
- export default class UECell extends UEBase {
- static readonly BundleKey: string = "gridMap";
- static readonly PrefabUrl: string = "UECell";
- static readonly CLS: string = "UECell";
- @property(cc.Node)
- private node_select: cc.Node = null!;
- cellData: I_CellData = null!;
- Init(cellData: I_CellData) {
- this.cellData = cellData;
- this.node.zIndex = cellData.zIndex;
- }
- SetSelect(isSelect: boolean) {
- this.node_select.active = isSelect;
- }
- /** 是否有物品可以拖动 */
- CanDrag(): boolean {
- return !this.IsEmpty();
- }
- GetCube(): UECube {
- return this.cellData.ueCube;
- }
- /** 该棋格是否是空的 */
- IsEmpty(): boolean {
- return this.cellData.ueCube == null;
- }
- }
|