| 12345678910111213141516171819202122232425262728293031 |
- import gameUI from "./gameUI";
- import towerManger from ".././tower/towerManger";
- import viewComtent from "./viewComtent";
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class TapNode extends cc.Component {
- public static instance:TapNode = null;
- protected onLoad () {
- TapNode.instance = this;
- this.node.active = false;
- this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
- }
- /**
- * touchstart 回调
- * @param e 参数
- */
- private onTouchStart(e: cc.Event.EventTouch): void {
- let turnPos = e.getLocation().sub(cc.v2(960,540));
- towerManger.instance.chaqiGetPos(turnPos.add(cc.v2(0,viewComtent.instance.getOff())));
- gameUI.instance.SkillTap(turnPos.add(cc.v2(0,viewComtent.instance.getOff())));
- }
- }
|