Explorar el Código

OpcodeType不需要热重载,去掉Lock

tanghai hace 2 años
padre
commit
a2f1a0ac82
Se han modificado 1 ficheros con 2 adiciones y 9 borrados
  1. 2 9
      Unity/Assets/Scripts/Core/Network/OpcodeType.cs

+ 2 - 9
Unity/Assets/Scripts/Core/Network/OpcodeType.cs

@@ -3,14 +3,12 @@ using System.Collections.Generic;
 
 
 namespace ET
 namespace ET
 {
 {
-    public class OpcodeType: SingletonLock<OpcodeType>, ISingletonAwake
+    public class OpcodeType: Singleton<OpcodeType>, ISingletonAwake
     {
     {
         // 初始化后不变,所以主线程,网络线程都可以读
         // 初始化后不变,所以主线程,网络线程都可以读
         private readonly DoubleMap<Type, ushort> typeOpcode = new();
         private readonly DoubleMap<Type, ushort> typeOpcode = new();
         
         
-        private readonly HashSet<ushort> outrActorMessage = new HashSet<ushort>();
-
-        private readonly Dictionary<Type, Type> requestResponse = new Dictionary<Type, Type>();
+        private readonly Dictionary<Type, Type> requestResponse = new();
         
         
         public void Awake()
         public void Awake()
         {
         {
@@ -57,11 +55,6 @@ namespace ET
             }
             }
         }
         }
         
         
-        public override void Load()
-        {
-            World.Instance.AddSingleton<OpcodeType>(true);
-        }
-        
         public ushort GetOpcode(Type type)
         public ushort GetOpcode(Type type)
         {
         {
             return this.typeOpcode.GetValueByKey(type);
             return this.typeOpcode.GetValueByKey(type);