import { GameInput } from "../game/Hero"; const {ccclass, property} = cc._decorator; @ccclass export default class ballonGuide extends cc.Component { @property(cc.Animation) private left:cc.Animation = null; @property(cc.Animation) private right:cc.Animation = null; @property(cc.Animation) private top:cc.Animation = null; @property(cc.Animation) private bottom:cc.Animation = null; // onLoad () {} public init(){ this.setShow(true); this.showTop(false); this.showBottom(false); this.showLeft(false); this.showRight(false); } showTop(isShow: boolean, str: string = undefined) { if (isShow && str) { this.top.node.getChildByName("lb").getComponent(cc.Label).string = str; } if (this.top.node.active == isShow) { return; } this.top.node.active = isShow; } showBottom(isShow: boolean, str: string = undefined) { if (isShow && str) { this.bottom.node.getChildByName("lb").getComponent(cc.Label).string = str; } if (this.bottom.node.active == isShow) { return; } this.bottom.node.active = isShow; } showLeft(isShow: boolean, str: string = undefined) { if (isShow && str) { this.left.node.getChildByName("lb").getComponent(cc.Label).string = str; } if (this.left.node.active == isShow) { return; } this.left.node.active = isShow; } showRight(isShow: boolean, str: string = undefined) { if (isShow && str) { this.right.node.getChildByName("lb").getComponent(cc.Label).string = str; } if (this.right.node.active == isShow) { return; } this.right.node.active = isShow; } public setShow(isShow) { this.node.active = isShow; } // public getImpPermit(ipt: GameInput) { // switch (ipt) { // case GameInput.down: // return this.bottom.node.active || !this.hasIptShow(); // case GameInput.leftClick: // return this.left.node.active || !this.hasIptShow(); // case GameInput.rightClick: // return this.right.node.active || !this.hasIptShow(); // case GameInput.up: // return this.top.node.active || !this.hasIptShow(); // default: // return true; // break; // } // } // private hasIptShow() { // return this.bottom.node.active || // this.left.node.active || // this.right.node.active || // this.top.node.active; // } // update (dt) {} }