123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- 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) {}
- }
|