Browse Source

1.修复协程锁一个bug
2.机器人工程引用相关代码
3.IdGenerater简化,一秒不够用借用下一秒
4.使用命令行参数--Console=1开启控制台

tanghai 4 years ago
parent
commit
3f3c916c46
54 changed files with 1006 additions and 355 deletions
  1. 51 3
      Robot/App/Program.cs
  2. 15 0
      Robot/App/Robot.App.csproj
  3. 48 0
      Robot/Hotfix/Robot.Hotfix.csproj
  4. 16 0
      Robot/Model/Base/DllHelper.cs
  5. 92 0
      Robot/Model/Robot.Model.csproj
  6. 2 2
      Server/App/Server.App.csproj
  7. 13 0
      Server/Hotfix/Demo/AppStart_Init.cs
  8. 118 0
      Server/Hotfix/Module/Console/ConsoleComponentSystem.cs
  9. 35 0
      Server/Hotfix/Module/Console/ReloadConfigConsoleHandler.cs
  10. 0 0
      Server/Hotfix/Module/MessageInner/OuterMessageDispatcher.cs
  11. 2 3
      Server/Hotfix/Server.Hotfix.csproj
  12. 20 0
      Server/Model/Module/Console/ConsoleComponent.cs
  13. 12 0
      Server/Model/Module/Console/ConsoleHandlerAttribute.cs
  14. 7 0
      Server/Model/Module/Console/IConsoleHandler.cs
  15. 25 0
      Server/Model/Module/Console/ModeContex.cs
  16. 1 1
      Server/Model/Module/Message/NetInnerComponent.cs
  17. 6 11
      Server/Model/Server.Model.csproj
  18. 0 1
      Unity/Assets/Editor/Helper/MongoHelper.cs
  19. 9 0
      Unity/Assets/Hotfix/Module/Config/ConfigComponentSystem.cs
  20. 8 0
      Unity/Assets/Hotfix/Module/MessageOuter.meta
  21. 0 0
      Unity/Assets/Hotfix/Module/MessageOuter/OuterMessageDispatcher.cs
  22. 1 1
      Unity/Assets/Hotfix/Module/MessageOuter/OuterMessageDispatcher.cs.meta
  23. 1 1
      Unity/Assets/Model/Core/Async/AsyncMethodBuilderAttribute.cs
  24. 1 1
      Unity/Assets/Model/Core/Helper/ByteHelper.cs
  25. 85 63
      Unity/Assets/Model/Core/Helper/IdGenerater.cs
  26. 4 4
      Unity/Assets/Model/Core/Helper/JsonHelper.cs
  27. 20 1
      Unity/Assets/Model/Core/Log/Log.cs
  28. 1 1
      Unity/Assets/Model/Core/Log/NLogger.cs
  29. 1 1
      Unity/Assets/Model/Core/Log/UnityLogger.cs
  30. 1 1
      Unity/Assets/Model/Core/Object/ComponentView.cs
  31. 6 1
      Unity/Assets/Model/Core/Object/EventSystem.cs
  32. 9 5
      Unity/Assets/Model/Core/Options.cs
  33. 0 32
      Unity/Assets/Model/Demo/Helper/PositionHelper.cs
  34. 2 0
      Unity/Assets/Model/Module/Config/ConfigComponent.cs
  35. 30 13
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLock.cs
  36. 94 161
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockComponent.cs
  37. 51 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueue.cs
  38. 11 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueue.cs.meta
  39. 47 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueueType.cs
  40. 11 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueueType.cs.meta
  41. 14 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockTimer.cs
  42. 11 0
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockTimer.cs.meta
  43. 62 6
      Unity/Assets/Model/Module/CoroutineLock/CoroutineLockType.cs
  44. 19 22
      Unity/Assets/Model/Module/Message/MessagePool.cs
  45. 8 0
      Unity/Assets/Model/Module/MessageOuter.meta
  46. 8 0
      Unity/Assets/ModelView/Resource.meta
  47. 0 0
      Unity/Assets/ModelView/Resource/PathHelper.cs
  48. 2 3
      Unity/Assets/ModelView/Resource/PathHelper.cs.meta
  49. 0 0
      Unity/Assets/ModelView/Resource/ResourcesComponent.cs
  50. 0 0
      Unity/Assets/ModelView/Resource/ResourcesComponent.cs.meta
  51. 4 4
      Unity/Packages/manifest.json
  52. 14 5
      Unity/Packages/packages-lock.json
  53. 2 2
      Unity/ProjectSettings/ProjectVersion.txt
  54. 6 6
      Unity/Unity.sln

+ 51 - 3
Robot/App/Program.cs

@@ -1,12 +1,60 @@
 using System;
+using System.Diagnostics;
+using System.IO;
+using System.Threading;
+using CommandLine;
+using NLog;
 
 namespace ET
 {
-    class Program
+    internal static class Program
     {
-        static void Main(string[] args)
+        private static void Main(string[] args)
         {
-            Console.WriteLine("Hello World!");
+            // 异步方法全部会回掉到主线程
+            SynchronizationContext.SetSynchronizationContext(ThreadSynchronizationContext.Instance);
+			
+            try
+            {		
+                Game.EventSystem.Add(typeof(Game).Assembly);
+                Game.EventSystem.Add(DllHelper.GetHotfixAssembly());
+				
+                ProtobufHelper.Init();
+                MongoHelper.Init();
+				
+                // 命令行参数
+                Options options = null;
+                Parser.Default.ParseArguments<Options>(args)
+                        .WithNotParsed(error => throw new Exception($"命令行格式错误!"))
+                        .WithParsed(o => { options = o; });
+
+                Game.Options = options;
+				
+                LogManager.Configuration.Variables["appIdFormat"] = $"{Game.Scene.Id:0000}";
+				
+                Log.Info($"server start........................ {Game.Scene.Id}");
+
+                Game.EventSystem.Publish(new EventType.AppStart());
+				
+                while (true)
+                {
+                    try
+                    {
+                        Thread.Sleep(1);
+                        Game.Update();
+                        Game.LateUpdate();
+                        Game.FrameFinish();
+                    }
+                    catch (Exception e)
+                    {
+                        Log.Error(e);
+                    }
+                }
+            }
+            catch (Exception e)
+            {
+                Log.Error(e);
+            }
         }
     }
 }

+ 15 - 0
Robot/App/Robot.App.csproj

@@ -6,6 +6,21 @@
         <RootNamespace>ET</RootNamespace>
     </PropertyGroup>
 
+    <PropertyGroup>
+        <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+
     <ItemGroup>
       <ProjectReference Include="..\Model\Robot.Model.csproj" />
     </ItemGroup>

+ 48 - 0
Robot/Hotfix/Robot.Hotfix.csproj

@@ -5,8 +5,56 @@
         <RootNamespace>ET</RootNamespace>
     </PropertyGroup>
 
+    <PropertyGroup>
+        <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+
     <ItemGroup>
       <ProjectReference Include="..\Model\Robot.Model.csproj" />
     </ItemGroup>
+    
+    <ItemGroup>
+        <Compile Include="..\..\Unity\Assets\Hotfix\Module\AI\**\*.cs">
+            <Link>Module\AI\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Hotfix\Module\Message\**\*.cs">
+            <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Hotfix\Module\MessageOuter\**\*.cs">
+            <Link>Module\MessageOuter\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Hotfix\Module\Numeric\**\*.cs">
+            <Link>Module\Numeric\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Hotfix\Module\Actor\**\*.cs">
+            <Link>Module\Actor\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Hotfix\Module\Message\**\*.cs">
+            <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+        <Compile Include="..\..\Server\Hotfix\Module\NetworkTCP\**\*.cs">
+            <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Hotfix\Demo\**\*.cs">
+            <Link>Demo\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+    </ItemGroup>
 
 </Project>

+ 16 - 0
Robot/Model/Base/DllHelper.cs

@@ -0,0 +1,16 @@
+using System.IO;
+using System.Reflection;
+
+namespace ET
+{
+    public static class DllHelper
+    {
+        public static Assembly GetHotfixAssembly()
+        {
+            byte[] dllBytes = File.ReadAllBytes("./Robot.Hotfix.dll");
+            byte[] pdbBytes = File.ReadAllBytes("./Robot.Hotfix.pdb");
+            Assembly assembly = Assembly.Load(dllBytes, pdbBytes);
+            return assembly;
+        }
+    }
+}

+ 92 - 0
Robot/Model/Robot.Model.csproj

@@ -5,4 +5,96 @@
         <RootNamespace>ET</RootNamespace>
     </PropertyGroup>
 
