Bladeren bron

联机游戏时,在本机上操作射程卡和倍镜,只有在当前自己的回合有效,应该是无论何时操作都有效,且只对本机用户有效

lvjincheng 3 jaren geleden
bovenliggende
commit
e56fc9edcd
1 gewijzigde bestanden met toevoegingen van 20 en 17 verwijderingen
  1. 20 17
      Assets/BowArrow/Scripts/Game/GameAssistUI.cs

+ 20 - 17
Assets/BowArrow/Scripts/Game/GameAssistUI.cs

@@ -78,14 +78,15 @@ public class GameAssistUI : MonoBehaviour
         bool autoSwitch = true;
         int myPlayerIndex = GetMyPlayerIndex();
         int curPlayerIndex = GetCurPlayerIndex();
-        if (GlobalData.pkMatchType == PKMatchType.OnlinePK) {
-            if (myPlayerIndex == curPlayerIndex) {
-                autoSwitch = true;
-            } else {
-                autoSwitch = false;
-                //渲染别人的瞄准镜
-                DisplayScaleAim(playerScaleAimValue_OnlinePK > 0, playerScaleAimValue_OnlinePK);             }
-        }
+        // if (GlobalData.pkMatchType == PKMatchType.OnlinePK) {
+        //     if (myPlayerIndex == curPlayerIndex) {
+        //         autoSwitch = true;
+        //     } else {
+        //         autoSwitch = false;
+        //         //渲染别人的瞄准镜
+        //         DisplayScaleAim(playerScaleAimValue_OnlinePK > 0, playerScaleAimValue_OnlinePK);             
+        //     }
+        // }
         if (autoSwitch) {
             if (scaleAimOn != playerScaleAimRecords[curPlayerIndex]) {
                 if (playerScaleAimRecords[curPlayerIndex]) {
@@ -105,12 +106,12 @@ public class GameAssistUI : MonoBehaviour
         }
     }
 
-    bool IsOnLinePkAndNotMyTime() {
-        if (GlobalData.pkMatchType != PKMatchType.OnlinePK) return false;
-        int myPlayerIndex = GetMyPlayerIndex();
-        int curPlayerIndex = GetCurPlayerIndex();
-        return myPlayerIndex != curPlayerIndex;
-    }
+    // bool IsOnLinePkAndNotMyTime() {
+    //     if (GlobalData.pkMatchType != PKMatchType.OnlinePK) return false;
+    //     int myPlayerIndex = GetMyPlayerIndex();
+    //     int curPlayerIndex = GetCurPlayerIndex();
+    //     return myPlayerIndex != curPlayerIndex;
+    // }
 
     [System.NonSerialized] public int playerScaleAimValue_OnlinePK = 0;
     bool[] playerScaleAimRecords = {false, false};
@@ -118,15 +119,17 @@ public class GameAssistUI : MonoBehaviour
 
     int GetMyPlayerIndex() {
         if (GlobalData.pkMatchType == PKMatchType.OnlinePK) {
-            return GlobalData.playerIndexInRoom;
+            // return GlobalData.playerIndexInRoom;
+            return 0;
         }
         return 0;
     }
 
     int GetCurPlayerIndex() {
         if (GlobalData.pkMatchType == PKMatchType.OnlinePK) {
-            GameMode gm = GameMgr.ins.gameMode;
-            if (GameMgr.gameType == 9) return ((PKGameMode_OnlinePK) gm).gameLogic.currentPlayerIndex;
+            // GameMode gm = GameMgr.ins.gameMode;
+            // if (GameMgr.gameType == 9) return ((PKGameMode_OnlinePK) gm).gameLogic.currentPlayerIndex;
+            return 0;
         } else if (GlobalData.pkMatchType == PKMatchType.LocalPK) {
             GameMode gm = GameMgr.ins.gameMode;
             if (GameMgr.gameType == 2) return ((PKGameMode) gm).currentPlayerIndex;