Prechádzať zdrojové kódy

提供全局统一的回调机制,之前的Timer回调,网络回调都可以统一使用这个回调机制,大大简化了代码
为什么不直接使用Action跟Func呢,主要原因是可以热重载,并且方便序列化跟打印,比如打印Timer的TimerAction。
Action跟Func却不方便打印跟序列化

tanghai 3 rokov pred
rodič
commit
b4274b1ef1
26 zmenil súbory, kde vykonal 187 pridanie a 235 odobranie
  1. 0 1
      Apps/Hotfix/AppStart_Init.cs
  2. 2 2
      Apps/Hotfix/Module/Actor/ActorMessageSenderComponentSystem.cs
  3. 2 2
      Apps/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs
  4. 1 1
      Apps/Hotfix/Module/MessageInner/NetInnerComponentSystem.cs
  5. 3 3
      Apps/Hotfix/Server/Session/SessionStreamDispatcherServerInner.cs
  6. 3 3
      Apps/Hotfix/Server/Session/SessionStreamDispatcherServerOuter.cs
  7. 3 3
      Unity/Codes/Hotfix/Client/Session/SessionStreamDispatcherClientOuter.cs
  8. 2 2
      Unity/Codes/Hotfix/Module/AI/AIComponentSystem.cs
  9. 2 1
      Unity/Codes/Hotfix/Module/Message/NetKcpComponentSystem.cs
  10. 2 2
      Unity/Codes/Hotfix/Module/Message/SessionAcceptTimeoutComponentSystem.cs
  11. 2 2
      Unity/Codes/Hotfix/Module/Message/SessionIdleCheckerComponentSystem.cs
  12. 0 85
      Unity/Codes/Hotfix/Module/Message/SessionStreamDispatcherSystem.cs
  13. 2 2
      Unity/Codes/Hotfix/Share/Move/MoveComponentSystem.cs
  14. 0 1
      Unity/Codes/HotfixView/AppStart_Init.cs
  15. 12 0
      Unity/Codes/Model/Core/Object/CallbackAttribute.cs
  16. 74 0
      Unity/Codes/Model/Core/Object/EventSystem.cs
  17. 53 0
      Unity/Codes/Model/Core/Object/ICallback.cs
  18. 12 0
      Unity/Codes/Model/Core/Timer/ATimer.cs
  19. 0 17
      Unity/Codes/Model/Core/Timer/ITimer.cs
  20. 0 14
      Unity/Codes/Model/Core/Timer/TimerAttribute.cs
  21. 2 58
      Unity/Codes/Model/Core/Timer/TimerComponent.cs
  22. 5 7
      Unity/Codes/Model/Core/Timer/TimerType.cs
  23. 1 1
      Unity/Codes/Model/Module/Message/NetKcpComponent.cs
  24. 0 9
      Unity/Codes/Model/Module/Message/SessionStreamDispatcher.cs
  25. 0 14
      Unity/Codes/Model/Module/Message/SessionStreamDispatcherAttribute.cs
  26. 4 5
      Unity/Codes/Model/Share/TimerType.cs

+ 0 - 1
Apps/Hotfix/AppStart_Init.cs

@@ -16,7 +16,6 @@ namespace ET.Server
             Game.Scene.AddComponent<TimerComponent>();
             Game.Scene.AddComponent<OpcodeTypeComponent>();
             Game.Scene.AddComponent<MessageDispatcherComponent>();
-            Game.Scene.AddComponent<SessionStreamDispatcher>();
             Game.Scene.AddComponent<CoroutineLockComponent>();
             // 发送普通actor消息
             Game.Scene.AddComponent<ActorMessageSenderComponent>();

+ 2 - 2
Apps/Hotfix/Module/Actor/ActorMessageSenderComponentSystem.cs