+    <PropertyGroup>
+        <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
+        <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+
+    <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
+      <OutputPath>../../Bin/</OutputPath>
+      <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+      <DefineConstants>TRACECOREAPP;NOT_UNITY</DefineConstants>
+    </PropertyGroup>
+    <ItemGroup>
+        <Compile Include="..\..\Unity\Assets\Editor\Helper\MongoHelper.cs">
+          <Link>Base\MongoHelper.cs</Link>
+        </Compile>
+        <Compile Include="..\..\Unity\Assets\Model\Module\Config\**\*.cs">
+            <Link>Module\Config\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Core\**\*.cs">
+            <Link>Core\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\AI\**\*.cs">
+            <Link>Module\AI\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\Network\**\*.cs">
+            <Link>Module\Network\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\NetworkTCP\**\*.cs">
+            <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Model\Module\NetworkTCP\**\*.cs">
+            <Link>Module\NetworkTCP\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\Message\**\*.cs">
+            <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Model\Module\Message\**\*.cs">
+            <Link>Module\Message\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\Numeric\**\*.cs">
+            <Link>Module\Numeric\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Demo\**\*.cs">
+            <Link>Demo\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Model\Generate\**\*.cs">
+            <Link>Generate\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Server\Model\Module\Actor\**\*.cs">
+            <Link>Module\Actor\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\Actor\**\*.cs">
+            <Link>Module\Actor\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\ActorLocation\**\*.cs">
+            <Link>Module\ActorLocation\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+
+        <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\**\*.cs">
+            <Link>Module\CoroutineLock\%(RecursiveDir)%(FileName)%(Extension)</Link>
+        </Compile>
+    </ItemGroup>
+    <ItemGroup>
+      <ProjectReference Include="..\..\ThirdParty\protobuf-net\protobuf-net.csproj" />
+      <ProjectReference Include="..\..\ThirdParty\ShareLib\ShareLib.csproj" />
+      <ProjectReference Include="..\..\ThirdParty\UnityEngine\UnityEngine.csproj" />
+    </ItemGroup>
+    <ItemGroup>
+      <PackageReference Include="CommandLineParser" Version="2.8.0" />
+      <PackageReference Include="mongocsharpdriver" Version="2.13.0" />
+      <PackageReference Include="NLog" Version="4.7.10" />
+      <PackageReference Include="SharpZipLib" Version="1.3.2" />
+    </ItemGroup>
+
 </Project>

+ 2 - 2
Server/App/Server.App.csproj

@@ -13,13 +13,13 @@
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;SERVER;NOT_UNITY</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
 
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;SERVER;NOT_UNITY</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>

+ 13 - 0
Server/Hotfix/Demo/AppStart_Init.cs

@@ -37,6 +37,19 @@ namespace ET
             {
                 await SceneFactory.Create(Game.Scene, startConfig.SceneId, startConfig.Zone, startConfig.Name, startConfig.Type, startConfig);
             }
+
+            switch (Game.Options.AppType)
+            {
+                case AppType.Server:
+                    break;
+                case AppType.Watcher:
+                    break;
+            }
+
+            if (Game.Options.Console == 1)
+            {
+                Game.Scene.AddComponent<ConsoleComponent>();
+            }
         }
     }
 }

+ 118 - 0
Server/Hotfix/Module/Console/ConsoleComponentSystem.cs

@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace ET
+{
+    [ObjectSystem]
+    public class ConsoleComponentAwakeSystem: AwakeSystem<ConsoleComponent>
+    {
+        public override void Awake(ConsoleComponent self)
+        {
+            self.Load();
+        }
+    }
+
+    [ObjectSystem]
+    public class ConsoleComponentLoadSystem: LoadSystem<ConsoleComponent>
+    {
+        public override void Load(ConsoleComponent self)
+        {
+            self.Load();
+        }
+    }
+    
+    [ObjectSystem]
+    public class ConsoleComponentStartSystem: StartSystem<ConsoleComponent>
+    {
+        public override void Start(ConsoleComponent self)
+        {
+            self.Start().Coroutine();
+        }
+    }
+
+    public static class ConsoleComponentSystem
+    {
+        public static void Load(this ConsoleComponent self)
+        {
+            self.Handlers.Clear();
+
+            HashSet<Type> types = EventSystem.Instance.GetTypes(typeof (ConsoleHandlerAttribute));
+
+            foreach (Type type in types)
+            {
+                object[] attrs = type.GetCustomAttributes(typeof(ConsoleHandlerAttribute), false);
+                if (attrs.Length == 0)
+                {
+                    continue;
+                }
+
+                ConsoleHandlerAttribute consoleHandlerAttribute = (ConsoleHandlerAttribute)attrs[0];
+
+                object obj = Activator.CreateInstance(type);
+
+                IConsoleHandler iConsoleHandler = obj as IConsoleHandler;
+                if (iConsoleHandler == null)
+                {
+                    throw new Exception($"ConsoleHandler handler not inherit IConsoleHandler class: {obj.GetType().FullName}");
+                }
+                self.Handlers.Add(consoleHandlerAttribute.Mode, iConsoleHandler);
+            }
+        }
+        
+        public static async ETVoid Start(this ConsoleComponent self)
+        {
+            self.CancellationTokenSource = new CancellationTokenSource();
+
+            while (true)
+            {
+                try
+                {
+                    ModeContex modeContex = self.GetComponent<ModeContex>();
+                    string line = await Task.Factory.StartNew(() =>
+                    {
+                        Console.Write($"{modeContex?.Mode ?? ""}> ");
+                        return Console.In.ReadLine();
+                    }, self.CancellationTokenSource.Token);
+                    
+                    line = line.Trim();
+
+                    switch (line)
+                    {
+                        case "":
+                            break;
+                        case "exit":
+                            self.RemoveComponent<ModeContex>();
+                            break;
+                        default:
+                        {
+                            string[] lines = line.Split(" ");
+                            string mode = modeContex == null? lines[0] : modeContex.Mode;
+
+                            if (!self.Handlers.TryGetValue(mode, out IConsoleHandler iConsoleHandler))
+                            {
+                                Log.Console($"not found command: {line}");
+                                break;
+                            }
+
+                            if (modeContex == null)
+                            {
+                                modeContex = self.AddComponent<ModeContex>();
+                                modeContex.Mode = mode;
+                            }
+                            await iConsoleHandler.Run(modeContex, line);
+                            break;
+                        }
+                    }
+
+
+                }
+                catch (Exception e)
+                {
+                    Log.Console(e.ToString());
+                }
+            }
+        }
+    }
+}

+ 35 - 0
Server/Hotfix/Module/Console/ReloadConfigConsoleHandler.cs

@@ -0,0 +1,35 @@
+using System;
+using NLog;
+
+namespace ET
+{
+    [ConsoleHandler(ConsoleMode.ReloadConfig)]
+    public class ReloadConfigConsoleHandler: IConsoleHandler
+    {
+        public async ETTask Run(ModeContex contex, string content)
+        {
+            switch (content)
+            {
+                case ConsoleMode.ReloadConfig:
+                    contex.Parent.RemoveComponent<ModeContex>();
+                    Log.Console("C must have config name, like: C UnitConfig");
+                    break;
+                default:
+                    string[] ss = content.Split(" ");
+                    string configName = ss[1];
+                    string category = $"{configName}Category";
+                    Type type = Game.EventSystem.GetType($"ET.{category}");
+                    if (type == null)
+                    {
+                        Log.Console($"reload config but not find {category}");
+                        return;
+                    }
+                    ConfigComponent.Instance.LoadOneConfig(type);
+                    Log.Console($"reload config {configName} finish!");
+                    break;
+            }
+            
+            await ETTask.CompletedTask;
+        }
+    }
+}

+ 0 - 0
Server/Hotfix/Module/Message/OuterMessageDispatcher.cs → Server/Hotfix/Module/MessageInner/OuterMessageDispatcher.cs


+ 2 - 3
Server/Hotfix/Server.Hotfix.csproj

@@ -9,17 +9,16 @@
     <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;NOT_UNITY;SERVER;</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;SERVER;NOT_UNITY</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
   <ItemGroup>
-    <Compile Remove="Other\**" />
     <Compile Include="..\..\Unity\Assets\Hotfix\Demo\Move\MoveComponentSystem.cs">
       <Link>Demo\Move\MoveComponentSystem.cs</Link>
     </Compile>

+ 20 - 0
Server/Model/Module/Console/ConsoleComponent.cs

