Explorar o código

击杀 取消侦探效果

woso_javan hai 1 mes
pai
achega
ebb1b340fa

+ 8 - 0
assets/module_aliens/Script/Components/RadarComponent.ts

@@ -19,10 +19,12 @@ export class RadarComponent extends Component {
 
     private registerEvent(){
         EventDispatcher.instance.on(GameEvent.EVENT_CAMERA_SCREENSHOT_RADAR,this.onRadar,this);
+        EventDispatcher.instance.on(GameEvent.EVENT_CAMERA_SHOOT_ENEMY,this.cancelRadar,this);
     }
 
     private unregisterEvent(){
         EventDispatcher.instance.off(GameEvent.EVENT_CAMERA_SCREENSHOT_RADAR,this.onRadar,this);
+        EventDispatcher.instance.off(GameEvent.EVENT_CAMERA_SHOOT_ENEMY,this.cancelRadar,this);
     }
 
     private async onRadar(){
@@ -43,6 +45,12 @@ export class RadarComponent extends Component {
         }
     }
 
+    private cancelRadar(){
+        console.log('取消雷达');
+        this.node.active = false;
+        this._shouldUpdatePosition = false;
+    }
+
     public lockPositionUpdate() {
         this._shouldUpdatePosition = false;
     }

+ 3 - 0
assets/module_aliens/Script/Enum/GameEvent.ts

@@ -21,6 +21,9 @@ export class GameEvent {
     /** 侦探事件*/
     static readonly EVENT_CAMERA_SCREENSHOT_RADAR = 'EVENT_CAMERA_SCREENSHOT_RADAR';
 
+    /** 取消侦探*/
+    static readonly EVENT_CAMERA_SCREENSHOT_RADAR_CANCEL = 'EVENT_CAMERA_SCREENSHOT_RADAR_CANCEL';
+
     /** 击中文本提示测试*/
     static readonly EVENT_CAMERA_SHOOT_TEXT = 'EVENT_CAMERA_SHOOT_TEXT';
 

+ 6 - 3
assets/module_aliens/Script/LevelAction.ts

@@ -173,7 +173,9 @@ export class LevelAction extends Component {
         this._originalRotation = this.camera.node.eulerAngles.clone();
 
         const radarComponent = AliensGlobalInstance.instance.renderNode.getComponent(RadarComponent)!;
-        radarComponent.lockPositionUpdate();
+        if(radarComponent){
+            radarComponent.unlockPositionUpdate();
+        }
     }
     
     private async _onTouchMove(event: EventTouch) {
@@ -208,8 +210,9 @@ export class LevelAction extends Component {
         this._isDragging = false;
 
         const radarComponent = AliensGlobalInstance.instance.renderNode.getComponent(RadarComponent)!;
-        radarComponent.unlockPositionUpdate();
-        // 不再需要重置_cameraOriginalPos,保持当前相机位置
+        if(radarComponent){
+            radarComponent.unlockPositionUpdate();
+        }
     }
 
  /***************************触摸事件end**********************************/

+ 43 - 43
profiles/v2/packages/scene.json

@@ -1189,40 +1189,40 @@
     },
     "773de0b0-468b-4fbb-965c-36c47d7a4c94": {
       "position": {
-        "x": 431.86215816746943,
-        "y": 812.6860704208086,
-        "z": 52.116033922381774
+        "x": 420.35793298021883,
+        "y": 819.0169323799558,
+        "z": 49.48293325437083
       },
       "rotation": {
-        "x": -0.08661488124250181,
-        "y": 0.3156171372989233,
-        "z": 0.028942770208700834,
-        "w": 0.9444818690918456
+        "x": -0.11783285597388655,
+        "y": 0.27097356918521603,
+        "z": 0.03342983526203466,
+        "w": 0.9547623730386611
       },
       "viewCenter": {
-        "x": 391.98606560893705,
-        "y": 800.4177270306443,
-        "z": -0.8857028290700697
+        "x": 389.3282446228908,
+        "y": 804.2117866248782,
+        "z": -0.7792235762579907
       },
       "contentRect": {
-        "x": -670.4524966662218,
-        "y": -228.60821357276177,
+        "x": -720.1034267218894,
+        "y": 138.11781299334973,
         "width": 0,
         "height": 0
       },
-      "scale": 0.45850202160233566
+      "scale": 0.14234857934458647
     },
     "19323c5d-5d36-438a-86ee-8288c690e5b0": {
       "position": {
-        "x": 51.31333333333333,
-        "y": 109.21999999999997,
-        "z": 5000
+        "x": 34.26709694545835,
+        "y": 34.26709694545835,
+        "z": 34.26709694545835
       },
       "rotation": {
-        "x": 0,
-        "y": 0,
-        "z": 0,
-        "w": 1
+        "x": -0.27984814233312133,
+        "y": 0.3647051996310009,
+        "z": 0.11591689595929512,
+        "w": 0.8804762392171493
       },
       "viewCenter": {
         "x": 0,
@@ -1230,24 +1230,24 @@
         "z": 0
       },
       "contentRect": {
-        "x": 180,
-        "y": 380,
-        "width": 350,
-        "height": 738.8888888888889
+        "x": 0,
+        "y": 0,
+        "width": 360,
+        "height": 760
       },
-      "scale": 0.9722222222222222
+      "scale": 1
     },
     "9e293cde-e27b-4902-808b-e884f3e9da32": {
       "position": {
-        "x": 180,
-        "y": 380.00000000000006,
-        "z": 5000
+        "x": 19.43736625967413,
+        "y": 19.437366259674125,
+        "z": 19.43736625967412
       },
       "rotation": {
-        "x": 0,
-        "y": 0,
-        "z": 0,
-        "w": 1
+        "x": -0.011661622662813826,
+        "y": 0.015197722542679004,
+        "z": 0.004830402266214932,
+        "w": 0.999804832454981
       },
       "viewCenter": {
         "x": 0,
@@ -1257,15 +1257,15 @@
       "contentRect": {
         "x": 0,
         "y": 0,
-        "width": 350,
-        "height": 738.8888888888889
+        "width": 360,
+        "height": 760
       },
-      "scale": 0.9722222222222222
+      "scale": 1
     },
     "be14c61f-22d8-4bb9-b444-ad9f29740469": {
       "position": {
-        "x": 361,
-        "y": 398.49999999999994,
+        "x": 681.2654783392229,
+        "y": 623.20703537804,
         "z": 5000
       },
       "rotation": {
@@ -1275,17 +1275,17 @@
         "w": 1
       },
       "viewCenter": {
-        "x": 369.184,
-        "y": 803.2222222222223,
-        "z": 1.647
+        "x": 0,
+        "y": 0,
+        "z": 0
       },
       "contentRect": {
         "x": 0,
         "y": 0,
-        "width": 712,
-        "height": 785.9612188365651
+        "width": 360,
+        "height": 760
       },
-      "scale": 0.9861495844875346
+      "scale": 1
     }
   },
   "camera-uuids": [

+ 1 - 1
temp/profiles/packages/scene.json

@@ -1,3 +1,3 @@
 {
-  "current-scene": "be14c61f-22d8-4bb9-b444-ad9f29740469"
+  "current-scene": ""
 }