12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { _decorator, Component, Node, Sprite, UITransform, Vec2, Vec3, view } from 'cc';
- import { ModulerBase } from './ModulerBase';
- const { ccclass, property } = _decorator;
- @ccclass('TowerUI')
- export class TowerUI extends ModulerBase {
- private _sell: UITransform = null;
- private _upGrade: UITransform = null;
- init(): void {
- this._sell = this.node.getChildByName("Sell").getComponent(UITransform);
- this._upGrade = this.node.getChildByName("UpGrade").getComponent(UITransform);
- }
- start() {
- }
- update(deltaTime: number) {
-
- }
- touchIcon(pos: Vec2):boolean{
- if(this._sell.getBoundingBoxToWorld().contains(pos)){
- }
- else if(this._upGrade.getBoundingBoxToWorld().contains(pos)){
-
- }
- this.hide();
- return false;
- }
- //当前卡片是否显示
- isShow(){
- return this.node.active;
- }
- show(pos: Vec3){
- //view.getVisibleSize().width;
- //view.getVisibleSize().height;
- // if(this.node.active){
- // this.hide();
- // return true;
- // }
- this.node.setPosition(pos);
- this.node.active = true;
- }
- hide(){
- this.node.active = false;
- }
- }
|