@@ -0,0 +1,20 @@
+using System.Collections.Generic;
+using System.Threading;
+
+namespace ET
+{
+    public static class ConsoleMode
+    {
+        public const string ReloadDll = "R";
+        public const string ReloadConfig = "C";
+        public const string ShowMemory = "M";
+        public const string Repl = "Repl";
+        public const string Debugger = "Debugger";
+    }
+
+    public class ConsoleComponent: Entity
+    {
+        public CancellationTokenSource CancellationTokenSource;
+        public Dictionary<string, IConsoleHandler> Handlers = new Dictionary<string, IConsoleHandler>();
+    }
+}

+ 12 - 0
Server/Model/Module/Console/ConsoleHandlerAttribute.cs

@@ -0,0 +1,12 @@
+namespace ET
+{
+    public class ConsoleHandlerAttribute: BaseAttribute
+    {
+        public string Mode { get; }
+
+        public ConsoleHandlerAttribute(string mode)
+        {
+            this.Mode = mode;
+        }
+    }
+}

+ 7 - 0
Server/Model/Module/Console/IConsoleHandler.cs

@@ -0,0 +1,7 @@
+namespace ET
+{
+    public interface IConsoleHandler
+    {
+        ETTask Run(ModeContex contex, string content);
+    }
+}

+ 25 - 0
Server/Model/Module/Console/ModeContex.cs

@@ -0,0 +1,25 @@
+namespace ET
+{
+    [ObjectSystem]
+    public class ModeContexAwakeSystem: AwakeSystem<ModeContex>
+    {
+        public override void Awake(ModeContex self)
+        {
+            self.Mode = "";
+        }
+    }
+
+    [ObjectSystem]
+    public class ModeContexDestroySystem: DestroySystem<ModeContex>
+    {
+        public override void Destroy(ModeContex self)
+        {
+            self.Mode = "";
+        }
+    }
+
+    public class ModeContex: Entity
+    {
+        public string Mode = "";
+    }
+}

+ 1 - 1
Server/Model/Module/NetworkTCP/NetInnerComponent.cs → Server/Model/Module/Message/NetInnerComponent.cs

@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 

+ 6 - 11
Server/Model/Server.Model.csproj

@@ -9,13 +9,13 @@
     <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;NOT_UNITY;SERVER</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
-    <DefineConstants>TRACE2_0;SERVER;NOT_CLIENT</DefineConstants>
+    <DefineConstants>TRACE2_0;SERVER;NOT_UNITY</DefineConstants>
     <OutputPath>..\..\Bin\</OutputPath>
     <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
@@ -41,6 +41,10 @@
     <Compile Include="..\..\Unity\Assets\Model\Module\AI\**\*.cs">
       <Link>Module\AI\%(RecursiveDir)%(FileName)%(Extension)</Link>
     </Compile>
+
+    <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\**\*.cs">
+      <Link>Module\CoroutineLock\%(RecursiveDir)%(FileName)%(Extension)</Link>
+    </Compile>
     
     <Compile Remove="Libs\**" />
     
@@ -53,15 +57,6 @@
     <Compile Include="..\..\Unity\Assets\Model\Module\Actor\IActorMessage.cs">
       <Link>Module\Actor\IActorMessage.cs</Link>
     </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\CoroutineLock.cs">
-      <Link>Module\CoroutineLock\CoroutineLock.cs</Link>
-    </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\CoroutineLockComponent.cs">
-      <Link>Module\CoroutineLock\CoroutineLockComponent.cs</Link>
-    </Compile>
-    <Compile Include="..\..\Unity\Assets\Model\Module\CoroutineLock\CoroutineLockType.cs">
-      <Link>Module\CoroutineLock\CoroutineLockType.cs</Link>
-    </Compile>
     <Compile Include="..\..\Unity\Assets\Model\Module\Message\MessageDispatcherComponent.cs">
       <Link>Module\Message\MessageDispatcherComponent.cs</Link>
     </Compile>

+ 0 - 1
Unity/Assets/Editor/Helper/MongoHelper.cs

@@ -31,7 +31,6 @@ namespace ET
 #else
             BsonSerializer.RegisterSerializer(typeof (Vector4), new StructBsonSerialize<Vector4>());
             BsonSerializer.RegisterSerializer(typeof (Vector3), new StructBsonSerialize<Vector3>());
-            BsonSerializer.RegisterSerializer(typeof (Vector2Int), new StructBsonSerialize<Vector2Int>());
 #endif
 
             var types = Game.EventSystem.GetTypes();

+ 9 - 0
Unity/Assets/Hotfix/Module/Config/ConfigComponentSystem.cs

