1 |
- {"version":3,"sources":["file:///D:/yyy/al/cocos_pro/plane_demo/assets/script/ui/uiMain.ts"],"names":["_decorator","Component","Input","Node","gameMangager","ccclass","property","uiMain","start","node","on","EventType","TOUCH_MOVE","_touchMove","TOUCH_START","_touchStart","TOUCH_END","_touchEnd","event","delta","getDelta","pos","playerPlane","position","setPosition","x","planeSpeed","y","z","console","log","gamgeManager","isShooting"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAASA,MAAAA,U,OAAAA,U;AAAYC,MAAAA,S,OAAAA,S;AAAuBC,MAAAA,K,OAAAA,K;AAAOC,MAAAA,I,OAAAA,I;;AAC1CC,MAAAA,Y,iBAAAA,Y;;;;;;;;;OACH;AAAEC,QAAAA,OAAF;AAAWC,QAAAA;AAAX,O,GAAwBN,U;;wBAGjBO,M,WADZF,OAAO,CAAC,QAAD,C,UAMHC,QAAQ,CAACH,IAAD,C,UAGRG,QAAQ;AAAA;AAAA,uC,2BATb,MACaC,MADb,SAC4BN,SAD5B,CACsC;AAAA;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAWlCO,QAAAA,KAAK,GAAG;AACJ;AACA,eAAKC,IAAL,CAAUC,EAAV,CAAaR,KAAK,CAACS,SAAN,CAAgBC,UAA7B,EAAyC,KAAKC,UAA9C,EAA0D,IAA1D,EAFI,CAGJ;;AACA,eAAKJ,IAAL,CAAUC,EAAV,CAAaR,KAAK,CAACS,SAAN,CAAgBG,WAA7B,EAA0C,KAAKC,WAA/C,EAA4D,IAA5D;AACA,eAAKN,IAAL,CAAUC,EAAV,CAAaR,KAAK,CAACS,SAAN,CAAgBK,SAA7B,EAAwC,KAAKC,SAA7C,EAAwD,IAAxD;AACH,SAjBiC,CAoBlC;AAEA;;;AACAJ,QAAAA,UAAU,CAACK,KAAD,EAAoB;AAC1B,cAAMC,KAAK,GAAGD,KAAK,CAACE,QAAN,EAAd;AACA,cAAIC,GAAG,GAAG,KAAKC,WAAL,CAAiBC,QAA3B,CAF0B,CAI1B;AACA;;AACA,eAAKD,WAAL,CAAiBE,WAAjB,CAA6BH,GAAG,CAACI,CAAJ,GAAQ,OAAO,KAAKC,UAAZ,GAAyBP,KAAK,CAACQ,CAApE,EAAuEN,GAAG,CAACM,CAA3E,EAA8EN,GAAG,CAACO,CAAJ,GAAQ,OAAO,KAAKF,UAAZ,GAAyBP,KAAK,CAACM,CAArH;AACH;;AACDV,QAAAA,WAAW,CAACG,KAAD,EAAmB;AAC1BW,UAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ;AAEA,eAAKC,YAAL,CAAkBC,UAAlB,CAA6B,IAA7B;AACH;;AACDf,QAAAA,SAAS,CAACC,KAAD,EAAmB;AACxBW,UAAAA,OAAO,CAACC,GAAR,CAAY,MAAZ;AACA,eAAKC,YAAL,CAAkBC,UAAlB,CAA6B,KAA7B;AACH;;AAvCiC,O,6EACjC1B,Q;;;;;iBACmB,C;;;;;;;iBAIO,I;;;;;;;iBAGS,I","sourcesContent":["import { _decorator, Component, EventTouch, Input, Node } from 'cc';\r\nimport { gameMangager } from '../framework/gameMangager';\r\nconst { ccclass, property } = _decorator;\r\n\r\n@ccclass('uiMain')\r\nexport class uiMain extends Component {\r\n @property\r\n public planeSpeed = 1;\r\n\r\n\r\n @property(Node)\r\n public playerPlane: Node = null\r\n\r\n @property(gameMangager)\r\n public gamgeManager: gameMangager = null;\r\n\r\n start() {\r\n // input.on(Input.EventType.TOUCH_START, this._touchStart, this);\r\n this.node.on(Input.EventType.TOUCH_MOVE, this._touchMove, this);\r\n // \r\n this.node.on(Input.EventType.TOUCH_START, this._touchStart, this);\r\n this.node.on(Input.EventType.TOUCH_END, this._touchEnd, this);\r\n }\r\n\r\n\r\n // update(deltaTime: number) { \r\n\r\n // }\r\n _touchMove(event: EventTouch) {\r\n const delta = event.getDelta();\r\n let pos = this.playerPlane.position;\r\n \r\n // x 上下, z 左右 \r\n // this.node.setPosition(pos.x - 0.01 * this.speed * delta.x, pos.y, pos.z - 0.01 * this.speed * delta.y)\r\n this.playerPlane.setPosition(pos.x + 0.01 * this.planeSpeed * delta.y, pos.y, pos.z + 0.01 * this.planeSpeed * delta.x)\r\n }\r\n _touchStart(event: EventTouch){\r\n console.log('开始发射');\r\n \r\n this.gamgeManager.isShooting(true)\r\n }\r\n _touchEnd(event: EventTouch){\r\n console.log('结束发射');\r\n this.gamgeManager.isShooting(false)\r\n }\r\n}\r\n\r\n\r\n"]}
|