Pārlūkot izejas kodu

同步提示版的速度

lvjincheng 4 gadi atpakaļ
vecāks
revīzija
0cb580efdb

+ 5 - 0
Assets/BowArrow/Scripts/Game/Arrow.cs

@@ -62,6 +62,11 @@ public class Arrow : MonoBehaviour
             Billboard.ins?.SetArrowSpeedScale(GameAssistUI.ins.shootScaleValue);
         }
         Billboard.ins?.ShowSpeed();
+        if (GlobalData.pkMatchType == PKMatchType.OnlinePK) {
+            if (GameMgr.gameType == 9) {
+                ((PKGameMode_OnlinePK)GameMgr.ins.gameMode).shootSpeedWillSend = Billboard.ins.GetShootSpeedText();
+            }
+        }
 
         if (absoluteRay.transform) {
             //记录射线有没有击中靶子

+ 10 - 0
Assets/BowArrow/Scripts/Game/Billboard.cs

@@ -34,4 +34,14 @@ public class Billboard : MonoBehaviour
             speedText.text = (this.arrowSpeed * this.arrowSpeedScale).ToString($"f{CommonConfig.arrowSpeedPrecision}");
         }
     }
+
+    public void SetShootSpeedText(string text) {
+        if (speedText) {
+            speedText.text = text;
+        }
+    }
+
+    public string GetShootSpeedText() {
+        return speedText.text;
+    }
 }

+ 8 - 0
Assets/BowArrow/Scripts/Manager/GameMode/PKGameMode_OnlinePK.cs

@@ -111,6 +111,9 @@ public class PKGameMode_OnlinePK : GameMode {
         if (key == "score") {
             HitTargetNumber.Create(float.Parse(data));
         }
+        if (key == "shootSpeed") {
+            Billboard.ins?.SetShootSpeedText(data);
+        }
     }
 
     void AutoSwitchBanUserControlBow() {
@@ -173,6 +176,7 @@ public class PKGameMode_OnlinePK : GameMode {
         }
     }
     string scoreWillSend = null;
+    public string shootSpeedWillSend = null;
     void upload2() {
         uploadGameDataTime -= Time.deltaTime;
         if (uploadGameDataTime <= 0) {
@@ -189,6 +193,10 @@ public class PKGameMode_OnlinePK : GameMode {
                 socketPlayer.UploadPKGameData("score", scoreWillSend);
                 scoreWillSend = null;
             }
+            if (shootSpeedWillSend != null) {
+                socketPlayer.UploadPKGameData("shootSpeed", shootSpeedWillSend);
+                shootSpeedWillSend = null;
+            }
         }
     }