64 lines
2.1 KiB
TypeScript
64 lines
2.1 KiB
TypeScript
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import BlockAssetManager from "../module/Tool/BlockAssetManager";
|
|
import MapConroler from "../Map";
|
|
import NumberToImage from "../NumberToImage";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
|
|
|
|
@ccclass
|
|
export default class ButtonWall extends cc.Component {
|
|
static _instance: any;
|
|
time: number = 60;
|
|
|
|
|
|
|
|
@property
|
|
UI: string = "";
|
|
|
|
posX: any;
|
|
posY: any;
|
|
color: number = -1;
|
|
// mapInfo: number[][] = [];
|
|
|
|
onLoad() {
|
|
|
|
}
|
|
|
|
start() {
|
|
|
|
}
|
|
|
|
setSpriteFrame(color, open, length) {
|
|
if (this.node.getChildByName("heng").active == true) {
|
|
let up = this.node.getChildByName("heng").getChildByName("up");
|
|
let upName = "heng" + length + "_" + "color" + color + "_up";
|
|
up.getComponent(cc.Sprite).spriteFrame = BlockAssetManager.instance.getAtlasFrame(this.UI, upName);
|
|
|
|
let down = this.node.getChildByName("heng").getChildByName("down");
|
|
let downName = "heng" + length + "_" + "color" + color + "_down";
|
|
down.getComponent(cc.Sprite).spriteFrame = BlockAssetManager.instance.getAtlasFrame(this.UI, downName);
|
|
}
|
|
|
|
else if (this.node.getChildByName("shu").active == true) {
|
|
let left = this.node.getChildByName("shu").getChildByName("left");
|
|
let leftName = "shu" + length + "_" + "color" + color + "_left";
|
|
left.getComponent(cc.Sprite).spriteFrame = BlockAssetManager.instance.getAtlasFrame(this.UI, leftName);
|
|
|
|
let right = this.node.getChildByName("shu").getChildByName("right");
|
|
let rightName = "shu" + length + "_" + "color" + color + "_right";
|
|
right.getComponent(cc.Sprite).spriteFrame = BlockAssetManager.instance.getAtlasFrame(this.UI, rightName);
|
|
}
|
|
}
|
|
|
|
|
|
// update (dt) {}
|
|
}
|