@@ -6,10 +6,10 @@ namespace ET
     [FriendClass(typeof(ActorMessageSenderComponent))]
     public static class ActorMessageSenderComponentSystem
     {
-        [Timer(TimerType.ActorMessageSenderChecker)]
+        [Callback(TimerType.ActorMessageSenderChecker)]
         public class ActorMessageSenderChecker: ATimer<ActorMessageSenderComponent>
         {
-            public override void Run(ActorMessageSenderComponent self)
+            protected override void Run(ActorMessageSenderComponent self)
             {
                 try
                 {

+ 2 - 2
Apps/Hotfix/Module/ActorLocation/ActorLocationSenderComponentSystem.cs

@@ -3,10 +3,10 @@ using System.IO;
 
 namespace ET
 {
-    [Timer(TimerType.ActorLocationSenderChecker)]
+    [Callback(TimerType.ActorLocationSenderChecker)]
     public class ActorLocationSenderChecker: ATimer<ActorLocationSenderComponent>
     {
-        public override void Run(ActorLocationSenderComponent self)
+        protected override void Run(ActorLocationSenderComponent self)
         {
             try
             {

+ 1 - 1
Apps/Hotfix/Module/MessageInner/NetInnerComponentSystem.cs

@@ -60,7 +60,7 @@ namespace ET
             }
 
             session.LastRecvTime = TimeHelper.ClientNow();
-            SessionStreamDispatcher.Instance.Dispatch(self.SessionStreamDispatcherType, session, memoryStream);
+            Game.EventSystem.Callback(self.SessionStreamDispatcherType, session, memoryStream);
         }
 
         public static void OnError(this NetInnerComponent self, long channelId, int error)

+ 3 - 3
Apps/Hotfix/Server/Session/SessionStreamDispatcherServerInner.cs

@@ -3,10 +3,10 @@ using System.IO;
 
 namespace ET.Server
 {
-    [SessionStreamDispatcher(SessionStreamDispatcherType.SessionStreamDispatcherServerInner)]
-    public class SessionStreamDispatcherServerInner: ISessionStreamDispatcher
+    [Callback(SessionStreamDispatcherType.SessionStreamDispatcherServerInner)]
+    public class SessionStreamDispatcherServerInner: IAction<Session, MemoryStream>
     {
-        public void Dispatch(Session session, MemoryStream memoryStream)
+        public void Handle(Session session, MemoryStream memoryStream)
         {
             ushort opcode = 0;
             try

+ 3 - 3
Apps/Hotfix/Server/Session/SessionStreamDispatcherServerOuter.cs

@@ -3,10 +3,10 @@ using System.IO;
 
 namespace ET.Server
 {
-    [SessionStreamDispatcher(SessionStreamDispatcherType.SessionStreamDispatcherServerOuter)]
-    public class SessionStreamDispatcherServerOuter: ISessionStreamDispatcher
+    [Callback(SessionStreamDispatcherType.SessionStreamDispatcherServerOuter)]
+    public class SessionStreamDispatcherServerOuter: IAction<Session, MemoryStream>
     {
-        public void Dispatch(Session session, MemoryStream memoryStream)
+        public void Handle(Session session, MemoryStream memoryStream)
         {
             ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex);
             Type type = OpcodeTypeComponent.Instance.GetType(opcode);

+ 3 - 3
Unity/Codes/Hotfix/Client/Session/SessionStreamDispatcherClientOuter.cs

@@ -3,10 +3,10 @@ using System.IO;
 
 namespace ET.Client
 {
-    [SessionStreamDispatcher(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter)]
-    public class SessionStreamDispatcherClientOuter: ISessionStreamDispatcher
+    [Callback(SessionStreamDispatcherType.SessionStreamDispatcherClientOuter)]
+    public class SessionStreamDispatcherClientOuter: IAction<Session, MemoryStream>
     {
-        public void Dispatch(Session session, MemoryStream memoryStream)
+        public void Handle(Session session, MemoryStream memoryStream)
         {
             ushort opcode = BitConverter.ToUInt16(memoryStream.GetBuffer(), Packet.KcpOpcodeIndex);
             Type type = OpcodeTypeComponent.Instance.GetType(opcode);

+ 2 - 2
Unity/Codes/Hotfix/Module/AI/AIComponentSystem.cs

@@ -6,10 +6,10 @@ namespace ET
     [FriendClass(typeof(AIDispatcherComponent))]
     public static class AIComponentSystem
     {
-        [Timer(TimerType.AITimer)]
+        [Callback(TimerType.AITimer)]
         public class AITimer: ATimer<AIComponent>
         {
-            public override void Run(AIComponent self)
+            protected override void Run(AIComponent self)
             {
                 try
                 {

+ 2 - 1
Unity/Codes/Hotfix/Module/Message/NetKcpComponentSystem.cs

@@ -57,7 +57,8 @@ namespace ET
             }
 
             session.LastRecvTime = TimeHelper.ClientNow();
-            SessionStreamDispatcher.Instance.Dispatch(self.SessionStreamDispatcherType, session, memoryStream);
+
+            Game.EventSystem.Callback(self.SessionStreamDispatcherType, session, memoryStream);
         }
 
         public static void OnError(this NetKcpComponent self, long channelId, int error)

+ 2 - 2
Unity/Codes/Hotfix/Module/Message/SessionAcceptTimeoutComponentSystem.cs

@@ -2,10 +2,10 @@
 
 namespace ET
 {
-    [Timer(TimerType.SessionAcceptTimeout)]
+    [Callback(TimerType.SessionAcceptTimeout)]
     public class SessionAcceptTimeout: ATimer<SessionAcceptTimeoutComponent>
     {
-        public override void Run(SessionAcceptTimeoutComponent self)
+        protected override void Run(SessionAcceptTimeoutComponent self)
         {
             try
             {

+ 2 - 2
Unity/Codes/Hotfix/Module/Message/SessionIdleCheckerComponentSystem.cs

@@ -2,10 +2,10 @@ using System;
 
 namespace ET
 {
-    [Timer(TimerType.SessionIdleChecker)]
+    [Callback(TimerType.SessionIdleChecker)]
     public class SessionIdleChecker: ATimer<SessionIdleCheckerComponent>
     {
-        public override void Run(SessionIdleCheckerComponent self)
+        protected override void Run(SessionIdleCheckerComponent self)
         {
             try
             {

+ 0 - 85
Unity/Codes/Hotfix/Module/Message/SessionStreamDispatcherSystem.cs

@@ -1,85 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace ET
-{
-    [FriendClass(typeof(SessionStreamDispatcher))]
-    public static class SessionStreamDispatcherSystem
-    {
-        [ObjectSystem]
-        public class SessionStreamDispatcherAwakeSystem: AwakeSystem<SessionStreamDispatcher>
-        {
-            public override void Awake(SessionStreamDispatcher self)
-            {
-                SessionStreamDispatcher.Instance = self;
-                self.Load();
-            }
-        }
-
-        [ObjectSystem]
-        public class SessionStreamDispatcherLoadSystem: LoadSystem<SessionStreamDispatcher>
-        {
-            public override void Load(SessionStreamDispatcher self)
-            {
-                self.Load();
-            }
-        }
-
-        [ObjectSystem]
-        public class SessionStreamDispatcherDestroySystem: DestroySystem<SessionStreamDispatcher>
-        {
-            public override void Destroy(SessionStreamDispatcher self)
-            {
-                SessionStreamDispatcher.Instance = null;
-            }
-        }
-        
-        public static void Load(this SessionStreamDispatcher self)
-        {
-            self.Dispatchers = new ISessionStreamDispatcher[100];
-            
-            HashSet<Type> types = Game.EventSystem.GetTypes(typeof (SessionStreamDispatcherAttribute));
-
-            foreach (Type type in types)
-            {
-                object[] attrs = type.GetCustomAttributes(typeof (SessionStreamDispatcherAttribute), false);
-                if (attrs.Length == 0)
-                {
-                    continue;
-                }
-                
-                SessionStreamDispatcherAttribute sessionStreamDispatcherAttribute = attrs[0] as SessionStreamDispatcherAttribute;
-                if (sessionStreamDispatcherAttribute == null)
-                {
-                    continue;
-                }
-
-                if (sessionStreamDispatcherAttribute.Type >= 100)
-                {
-                    Log.Error("session dispatcher type must < 100");
-                    continue;
-                }
-                
-                ISessionStreamDispatcher iSessionStreamDispatcher = Activator.CreateInstance(type) as ISessionStreamDispatcher;
-                if (iSessionStreamDispatcher == null)
-                {
-                    Log.Error($"sessionDispatcher {type.Name} 需要继承 ISessionDispatcher");
-                    continue;
-                }
-
-                self.Dispatchers[sessionStreamDispatcherAttribute.Type] = iSessionStreamDispatcher;
-            }
-        }
-
-        public static void Dispatch(this SessionStreamDispatcher self, int type, Session session, MemoryStream memoryStream)
-        {
-            ISessionStreamDispatcher sessionStreamDispatcher = self.Dispatchers[type];
-            if (sessionStreamDispatcher == null)
-            {
-                throw new Exception("maybe your NetInnerComponent or NetOuterComponent not set SessionStreamDispatcherType");
-            }
-            sessionStreamDispatcher.Dispatch(session, memoryStream);
-        }
-    }
-}

+ 2 - 2
Unity/Codes/Hotfix/Share/Move/MoveComponentSystem.cs

@@ -7,10 +7,10 @@ namespace ET
     [FriendClass(typeof(MoveComponent))]
     public static class MoveComponentSystem
     {
-        [Timer(TimerType.MoveTimer)]
+        [Callback(TimerType.MoveTimer)]
         public class MoveTimer: ATimer<MoveComponent>
         {
-            public override void Run(MoveComponent self)
+            protected override void Run(MoveComponent self)
             {
                 try
                 {

+ 0 - 1
Unity/Codes/HotfixView/AppStart_Init.cs

@@ -19,7 +19,6 @@ namespace ET.Client
             Game.Scene.AddComponent<MessageDispatcherComponent>();
             
             Game.Scene.AddComponent<NetThreadComponent>();
-            Game.Scene.AddComponent<SessionStreamDispatcher>();
             Game.Scene.AddComponent<ClientSceneManagerComponent>();
             
             Game.Scene.AddComponent<GlobalComponent>();

+ 12 - 0
Unity/Codes/Model/Core/Object/CallbackAttribute.cs

@@ -0,0 +1,12 @@
+namespace ET
+{
+    public class CallbackAttribute: BaseAttribute
+    {
+        public int Type { get; }
+
+        public CallbackAttribute(int type)
+        {
+            this.Type = type;
+        }
+    }
+}

+ 74 - 0
Unity/Codes/Model/Core/Object/EventSystem.cs

@@ -89,6 +89,8 @@ namespace ET
         private readonly UnOrderMultiMapSet<Type, Type> types = new();
 
         private readonly Dictionary<Type, List<EventInfo>> allEvents = new();
+        
+        private object[] allCallbacks;
 
         private TypeSystems typeSystems = new();
 
@@ -191,6 +193,28 @@ namespace ET
                     this.allEvents[eventType].Add(eventInfo);
                 }
             }
+
+            this.allCallbacks = new object[10000];
+            foreach (Type type in types[typeof (CallbackAttribute)])
+            {
+                object obj = Activator.CreateInstance(type);
+                if (obj == null)
+                {
+                    throw new Exception($"type not is AEvent: {type.Name}");
+                }
+                
+                object[] attrs = type.GetCustomAttributes(typeof(CallbackAttribute), false);
+                foreach (object attr in attrs)
+                {
+                    CallbackAttribute callbackAttribute = attr as CallbackAttribute;
+
+                    if (this.allCallbacks[callbackAttribute.Type] != null)
+                    {
+                        throw new Exception($"action type duplicate: {callbackAttribute.Type}");
+                    }
+                    this.allCallbacks[callbackAttribute.Type] = obj;
+                }
+            }
         }
 
         public void Add(Assembly assembly)
@@ -701,6 +725,56 @@ namespace ET
                 aEvent.Handle(entity, a).Coroutine();
             }
         }
+        
+        public void Callback(int type)
+        {
+            (this.allCallbacks[type] as IAction).Handle();
+        }
+
+        public void Callback<A>(int type, A a)
+        {
+            (this.allCallbacks[type] as IAction<A>).Handle(a);
+        }
+        
+        public void Callback<A, B>(int type, A a, B b)
+        {
+            (this.allCallbacks[type] as IAction<A, B>).Handle(a, b);
+        }
+        
+        public void Callback<A, B, C>(int type, A a, B b, C c)
+        {
+            (this.allCallbacks[type] as IAction<A, B, C>).Handle(a, b, c);
+        }
+        
+        public void Callback<A, B, C, D>(int type, A a, B b, C c, D d)
+        {
+            (this.allCallbacks[type] as IAction<A, B, C, D>).Handle(a, b, c, d);
+        }
+        
+        public T Callback<T>(int type)
+        {
+            return (this.allCallbacks[type] as IFunc<T>).Handle();
+        }
+
+        public T Callback<T, A>(int type, A a)
+        {
+            return (this.allCallbacks[type] as IFunc<T, A>).Handle(a);
+        }
+        
+        public T Callback<T, A, B>(int type, A a, B b)
+        {
+            return (this.allCallbacks[type] as IFunc<T, A, B>).Handle(a, b);
+        }
+        
+        public T Callback<T, A, B, C>(int type, A a, B b, C c)
+        {
+            return (this.allCallbacks[type] as IFunc<T, A, B, C>).Handle(a, b, c);
+        }
+        
+        public T Callback<T, A, B, C, D>(int type, A a, B b, C c, D d)
+        {
+            return (this.allCallbacks[type] as IFunc<T, A, B, C, D>).Handle(a, b, c, d);
+        }
 
         public override string ToString()
         {

+ 53 - 0
Unity/Codes/Model/Core/Object/ICallback.cs

@@ -0,0 +1,53 @@
+namespace ET
+{
+
+    public interface IAction
+    {
+        public void Handle();
+    }
+
+    public interface IAction<A>
+    {
+        public void Handle(A a);
+    }
+
+    public interface IAction<A, B>
+    {
+        public void Handle(A a, B b);
+    }
+
+    public interface IAction<A, B, C>
+    {
+        public void Handle(A a, B b, C c);
+    }
+
+    public interface IAction<A, B, C, D>
+    {
+        public void Handle(A a, B b, C c, D d);
+    }
+
+    public interface IFunc<T>
+    {
+        public T Handle();
+    }
+
+    public interface IFunc<T, A>
+    {
+        public T Handle(A a);
+    }
+
+    public interface IFunc<T, A, B>
+    {
+        public T Handle(A a, B b);
+    }
+
+    public interface IFunc<T, A, B, C>
+    {
+        public T Handle(A a, B b, C c);
+    }
+
+    public interface IFunc<T, A, B, C, D>
+    {
+        public T Handle(A a, B b, C c, D d);
+    }
+}

+ 12 - 0
Unity/Codes/Model/Core/Timer/ATimer.cs

@@ -0,0 +1,12 @@
+namespace ET
+{
+    public abstract class ATimer<T>: IAction<object> where T: class
+    {
+        public void Handle(object a)
+        {
+            this.Run(a as T);
+        }
+
+        protected abstract void Run(T t);
+    }
+}

+ 0 - 17
Unity/Codes/Model/Core/Timer/ITimer.cs

@@ -1,17 +0,0 @@
-namespace ET
-{
-    public interface ITimer
-    {
-        void Handle(object args);
-    }
-    
-    public abstract class ATimer<T>: ITimer where T: class
-    {
-        public void Handle(object args)
-        {
-            this.Run(args as T);
-        }
-
-        public abstract void Run(T t);
-    }
-}

+ 0 - 14
Unity/Codes/Model/Core/Timer/TimerAttribute.cs

@@ -1,14 +0,0 @@
-using System;
-
-namespace ET
-{
-    public class TimerAttribute: BaseAttribute
-    {
-        public int Type { get; }
-
-        public TimerAttribute(int type)
-        {
-            this.Type = type;
-        }
-    }
-}

+ 2 - 58
Unity/Codes/Model/Core/Timer/TimerComponent.cs

@@ -56,7 +56,6 @@ namespace ET
             public override void Awake(TimerComponent self)
             {
                 TimerComponent.Instance = self;
-                self.Init();
             }
         }
 
@@ -116,15 +115,6 @@ namespace ET
             }
         }
     
-        [ObjectSystem]
-        public class TimerComponentLoadSystem: LoadSystem<TimerComponent>
-        {
-            public override void Load(TimerComponent self)
-            {
-                self.Init();
-            }
-        }
-
         [ObjectSystem]
         public class TimerComponentDestroySystem: DestroySystem<TimerComponent>
         {
@@ -134,35 +124,6 @@ namespace ET
             }
         }
 
-        private static void Init(this TimerComponent self)
-        {
-            self.timerActions = new ITimer[TimerComponent.TimeTypeMax];
-
-            HashSet<Type> types = Game.EventSystem.GetTypes(typeof (TimerAttribute));
-
-            foreach (Type type in types)
-            {
-                ITimer iTimer = Activator.CreateInstance(type) as ITimer;
-                if (iTimer == null)
-                {
-                    Log.Error($"Timer Action {type.Name} 需要继承 ITimer");
-                    continue;
-                }
-                
-                object[] attrs = type.GetCustomAttributes(typeof(TimerAttribute), false);
-                if (attrs.Length == 0)
-                {
-                    continue;
-                }
-
-                foreach (object attr in attrs)
-                {
-                    TimerAttribute timerAttribute = attr as TimerAttribute;
-                    self.timerActions[timerAttribute.Type] = iTimer;
-                }
-            }
-        }
-
         private static void Run(this TimerComponent self, TimerAction timerAction)
         {
             switch (timerAction.TimerClass)
@@ -170,13 +131,7 @@ namespace ET
                 case TimerClass.OnceTimer:
                 {
                     int type = timerAction.Type;
-                    ITimer timer = self.timerActions[type];
-                    if (timer == null)
-                    {
-                        Log.Error($"not found timer action: {type}");
-                        return;
-                    }
-                    timer.Handle(timerAction.Object);
+                    Game.EventSystem.Callback(type, timerAction.Object);
                     break;
                 }
                 case TimerClass.OnceWaitTimer:
@@ -191,14 +146,7 @@ namespace ET
                     int type = timerAction.Type;
                     long tillTime = TimeHelper.ServerNow() + timerAction.Time;
                     self.AddTimer(tillTime, timerAction);
-
-                    ITimer timer = self.timerActions[type];
-                    if (timer == null)
-                    {
-                        Log.Error($"not found timer action: {type}");
-                        return;
-                    }
-                    timer.Handle(timerAction.Object);
+                    Game.EventSystem.Callback(type, timerAction.Object);
                     break;
                 }
             }
@@ -388,9 +336,5 @@ namespace ET
 
         // 记录最小时间,不用每次都去MultiMap取第一个值
         public long minTime;
-
-        public const int TimeTypeMax = 10000;
-
-        public ITimer[] timerActions;
     }
 }

+ 5 - 7
Unity/Codes/Model/Core/Timer/TimerType.cs

@@ -2,12 +2,10 @@
 {
     public static partial class TimerType
     {
-        // 框架层0-1000,逻辑层的timer type从1000起
-        public const int WaitTimer = 0;
-        public const int SessionIdleChecker = 1;
-        public const int ActorLocationSenderChecker = 2;
-        public const int ActorMessageSenderChecker = 3;
-
-        // 不能超过1000
+        // 框架层100-200,逻辑层的timer type从200起
+        public const int WaitTimer = 100;
+        public const int SessionIdleChecker = 101;
+        public const int ActorLocationSenderChecker = 102;
+        public const int ActorMessageSenderChecker = 103;
     }
 }

+ 1 - 1
Unity/Codes/Model/Module/Message/NetKcpComponent.cs

@@ -4,7 +4,7 @@ namespace ET
 {
     [ChildType(typeof(Session))]
     [ComponentOf(typeof(Scene))]
-    public class NetKcpComponent: Entity, IAwake<int>, IAwake<IPEndPoint, int>, IDestroy
+    public class NetKcpComponent: Entity, IAwake<int>, IAwake<IPEndPoint, int>, IDestroy, IAwake<IAction<int>>
     {
         public AService Service;
         

+ 0 - 9
Unity/Codes/Model/Module/Message/SessionStreamDispatcher.cs

@@ -1,9 +0,0 @@
-namespace ET
-{
-    [ComponentOf(typeof(Scene))]
-    public class SessionStreamDispatcher: Entity, IAwake, IDestroy, ILoad
-    {
-        public static SessionStreamDispatcher Instance;
-        public ISessionStreamDispatcher[] Dispatchers;
-    }
-}

+ 0 - 14
Unity/Codes/Model/Module/Message/SessionStreamDispatcherAttribute.cs

@@ -1,14 +0,0 @@
-using System;
-
-namespace ET
-{
-    public class SessionStreamDispatcherAttribute: BaseAttribute
-    {
-        public int Type;
-
-        public SessionStreamDispatcherAttribute(int type)
-        {
-            this.Type = type;
-        }
-    }
-}

+ 4 - 5
Unity/Codes/Model/Share/TimerType.cs

@@ -2,10 +2,9 @@
 {
     public static partial class TimerType
     {
-        // 框架层0-1000,逻辑层的timer type 1000-9999
-        public const int MoveTimer = 1001;
-        public const int AITimer = 1002;
-        public const int SessionAcceptTimeout = 1003;
-        // 不能超过10000
+        // 框架层0-100,逻辑层的timer type 200-300
+        public const int MoveTimer = 201;
+        public const int AITimer = 202;
+        public const int SessionAcceptTimeout = 203;
     }
 }