Эх сурвалжийг харах

修复FiberLog分析器检测出来的错误

tanghai 2 жил өмнө
parent
commit
fb86772324

+ 1 - 1
Unity/Assets/Resources/GlobalConfig.asset

@@ -12,6 +12,6 @@ MonoBehaviour:
   m_Script: {fileID: 11500000, guid: 36527db572638af47b03c805671cba75, type: 3}
   m_Name: GlobalConfig
   m_EditorClassIdentifier: 
-  CodeMode: 1
+  CodeMode: 3
   BuildType: 1
   AppType: 7

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs

@@ -18,7 +18,7 @@ namespace ET.Client
             }
             catch (Exception e)
             {
-                Log.Error(e);
+                root.Fiber.Error(e);
             }	
         }
         

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Robot/Console/CreateRobotConsoleHandler.cs

@@ -31,7 +31,7 @@ namespace ET.Server
                     for (int i = 0; i < options.Num; ++i)
                     {
                         await robotManagerComponent.NewRobot($"Robot_{i}");
-                        Log.Console($"create robot {i}");
+                        fiber.Console($"create robot {i}");
                         await timerComponent.WaitAsync(2000);
                     }
                     break;

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/Http/HttpComponentSystem.cs

@@ -56,7 +56,7 @@ namespace ET.Server
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    self.Fiber().Error(e);
                 }
             }
         }
@@ -70,7 +70,7 @@ namespace ET.Server
             }
             catch (Exception e)
             {
-                Log.Error(e);
+                self.Fiber().Error(e);
             }
             context.Request.InputStream.Dispose();
             context.Response.OutputStream.Dispose();

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Module/Router/RouterComponentSystem.cs

@@ -76,7 +76,7 @@ namespace ET.Server
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    self.Fiber().Error(e);
                 }
             }
         }
@@ -134,7 +134,7 @@ namespace ET.Server
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    self.Fiber().Error(e);
                 }
             }
         }

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/Module/Console/ConsoleComponentSystem.cs

@@ -61,7 +61,7 @@ namespace ET
                 }
                 catch (Exception e)
                 {
-                    Log.Console(e.ToString());
+                    self.Fiber().Console(e.ToString());
                 }
             }
         }

+ 3 - 3
Unity/Assets/Scripts/Hotfix/Share/Module/Console/ReloadConfigConsoleHandler.cs

@@ -11,7 +11,7 @@ namespace ET
             {
                 case ConsoleMode.ReloadConfig:
                     contex.Parent.RemoveComponent<ModeContex>();
-                    Log.Console("C must have config name, like: C UnitConfig");
+                    fiber.Console("C must have config name, like: C UnitConfig");
                     break;
                 default:
                     string[] ss = content.Split(" ");
@@ -20,11 +20,11 @@ namespace ET
                     Type type = CodeTypes.Instance.GetType($"ET.{category}");
                     if (type == null)
                     {
-                        Log.Console($"reload config but not find {category}");
+                        fiber.Console($"reload config but not find {category}");
                         return;
                     }
                     ConfigLoader.Instance.Reload(type);
-                    Log.Console($"reload config {configName} finish!");
+                    fiber.Console($"reload config {configName} finish!");
                     break;
             }
             

+ 1 - 1
Unity/Assets/Scripts/HotfixView/Client/Demo/Scene/SceneChangeStart_AddComponent.cs

@@ -25,7 +25,7 @@ namespace ET.Client
             }
             catch (Exception e)
             {
-                Log.Error(e);
+                root.Fiber.Error(e);
             }
 
         }

+ 3 - 2
Unity/Assets/Scripts/HotfixView/Client/Demo/UI/UIHelp/UIHelpEvent.cs

@@ -8,9 +8,10 @@ namespace ET.Client
     {
         public override async ETTask<UI> OnCreate(UIComponent uiComponent, UILayer uiLayer)
         {
+	        Fiber fiber = uiComponent.Fiber();
 	        try
 	        {
-		        ResourcesComponent resourcesComponent = uiComponent.Root().GetComponent<ResourcesComponent>();
+		        ResourcesComponent resourcesComponent = fiber.Root.GetComponent<ResourcesComponent>();
 		        await uiComponent.Scene().GetComponent<ResourcesLoaderComponent>().LoadAsync(resourcesComponent.StringToAB(UIType.UIHelp));
 		        GameObject bundleGameObject = (GameObject) resourcesComponent.GetAsset(resourcesComponent.StringToAB(UIType.UIHelp), UIType.UIHelp);
 		        GameObject gameObject = UnityEngine.Object.Instantiate(bundleGameObject, uiComponent.UIGlobalComponent.GetLayer((int)uiLayer));
@@ -21,7 +22,7 @@ namespace ET.Client
 	        }
 	        catch (Exception e)
 	        {
-				Log.Error(e);
+		        fiber.Error(e);
 		        return null;
 	        }
 		}

+ 2 - 2
Unity/Assets/Scripts/Model/Share/LockStep/LSEntitySystemSingleton.cs

@@ -69,7 +69,7 @@ namespace ET
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    entity.Fiber().Error(e);
                 }
             }
         }
@@ -95,7 +95,7 @@ namespace ET
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    entity.Fiber().Error(e);
                 }
             }
         }

+ 3 - 2
Unity/Assets/Scripts/Model/Share/Module/Message/MessageSessionDispatcher.cs

@@ -66,11 +66,12 @@ namespace ET
 
         public void Handle(Session session, object message)
         {
+            Fiber fiber = session.Fiber();
             List<MessageSessionDispatcherInfo> actions;
             ushort opcode = OpcodeType.Instance.GetOpcode(message.GetType());
             if (!this.handlers.TryGetValue(opcode, out actions))
             {
-                Log.Error($"消息没有处理: {opcode} {message}");
+                fiber.Error($"消息没有处理: {opcode} {message}");
                 return;
             }
 
@@ -88,7 +89,7 @@ namespace ET
                 }
                 catch (Exception e)
                 {
-                    Log.Error(e);
+                    fiber.Error(e);
                 }
             }
         }

+ 5 - 5
Unity/Assets/Scripts/Model/Share/Module/Message/MessageSessionHandler.cs

@@ -16,13 +16,13 @@ namespace ET
             using Message msg = message as Message;
             if (message == null)
             {
-                Log.Error($"消息类型转换错误: {msg.GetType().FullName} to {typeof (Message).Name}");
+                session.Fiber().Error($"消息类型转换错误: {msg.GetType().FullName} to {typeof (Message).Name}");
                 return;
             }
 
             if (session.IsDisposed)
             {
-                Log.Error($"session disconnect {msg}");
+                session.Fiber().Error($"session disconnect {msg}");
                 return;
             }
 
@@ -64,7 +64,7 @@ namespace ET
                 long instanceId = session.InstanceId;
 
                 Response response = ObjectPool.Instance.Fetch<Response>();
-
+                Fiber fiber = session.Fiber();
                 try
                 {
                     await this.Run(session, request, response);
@@ -72,13 +72,13 @@ namespace ET
                 catch (RpcException exception)
                 {
                     // 这里不能返回堆栈给客户端
-                    Log.Error(exception.ToString());
+                    fiber.Error(exception.ToString());
                     response.Error = exception.Error;
                 }
                 catch (Exception exception)
                 {
                     // 这里不能返回堆栈给客户端
-                    Log.Error(exception.ToString());
+                    fiber.Error(exception.ToString());
                     response.Error = ErrorCore.ERR_RpcFail;
                 }