Browse Source

删一些没用的代码

zhengchen 1 year ago
parent
commit
10386c9a4b
2 changed files with 7 additions and 10 deletions
  1. 2 7
      Assets/Scripts/Game/GameCore.cs
  2. 5 3
      Assets/Scripts/Ragdoll/RdResetAttribute.cs

+ 2 - 7
Assets/Scripts/Game/GameCore.cs

@@ -2,7 +2,6 @@ using System;
 using System.Collections.Generic;
 using Comp;
 using HttpApi;
-using JetBrains.Annotations;
 using Ragdoll;
 using UnityEngine;
 
@@ -67,8 +66,8 @@ namespace Game
             battleState = new GameBattleState(this);
             liftState = new GameLiftState(this);
             endState = new GameEndState(this);
-
-            this.liftTimes = 2;
+            // 举J次数限制
+            liftTimes = 2;
 
             this.localPlayer = localPlayer;
             this.antiPlayer = antiPlayer;
@@ -77,13 +76,9 @@ namespace Game
             this.camera = camera;
             this.resultPanel = resultPanel;
 
-            localPlayer.cockId = 2;
-
             cockDict = new Dictionary<int, CockActionComp>();
             masterDict = new Dictionary<int, MasterActionComp>();
 
-            // var battleDetailList = JsonConvert.DeserializeObject<BattleDetailListObj>(jsonLogs);
-
             var battleDetailList = jsonLogs;
             winPlayerId = battleDetailList.winPlayer;
             diamond = battleDetailList.diamond;

+ 5 - 3
Assets/Scripts/Ragdoll/RdResetAttribute.cs

@@ -4,8 +4,7 @@ using UnityEngine;
 
 namespace Ragdoll
 {
-    public delegate void ResetDelegate(object value);
-
+    
     [AttributeUsage(AttributeTargets.Field)]
     public class RdResetAttribute : Attribute
     {
@@ -58,7 +57,10 @@ namespace Ragdoll
                     }
                     else if (field.FieldType.IsArray) // 数组重置为空数组
                     {
-                        field.SetValue(obj, Array.CreateInstance(field.FieldType.GetElementType(), 0));
+                        field.SetValue(obj,
+                            field.FieldType.GetElementType() == null
+                                ? null
+                                : Array.CreateInstance(field.FieldType.GetElementType(), 0));
                     }
                     else if (field.FieldType.IsGenericType &&
                              field.FieldType.GetGenericTypeDefinition() == typeof(List<>)) // 列表重置为空列表