@@ -22,6 +22,15 @@ namespace ET
     
     public static class ConfigComponentSystem
 	{
+		public static void LoadOneConfig(this ConfigComponent self, Type configType)
+		{
+			byte[] oneConfigBytes = ConfigComponent.GetOneConfigBytes(configType.FullName);
+
+			object category = ProtobufHelper.FromBytes(configType, oneConfigBytes, 0, oneConfigBytes.Length);
+
+			self.AllConfig[configType] = category;
+		}
+		
 		public static async ETTask LoadAsync(this ConfigComponent self)
 		{
 			self.AllConfig.Clear();

+ 8 - 0
Unity/Assets/Hotfix/Module/MessageOuter.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a5b34826b9ce24c7cb122e72c98d7922
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Assets/Hotfix/Module/Message/OuterMessageDispatcher.cs → Unity/Assets/Hotfix/Module/MessageOuter/OuterMessageDispatcher.cs


+ 1 - 1
Unity/Assets/Hotfix/Module/Message/OuterMessageDispatcher.cs.meta → Unity/Assets/Hotfix/Module/MessageOuter/OuterMessageDispatcher.cs.meta

@@ -1,5 +1,5 @@
 fileFormatVersion: 2
-guid: eadf6b4c6d9e4f146bbf89d803c01c96
+guid: aefbf5630f2854ad78f151e0721ccfbf
 MonoImporter:
   externalObjects: {}
   serializedVersion: 2

+ 1 - 1
Unity/Assets/Model/Core/Async/AsyncMethodBuilderAttribute.cs

@@ -1,4 +1,4 @@
-#if !SERVER
+#if !NOT_UNITY
 namespace System.Runtime.CompilerServices
 {
     public sealed class AsyncMethodBuilderAttribute: Attribute

+ 1 - 1
Unity/Assets/Model/Core/Helper/ByteHelper.cs

@@ -1,4 +1,4 @@
-using System.Text;
+using System.Text;
 
 namespace ET
 {

+ 85 - 63
Unity/Assets/Model/Core/Helper/IdGenerater.cs

@@ -28,7 +28,7 @@ namespace ET
 
         public IdStruct(long id)
         {
-            ulong result = (ulong) id;
+            ulong result = (ulong) id; 
             this.Value = (ushort) (result & ushort.MaxValue);
             result >>= 16;
             this.Process = (int) (result & IdGenerater.Mask18bit);
@@ -100,9 +100,6 @@ namespace ET
         public long ToLong()
         {
             ulong result = 0;
-
-            result |= 1ul << 63; // 最高位变成1,暂时让它跟普通id区分一下,正式版删除
-            
             result |= this.Value;
             result |= (uint)this.ProcessMode << 16;
             result |= (ulong) this.Zone << 24;
@@ -117,6 +114,18 @@ namespace ET
             this.Value = value;
             this.Zone = (ushort)zone;
         }
+        
+        public UnitIdStruct(long id)
+        {
+            ulong result = (ulong) id;
+            this.Value = (ushort)(result & ushort.MaxValue);
+            result >>= 16;
+            this.ProcessMode = (byte)(result & byte.MaxValue);
+            result >>= 8;
+            this.Zone = (ushort)(result & 0x03ff);
+            result >>= 10;
+            this.Time = (uint)result;
+        }
                         
         public override string ToString()
         {
@@ -140,94 +149,110 @@ namespace ET
         private long epoch2020;
         private ushort value;
         private uint lastIdTime;
-        private ushort idThisSecCount;
 
         
-        private long instanceIdEpoch;
+        private long epochThisYear;
         private uint instanceIdValue;
         private uint lastInstanceIdTime;
-        private uint instanceIdThisSecCount;
         
         
         private ushort unitIdValue;
         private uint lastUnitIdTime;
-        private ushort unitIdThisSecCount;
 
         public IdGenerater()
         {
-            long epoch1970 = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000;
-            this.epoch2020 = new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970;
-            this.instanceIdEpoch = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970;
+            long epoch1970tick = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000;
+            this.epoch2020 = new DateTime(2020, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970tick;
+            this.epochThisYear = new DateTime(DateTime.Now.Year, 1, 1, 0, 0, 0, DateTimeKind.Utc).Ticks / 10000 - epoch1970tick;
+            
+            this.lastInstanceIdTime = TimeSinceThisYear();
+            if (this.lastInstanceIdTime <= 0)
+            {
+                Log.Warning($"lastInstanceIdTime less than 0: {this.lastInstanceIdTime}");
+                this.lastInstanceIdTime = 1;
+            }
+            this.lastIdTime = TimeSince2020();
+            if (this.lastIdTime <= 0)
+            {
+                Log.Warning($"lastIdTime less than 0: {this.lastIdTime}");
+                this.lastIdTime = 1;
+            }
+            this.lastUnitIdTime = TimeSince2020();
+            if (this.lastUnitIdTime <= 0)
+            {
+                Log.Warning($"lastUnitIdTime less than 0: {this.lastUnitIdTime}");
+                this.lastUnitIdTime = 1;
+            }
         }
 
         public void Dispose()
         {
             this.epoch2020 = 0;
-            this.instanceIdEpoch = 0;
+            this.epochThisYear = 0;
             this.value = 0;
         }
 
         private uint TimeSince2020()
         {
-            return (uint)((Game.TimeInfo.FrameTime - this.epoch2020) / 1000);
+            uint a = (uint)((Game.TimeInfo.FrameTime - this.epoch2020) / 1000);
+            return a;
         }
         
         private uint TimeSinceThisYear()
         {
-            return (uint)((Game.TimeInfo.FrameTime - this.instanceIdEpoch) / 1000);
+            uint a = (uint)((Game.TimeInfo.FrameTime - this.epochThisYear) / 1000);
+            return a;
         }
-
+        
         public long GenerateInstanceId()
         {
             uint time = TimeSinceThisYear();
-            
-            if (time == this.lastInstanceIdTime)
-            {
-                ++this.instanceIdThisSecCount;
-            }
-            else
+
+            if (time > this.lastInstanceIdTime)
             {
                 this.lastInstanceIdTime = time;
-                this.instanceIdThisSecCount = 1;
-            }
-            if (this.instanceIdThisSecCount > IdGenerater.Mask18bit - 1)
-            {
-                Log.Error($"instanceid count per sec overflow: {this.instanceIdThisSecCount}");
+                this.instanceIdValue = 0;
             }
-            
-            
-            if (++this.instanceIdValue > IdGenerater.Mask18bit - 1) // 18bit
+            else
             {
-                this.instanceIdValue = 0;
+                ++this.instanceIdValue;
+                
+                if (this.instanceIdValue > IdGenerater.Mask18bit - 1) // 18bit
+                {
+                    ++this.lastInstanceIdTime; // 借用下一秒
+                    this.instanceIdValue = 0;
+#if NOT_UNITY
+                    Log.Error($"instanceid count per sec overflow: {time} {this.lastInstanceIdTime}");
+#endif
+                }
             }
-            InstanceIdStruct instanceIdStruct = new InstanceIdStruct(time, Game.Options.Process, this.instanceIdValue);
+
+            InstanceIdStruct instanceIdStruct = new InstanceIdStruct(this.lastInstanceIdTime, Game.Options.Process, this.instanceIdValue);
             return instanceIdStruct.ToLong();
         }
 
         public long GenerateId()
         {
             uint time = TimeSince2020();
-            
-            if (time == lastIdTime)
-            {
-                ++this.idThisSecCount;
-            }
-            else
+
+            if (time > this.lastIdTime)
             {
                 this.lastIdTime = time;
-                this.idThisSecCount = 1;
-            }
-            if (this.idThisSecCount == ushort.MaxValue)
-            {
-                Log.Error($"id count per sec overflow: {this.idThisSecCount}");
+                this.value = 0;
             }
-
-
-            if (++value > ushort.MaxValue - 1)
+            else
             {
-                this.value = 0;
+                ++this.value;
+                
+                if (value > ushort.MaxValue - 1)
+                {
+                    this.value = 0;
+                    ++this.lastIdTime; // 借用下一秒
+                    Log.Error($"id count per sec overflow: {time} {this.lastIdTime}");
+                }
             }
-            IdStruct idStruct = new IdStruct(time, Game.Options.Process, value);
+            
+            IdStruct idStruct = new IdStruct(this.lastIdTime, Game.Options.Process, value);
             return idStruct.ToLong();
         }
         
@@ -238,28 +263,25 @@ namespace ET
                 throw new Exception($"zone > MaxZone: {zone}");
             }
             uint time = TimeSince2020();
-            
-            
-            if (time == this.lastUnitIdTime)
-            {
-                ++this.unitIdThisSecCount;
-            }
-            else
+
+            if (time > this.lastUnitIdTime)
             {
                 this.lastUnitIdTime = time;
-                this.unitIdThisSecCount = 1;
-            }
-            if (this.unitIdThisSecCount == ushort.MaxValue)
-            {
-                Log.Error($"unitid count per sec overflow: {this.unitIdThisSecCount}");
+                this.unitIdValue = 0;
             }
-
-            if (++this.unitIdValue > ushort.MaxValue - 1)
+            else
             {
-                this.unitIdValue = 0;
+                ++this.unitIdValue;
+                
+                if (this.unitIdValue > ushort.MaxValue - 1)
+                {
+                    this.unitIdValue = 0;
+                    ++this.lastUnitIdTime; // 借用下一秒
+                    Log.Error($"unitid count per sec overflow: {time} {this.lastUnitIdTime}");
+                }
             }
 
-            UnitIdStruct unitIdStruct = new UnitIdStruct(zone, Game.Options.Process, time, this.unitIdValue);
+            UnitIdStruct unitIdStruct = new UnitIdStruct(zone, Game.Options.Process, this.lastUnitIdTime, this.unitIdValue);
             return unitIdStruct.ToLong();
         }
     }

+ 4 - 4
Unity/Assets/Model/Core/Helper/JsonHelper.cs

@@ -4,13 +4,13 @@ namespace ET
 {
     public static class JsonHelper
     {
-#if SERVER
+#if NOT_UNITY
         private static readonly MongoDB.Bson.IO.JsonWriterSettings logDefineSettings = new MongoDB.Bson.IO.JsonWriterSettings() { OutputMode = MongoDB.Bson.IO.JsonOutputMode.RelaxedExtendedJson };
 #endif
         
         public static string ToJson(object message)
         {
-#if SERVER
+#if NOT_UNITY
             return MongoDB.Bson.BsonExtensionMethods.ToJson(message, logDefineSettings);
 #else
             return LitJson.JsonMapper.ToJson(message);
@@ -19,7 +19,7 @@ namespace ET
         
         public static object FromJson(Type type, string json)
         {
-#if SERVER
+#if NOT_UNITY
             return MongoDB.Bson.Serialization.BsonSerializer.Deserialize(json, type);
 #else
             return LitJson.JsonMapper.ToObject(json, type);
@@ -29,7 +29,7 @@ namespace ET
         
         public static T FromJson<T>(string json)
         {
-#if SERVER
+#if NOT_UNITY
             return MongoDB.Bson.Serialization.BsonSerializer.Deserialize<T>(json);
 #else
             return LitJson.JsonMapper.ToObject<T>(json);

+ 20 - 1
Unity/Assets/Model/Core/Log/Log.cs

@@ -20,7 +20,7 @@ namespace ET
 
         static Log()
         {
-#if SERVER
+#if NOT_UNITY
             ILog = new NLogger("Server");
 #else
             ILog = new UnityLogger();
@@ -151,5 +151,24 @@ namespace ET
             ErrorCallback?.Invoke(s);
             ILog.Error(s);
         }
+        
+        public static void Console(string message)
+        {
+            if (Game.Options.Console == 1)
+            {
+                System.Console.WriteLine(message);
+            }
+            ILog.Debug(message);
+        }
+        
+        public static void Console(string message, params object[] args)
+        {
+            string s = string.Format(message, args);
+            if (Game.Options.Console == 1)
+            {
+                System.Console.WriteLine(s);
+            }
+            ILog.Debug(s);
+        }
     }
 }

+ 1 - 1
Unity/Assets/Model/Core/Log/NLogger.cs

@@ -1,4 +1,4 @@
-#if NOT_CLIENT
+#if NOT_UNITY
 using NLog;
 
 namespace ET

+ 1 - 1
Unity/Assets/Model/Core/Log/UnityLogger.cs

@@ -1,4 +1,4 @@
-#if !NOT_CLIENT
+#if !NOT_UNITY
 using System;
 
 namespace ET

+ 1 - 1
Unity/Assets/Model/Core/Object/ComponentView.cs

@@ -2,7 +2,7 @@ using UnityEngine;
 
 namespace ET
 {
-#if !NOT_CLIENT
+#if !NOT_UNITY
     public class ComponentView: MonoBehaviour
     {
         public object Component

+ 6 - 1
Unity/Assets/Model/Core/Object/EventSystem.cs

@@ -14,7 +14,7 @@ namespace ET
 		{
 			get
 			{
-				return instance ?? (instance = new EventSystem());
+				return instance ??= new EventSystem();
 			}
 		}
 		
@@ -169,6 +169,11 @@ namespace ET
 			return allTypes;
 		}
 
+		public Type GetType(string typeName)
+		{
+			return typeof (Game).Assembly.GetType(typeName);
+		}
+
 		public void RegisterSystem(Entity component, bool isRegister = true)
 		{
 			if (!isRegister)

+ 9 - 5
Unity/Assets/Model/Core/Options.cs

@@ -4,16 +4,17 @@ using System.Collections.Generic;
 
 namespace ET
 {
-    public enum ServerType
+    public enum AppType
     {
-        Game,
+        Server,
+        Robot,
         Watcher,
     }
     
     public class Options
     {
-        [Option("ServerType", Required = false, Default = ServerType.Game, HelpText = "serverType enum")]
-        public ServerType ServerType { get; set; }
+        [Option("ServerType", Required = false, Default = AppType.Server, HelpText = "serverType enum")]
+        public AppType AppType { get; set; }
 
         [Option("Process", Required = false, Default = 1)]
         public int Process { get; set; } = 1;
@@ -21,7 +22,10 @@ namespace ET
         [Option("Develop", Required = false, Default = 0, HelpText = "develop mode, 0正式 1开发 2压测")]
         public int Develop { get; set; } = 0;
 
-        [Option("LogLevel", Required = false, Default = 0)]
+        [Option("LogLevel", Required = false, Default = 2)]
         public int LogLevel { get; set; } = 2;
+        
+        [Option("Console", Required = false, Default = 0)]
+        public int Console { get; set; } = 0;
     }
 }

+ 0 - 32
Unity/Assets/Model/Demo/Helper/PositionHelper.cs

@@ -19,11 +19,6 @@ namespace ET
 			return new Vector3(pos.x, 0, pos.z);
 		}
 
-		public static Quaternion AngleToQuaternion(int angle)
-		{
-			return Quaternion.AngleAxis(-angle, Vector3.up) * Quaternion.AngleAxis(90, Vector3.up);
-		}
-
 		public static Quaternion GetVector3ToQuaternion(Vector3 source, Vector3 dire)
 		{
 			Vector3 nowPos = source;
@@ -49,11 +44,6 @@ namespace ET
             return Vector2.Distance(d1, d2);
         }
 
-        public static Quaternion GetAngleToQuaternion(float angle)
-		{
-			return Quaternion.AngleAxis(-angle, Vector3.up) * Quaternion.AngleAxis(90, Vector3.up);
-		}
-
 		public static float Vector3ToAngle360(Vector3 from, Vector3 to)
 		{
 			float angle = Vector3.Angle(from, to);
@@ -79,28 +69,6 @@ namespace ET
             return Mathf.Abs((A * pointVe2.x + B * pointVe2.y + C) / denominator); ;
         }
         /// <summary>
-        /// 判断射线是否碰撞到球体,如果碰撞到,返回射线起点到碰撞点之间的距离
-        /// </summary>
-        /// <param name="ray"></param>
-        /// <param name="center"></param>
-        /// <param name="redius"></param>
-        /// <param name="dist"></param>
-        /// <returns></returns>
-        public static bool RayCastSphere(Ray ray, Vector3 center, float redius, out float dist)
-        {
-            dist = 0;
-            Vector3 ma = center - ray.origin;
-            float distance = Vector3.Cross(ma, ray.direction).magnitude / ray.direction.magnitude;
-            if (distance < redius)
-            {
-                float op = GGTheorem(Vector3.Distance(center, ray.origin), distance);
-                float rp = GGTheorem(redius, distance);
-                dist = op - rp;
-                return true;
-            }
-            return false;
-        }
-        /// <summary>
         /// 勾股定理
         /// </summary>
         /// <param name="x"></param>

+ 2 - 0
Unity/Assets/Model/Module/Config/ConfigComponent.cs

@@ -10,6 +10,8 @@ namespace ET
     {
         public static Action<Dictionary<string, byte[]>> GetAllConfigBytes;
         
+        public static Func<string, byte[]> GetOneConfigBytes;
+        
         public static ConfigComponent Instance;
 		
         public Dictionary<Type, object> AllConfig = new Dictionary<Type, object>();

+ 30 - 13
Unity/Assets/Model/Module/CoroutineLock/CoroutineLock.cs

@@ -2,24 +2,41 @@ using System;
 
 namespace ET
 {
-    public readonly struct CoroutineLock: IDisposable
+    [ObjectSystem]
+    public class CoroutineLockAwakeSystem: AwakeSystem<CoroutineLock, CoroutineLockType, long, int>
     {
-        private readonly CoroutineLockComponent coroutineLockComponent;
-        private readonly CoroutineLockType coroutineLockType;
-        private readonly long key;
-        private readonly short index;
-
-        public CoroutineLock(CoroutineLockComponent coroutineLockComponent, CoroutineLockType type, long k, short index)
+        public override void Awake(CoroutineLock self, CoroutineLockType type, long k, int count)
         {
-            this.coroutineLockComponent = coroutineLockComponent;
-            this.coroutineLockType = type;
-            this.key = k;
-            this.index = index;
+            self.coroutineLockType = type;
+            self.key = k;
+            self.count = count;
         }
+    }
 
-        public void Dispose()
+    [ObjectSystem]
+    public class CoroutineLockDestroySystem: DestroySystem<CoroutineLock>
+    {
+        public override void Destroy(CoroutineLock self)
         {
-            coroutineLockComponent.Notify(coroutineLockType, this.key, this.index);
+            if (self.coroutineLockType != CoroutineLockType.None)
+            {
+                CoroutineLockComponent.Instance.Notify(self.coroutineLockType, self.key, self.count + 1);
+            }
+            else
+            {
+                // CoroutineLockType.None说明协程锁超时了
+                Log.Error($"coroutine lock timeout: {self.coroutineLockType} {self.key} {self.count}");
+            }
+            self.coroutineLockType = CoroutineLockType.None;
+            self.key = 0;
+            self.count = 0;
         }
     }
+    
+    public class CoroutineLock: Entity
+    {
+        public CoroutineLockType coroutineLockType;
+        public long key;
+        public int count;
+    }
 }

+ 94 - 161
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockComponent.cs

@@ -1,256 +1,189 @@
-using System;
 using System.Collections.Generic;
-using System.Linq;
 
 namespace ET
 {
-    using CoroutineLockQueue = SortedDictionary<int, ETTask<CoroutineLock>>;
-    using CoroutineLockQueueType = Dictionary<long, SortedDictionary<int, ETTask<CoroutineLock>>>;
-    
-    public struct CoroutineLockTimer
-    {
-        public CoroutineLockType CoroutineLockType;
-        public long Key;
-        public int N;
-        
-        public CoroutineLockTimer(CoroutineLockType coroutineLockType, long key, int n)
-        {
-            this.CoroutineLockType = coroutineLockType;
-            this.Key = key;
-            this.N = n;
-        }
-    }
-    
     [ObjectSystem]
-    public class CoroutineLockComponentSystem: AwakeSystem<CoroutineLockComponent>
+    public class CoroutineLockComponentAwakeSystem: AwakeSystem<CoroutineLockComponent>
     {
         public override void Awake(CoroutineLockComponent self)
         {
-            self.Awake();
+            CoroutineLockComponent.Instance = self;
+            for (int i = 0; i < self.list.Capacity; ++i)
+            {
+                self.list.Add(EntityFactory.CreateWithId<CoroutineLockQueueType>(self.Domain, ++self.idGenerator));
+            }
         }
     }
 
-    public class CoroutineLockComponentUpdateSystem: UpdateSystem<CoroutineLockComponent>
+    [ObjectSystem]
+    public class CoroutineLockComponentDestroySystem: DestroySystem<CoroutineLockComponent>
     {
-        public override void Update(CoroutineLockComponent self)
+        public override void Destroy(CoroutineLockComponent self)
         {
-            self.Update();
+            self.list.Clear();
+            self.nextFrameRun.Clear();
+            self.timers.Clear();
+            self.timeOutIds.Clear();
+            self.timerOutTimer.Clear();
+            self.idGenerator = 0;
+            self.minTime = 0;
         }
     }
 
-    public class CoroutineLockComponent: Entity
+    public class CoroutineLockComponentUpdateSystem: UpdateSystem<CoroutineLockComponent>
     {
-        public static CoroutineLockComponent Instance
-        {
-            get;
-            private set;
-        }
-
-        private int n;
-        
-        private readonly Queue<CoroutineLockQueue> coroutineLockQueuePool = new Queue<CoroutineLockQueue>();
-
-        private CoroutineLockQueue FetchCoroutineLockQueue()
-        {
-            if (this.coroutineLockQueuePool.Count == 0)
-            {
-                return new CoroutineLockQueue();
-            }
-
-            return this.coroutineLockQueuePool.Dequeue();
-        }
-        
-        private void RecycleCoroutineLockQueue(CoroutineLockQueue coroutineLockQueue)
-        {
-            this.coroutineLockQueuePool.Enqueue(coroutineLockQueue);
-        }
-
-        private readonly List<CoroutineLockQueueType> list = new List<CoroutineLockQueueType>((int) CoroutineLockType.Max);
-
-        private readonly Queue<(CoroutineLockType, long)> nextFrameRun = new Queue<(CoroutineLockType, long)>();
-
-        private readonly MultiMap<long, CoroutineLockTimer> timers = new MultiMap<long, CoroutineLockTimer>();
-        
-        private readonly Queue<long> timeOutIds = new Queue<long>();
-
-        private readonly Queue<CoroutineLockTimer> timerOutTimer = new Queue<CoroutineLockTimer>();
-
-        private long minTime;
-
-        public void Awake()
-        {
-            Instance = this;
-            for (int i = 0; i < this.list.Capacity; ++i)
-            {
-                this.list.Add(new CoroutineLockQueueType());
-            }
-        }
-
-        public void Update()
+        public override void Update(CoroutineLockComponent self)
         {
-            int count = this.nextFrameRun.Count;
+            // 检测超时的CoroutineLock
+            TimeoutCheck(self);
+            
+            int count = self.nextFrameRun.Count;
             // 注意这里不能将this.nextFrameRun.Count 放到for循环中,因为循环过程中会有对象继续加入队列
             for (int i = 0; i < count; ++i)
             {
-                (CoroutineLockType coroutineLockType, long key) = this.nextFrameRun.Dequeue();
-                this.Notify(coroutineLockType, key, 1);
+                (CoroutineLockType coroutineLockType, long key) = self.nextFrameRun.Dequeue();
+                self.Notify(coroutineLockType, key, 0);
             }
-
-            TimeoutCheck();
         }
-
-        // 这里没有用TimerComponent,是为了避免每个计时器一个回调的gc
-        private void TimeoutCheck()
+        
+        public void TimeoutCheck(CoroutineLockComponent self)
         {
             // 超时的锁
-            if (this.timers.Count == 0)
+            if (self.timers.Count == 0)
             {
                 return;
             }
 
             long timeNow = TimeHelper.ClientFrameTime();
 
-            if (timeNow < this.minTime)
+            if (timeNow < self.minTime)
             {
                 return;
             }
 
-            foreach (KeyValuePair<long, List<CoroutineLockTimer>> kv in this.timers)
+            foreach (KeyValuePair<long, List<CoroutineLockTimer>> kv in self.timers)
             {
                 long k = kv.Key;
                 if (k > timeNow)
                 {
-                    minTime = k;
+                    self.minTime = k;
                     break;
                 }
 
-                this.timeOutIds.Enqueue(k);
+                self.timeOutIds.Enqueue(k);
             }
             
-            this.timerOutTimer.Clear();
+            self.timerOutTimer.Clear();
             
-            while (this.timeOutIds.Count > 0)
+            while (self.timeOutIds.Count > 0)
             {
-                long time = this.timeOutIds.Dequeue();
-                foreach (CoroutineLockTimer coroutineLockTimer in this.timers[time])
+                long time = self.timeOutIds.Dequeue();
+                foreach (CoroutineLockTimer coroutineLockTimer in self.timers[time])
                 {
-                    this.timerOutTimer.Enqueue(coroutineLockTimer);
+                    self.timerOutTimer.Enqueue(coroutineLockTimer);
                 }
-                this.timers.Remove(time);
+                self.timers.Remove(time);
             }
             
-            while (this.timerOutTimer.Count > 0)
+            while (self.timerOutTimer.Count > 0)
             {
-                CoroutineLockTimer coroutineLockTimer = this.timerOutTimer.Dequeue();
-
-                CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockTimer.CoroutineLockType];
-                if (!coroutineLockQueueType.TryGetValue(coroutineLockTimer.Key, out CoroutineLockQueue queue))
-                {
-                    continue;
-                }
-                if (!queue.TryGetValue(coroutineLockTimer.N, out ETTask<CoroutineLock> tcs))
+                CoroutineLockTimer coroutineLockTimer = self.timerOutTimer.Dequeue();
+                if (coroutineLockTimer.CoroutineLockInstanceId != coroutineLockTimer.CoroutineLock.InstanceId)
                 {
                     continue;
                 }
-                
-                queue.Remove(coroutineLockTimer.N);
-                
-                if (queue.Count == 0)
-                {
-                    this.RecycleCoroutineLockQueue(queue);
-                    coroutineLockQueueType.Remove(coroutineLockTimer.Key);
-                }
-                
-                CoroutineLockType coroutineLockType = coroutineLockTimer.CoroutineLockType;
-                long key = coroutineLockTimer.Key;
-                
-                tcs.SetException(new Exception($"coroutineLock timeout maybe have deadlock: {coroutineLockType} {key}"));
+
+                CoroutineLock coroutineLock = coroutineLockTimer.CoroutineLock;
+                // 超时直接调用下一个锁
+                self.NextFrameRun(coroutineLock.coroutineLockType, coroutineLock.key);
+                coroutineLock.coroutineLockType = CoroutineLockType.None; // 上面调用了下一个, dispose不再调用
             }
         }
+    }
+
+    public static class CoroutineLockComponentSystem
+    {
+        public static void NextFrameRun(this CoroutineLockComponent self, CoroutineLockType coroutineLockType, long key)
+        {
+            self.nextFrameRun.Enqueue((coroutineLockType, key));
+        }
 
-        public override void Dispose()
+        public static void AddTimer(this CoroutineLockComponent self, long tillTime, CoroutineLock coroutineLock)
         {
-            if (this.IsDisposed)
+            self.timers.Add(tillTime, new CoroutineLockTimer(coroutineLock));
+            if (tillTime < self.minTime)
             {
-                return;
+                self.minTime = tillTime;
             }
-
-            base.Dispose();
-
-            this.list.Clear();
         }
 
-        public async ETTask<CoroutineLock> Wait(CoroutineLockType coroutineLockType, long key, int time = 60000)
+        public static async ETTask<CoroutineLock> Wait(this CoroutineLockComponent self, CoroutineLockType coroutineLockType, long key, int time = 60000)
         {
-            CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockType];
+            CoroutineLockQueueType coroutineLockQueueType = self.list[(int) coroutineLockType];
+   
             if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
             {
-                coroutineLockQueueType.Add(key, FetchCoroutineLockQueue());
-
-                return new CoroutineLock(this, coroutineLockType, key, 1);
+                coroutineLockQueueType.Add(key, EntityFactory.CreateWithId<CoroutineLockQueue>(self.Domain, ++self.idGenerator, true));
+                return self.CreateCoroutineLock(coroutineLockType, key, time, 1);
             }
 
             ETTask<CoroutineLock> tcs = ETTask<CoroutineLock>.Create(true);
+            queue.Add(tcs, time);
             
-            int i = ++this.n;
-            if (time > 0)
-            {
-                long tillTime = TimeHelper.ClientFrameTime() + time;
-                CoroutineLockTimer coroutineLockTimer = new CoroutineLockTimer(coroutineLockType, key, i);
-                this.timers.Add(tillTime, coroutineLockTimer);
-                if (tillTime < this.minTime)
-                {
-                    this.minTime = tillTime;
-                }
-            }
-            queue.Add(i, tcs);
             return await tcs;
         }
 
-        public int GetCount(CoroutineLockType coroutineLockType, long key)
+        public static CoroutineLock CreateCoroutineLock(this CoroutineLockComponent self, CoroutineLockType coroutineLockType, long key, int time, int count)
         {
-            CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockType];
-            if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
+            CoroutineLock coroutineLock = EntityFactory.CreateWithId<CoroutineLock, CoroutineLockType, long, int>(self.Domain, ++self.idGenerator, coroutineLockType, key, count, true);
+            if (time > 0)
             {
-                return 0;
+                self.AddTimer(TimeHelper.ClientFrameTime() + time, coroutineLock);
             }
-
-            return queue.Count;
+            return coroutineLock;
         }
 
-        public void Notify(CoroutineLockType coroutineLockType, long key, short index)
+        public static void Notify(this CoroutineLockComponent self, CoroutineLockType coroutineLockType, long key, int count)
         {
-            if (this.list.Count == 0) // 客户端关闭了
-            {
-                return;
-            }
-            CoroutineLockQueueType coroutineLockQueueType = this.list[(int) coroutineLockType];
+            CoroutineLockQueueType coroutineLockQueueType = self.list[(int) coroutineLockType];
             if (!coroutineLockQueueType.TryGetValue(key, out CoroutineLockQueue queue))
             {
                 return;
-                // coroutineLockQueueType是空的也正常,因为有些协程锁可能超时删除了
-                //throw new Exception($"first work notify not find queue");
             }
 
             if (queue.Count == 0)
             {
-                this.RecycleCoroutineLockQueue(queue);
                 coroutineLockQueueType.Remove(key);
                 return;
             }
             
-            // 注意因为协程锁Dispose会调用下一个协程,如果队列过多,堆栈可能溢出,所以这里限制了一次最多递归10层,
-            // 超出则记录一下,下一帧再继续
-            if (index > 10)
+#if NOT_UNITY
+            const int frameCoroutineCount = 5;
+#else
+            const int frameCoroutineCount = 10;
+#endif
+
+            if (count > frameCoroutineCount)
             {
-                this.nextFrameRun.Enqueue((coroutineLockType, key));
+                self.NextFrameRun(coroutineLockType, key);
                 return;
             }
-
-            var kv = queue.First();
-            var tcs = kv.Value;
-            queue.Remove(kv.Key);
-            tcs.SetResult(new CoroutineLock(this, coroutineLockType, key, (short)(index + 1)));
+            
+            CoroutineLockInfo coroutineLockInfo = queue.Dequeue();
+            coroutineLockInfo.Tcs.SetResult(self.CreateCoroutineLock(coroutineLockType, key, coroutineLockInfo.Time, count));
         }
     }
+
+    public class CoroutineLockComponent: Entity
+    {
+        public static CoroutineLockComponent Instance;
+        
+        public List<CoroutineLockQueueType> list = new List<CoroutineLockQueueType>((int) CoroutineLockType.Max);
+        public Queue<(CoroutineLockType, long)> nextFrameRun = new Queue<(CoroutineLockType, long)>();
+        public MultiMap<long, CoroutineLockTimer> timers = new MultiMap<long, CoroutineLockTimer>();
+        public Queue<long> timeOutIds = new Queue<long>();
+        public Queue<CoroutineLockTimer> timerOutTimer = new Queue<CoroutineLockTimer>();
+        public long idGenerator;
+        public long minTime;
+    }
 }

+ 51 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueue.cs

@@ -0,0 +1,51 @@
+using System.Collections.Generic;
+
+namespace ET
+{
+    [ObjectSystem]
+    public class CoroutineLockQueueAwakeSystem: AwakeSystem<CoroutineLockQueue>
+    {
+        public override void Awake(CoroutineLockQueue self)
+        {
+            self.queue.Clear();
+        }
+    }
+
+    [ObjectSystem]
+    public class CoroutineLockQueueDestroySystem: DestroySystem<CoroutineLockQueue>
+    {
+        public override void Destroy(CoroutineLockQueue self)
+        {
+            self.queue.Clear();
+        }
+    }
+
+    public struct CoroutineLockInfo
+    {
+        public ETTask<CoroutineLock> Tcs;
+        public int Time;
+    }
+    
+    public class CoroutineLockQueue: Entity
+    {
+        public Queue<CoroutineLockInfo> queue = new Queue<CoroutineLockInfo>();
+
+        public void Add(ETTask<CoroutineLock> tcs, int time)
+        {
+            this.queue.Enqueue(new CoroutineLockInfo(){Tcs = tcs, Time = time});
+        }
+
+        public int Count
+        {
+            get
+            {
+                return this.queue.Count;
+            }
+        }
+
+        public CoroutineLockInfo Dequeue()
+        {
+            return this.queue.Dequeue();
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueue.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: b13bfcad3210a40f88ac803f07b31294
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 47 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueueType.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+
+namespace ET
+{
+    [ObjectSystem]
+    public class CoroutineLockQueueTypeAwakeSystem: AwakeSystem<CoroutineLockQueueType>
+    {
+        public override void Awake(CoroutineLockQueueType self)
+        {
+            self.dictionary.Clear();
+        }
+    }
+
+    [ObjectSystem]
+    public class CoroutineLockQueueTypeDestroySystem: DestroySystem<CoroutineLockQueueType>
+    {
+        public override void Destroy(CoroutineLockQueueType self)
+        {
+            self.dictionary.Clear();
+        }
+    }
+    
+    public class CoroutineLockQueueType: Entity
+    {
+        public Dictionary<long, CoroutineLockQueue> dictionary = new Dictionary<long, CoroutineLockQueue>();
+
+        public bool TryGetValue(long key, out CoroutineLockQueue value)
+        {
+            return this.dictionary.TryGetValue(key, out value);
+        }
+
+        public void Remove(long key)
+        {
+            if (this.dictionary.TryGetValue(key, out CoroutineLockQueue value))
+            {
+                value.Dispose();
+            }
+            this.dictionary.Remove(key);
+        }
+        
+        public void Add(long key, CoroutineLockQueue value)
+        {
+            this.dictionary.Add(key, value);
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockQueueType.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3c7021c7dd53741378ffbf9139e3d8c5
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 14 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockTimer.cs

@@ -0,0 +1,14 @@
+namespace ET
+{
+    public struct CoroutineLockTimer
+    {
+        public CoroutineLock CoroutineLock;
+        public long CoroutineLockInstanceId;
+
+        public CoroutineLockTimer(CoroutineLock coroutineLock)
+        {
+            this.CoroutineLock = coroutineLock;
+            this.CoroutineLockInstanceId = coroutineLock.InstanceId;
+        }
+    }
+}

+ 11 - 0
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockTimer.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: edccfb993e146422ea344b9d52ddf98e
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 62 - 6
Unity/Assets/Model/Module/CoroutineLock/CoroutineLockType.cs

@@ -3,12 +3,68 @@ namespace ET
     public enum CoroutineLockType
     {
         None = 0,
-        Location, // location进程上使用
-        ActorLocationSender, // ActorLocationSender中队列消息 
-        Mailbox, // Mailbox中队列
-        DB, // 存储数据库
+        Location,                  // location进程上使用
+        ActorLocationSender,       // ActorLocationSender中队列消息 
+        Mailbox,                   // Mailbox中队列
+        AccountName,               // Realm上验证账号时使用
+        GateAccountLock,           // Gate上登陆账号时使用
+        LockPlayerName,            // 锁定玩家角色名字
+        UnitId,                    // Map服务器上线下线时使用
+        GateOffline,               // Gate上下线用
+        SendMail,                  // 发送Mail时使用
+        DB,                        // 存储数据库
+        LevelSeal,                 //玩家请求是否达到等级封印时使用
+        ClientChangeScene,         // 客户端切换场景
+        GetCityUnit,               // 获得城池Unit
+        GetFamilyUnit,             // 获得家族Unit
+        GetFamilyEntity,           // 获得家族实体
+        LockFamilyName,            // 家族名字
+        EnterFamilyMainScene,      // 进入家族领地
+        EnterFamilyTrial,          // 进入家族试炼场
+        OpenTower,                 // 开启塔林
+        ZiJinKu,                   // 开启紫金窟
+        EnterCityBattlePreScene,   // 进入城战准备副本
+        TransferOtherCopy,         // 请求分配到一个新的战场
+        CityBattleAuction,         // 城战竞拍
+        CityBattleRecruitSubMoney, // 城战招募状态扣钱
+        JoinOrExitFamily,          // 玩家加入、退出、踢出家族
+        HitDevilPlayerData,        //棒打魔王结算增加烧饼,玩家登陆到棒打魔王服.
+        MedicalNumber,             //伏鼎牌照抽奖
+        GetExtraExpress,           // 领取快递
+        GetYinYangUnit,            // 获取阴阳玑Unit
+        GetFTUnitInfo,             // 获取好友组队服玩家信息
+        TuTeng,                    // 批量获取组合图腾
+        GetPlayerChat,             //获取聊天存储记录
+        LoadSystemComponent,       // 加载各个系统组件
+        ChargeByOid,               // 充值
+        UnitCache,                 // 查询缓存
+        QuestDrop,                 //任务掉落
+        Login,                     // 登陆时,反正访问数据库峰值太高的排队
+        CityBroadcast,             // 城池广播
+        HomeWorld,                 // 师傅世界服操作
+        GetCache,                  // 获取缓存
+        GetHomeUnit,               // 获取家园玩家
+        HandleFamilyEntity,        // 处理家族实体
+        AskScene,                  // 请求场景
+        GMService,
+        UnitCacheGet, // UnitCache查询组件
+        Auction,      // 拍卖
+        Match,
+        JGSettleRecord, // 九宫结算记录
+        AugurMgrBuyNumber,
+        GetTeaUnit,              // 获取茶楼Unit
+        AnimalCheck_LockRoom, // 锁住房间
+
+        // Client
         Resources,
-        //必须放最后
-        Max,
+        ResourcesLoader,
+        GiveTax, // 给国库上税
+        
+        SceneMapResourcesLoader,
+        SceneMapResources,
+
+        ChangeModel,//切换模型频繁
+
+        Max, // 这个必须在最后
     }
 }

+ 19 - 22
Unity/Assets/Model/Module/Message/MessagePool.cs

@@ -1,5 +1,5 @@
 using System;
-#if !SERVER
+#if !NOT_UNITY
 using System.Collections.Generic;
 
 #endif
@@ -14,34 +14,31 @@ namespace ET
             get;
         } = new MessagePool();
 
-#if !NOT_CLIENT
+#if !NOT_UNITY
         private readonly Dictionary<Type, Queue<object>> dictionary = new Dictionary<Type, Queue<object>>();
 #endif
 
         public object Fetch(Type type)
         {
-#if !NOT_CLIENT
-            Queue<object> queue;
-            if (!this.dictionary.TryGetValue(type, out queue))
-            {
-                queue = new Queue<object>();
-                this.dictionary.Add(type, queue);
-            }
+            //Queue<object> queue;
+            //if (!this.dictionary.TryGetValue(type, out queue))
+            //{
+            //    queue = new Queue<object>();
+            //    this.dictionary.Add(type, queue);
+            //}
+//
+            //object obj;
+            //if (queue.Count > 0)
+            //{
+            //    obj = queue.Dequeue();
+            //}
+            //else
+            //{
+            //    obj = Activator.CreateInstance(type);
+            //}
 
-            object obj;
-            if (queue.Count > 0)
-            {
-                obj = queue.Dequeue();
-            }
-            else
-            {
-                obj = Activator.CreateInstance(type);
-            }
-
-            return obj;
-#else
+            //return obj;
 			return Activator.CreateInstance(type);
-#endif
         }
 
         public T Fetch<T>() where T : class

+ 8 - 0
Unity/Assets/Model/Module/MessageOuter.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c6cefe3880e0c4df7a91259a5c228d85
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 8 - 0
Unity/Assets/ModelView/Resource.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 19103d501aa624c8c8cae2abfd4bbad2
+folderAsset: yes
+DefaultImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 0
Unity/Assets/Model/Demo/Helper/PathHelper.cs → Unity/Assets/ModelView/Resource/PathHelper.cs


+ 2 - 3
Unity/Assets/Model/Demo/Helper/PathHelper.cs.meta → Unity/Assets/ModelView/Resource/PathHelper.cs.meta

@@ -1,8 +1,7 @@
 fileFormatVersion: 2
-guid: 17fbf19c32edc0e4e80e07c1e826710f
-timeCreated: 1508557211
-licenseType: Free
+guid: aa13605b7aaf0411fa34c7495a4bfb1c
 MonoImporter:
+  externalObjects: {}
   serializedVersion: 2
   defaultReferences: []
   executionOrder: 0

+ 0 - 0
Unity/Assets/Model/Module/Resource/ResourcesComponent.cs → Unity/Assets/ModelView/Resource/ResourcesComponent.cs


+ 0 - 0
Unity/Assets/Model/Module/Resource/ResourcesComponent.cs.meta → Unity/Assets/ModelView/Resource/ResourcesComponent.cs.meta


+ 4 - 4
Unity/Packages/manifest.json

@@ -3,11 +3,11 @@
     "com.unity.2d.sprite": "1.0.0",
     "com.unity.2d.tilemap": "1.0.0",
     "com.unity.assetbundlebrowser": "1.7.0",
-    "com.unity.collab-proxy": "1.3.9",
+    "com.unity.collab-proxy": "1.5.7",
     "com.unity.ide.rider": "2.0.7",
-    "com.unity.ide.visualstudio": "2.0.7",
-    "com.unity.textmeshpro": "3.0.4",
-    "com.unity.timeline": "1.4.7",
+    "com.unity.ide.visualstudio": "2.0.8",
+    "com.unity.textmeshpro": "3.0.6",
+    "com.unity.timeline": "1.4.8",
     "com.unity.ugui": "1.0.0",
     "com.unity.modules.ai": "1.0.0",
     "com.unity.modules.androidjni": "1.0.0",

+ 14 - 5
Unity/Packages/packages-lock.json

@@ -20,10 +20,12 @@
       "url": "https://packages.unity.cn"
     },
     "com.unity.collab-proxy": {
-      "version": "1.3.9",
+      "version": "1.5.7",
       "depth": 0,
       "source": "registry",
-      "dependencies": {},
+      "dependencies": {
+        "com.unity.nuget.newtonsoft-json": "2.0.0"
+      },
       "url": "https://packages.unity.cn"
     },
     "com.unity.ext.nunit": {
@@ -43,7 +45,7 @@
       "url": "https://packages.unity.cn"
     },
     "com.unity.ide.visualstudio": {
-      "version": "2.0.7",
+      "version": "2.0.8",
       "depth": 0,
       "source": "registry",
       "dependencies": {
@@ -51,6 +53,13 @@
       },
       "url": "https://packages.unity.cn"
     },
+    "com.unity.nuget.newtonsoft-json": {
+      "version": "2.0.0",
+      "depth": 1,
+      "source": "registry",
+      "dependencies": {},
+      "url": "https://packages.unity.cn"
+    },
     "com.unity.test-framework": {
       "version": "1.1.24",
       "depth": 1,
@@ -63,7 +72,7 @@
       "url": "https://packages.unity.cn"
     },
     "com.unity.textmeshpro": {
-      "version": "3.0.4",
+      "version": "3.0.6",
       "depth": 0,
       "source": "registry",
       "dependencies": {
@@ -72,7 +81,7 @@
       "url": "https://packages.unity.cn"
     },
     "com.unity.timeline": {
-      "version": "1.4.7",
+      "version": "1.4.8",
       "depth": 0,
       "source": "registry",
       "dependencies": {

+ 2 - 2
Unity/ProjectSettings/ProjectVersion.txt

@@ -1,2 +1,2 @@
-m_EditorVersion: 2020.3.3f1c1
-m_EditorVersionWithRevision: 2020.3.3f1c1 (a34b99c2c582)
+m_EditorVersion: 2020.3.11f1c1
+m_EditorVersionWithRevision: 2020.3.11f1c1 (77449f27ef9b)

+ 6 - 6
Unity/Unity.sln

@@ -3,12 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{d2ad5be1-263a-9a30-ab0f-dc5b08044350}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.csproj", "{9498bfb4-d9f5-c441-13e3-3f26f7700e29}"
-EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{52f66610-896a-c4d1-9881-1a19df7ab80e}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.HotfixView", "Unity.HotfixView.csproj", "{de4513d3-889b-5c52-8e9c-744c99ae7509}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.csproj", "{9498bfb4-d9f5-c441-13e3-3f26f7700e29}"
+EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ModelView", "Unity.ModelView.csproj", "{c109842f-01da-64d4-dbf2-00c6449e459e}"
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{041131cd-3018-19b1-81b6-5dbee2467ffb}"
@@ -23,10 +23,6 @@ Global
 		{d2ad5be1-263a-9a30-ab0f-dc5b08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{d2ad5be1-263a-9a30-ab0f-dc5b08044350}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{d2ad5be1-263a-9a30-ab0f-dc5b08044350}.Release|Any CPU.Build.0 = Release|Any CPU
-		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Release|Any CPU.Build.0 = Release|Any CPU
 		{52f66610-896a-c4d1-9881-1a19df7ab80e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{52f66610-896a-c4d1-9881-1a19df7ab80e}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{52f66610-896a-c4d1-9881-1a19df7ab80e}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -35,6 +31,10 @@ Global
 		{de4513d3-889b-5c52-8e9c-744c99ae7509}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{de4513d3-889b-5c52-8e9c-744c99ae7509}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{de4513d3-889b-5c52-8e9c-744c99ae7509}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9498bfb4-d9f5-c441-13e3-3f26f7700e29}.Release|Any CPU.Build.0 = Release|Any CPU
 		{c109842f-01da-64d4-dbf2-00c6449e459e}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
 		{c109842f-01da-64d4-dbf2-00c6449e459e}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{c109842f-01da-64d4-dbf2-00c6449e459e}.Release|Any CPU.ActiveCfg = Release|Any CPU