Просмотр исходного кода

实现actor模型,任何Entity只要加上ActorComponent就成为一个actor,任何进程都能拿着id用ActorProxy对其发送消息

tanghai 8 лет назад
Родитель
Сommit
51f5eb3dfc
68 измененных файлов с 515 добавлено и 4572 удалено
  1. 1 0
      .gitignore
  2. 1 1
      Config/StartConfig/LocalAllServer.txt
  3. 1 1
      Server/App/NLog.config
  4. 13 3
      Server/App/Program.cs
  5. 15 0
      Server/Hotfix/Handler/Actor_TestHandler.cs
  6. 42 0
      Server/Hotfix/Handler/C2G_LoginGateHandler.cs
  7. 0 0
      Server/Hotfix/Handler/C2M_ReloadHandler.cs
  8. 1 2
      Server/Hotfix/Handler/C2R_LoginHandler.cs
  9. 0 0
      Server/Hotfix/Handler/C2R_PingHandler.cs
  10. 0 0
      Server/Hotfix/Handler/G2G_LockReleaseRequestHandler.cs
  11. 0 0
      Server/Hotfix/Handler/G2G_LockRequestHandler.cs
  12. 26 0
      Server/Hotfix/Handler/G2M_CreateUnitHandler.cs
  13. 0 0
      Server/Hotfix/Handler/M2A_ReloadHandler.cs
  14. 1 1
      Server/Hotfix/Handler/ObjectAddRequestHandler.cs
  15. 3 3
      Server/Hotfix/Handler/ObjectGetRequestHandler.cs
  16. 0 0
      Server/Hotfix/Handler/ObjectLockRequestHandler.cs
  17. 0 0
      Server/Hotfix/Handler/ObjectRemoveRequestHandler.cs
  18. 1 1
      Server/Hotfix/Handler/ObjectUnLockRequestHandler.cs
  19. 2 1
      Server/Hotfix/Handler/R2G_GetLoginKeyHandler.cs
  20. 2 2
      Server/Hotfix/Helper/MessageHelper.cs
  21. 0 31
      Server/Hotfix/Message/C2G_LoginGateHandler.cs
  22. 15 13
      Server/Hotfix/Server.Hotfix.csproj
  23. 33 15
      Server/Model/Component/ActorComponent.cs
  24. 2 2
      Server/Model/Component/ActorProxyComponent.cs
  25. 4 4
      Server/Model/Component/AppManagerComponent.cs
  26. 8 8
      Server/Model/Component/DBComponent.cs
  27. 1 1
      Server/Model/Component/DBProxyComponent.cs
  28. 0 57
      Server/Model/Component/GamerComponent.cs
  29. 9 30
      Server/Model/Component/GateSessionKeyComponent.cs
  30. 17 13
      Server/Model/Component/LocationComponent.cs
  31. 6 6
      Server/Model/Component/LocationProxyComponent.cs
  32. 53 0
      Server/Model/Component/PlayerComponent.cs
  33. 0 19
      Server/Model/Component/Session/SessionGamerComponent.cs
  34. 19 0
      Server/Model/Component/Session/SessionPlayerComponent.cs
  35. 8 1
      Server/Model/Component/StartConfigComponent.cs
  36. 69 32
      Server/Model/Entity/ActorProxy.cs
  37. 0 44
      Server/Model/Entity/Gamer.cs
  38. 6 16
      Server/Model/Entity/Message/InnerMessage.cs
  39. 3 0
      Server/Model/Entity/Message/InnerOpcode.cs
  40. 33 0
      Server/Model/Entity/Player.cs
  41. 16 10
      Server/Model/Entity/Unit.cs
  42. 8 4
      Server/Model/Helper/ObjectFactory.cs
  43. 10 9
      Server/Model/Message/AppType.cs
  44. 4 3
      Server/Model/Message/OuterMessageDispatcher.cs
  45. 1 1
      Server/Model/Object/Object.cs
  46. 3 3
      Server/Model/Server.Model.csproj
  47. 1 1
      Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
  48. 2 0
      Unity/Assets/Scripts/Base/Config/AConfigComponent.cs
  49. 31 0
      Unity/Assets/Scripts/Base/Message/AActorMessage.cs
  50. 3 0
      Unity/Assets/Scripts/Base/Message/AActorMessage.cs.meta
  51. 1 1
      Unity/Assets/Scripts/Base/Message/AMessage.cs
  52. 10 9
      Unity/Assets/Scripts/Base/Message/AppType.cs
  53. 2 0
      Unity/Assets/Scripts/Entity/Message/Opcode.cs
  54. 13 1
      Unity/Assets/Scripts/Entity/Message/OuterMessage.cs
  55. 3 3
      Unity/Assets/Scripts/Entity/Session.cs
  56. 0 36
      Unity/Hotfix/Base/Helper/JsonHelper.cs
  57. 0 60
      Unity/Hotfix/Base/LitJson/IJsonWrapper.cs
  58. 0 1002
      Unity/Hotfix/Base/LitJson/JsonData.cs
  59. 0 60
      Unity/Hotfix/Base/LitJson/JsonException.cs
  60. 0 1049
      Unity/Hotfix/Base/LitJson/JsonMapper.cs
  61. 0 105
      Unity/Hotfix/Base/LitJson/JsonMockWrapper.cs
  62. 0 472
      Unity/Hotfix/Base/LitJson/JsonReader.cs
  63. 0 463
      Unity/Hotfix/Base/LitJson/JsonWriter.cs
  64. 0 912
      Unity/Hotfix/Base/LitJson/Lexer.cs
  65. 0 44
      Unity/Hotfix/Base/LitJson/ParserToken.cs
  66. 11 7
      Unity/Hotfix/UI/UILobby/Component/UILobbyComponent.cs
  67. 0 10
      Unity/Hotfix/Unity.Hotfix.csproj
  68. 1 0
      Unity/Unity.csproj

+ 1 - 0
.gitignore

@@ -36,3 +36,4 @@ _ReSharper.CSharp/
 /.vs
 /Server/.vs/
 /Unity/.vs/
+/Tools/MongoDB

+ 1 - 1
Config/StartConfig/LocalAllServer.txt

@@ -1 +1 @@
-{ "_t" : "StartConfig", "_id" : NumberLong("96871765901315"), "components" : [{ "_t" : "InnerConfig", "_id" : NumberLong("96871765901316"), "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "OuterConfig", "_id" : NumberLong("96871765901317"), "Host" : "127.0.0.1", "Port" : 10001 }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }
+{ "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "components" : [{ "_t" : "OuterConfig", "_id" : NumberLong("98547768819755"), "Host" : "127.0.0.1", "Port" : 10001, "Host2" : null }, { "_t" : "InnerConfig", "_id" : NumberLong("98547768819756"), "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "HttpConfig", "_id" : NumberLong("98547768819757"), "Url" : "", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "_id" : NumberLong("98547768819758"), "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }

+ 1 - 1
Server/App/NLog.config

@@ -13,7 +13,7 @@
 		<target name="debug" xsi:type="File"
 			fileName="${basedir}/../Logs/Log-${var:appType}-${var:appId}-Debug.txt"
 			deleteOldFileOnStartup="false"
-			layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message}" />
+			layout="${longdate} ${var:appType} ${var:appId} ${callsite:className=false:methodName=false:fileName=true:includeSourcePath=false:skipFrames=2} ${message} ${stacktrace:format=Flat:topFrames=100:skipFrames=2}" />
 	</targets>
 
 	<targets>

+ 13 - 3
Server/App/Program.cs

@@ -43,7 +43,6 @@ namespace App
 						Game.Scene.AddComponent<AppManagerComponent>();
 						break;
 					case AppType.Realm:
-						Game.Scene.AddComponent<UnitComponent>();
 						Game.Scene.AddComponent<ActorMessageDispatherComponent>();
 						Game.Scene.AddComponent<ActorManagerComponent>();
 						Game.Scene.AddComponent<NetInnerComponent, string, int>(innerConfig.Host, innerConfig.Port);
@@ -53,6 +52,7 @@ namespace App
 						Game.Scene.AddComponent<RealmGateAddressComponent>();
 						break;
 					case AppType.Gate:
+						Game.Scene.AddComponent<PlayerComponent>();
 						Game.Scene.AddComponent<ActorMessageDispatherComponent>();
 						Game.Scene.AddComponent<ActorManagerComponent>();
 						Game.Scene.AddComponent<NetInnerComponent, string, int>(innerConfig.Host, innerConfig.Port);
@@ -65,11 +65,21 @@ namespace App
 						Game.Scene.AddComponent<NetInnerComponent, string, int>(innerConfig.Host, innerConfig.Port);
 						Game.Scene.AddComponent<LocationComponent>();
 						break;
+					case AppType.Map:
+						Game.Scene.AddComponent<NetInnerComponent, string, int>(innerConfig.Host, innerConfig.Port);
+						Game.Scene.AddComponent<LocationComponent>();
+						Game.Scene.AddComponent<UnitComponent>();
+						Game.Scene.AddComponent<LocationProxyComponent>();
+						Game.Scene.AddComponent<ActorComponent>();
+						break;
 					case AppType.AllServer:
-						Game.Scene.AddComponent<GamerComponent>();
+						Game.Scene.AddComponent<ActorProxyComponent>();
+						Game.Scene.AddComponent<PlayerComponent>();
 						Game.Scene.AddComponent<UnitComponent>();
+						Game.Scene.AddComponent<DBComponent>();
+						Game.Scene.AddComponent<DBProxyComponent>();
 						Game.Scene.AddComponent<LocationComponent>();
-						Game.Scene.AddComponent<ActorMessageDispatherComponent>();
+						Game.Scene.AddComponent<ActorMessageDispatherComponent, AppType>(AppType.AllServer);
 						Game.Scene.AddComponent<ActorManagerComponent>();
 						Game.Scene.AddComponent<NetInnerComponent, string, int>(innerConfig.Host, innerConfig.Port);
 						Game.Scene.AddComponent<NetOuterComponent, string, int>(outerConfig.Host, outerConfig.Port);

+ 15 - 0
Server/Hotfix/Handler/Actor_TestHandler.cs

@@ -0,0 +1,15 @@
+using System.Threading.Tasks;
+using Model;
+
+namespace Hotfix
+{
+	[ActorMessageHandler(AppType.Map)]
+	public class Actor_TestHandler : AMActorHandler<Unit, Actor_Test>
+	{
+		protected override async Task<bool> Run(Unit unit, Actor_Test message)
+		{
+			Log.Info(message.Info);
+			return true;
+		}
+	}
+}

+ 42 - 0
Server/Hotfix/Handler/C2G_LoginGateHandler.cs

@@ -0,0 +1,42 @@
+using System;
+using Model;
+
+namespace Hotfix
+{
+	[MessageHandler(AppType.Gate)]
+	public class C2G_LoginGateHandler : AMRpcHandler<C2G_LoginGate, G2C_LoginGate>
+	{
+		protected override async void Run(Session session, C2G_LoginGate message, Action<G2C_LoginGate> reply)
+		{
+			G2C_LoginGate response = new G2C_LoginGate();
+			try
+			{
+				string account = Game.Scene.GetComponent<GateSessionKeyComponent>().Get(message.Key);
+				if (account == null)
+				{
+					response.Error = ErrorCode.ERR_ConnectGateKeyError;
+					response.Message = "Gate key验证失败!";
+					reply(response);
+					return;
+				}
+				Player player = ObjectFactory.Create<Player, string>(account);
+				Game.Scene.GetComponent<PlayerComponent>().Add(player);
+				session.AddComponent<SessionPlayerComponent>().Player = player;
+
+				// 在map服务器上创建战斗Unit
+				string mapAddress = Game.Scene.GetComponent<StartConfigComponent>().MapConfig.GetComponent<InnerConfig>().Address;
+				Session mapSession = Game.Scene.GetComponent<NetInnerComponent>().Get(mapAddress);
+				M2G_CreateUnit createUnit = await mapSession.Call<M2G_CreateUnit>(new G2M_CreateUnit() { PlayerId = player.Id });
+				player.UnitId = createUnit.UnitId;
+
+				response.PlayerId = player.Id;
+				response.UnitId = createUnit.UnitId;
+				reply(response);
+			}
+			catch (Exception e)
+			{
+				ReplyError(response, e, reply);
+			}
+		}
+	}
+}

+ 0 - 0
Server/Hotfix/Message/C2M_ReloadHandler.cs → Server/Hotfix/Handler/C2M_ReloadHandler.cs


+ 1 - 2
Server/Hotfix/Message/C2R_LoginHandler.cs → Server/Hotfix/Handler/C2R_LoginHandler.cs

@@ -8,7 +8,6 @@ namespace Hotfix
 	{
 		protected override async void Run(Session session, C2R_Login message, Action<R2C_Login> reply)
 		{
-			Log.Debug("11111111111111111111");
 			R2C_Login response = new R2C_Login();
 			try
 			{
@@ -26,7 +25,7 @@ namespace Hotfix
 				Session gateSession = Game.Scene.GetComponent<NetInnerComponent>().Get(innerAddress);
 
 				// 向gate请求一个key,客户端可以拿着这个key连接gate
-				G2R_GetLoginKey g2RGetLoginKey = await gateSession.Call<G2R_GetLoginKey>(new R2G_GetLoginKey());
+				G2R_GetLoginKey g2RGetLoginKey = await gateSession.Call<G2R_GetLoginKey>(new R2G_GetLoginKey() {Account = message.Account});
 
 				string outerAddress = $"{config.GetComponent<OuterConfig>().Host}:{config.GetComponent<OuterConfig>().Port}";
 

+ 0 - 0
Server/Hotfix/Message/C2R_PingHandler.cs → Server/Hotfix/Handler/C2R_PingHandler.cs


+ 0 - 0
Server/Hotfix/Message/G2G_LockReleaseRequestHandler.cs → Server/Hotfix/Handler/G2G_LockReleaseRequestHandler.cs


+ 0 - 0
Server/Hotfix/Message/G2G_LockRequestHandler.cs → Server/Hotfix/Handler/G2G_LockRequestHandler.cs


+ 26 - 0
Server/Hotfix/Handler/G2M_CreateUnitHandler.cs

@@ -0,0 +1,26 @@
+using System;
+using Model;
+
+namespace Hotfix
+{
+	[MessageHandler(AppType.Map)]
+	public class G2M_CreateUnitHandler : AMRpcHandler<G2M_CreateUnit, M2G_CreateUnit>
+	{
+		protected override void Run(Session session, G2M_CreateUnit message, Action<M2G_CreateUnit> reply)
+		{
+			M2G_CreateUnit response = new M2G_CreateUnit();
+			try
+			{
+				Unit unit = ObjectFactory.Create<Unit, UnitType>(UnitType.Hero);
+				unit.AddComponent<ActorComponent, IEntityActorHandler>(new CommonEntityActorHandler());
+				Game.Scene.GetComponent<UnitComponent>().Add(unit);
+				response.UnitId = unit.Id;
+				reply(response);
+			}
+			catch (Exception e)
+			{
+				ReplyError(response, e, reply);
+			}
+		}
+	}
+}

+ 0 - 0
Server/Hotfix/Message/M2A_ReloadHandler.cs → Server/Hotfix/Handler/M2A_ReloadHandler.cs


+ 1 - 1
Server/Hotfix/Message/ObjectAddRequestHandler.cs → Server/Hotfix/Handler/ObjectAddRequestHandler.cs

@@ -11,7 +11,7 @@ namespace Hotfix
 			ObjectAddResponse response = new ObjectAddResponse();
 			try
 			{
-				Game.Scene.GetComponent<LocationComponent>().Add(message.Key, session.RemoteAddress);
+				Game.Scene.GetComponent<LocationComponent>().Add(message.Key, message.AppId);
 				reply(response);
 			}
 			catch (Exception e)

+ 3 - 3
Server/Hotfix/Message/ObjectGetRequestHandler.cs → Server/Hotfix/Handler/ObjectGetRequestHandler.cs

@@ -11,12 +11,12 @@ namespace Hotfix
 			ObjectGetResponse response = new ObjectGetResponse();
 			try
 			{
-				string location = await Game.Scene.GetComponent<LocationComponent>().GetAsync(message.Key);
-				if (location == "")
+				int appId = await Game.Scene.GetComponent<LocationComponent>().GetAsync(message.Key);
+				if (appId == 0)
 				{
 					response.Error = ErrorCode.ERR_ActorLocationNotFound;
 				}
-				response.Location = location;
+				response.AppId = appId;
 				reply(response);
 			}
 			catch (Exception e)

+ 0 - 0
Server/Hotfix/Message/ObjectLockRequestHandler.cs → Server/Hotfix/Handler/ObjectLockRequestHandler.cs


+ 0 - 0
Server/Hotfix/Message/ObjectRemoveRequestHandler.cs → Server/Hotfix/Handler/ObjectRemoveRequestHandler.cs


+ 1 - 1
Server/Hotfix/Message/ObjectUnLockRequestHandler.cs → Server/Hotfix/Handler/ObjectUnLockRequestHandler.cs

@@ -11,7 +11,7 @@ namespace Hotfix
 			ObjectUnLockResponse response = new ObjectUnLockResponse();
 			try
 			{
-				Game.Scene.GetComponent<LocationComponent>().UpdateAndUnLock(message.Key, message.AppId, message.Value);
+				Game.Scene.GetComponent<LocationComponent>().UpdateAndUnLock(message.Key, message.LockAppId, message.AppId);
 				reply(response);
 			}
 			catch (Exception e)

+ 2 - 1
Server/Hotfix/Message/R2G_GetLoginKeyHandler.cs → Server/Hotfix/Handler/R2G_GetLoginKeyHandler.cs

@@ -11,7 +11,8 @@ namespace Hotfix
 			G2R_GetLoginKey response = new G2R_GetLoginKey();
 			try
 			{
-				long key = Game.Scene.GetComponent<GateSessionKeyComponent>().Get();
+				long key = RandomHelper.RandInt64();
+				Game.Scene.GetComponent<GateSessionKeyComponent>().Add(key, message.Account);
 				response.Key = key;
 				reply(response);
 			}

+ 2 - 2
Server/Hotfix/Helper/MessageHelper.cs

@@ -6,8 +6,8 @@ namespace Hotfix
 	{
 		public static void Broadcast<Message>(Message message) where Message: AMessage
 		{
-			Gamer[] gamers = Game.Scene.GetComponent<GamerComponent>().GetAll();
-			foreach (Gamer gamer in gamers)
+			Player[] players = Game.Scene.GetComponent<PlayerComponent>().GetAll();
+			foreach (Player gamer in players)
 			{
 				gamer.GetComponent<SessionInfoComponent>().Session.Send(message);
 			}

+ 0 - 31
Server/Hotfix/Message/C2G_LoginGateHandler.cs

@@ -1,31 +0,0 @@
-using System;
-using Model;
-
-namespace Hotfix
-{
-	[MessageHandler(AppType.Gate)]
-	public class C2G_LoginGateHandler : AMRpcHandler<C2G_LoginGate, G2C_LoginGate>
-	{
-		protected override async void Run(Session session, C2G_LoginGate message, Action<G2C_LoginGate> reply)
-		{
-			G2C_LoginGate response = new G2C_LoginGate();
-			try
-			{
-				bool isCheckOK = Game.Scene.GetComponent<GateSessionKeyComponent>().Check(message.Key);
-				if (!isCheckOK)
-				{
-					response.Error = ErrorCode.ERR_ConnectGateKeyError;
-					response.Message = "Gate key验证失败!";
-				}
-				reply(response);
-
-				await Game.Scene.GetComponent<TimerComponent>().WaitAsync(5000);
-				session.Dispose();
-			}
-			catch (Exception e)
-			{
-				ReplyError(response, e, reply);
-			}
-		}
-	}
-}

+ 15 - 13
Server/Hotfix/Server.Hotfix.csproj

@@ -36,21 +36,23 @@
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Component\RealmGateAddressComponentE.cs" />
+    <Compile Include="Handler\Actor_TestHandler.cs" />
+    <Compile Include="Handler\G2M_CreateUnitHandler.cs" />
     <Compile Include="Helper\MessageHelper.cs" />
-    <Compile Include="Message\C2G_LoginGateHandler.cs" />
-    <Compile Include="Message\C2R_PingHandler.cs" />
-    <Compile Include="Message\G2G_LockReleaseRequestHandler.cs" />
-    <Compile Include="Message\ObjectGetRequestHandler.cs" />
-    <Compile Include="Message\ObjectUnLockRequestHandler.cs" />
-    <Compile Include="Message\ObjectLockRequestHandler.cs" />
-    <Compile Include="Message\ObjectRemoveRequestHandler.cs" />
-    <Compile Include="Message\ObjectAddRequestHandler.cs" />
-    <Compile Include="Message\M2A_ReloadHandler.cs" />
-    <Compile Include="Message\C2M_ReloadHandler.cs" />
-    <Compile Include="Message\G2G_LockRequestHandler.cs" />
-    <Compile Include="Message\R2G_GetLoginKeyHandler.cs" />
+    <Compile Include="Handler\C2G_LoginGateHandler.cs" />
+    <Compile Include="Handler\C2R_PingHandler.cs" />
+    <Compile Include="Handler\G2G_LockReleaseRequestHandler.cs" />
+    <Compile Include="Handler\ObjectGetRequestHandler.cs" />
+    <Compile Include="Handler\ObjectUnLockRequestHandler.cs" />
+    <Compile Include="Handler\ObjectLockRequestHandler.cs" />
+    <Compile Include="Handler\ObjectRemoveRequestHandler.cs" />
+    <Compile Include="Handler\ObjectAddRequestHandler.cs" />
+    <Compile Include="Handler\M2A_ReloadHandler.cs" />
+    <Compile Include="Handler\C2M_ReloadHandler.cs" />
+    <Compile Include="Handler\G2G_LockRequestHandler.cs" />
+    <Compile Include="Handler\R2G_GetLoginKeyHandler.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Message\C2R_LoginHandler.cs" />
+    <Compile Include="Handler\C2R_LoginHandler.cs" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Base\Server.Base.csproj">

+ 33 - 15
Server/Model/Component/ActorComponent.cs

@@ -11,12 +11,22 @@ namespace Model
 	}
 
 	[ObjectEvent]
-	public class ActorComponentEvent : ObjectEvent<ActorComponent>, IAwake<IEntityActorHandler>
+	public class ActorComponentEvent : ObjectEvent<ActorComponent>, IAwake, IAwake<IEntityActorHandler>, IStart
 	{
+		public void Awake()
+		{
+			this.Get().Awake();
+		}
+
 		public void Awake(IEntityActorHandler iEntityActorHandler)
 		{
 			this.Get().Awake(iEntityActorHandler);
 		}
+
+		public void Start()
+		{
+			this.Get().Start();
+		}
 	}
 
 	/// <summary>
@@ -33,20 +43,21 @@ namespace Model
 
 		private TaskCompletionSource<ActorMessageInfo> tcs;
 
-		public async void Awake(IEntityActorHandler iEntityActorHandler)
+		public void Awake()
 		{
-			try
-			{
-				this.entityActorHandler = iEntityActorHandler;
-				this.actorId = this.Owner.Id;
-				Game.Scene.GetComponent<ActorManagerComponent>().Add(this.Owner);
-				await Game.Scene.GetComponent<LocationProxyComponent>().Add(this.actorId);
-			}
-			catch (Exception)
-			{
-				Log.Error($"register actor fail: {this.actorId}");
-			}
+			this.entityActorHandler = new CommonEntityActorHandler();
+		}
 
+		public void Awake(IEntityActorHandler iEntityActorHandler)
+		{
+			this.entityActorHandler = iEntityActorHandler;
+		}
+		
+		public async void Start()
+		{
+			this.actorId = this.Owner.Id;
+			Game.Scene.GetComponent<ActorManagerComponent>().Add(this.Owner);
+			await Game.Scene.GetComponent<LocationProxyComponent>().Add(this.actorId);
 			this.HandleAsync();
 		}
 
@@ -78,8 +89,15 @@ namespace Model
 		{
 			while (true)
 			{
-				ActorMessageInfo info = await this.GetAsync();
-				await this.entityActorHandler.Handle(info.Session, this.Owner, info.Message);
+				try
+				{
+					ActorMessageInfo info = await this.GetAsync();
+					await this.entityActorHandler.Handle(info.Session, this.Owner, info.Message);
+				}
+				catch (Exception e)
+				{
+					Log.Error(e.ToString());
+				}
 			}
 		}
 

+ 2 - 2
Server/Model/Component/ActorProxyComponent.cs

@@ -12,8 +12,8 @@ namespace Model
 			{
 				return actorProxy;
 			}
-			
-			actorProxy = new ActorProxy(id);
+
+			actorProxy = ObjectFactory.CreateWithId<ActorProxy>(id);
 			this.dictionary[id] = actorProxy;
 			return actorProxy;
 		}

+ 4 - 4
Server/Model/Component/AppManagerComponent.cs

@@ -6,11 +6,11 @@ using System.Linq;
 namespace Model
 {
 	[ObjectEvent]
-	public class AppManagerComponentEvent : ObjectEvent<AppManagerComponent>, IAwake
+	public class AppManagerComponentEvent : ObjectEvent<AppManagerComponent>, IStart
 	{
-		public void Awake()
+		public void Start()
 		{
-			this.Get().Awake();
+			this.Get().Start();
 		}
 	}
 
@@ -18,7 +18,7 @@ namespace Model
 	{
 		private readonly Dictionary<int, Process> processes = new Dictionary<int, Process>();
 
-		public void Awake()
+		public void Start()
 		{
 			string[] ips = NetHelper.GetAddressIPs();
 			StartConfig[] startConfigs = Game.Scene.GetComponent<StartConfigComponent>().GetAll();

+ 8 - 8
Server/Model/Component/DBComponent.cs

@@ -3,11 +3,11 @@
 namespace Model
 {
 	[ObjectEvent]
-	public class DBComponentEvent : ObjectEvent<DBComponent>, IAwake
+	public class DBComponentEvent : ObjectEvent<DBComponent>, IStart
 	{
-		public void Awake()
+		public void Start()
 		{
-			this.Get().Awake();
+			this.Get().Start();
 		}
 	}
 
@@ -19,12 +19,12 @@ namespace Model
 		public MongoClient mongoClient;
 		public IMongoDatabase database;
 
-		public void Awake()
+		public void Start()
 		{
-			DBConfig config = Game.Scene.GetComponent<StartConfigComponent>().StartConfig.GetComponent<DBConfig>();
-			string connectionString = config.ConnectionString;
-			mongoClient = new MongoClient(connectionString);
-			this.database = this.mongoClient.GetDatabase(config.DBName);
+			//DBConfig config = Game.Scene.GetComponent<StartConfigComponent>().StartConfig.GetComponent<DBConfig>();
+			//string connectionString = config.ConnectionString;
+			//mongoClient = new MongoClient(connectionString);
+			//this.database = this.mongoClient.GetDatabase(config.DBName);
 		}
 
 		public IMongoCollection<Entity> GetCollection(string name)

+ 1 - 1
Server/Model/Component/DBProxyComponent.cs

@@ -13,7 +13,7 @@ namespace Model
 
 		public void Awake()
 		{
-			StartConfig dbStartConfig = Game.Scene.GetComponent<StartConfigComponent>().DBStartConfig;
+			StartConfig dbStartConfig = Game.Scene.GetComponent<StartConfigComponent>().DBConfig;
 			dbAddress = dbStartConfig.GetComponent<InnerConfig>().Address;
 		}
 

+ 0 - 57
Server/Model/Component/GamerComponent.cs

@@ -1,57 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Model
-{
-	public class GamerComponent : Component
-	{
-		private readonly Dictionary<long, Gamer> idGamers = new Dictionary<long, Gamer>();
-
-		public void Add(Gamer gamer)
-		{
-			if (this.idGamers.Count > 1)
-			{
-				gamer.Team = 1;
-			}
-			this.idGamers.Add(gamer.Id, gamer);
-		}
-
-		public Gamer Get(long id)
-		{
-			this.idGamers.TryGetValue(id, out Gamer gamer);
-			return gamer;
-		}
-
-		public void Remove(long id)
-		{
-			this.idGamers.Remove(id);
-		}
-
-		public int Count
-		{
-			get
-			{
-				return this.idGamers.Count;
-			}
-		}
-
-		public Gamer[] GetAll()
-		{
-			return this.idGamers.Values.ToArray();
-		}
-
-		public override void Dispose()
-		{
-			if (this.Id == 0)
-			{
-				return;
-			}
-			base.Dispose();
-
-			foreach (Gamer gamer in this.idGamers.Values)
-			{
-				gamer.Dispose();
-			}
-		}
-	}
-}

+ 9 - 30
Server/Model/Component/GateSessionKeyComponent.cs

@@ -2,42 +2,21 @@
 
 namespace Model
 {
-	[ObjectEvent]
-	public class GateSessionKeyComponentEvent : ObjectEvent<GateSessionKeyComponent>, IAwake
-	{
-		public void Awake()
-		{
-			this.Get().Awake();
-		}
-	}
-	
 	public class GateSessionKeyComponent : Component
 	{
-		private TimerComponent timerComponent;
-
-		private readonly HashSet<long> sessionKey = new HashSet<long>();
-
-		public void Awake()
-		{
-			this.timerComponent = Game.Scene.GetComponent<TimerComponent>();
-		}
-
-		public long Get()
+		private readonly Dictionary<long, string> sessionKey = new Dictionary<long, string>();
+		
+		public void Add(long key, string account)
 		{
-			long key = RandomHelper.RandInt64();
-			this.sessionKey.Add(key);
+			this.sessionKey.Add(key, account);
 			this.TimeoutRemoveKey(key);
-			return key;
 		}
 
-		public bool Check(long key)
+		public string Get(long key)
 		{
-			bool ret = this.sessionKey.Contains(key);
-			if (ret)
-			{
-				this.sessionKey.Remove(key);
-			}
-			return ret;
+			string account = null;
+			this.sessionKey.TryGetValue(key, out account);
+			return account;
 		}
 
 		public void Remove(long key)
@@ -47,7 +26,7 @@ namespace Model
 
 		private async void TimeoutRemoveKey(long key)
 		{
-			await this.timerComponent.WaitAsync(20000);
+			await Game.Scene.GetComponent<TimerComponent>().WaitAsync(20000);
 			this.sessionKey.Remove(key);
 		}
 	}

+ 17 - 13
Server/Model/Component/LocationComponent.cs

@@ -58,15 +58,15 @@ namespace Model
 	{
 		private readonly long key;
 
-		private readonly TaskCompletionSource<string> tcs;
+		private readonly TaskCompletionSource<int> tcs;
 
 		public LocationQueryTask(long key)
 		{
 			this.key = key;
-			this.tcs = new TaskCompletionSource<string>();
+			this.tcs = new TaskCompletionSource<int>();
 		}
 
-		public Task<string> Task
+		public Task<int> Task
 		{
 			get
 			{
@@ -78,7 +78,7 @@ namespace Model
 		{
 			try
 			{
-				string location = Scene.GetComponent<LocationComponent>().Get(key);
+				int location = Scene.GetComponent<LocationComponent>().Get(key);
 				this.tcs.SetResult(location);
 			}
 			catch (Exception e)
@@ -90,28 +90,31 @@ namespace Model
 
 	public class LocationComponent : Component
 	{
-		private readonly Dictionary<long, string> locations = new Dictionary<long, string>();
+		private readonly Dictionary<long, int> locations = new Dictionary<long, int>();
 
 		private readonly Dictionary<long, int> lockDict = new Dictionary<long, int>();
 
 		private readonly Dictionary<long, Queue<LocationTask>> taskQueues = new Dictionary<long, Queue<LocationTask>>();
 
-		public async void Add(long key, string address)
+		public void Add(long key, int appId)
 		{
-			this.locations[key] = address;
+			this.locations[key] = appId;
+
+			Log.Info($"location add key: {key} appid: {appId}");
 
 			// 更新db
-			await Game.Scene.GetComponent<DBProxyComponent>().Save(new Location(key, address));
+			//await Game.Scene.GetComponent<DBProxyComponent>().Save(new Location(key, address));
 		}
 
 		public void Remove(long key)
 		{
+			Log.Info($"location remove key: {key}");
 			this.locations.Remove(key);
 		}
 
-		public string Get(long key)
+		public int Get(long key)
 		{
-			this.locations.TryGetValue(key, out string location);
+			this.locations.TryGetValue(key, out int location);
 			return location;
 		}
 
@@ -139,7 +142,7 @@ namespace Model
 			}
 		}
 
-		public void UpdateAndUnLock(long key, int appId, string value)
+		public void UpdateAndUnLock(long key, int appId, int value)
 		{
 			int saveAppId = 0;
 			this.lockDict.TryGetValue(key, out saveAppId);
@@ -191,11 +194,12 @@ namespace Model
 			return task.Task;
 		}
 
-		public Task<string> GetAsync(long key)
+		public Task<int> GetAsync(long key)
 		{
 			if (!this.lockDict.ContainsKey(key))
 			{
-				this.locations.TryGetValue(key, out string location);
+				Log.Info($"location get key: {key}");
+				this.locations.TryGetValue(key, out int location);
 				return Task.FromResult(location);
 			}
 

+ 6 - 6
Server/Model/Component/LocationProxyComponent.cs

@@ -27,19 +27,19 @@ namespace Model
 		public async Task Add(long key)
 		{
 			Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.LocationAddress);
-			await session.Call<ObjectAddResponse>(new ObjectAddRequest() { Key = key });
+			await session.Call<ObjectAddResponse>(new ObjectAddRequest() { Key = key, AppId = this.AppId });
 		}
 
 		public async Task Lock(long key, int time = 1000)
 		{
 			Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.LocationAddress);
-			await session.Call<ObjectLockResponse>(new ObjectLockRequest() { Key = key, AppId = this.AppId, Time = time });
+			await session.Call<ObjectLockResponse>(new ObjectLockRequest() { Key = key, LockAppId = this.AppId, Time = time });
 		}
 
-		public async Task UnLock(long key, string value)
+		public async Task UnLock(long key, int value)
 		{
 			Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.LocationAddress);
-			await session.Call<ObjectUnLockResponse>(new ObjectUnLockRequest() { Key = key, AppId = this.AppId, Value = value});
+			await session.Call<ObjectUnLockResponse>(new ObjectUnLockRequest() { Key = key, LockAppId = this.AppId, AppId = value});
 		}
 
 		public async Task Remove(long key)
@@ -48,11 +48,11 @@ namespace Model
 			await session.Call<ObjectRemoveResponse>(new ObjectRemoveRequest() { Key = key });
 		}
 
-		public async Task<string> Get(long key)
+		public async Task<int> Get(long key)
 		{
 			Session session = Game.Scene.GetComponent<NetInnerComponent>().Get(this.LocationAddress);
 			ObjectGetResponse response = await session.Call<ObjectGetResponse>(new ObjectGetRequest() { Key = key });
-			return response.Location;
+			return response.AppId;
 		}
 
 		public override void Dispose()

+ 53 - 0
Server/Model/Component/PlayerComponent.cs

@@ -0,0 +1,53 @@
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Model
+{
+	public class PlayerComponent : Component
+	{
+		private readonly Dictionary<long, Player> idPlayers = new Dictionary<long, Player>();
+
+		public void Add(Player player)
+		{
+			this.idPlayers.Add(player.Id, player);
+		}
+
+		public Player Get(long id)
+		{
+			this.idPlayers.TryGetValue(id, out Player gamer);
+			return gamer;
+		}
+
+		public void Remove(long id)
+		{
+			this.idPlayers.Remove(id);
+		}
+
+		public int Count
+		{
+			get
+			{
+				return this.idPlayers.Count;
+			}
+		}
+
+		public Player[] GetAll()
+		{
+			return this.idPlayers.Values.ToArray();
+		}
+
+		public override void Dispose()
+		{
+			if (this.Id == 0)
+			{
+				return;
+			}
+			base.Dispose();
+
+			foreach (Player player in this.idPlayers.Values)
+			{
+				player.Dispose();
+			}
+		}
+	}
+}

+ 0 - 19
Server/Model/Component/Session/SessionGamerComponent.cs

@@ -1,19 +0,0 @@
-namespace Model
-{
-	public class SessionGamerComponent : Component
-	{
-		public Gamer Gamer;
-
-		public override void Dispose()
-		{
-			if (this.Id == 0)
-			{
-				return;
-			}
-
-			base.Dispose();
-
-			Game.Scene.GetComponent<GamerComponent>().Remove(this.Gamer.Id);
-		}
-	}
-}

+ 19 - 0
Server/Model/Component/Session/SessionPlayerComponent.cs

@@ -0,0 +1,19 @@
+namespace Model
+{
+	public class SessionPlayerComponent : Component
+	{
+		public Player Player;
+
+		public override void Dispose()
+		{
+			if (this.Id == 0)
+			{
+				return;
+			}
+
+			base.Dispose();
+
+			Game.Scene.GetComponent<PlayerComponent>()?.Remove(this.Player.Id);
+		}
+	}
+}

+ 8 - 1
Server/Model/Component/StartConfigComponent.cs

@@ -21,12 +21,14 @@ namespace Model
 		
 		public StartConfig StartConfig { get; private set; }
 
-		public StartConfig DBStartConfig { get; private set; }
+		public StartConfig DBConfig { get; private set; }
 
 		public StartConfig RealmConfig { get; private set; }
 
 		public StartConfig LocationConfig { get; private set; }
 
+		public StartConfig MapConfig { get; private set; }
+
 		public void Awake(string path, int appId)
 		{
 			string[] ss = File.ReadAllText(path).Split('\n');
@@ -52,6 +54,11 @@ namespace Model
 					{
 						LocationConfig = startConfig;
 					}
+
+					if (startConfig.AppType.Is(AppType.Map))
+					{
+						MapConfig = startConfig;
+					}
 				}
 				catch (Exception)
 				{

+ 69 - 32
Server/Model/Entity/ActorProxy.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
 
@@ -69,6 +70,21 @@ namespace Model
 		}
 	}
 
+
+	[ObjectEvent]
+	public class ActorProxyEvent : ObjectEvent<ActorProxy>, IAwake, IStart
+	{
+		public void Awake()
+		{
+			this.Get().Awake();
+		}
+
+		public void Start()
+		{
+			this.Get().Start();
+		}
+	}
+
 	public sealed class ActorProxy : Entity
 	{
 		// actor的地址
@@ -92,7 +108,15 @@ namespace Model
 
 		private int failTimes;
 		
-		public ActorProxy(long id): base(id)
+		public void Awake()
+		{
+			this.RunningTasks = new Queue<ActorTask>();
+			this.WaitingTasks = new Queue<ActorTask>();
+			this.WindowSize = 1;
+			this.CancellationTokenSource = new CancellationTokenSource();
+		}
+		
+		public void Start()
 		{
 			this.UpdateAsync();
 		}
@@ -138,6 +162,11 @@ namespace Model
 
 		private async void UpdateAsync()
 		{
+			if (this.Address == null)
+			{
+				int appId = await Game.Scene.GetComponent<LocationProxyComponent>().Get(this.Id);
+				this.Address = Game.Scene.GetComponent<StartConfigComponent>().Get(appId).GetComponent<InnerConfig>().Address;
+			}
 			while (true)
 			{
 				ActorTask actorTask = await this.GetAsync();
@@ -147,48 +176,56 @@ namespace Model
 
 		private async void RunTask(ActorTask task)
 		{
-			AResponse response = await task.Run();
-
-			// 如果没找到Actor,发送窗口减少为1,重试
-			if (response.Error == ErrorCode.ERR_NotFoundActor)
+			try
 			{
-				this.CancellationTokenSource.Cancel();
-				this.WindowSize = 1;
-				++this.failTimes;
+				AResponse response = await task.Run();
 
-				while (this.WaitingTasks.Count > 0)
+				// 如果没找到Actor,发送窗口减少为1,重试
+				if (response.Error == ErrorCode.ERR_NotFoundActor)
 				{
-					ActorTask actorTask = this.WaitingTasks.Dequeue();
-					this.RunningTasks.Enqueue(actorTask);
-				}
-				ObjectHelper.Swap(ref this.RunningTasks, ref this.WaitingTasks);
+					this.CancellationTokenSource.Cancel();
+					this.WindowSize = 1;
+					++this.failTimes;
 
-				// 失败3次则清空actor发送队列,返回失败
-				if (this.failTimes > 3)
-				{
 					while (this.WaitingTasks.Count > 0)
 					{
 						ActorTask actorTask = this.WaitingTasks.Dequeue();
-						actorTask.RunFail(response.Error);
+						this.RunningTasks.Enqueue(actorTask);
+					}
+					ObjectHelper.Swap(ref this.RunningTasks, ref this.WaitingTasks);
+
+					// 失败3次则清空actor发送队列,返回失败
+					if (this.failTimes > 3)
+					{
+						while (this.WaitingTasks.Count > 0)
+						{
+							ActorTask actorTask = this.WaitingTasks.Dequeue();
+							actorTask.RunFail(response.Error);
+						}
+						return;
 					}
+
+					// 等待一会再发送
+					await this.Parent.GetComponent<TimerComponent>().WaitAsync(this.failTimes * 500);
+					int appId = await Game.Scene.GetComponent<LocationProxyComponent>().Get(this.Id);
+					this.Address = Game.Scene.GetComponent<StartConfigComponent>().Get(appId).GetComponent<InnerConfig>().Address;
+					this.CancellationTokenSource = new CancellationTokenSource();
+					this.AllowGet();
 					return;
 				}
 
-				// 等待一会再发送
-				await this.Parent.GetComponent<TimerComponent>().WaitAsync(this.failTimes * 500);
-				this.Address = await this.Parent.GetComponent<LocationProxyComponent>().Get(this.Id);
-				this.CancellationTokenSource = new CancellationTokenSource();
-				this.AllowGet();
-				return;
-			}
-
-			// 发送成功
-			this.failTimes = 0;
-			if (this.WindowSize < MaxWindowSize)
+				// 发送成功
+				this.failTimes = 0;
+				if (this.WindowSize < MaxWindowSize)
+				{
+					++this.WindowSize;
+				}
+				this.Remove();
+				}
+			catch (Exception e)
 			{
-				++this.WindowSize;
+				Log.Error(e.ToString());
 			}
-			this.Remove();
 		}
 
 		public void Send(AActorMessage message)
@@ -214,7 +251,7 @@ namespace Model
 			}
 			catch (RpcException e)
 			{
-				Log.Error(e.ToString());
+				Log.Error($"{this.Address} {e}");
 				throw;
 			}
 		}

+ 0 - 44
Server/Model/Entity/Gamer.cs

@@ -1,44 +0,0 @@
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Model
-{
-	public sealed class Gamer : Entity
-	{
-		public string Account { get; }
-
-		public int Team { get; set; }
-
-		private readonly Dictionary<long, Unit> dictionary = new Dictionary<long, Unit>();
-
-		public Gamer(string account)
-		{
-			this.Account = account;
-		}
-
-		public Unit[] GetAll()
-		{
-			return this.dictionary.Values.ToArray();
-		}
-
-		public void Add(Unit unit)
-		{
-			this.dictionary.Add(unit.Id, unit);
-		}
-
-		public void Remove(long id)
-		{
-			this.dictionary.Remove(id);
-		}
-
-		public override void Dispose()
-		{
-			if (this.Id == 0)
-			{
-				return;
-			}
-
-			base.Dispose();
-		}
-	}
-}

+ 6 - 16
Server/Model/Entity/Message/InnerMessage.cs

@@ -1,18 +1,8 @@
-using System.Collections.Generic;
-
using MongoDB.Bson.Serialization.Attributes;
+using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
 
 
 // ·þÎñÆ÷ÄÚ²¿ÏûÏ¢ Opcode´Ó10000¿ªÊ¼
-
-
-namespace Model
{
	[Message(Opcode.R2G_GetLoginKey)]
	[BsonIgnoreExtraElements]
	public class R2G_GetLoginKey : ARequest
	{
	}
-
-
	[Message(Opcode.G2R_GetLoginKey)]
	[BsonIgnoreExtraElements]
	public class G2R_GetLoginKey : AResponse
	{
		public long Key;
-
		public G2R_GetLoginKey()
		{
		}
-
-		public G2R_GetLoginKey(long key)
		{
			this.Key = key;
		}
	}
-
-
	[Message(Opcode.M2A_Reload)]
	[BsonIgnoreExtraElements]
	public class M2A_Reload : ARequest
	{
	}
+namespace Model
{
	[Message(Opcode.M2A_Reload)]
	[BsonIgnoreExtraElements]
	public class M2A_Reload : ARequest
	{
	}
 
 
	[Message(Opcode.A2M_Reload)]
	[BsonIgnoreExtraElements]
	public class A2M_Reload : AResponse
	{
	}
 
@@ -48,7 +38,7 @@ namespace Model
{
	[Message(Opcode.R2G_GetLoginKey)]
	[BsonIgnoreExtraElements]
 
 	[Message(Opcode.DBQueryJsonResponse)]
	[BsonIgnoreExtraElements]
	public class DBQueryJsonResponse : AResponse
	{
		public List<Entity> Entitys;
	}
 
-	[Message(Opcode.ObjectAddRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectAddRequest : ARequest
	{
		public long Key { get; set; }
	}
+	[Message(Opcode.ObjectAddRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectAddRequest : ARequest
	{
		public long Key { get; set; }
		public int AppId { get; set; }
	}
 
 	[Message(Opcode.ObjectAddResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectAddResponse : AResponse
	{
	}
 
@@ -56,14 +46,14 @@ namespace Model
{
	[Message(Opcode.R2G_GetLoginKey)]
	[BsonIgnoreExtraElements]
 
 	[Message(Opcode.ObjectRemoveResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectRemoveResponse : AResponse
	{
	}
 
-	[Message(Opcode.ObjectLockRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectLockRequest : ARequest
	{
		public long Key { get; set; }
		public int AppId { get; set; }
		public int Time { get; set; }
	}
+	[Message(Opcode.ObjectLockRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectLockRequest : ARequest
	{
		public long Key { get; set; }
		public int LockAppId { get; set; }
		public int AppId { get; set; }
		public int Time { get; set; }
	}
 
 	[Message(Opcode.ObjectLockResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectLockResponse : AResponse
	{
	}
 
-	[Message(Opcode.ObjectUnLockRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectUnLockRequest : ARequest
	{
		public long Key { get; set; }
		public int AppId { get; set; }
		public string Value { get; set; }
	}
+	[Message(Opcode.ObjectUnLockRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectUnLockRequest : ARequest
	{
		public long Key { get; set; }
		public int LockAppId { get; set; }
		public int AppId { get; set; }
	}
 
 	[Message(Opcode.ObjectUnLockResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectUnLockResponse : AResponse
	{
	}
 
 	[Message(Opcode.ObjectGetRequest)]
	[BsonIgnoreExtraElements]
	public class ObjectGetRequest : ARequest
	{
		public long Key { get; set; }
	}
 
-	[Message(Opcode.ObjectGetResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectGetResponse : AResponse
	{
		public string Location { get; set; }
	}
}
+	[Message(Opcode.ObjectGetResponse)]
	[BsonIgnoreExtraElements]
	public class ObjectGetResponse : AResponse
	{
		public int AppId { get; set; }
	}


	[Message(Opcode.R2G_GetLoginKey)]
	[BsonIgnoreExtraElements]
	public class R2G_GetLoginKey : ARequest
	{
		public string Account;
	}


	[Message(Opcode.G2R_GetLoginKey)]
	[BsonIgnoreExtraElements]
	public class G2R_GetLoginKey : AResponse
	{
		public long Key;

		public G2R_GetLoginKey()
		{
		}

		public G2R_GetLoginKey(long key)
		{
			this.Key = key;
		}
	}


	[Message(Opcode.G2M_CreateUnit)]
	[BsonIgnoreExtraElements]
	public class G2M_CreateUnit : ARequest
	{
		public long PlayerId;
	}


	[Message(Opcode.M2G_CreateUnit)]
	[BsonIgnoreExtraElements]
	public class M2G_CreateUnit : AResponse
	{
		public long UnitId;
	}
}

+ 3 - 0
Server/Model/Entity/Message/InnerOpcode.cs

@@ -34,5 +34,8 @@
 
 		public const ushort R2G_GetLoginKey = 101;
 		public const ushort G2R_GetLoginKey = 102;
+
+		public const ushort G2M_CreateUnit = 103;
+		public const ushort M2G_CreateUnit = 104;
 	}
 }

+ 33 - 0
Server/Model/Entity/Player.cs

@@ -0,0 +1,33 @@
+namespace Model
+{
+	[ObjectEvent]
+	public class GamerEvent : ObjectEvent<Player>, IAwake<string>
+	{
+		public void Awake(string account)
+		{
+			this.Get().Awake(account);
+		}
+	}
+
+	public sealed class Player : Entity
+	{
+		public string Account { get; private set; }
+		
+		public long UnitId { get; set; }
+
+		public void Awake(string account)
+		{
+			this.Account = account;
+		}
+		
+		public override void Dispose()
+		{
+			if (this.Id == 0)
+			{
+				return;
+			}
+
+			base.Dispose();
+		}
+	}
+}

+ 16 - 10
Server/Model/Entity/Unit.cs

@@ -7,15 +7,27 @@ namespace Model
 		Hero,
 		Npc
 	}
-	
-	public sealed class Unit: Entity
+
+	[ObjectEvent]
+	public class UnitEvent : ObjectEvent<Unit>, IAwake<UnitType>
 	{
-		public UnitType UnitType { get; }
+		public void Awake(UnitType unitType)
+		{
+			this.Get().Awake(unitType);
+		}
+	}
 
-		public Gamer Gamer;
+	public sealed class Unit: Entity
+	{
+		public UnitType UnitType { get; private set; }
 
 		public Vector3 Position;
 
+		public void Awake(UnitType unitType)
+		{
+			this.UnitType = unitType;
+		}
+
 		public override void Dispose()
 		{
 			if (this.Id == 0)
@@ -25,11 +37,5 @@ namespace Model
 
 			base.Dispose();
 		}
-
-		public Unit(Gamer gamer, UnitType unitType)
-		{
-			this.Gamer = gamer;
-			this.UnitType = unitType;
-		}
 	}
 }

+ 8 - 4
Server/Model/Helper/ObjectFactory.cs

@@ -34,28 +34,32 @@ namespace Model
 
 		public static T CreateWithId<T>(long id) where T : Disposer
 		{
-			T disposer = (T)Activator.CreateInstance(typeof(T), id);
+			T disposer = (T)Activator.CreateInstance(typeof(T));
+			disposer.Id = id;
 			ObjectEvents.Instance.Awake(disposer);
 			return disposer;
 		}
 
 		public static T CreateWithId<T, A>(long id, A a) where T : Disposer
 		{
-			T disposer = (T)Activator.CreateInstance(typeof(T), id);
+			T disposer = (T)Activator.CreateInstance(typeof(T));
+			disposer.Id = id;
 			ObjectEvents.Instance.Awake(disposer, a);
 			return disposer;
 		}
 
 		public static T CreateWithId<T, A, B>(long id, A a, B b) where T : Disposer
 		{
-			T disposer = (T)Activator.CreateInstance(typeof(T), id);
+			T disposer = (T)Activator.CreateInstance(typeof(T));
+			disposer.Id = id;
 			ObjectEvents.Instance.Awake(disposer, a, b);
 			return disposer;
 		}
 
 		public static T CreateWithId<T, A, B, C>(long id, A a, B b, C c) where T : Disposer
 		{
-			T disposer = (T)Activator.CreateInstance(typeof(T), id);
+			T disposer = (T)Activator.CreateInstance(typeof(T));
+			disposer.Id = id;
 			ObjectEvents.Instance.Awake(disposer, a, b, c);
 			return disposer;
 		}

+ 10 - 9
Server/Model/Message/AppType.cs

@@ -8,18 +8,19 @@ namespace Model
 	{
 		None = 0,
 		Manager = 1,
-		Realm = 2,
-		Gate = 4,
-		Http = 8,
-		DB = 16,
-		Location = 32,
+		Realm = 1 << 1,
+		Gate = 1 << 2,
+		Http = 1 << 3,
+		DB = 1 << 4,
+		Location = 1 << 5,
+		Map = 1 << 6,
 
-		Robot = 64,
-		Benchmark = 128,
-		Client = 256,
+		Robot = 1 << 29,
+		Benchmark = 1 << 30,
+		Client = 1 << 31,
 
 		// 7
-		AllServer = Manager | Realm | Gate | Http | DB | Location
+		AllServer = Manager | Realm | Gate | Http | DB | Location | Map
 	}
 
 	public static class AppTypeHelper

+ 4 - 3
Server/Model/Message/OuterMessageDispatcher.cs

@@ -10,7 +10,8 @@ namespace Model
 			if (message is AActorMessage aActorMessage)
 			{
 				ActorProxy actorProxy = Game.Scene.GetComponent<ActorProxyComponent>().Get(aActorMessage.Id);
-				aActorMessage.Id = session.GetComponent<SessionGamerComponent>().Gamer.Id;
+				long unitId = session.GetComponent<SessionPlayerComponent>().Player.UnitId;
+				aActorMessage.Id = unitId;
 				actorProxy.Send(aActorMessage);
 				return;
 			}
@@ -19,7 +20,7 @@ namespace Model
 			if (message is AActorRequest aActorRequest)
 			{
 				ActorProxy actorProxy = Game.Scene.GetComponent<ActorProxyComponent>().Get(aActorRequest.Id);
-				aActorRequest.Id = session.GetComponent<SessionGamerComponent>().Gamer.Id;
+				aActorRequest.Id = session.GetComponent<SessionPlayerComponent>().Player.Id;
 				uint rpcId = aActorRequest.RpcId;
 				AActorResponse aActorResponse = await actorProxy.Call<AActorResponse>(aActorRequest);
 				aActorResponse.RpcId = rpcId;
@@ -27,7 +28,7 @@ namespace Model
 				return;
 			}
 
-			if (message is AMessage || message is ARequest)
+			if (message is AMessage)
 			{
 				Game.Scene.GetComponent<MessageDispatherComponent>().Handle(session, message);
 				return;

+ 1 - 1
Server/Model/Object/Object.cs

@@ -9,7 +9,7 @@ namespace Model
 	{
 		[BsonId]
 		[BsonIgnoreIfDefault]
-		public long Id { get; protected set; }
+		public long Id { get; set; }
 
 		protected Object()
 		{

+ 3 - 3
Server/Model/Server.Model.csproj

@@ -68,8 +68,8 @@
       <Link>Entity\Message\OuterMessage.cs</Link>
     </Compile>
     <Compile Include="Component\ActorProxyComponent.cs" />
-    <Compile Include="Component\GamerComponent.cs" />
-    <Compile Include="Entity\Gamer.cs" />
+    <Compile Include="Component\PlayerComponent.cs" />
+    <Compile Include="Entity\Player.cs" />
     <Compile Include="Entity\Location.cs" />
     <Compile Include="Helper\ObjectFactory.cs" />
     <Compile Include="Message\IEntityActorHandler.cs" />
@@ -94,7 +94,7 @@
     <Compile Include="Component\NetOuterComponent.cs" />
     <Compile Include="Component\NetworkComponent.cs" />
     <Compile Include="Component\RobotComponent.cs" />
-    <Compile Include="Component\Session\SessionGamerComponent.cs" />
+    <Compile Include="Component\Session\SessionPlayerComponent.cs" />
     <Compile Include="Component\TimerComponent.cs" />
     <Compile Include="Component\LocationComponent.cs" />
     <Compile Include="Component\ActorComponent.cs" />

+ 1 - 1
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs

@@ -304,7 +304,7 @@ namespace MyEditor
 					newStartConfig.AddComponent<OuterConfig>();
 				}
 
-				if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager | AppType.Http | AppType.DB))
+				if (this.AppType.Is(AppType.Gate | AppType.Realm | AppType.Manager | AppType.Http | AppType.DB | AppType.Map))
 				{
 					newStartConfig.AddComponent<InnerConfig>();
 				}

+ 2 - 0
Unity/Assets/Scripts/Base/Config/AConfigComponent.cs

@@ -8,6 +8,8 @@ namespace Model
 	[BsonKnownTypes(typeof(ClientConfig))]
 	[BsonKnownTypes(typeof(InnerConfig))]
 	[BsonKnownTypes(typeof(OuterConfig))]
+	[BsonKnownTypes(typeof(HttpConfig))]
+	[BsonKnownTypes(typeof(DBConfig))]
 	[BsonKnownTypes(typeof(RunServerConfig))]
 	public abstract class AConfigComponent: Component
 	{

+ 31 - 0
Unity/Assets/Scripts/Base/Message/AActorMessage.cs

@@ -0,0 +1,31 @@
+using MongoDB.Bson.Serialization.Attributes;
+
+namespace Model
+{
+	public interface IActorMessage
+	{
+		long Id { get; set; }
+	}
+
+	public abstract class AActorMessage: ARequest, IActorMessage
+	{
+		public long Id { get; set; }
+	}
+
+	public abstract class ActorMessageResponse : AResponse
+	{
+	}
+
+	public abstract class AActorRequest : ARequest, IActorMessage
+	{
+		[BsonIgnoreIfDefault]
+		public long Id { get; set; }
+	}
+
+	/// <summary>
+	/// 服务端回的RPC消息需要继承这个抽象类
+	/// </summary>
+	public abstract class AActorResponse: AResponse
+	{
+	}
+}

+ 3 - 0
Unity/Assets/Scripts/Base/Message/AActorMessage.cs.meta

@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: a6e143f63ac64f97a66fd168b3442ec8
+timeCreated: 1503721327

+ 1 - 1
Unity/Assets/Scripts/Base/Message/AMessage.cs

@@ -4,7 +4,7 @@
 	{
 	}
 
-	public abstract class ARequest
+	public abstract class ARequest: AMessage
 	{
 		public uint RpcId;
 	}

+ 10 - 9
Unity/Assets/Scripts/Base/Message/AppType.cs

@@ -8,18 +8,19 @@ namespace Model
 	{
 		None = 0,
 		Manager = 1,
-		Realm = 2,
-		Gate = 4,
-		Http = 8,
-		DB = 16,
-		Location = 32,
+		Realm = 1 << 1,
+		Gate = 1 << 2,
+		Http = 1 << 3,
+		DB = 1 << 4,
+		Location = 1 << 5,
+		Map = 1 << 6,
 
-		Robot = 64,
-		Benchmark = 128,
-		Client = 256,
+		Robot = 1 << 29,
+		Benchmark = 1 << 30,
+		Client = 1 << 31,
 
 		// 7
-		AllServer = Manager | Realm | Gate | Http | DB | Location
+		AllServer = Manager | Realm | Gate | Http | DB | Location | Map
 	}
 
 	public static class AppTypeHelper

+ 2 - 0
Unity/Assets/Scripts/Entity/Message/Opcode.cs

@@ -10,5 +10,7 @@
 		public const ushort C2G_GetPlayerInfo = 1006;
 		public const ushort G2C_GetPlayerInfo = 1007;
 		public const ushort C2M_Reload = 1008;
+
+		public const ushort Actor_Test = 1009;
 	}
 }

+ 13 - 1
Unity/Assets/Scripts/Entity/Message/OuterMessage.cs

@@ -6,7 +6,6 @@ namespace Model
 	public class C2R_Login: ARequest
 	{
 		public string Account;
-		
 		public string Password;
 	}
 
@@ -32,8 +31,21 @@ namespace Model
 	[Message(Opcode.G2C_LoginGate)]
 	public class G2C_LoginGate: AResponse
 	{
+		public long PlayerId;
+		public long UnitId;
+	}
+
+
+	[Message(Opcode.Actor_Test)]
+	public class Actor_Test : AActorMessage
+	{
+		public string Info;
 	}
 
+
+
+
+
 	[Message(Opcode.C2M_Reload)]
 	public class C2M_Reload: ARequest
 	{

+ 3 - 3
Unity/Assets/Scripts/Entity/Session.cs

@@ -123,7 +123,7 @@ namespace Model
 		/// <summary>
 		/// Rpc调用
 		/// </summary>
-		public Task<Response> Call<Request, Response>(Request request, CancellationToken cancellationToken) where Request : ARequest
+		public Task<Response> Call<Response>(ARequest request, CancellationToken cancellationToken)
 			where Response : AResponse
 		{
 			request.RpcId = ++RpcId;
@@ -158,7 +158,7 @@ namespace Model
 		/// <summary>
 		/// Rpc调用,发送一个消息,等待返回一个消息
 		/// </summary>
-		public Task<Response> Call<Request, Response>(Request request) where Request : ARequest where Response : AResponse
+		public Task<Response> Call<Response>(ARequest request) where Response : AResponse
 		{
 			request.RpcId = ++RpcId;
 			this.SendMessage(request);
@@ -186,7 +186,7 @@ namespace Model
 			return tcs.Task;
 		}
 
-		public void Send<Message>(Message message) where Message : AMessage
+		public void Send(AMessage message)
 		{
 			if (this.Id == 0)
 			{

+ 0 - 36
Unity/Hotfix/Base/Helper/JsonHelper.cs

@@ -1,36 +0,0 @@
-using System;
-using LitJson;
-using Model;
-
-namespace Hotfix
-{
-	public static class JsonHelper
-	{
-		public static string ToJson(object obj)
-		{
-			return JsonMapper.ToJson(obj);
-		}
-
-		public static T FromJson<T>(string str)
-		{
-			return JsonMapper.ToObject<T>(str);
-		}
-
-		public static object FromJson(Type type, string str)
-		{
-			return JsonMapper.ToObject(type, str);
-		}
-
-		public static T FromJson<T>(byte[] bytes, int index, int count)
-		{
-			string str = bytes.ToStr();
-			return JsonMapper.ToObject<T>(str);
-		}
-
-		public static object FromJson(Type type, byte[] bytes, int index, int count)
-		{
-			string str = bytes.ToStr(index, count);
-			return JsonMapper.ToObject(type, str);
-		}
-	}
-}

+ 0 - 60
Unity/Hotfix/Base/LitJson/IJsonWrapper.cs

@@ -1,60 +0,0 @@
-#region Header
-/**
- * IJsonWrapper.cs
- *   Interface that represents a type capable of handling all kinds of JSON
- *   data. This is mainly used when mapping objects through JsonMapper, and
- *   it's implemented by JsonData.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System.Collections;
-using System.Collections.Specialized;
-
-
-namespace LitJson
-{
-    public enum JsonType
-    {
-        None,
-
-        Object,
-        Array,
-        String,
-        Int,
-        Long,
-        Double,
-        Boolean
-    }
-
-    public interface IJsonWrapper : IList, IOrderedDictionary
-    {
-        bool IsArray   { get; }
-        bool IsBoolean { get; }
-        bool IsDouble  { get; }
-        bool IsInt     { get; }
-        bool IsLong    { get; }
-        bool IsObject  { get; }
-        bool IsString  { get; }
-
-        bool     GetBoolean ();
-        double   GetDouble ();
-        int      GetInt ();
-        JsonType GetJsonType ();
-        long     GetLong ();
-        string   GetString ();
-
-        void SetBoolean  (bool val);
-        void SetDouble   (double val);
-        void SetInt      (int val);
-        void SetJsonType (JsonType type);
-        void SetLong     (long val);
-        void SetString   (string val);
-
-        string ToJson ();
-        void   ToJson (JsonWriter writer);
-    }
-}

+ 0 - 1002
Unity/Hotfix/Base/LitJson/JsonData.cs

@@ -1,1002 +0,0 @@
-#region Header
-/**
- * JsonData.cs
- *   Generic type to hold JSON data (objects, arrays, and so on). This is
- *   the default type returned by JsonMapper.ToObject().
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Collections.Specialized;
-using System.IO;
-
-
-namespace LitJson
-{
-    public class JsonData : IJsonWrapper, IEquatable<JsonData>
-    {
-        #region Fields
-        private IList<JsonData>               inst_array;
-        private bool                          inst_boolean;
-        private double                        inst_double;
-        private int                           inst_int;
-        private long                          inst_long;
-        private IDictionary<string, JsonData> inst_object;
-        private string                        inst_string;
-        private string                        json;
-        private JsonType                      type;
-
-        // Used to implement the IOrderedDictionary interface
-        private IList<KeyValuePair<string, JsonData>> object_list;
-        #endregion
-
-
-        #region Properties
-        public int Count {
-            get { return EnsureCollection ().Count; }
-        }
-
-        public bool IsArray {
-            get { return type == JsonType.Array; }
-        }
-
-        public bool IsBoolean {
-            get { return type == JsonType.Boolean; }
-        }
-
-        public bool IsDouble {
-            get { return type == JsonType.Double; }
-        }
-
-        public bool IsInt {
-            get { return type == JsonType.Int; }
-        }
-
-        public bool IsLong {
-            get { return type == JsonType.Long; }
-        }
-
-        public bool IsObject {
-            get { return type == JsonType.Object; }
-        }
-
-        public bool IsString {
-            get { return type == JsonType.String; }
-        }
-
-        public ICollection<string> Keys {
-            get { EnsureDictionary (); return inst_object.Keys; }
-        }
-        #endregion
-
-
-        #region ICollection Properties
-        int ICollection.Count {
-            get {
-                return Count;
-            }
-        }
-
-        bool ICollection.IsSynchronized {
-            get {
-                return EnsureCollection ().IsSynchronized;
-            }
-        }
-
-        object ICollection.SyncRoot {
-            get {
-                return EnsureCollection ().SyncRoot;
-            }
-        }
-        #endregion
-
-
-        #region IDictionary Properties
-        bool IDictionary.IsFixedSize {
-            get {
-                return EnsureDictionary ().IsFixedSize;
-            }
-        }
-
-        bool IDictionary.IsReadOnly {
-            get {
-                return EnsureDictionary ().IsReadOnly;
-            }
-        }
-
-        ICollection IDictionary.Keys {
-            get {
-                EnsureDictionary ();
-                IList<string> keys = new List<string> ();
-
-                foreach (KeyValuePair<string, JsonData> entry in
-                         object_list) {
-                    keys.Add (entry.Key);
-                }
-
-                return (ICollection) keys;
-            }
-        }
-
-        ICollection IDictionary.Values {
-            get {
-                EnsureDictionary ();
-                IList<JsonData> values = new List<JsonData> ();
-
-                foreach (KeyValuePair<string, JsonData> entry in
-                         object_list) {
-                    values.Add (entry.Value);
-                }
-
-                return (ICollection) values;
-            }
-        }
-        #endregion
-
-
-
-        #region IJsonWrapper Properties
-        bool IJsonWrapper.IsArray {
-            get { return IsArray; }
-        }
-
-        bool IJsonWrapper.IsBoolean {
-            get { return IsBoolean; }
-        }
-
-        bool IJsonWrapper.IsDouble {
-            get { return IsDouble; }
-        }
-
-        bool IJsonWrapper.IsInt {
-            get { return IsInt; }
-        }
-
-        bool IJsonWrapper.IsLong {
-            get { return IsLong; }
-        }
-
-        bool IJsonWrapper.IsObject {
-            get { return IsObject; }
-        }
-
-        bool IJsonWrapper.IsString {
-            get { return IsString; }
-        }
-        #endregion
-
-
-        #region IList Properties
-        bool IList.IsFixedSize {
-            get {
-                return EnsureList ().IsFixedSize;
-            }
-        }
-
-        bool IList.IsReadOnly {
-            get {
-                return EnsureList ().IsReadOnly;
-            }
-        }
-        #endregion
-
-
-        #region IDictionary Indexer
-        object IDictionary.this[object key] {
-            get {
-                return EnsureDictionary ()[key];
-            }
-
-            set {
-                if (! (key is String))
-                    throw new ArgumentException (
-                        "The key has to be a string");
-
-                JsonData data = ToJsonData (value);
-
-                this[(string) key] = data;
-            }
-        }
-        #endregion
-
-
-        #region IOrderedDictionary Indexer
-        object IOrderedDictionary.this[int idx] {
-            get {
-                EnsureDictionary ();
-                return object_list[idx].Value;
-            }
-
-            set {
-                EnsureDictionary ();
-                JsonData data = ToJsonData (value);
-
-                KeyValuePair<string, JsonData> old_entry = object_list[idx];
-
-                inst_object[old_entry.Key] = data;
-
-                KeyValuePair<string, JsonData> entry =
-                    new KeyValuePair<string, JsonData> (old_entry.Key, data);
-
-                object_list[idx] = entry;
-            }
-        }
-        #endregion
-
-
-        #region IList Indexer
-        object IList.this[int index] {
-            get {
-                return EnsureList ()[index];
-            }
-
-            set {
-                EnsureList ();
-                JsonData data = ToJsonData (value);
-
-                this[index] = data;
-            }
-        }
-        #endregion
-
-
-        #region Public Indexers
-        public JsonData this[string prop_name] {
-            get {
-                EnsureDictionary ();
-                return inst_object[prop_name];
-            }
-
-            set {
-                EnsureDictionary ();
-
-                KeyValuePair<string, JsonData> entry =
-                    new KeyValuePair<string, JsonData> (prop_name, value);
-
-                if (inst_object.ContainsKey (prop_name)) {
-                    for (int i = 0; i < object_list.Count; i++) {
-                        if (object_list[i].Key == prop_name) {
-                            object_list[i] = entry;
-                            break;
-                        }
-                    }
-                } else
-                    object_list.Add (entry);
-
-                inst_object[prop_name] = value;
-
-                json = null;
-            }
-        }
-
-        public JsonData this[int index] {
-            get {
-                EnsureCollection ();
-
-                if (type == JsonType.Array)
-                    return inst_array[index];
-
-                return object_list[index].Value;
-            }
-
-            set {
-                EnsureCollection ();
-
-                if (type == JsonType.Array)
-                    inst_array[index] = value;
-                else {
-                    KeyValuePair<string, JsonData> entry = object_list[index];
-                    KeyValuePair<string, JsonData> new_entry =
-                        new KeyValuePair<string, JsonData> (entry.Key, value);
-
-                    object_list[index] = new_entry;
-                    inst_object[entry.Key] = value;
-                }
-
-                json = null;
-            }
-        }
-        #endregion
-
-
-        #region Constructors
-        public JsonData ()
-        {
-        }
-
-        public JsonData (bool boolean)
-        {
-            type = JsonType.Boolean;
-            inst_boolean = boolean;
-        }
-
-        public JsonData (double number)
-        {
-            type = JsonType.Double;
-            inst_double = number;
-        }
-
-        public JsonData (int number)
-        {
-            type = JsonType.Int;
-            inst_int = number;
-        }
-
-        public JsonData (long number)
-        {
-            type = JsonType.Long;
-            inst_long = number;
-        }
-
-        public JsonData (object obj)
-        {
-            if (obj is Boolean) {
-                type = JsonType.Boolean;
-                inst_boolean = (bool) obj;
-                return;
-            }
-
-            if (obj is Double) {
-                type = JsonType.Double;
-                inst_double = (double) obj;
-                return;
-            }
-
-            if (obj is Int32) {
-                type = JsonType.Int;
-                inst_int = (int) obj;
-                return;
-            }
-
-            if (obj is Int64) {
-                type = JsonType.Long;
-                inst_long = (long) obj;
-                return;
-            }
-
-            if (obj is String) {
-                type = JsonType.String;
-                inst_string = (string) obj;
-                return;
-            }
-
-            throw new ArgumentException (
-                "Unable to wrap the given object with JsonData");
-        }
-
-        public JsonData (string str)
-        {
-            type = JsonType.String;
-            inst_string = str;
-        }
-        #endregion
-
-
-        #region Implicit Conversions
-        public static implicit operator JsonData (Boolean data)
-        {
-            return new JsonData (data);
-        }
-
-        public static implicit operator JsonData (Double data)
-        {
-            return new JsonData (data);
-        }
-
-        public static implicit operator JsonData (Int32 data)
-        {
-            return new JsonData (data);
-        }
-
-        public static implicit operator JsonData (Int64 data)
-        {
-            return new JsonData (data);
-        }
-
-        public static implicit operator JsonData (String data)
-        {
-            return new JsonData (data);
-        }
-        #endregion
-
-
-        #region Explicit Conversions
-        public static explicit operator Boolean (JsonData data)
-        {
-            if (data.type != JsonType.Boolean)
-                throw new InvalidCastException (
-                    "Instance of JsonData doesn't hold a double");
-
-            return data.inst_boolean;
-        }
-
-        public static explicit operator Double (JsonData data)
-        {
-            if (data.type != JsonType.Double)
-                throw new InvalidCastException (
-                    "Instance of JsonData doesn't hold a double");
-
-            return data.inst_double;
-        }
-
-        public static explicit operator Int32 (JsonData data)
-        {
-            if (data.type != JsonType.Int)
-                throw new InvalidCastException (
-                    "Instance of JsonData doesn't hold an int");
-
-            return data.inst_int;
-        }
-
-        public static explicit operator Int64 (JsonData data)
-        {
-            if (data.type != JsonType.Long)
-                throw new InvalidCastException (
-                    "Instance of JsonData doesn't hold an int");
-
-            return data.inst_long;
-        }
-
-        public static explicit operator String (JsonData data)
-        {
-            if (data.type != JsonType.String)
-                throw new InvalidCastException (
-                    "Instance of JsonData doesn't hold a string");
-
-            return data.inst_string;
-        }
-        #endregion
-
-
-        #region ICollection Methods
-        void ICollection.CopyTo (Array array, int index)
-        {
-            EnsureCollection ().CopyTo (array, index);
-        }
-        #endregion
-
-
-        #region IDictionary Methods
-        void IDictionary.Add (object key, object value)
-        {
-            JsonData data = ToJsonData (value);
-
-            EnsureDictionary ().Add (key, data);
-
-            KeyValuePair<string, JsonData> entry =
-                new KeyValuePair<string, JsonData> ((string) key, data);
-            object_list.Add (entry);
-
-            json = null;
-        }
-
-        void IDictionary.Clear ()
-        {
-            EnsureDictionary ().Clear ();
-            object_list.Clear ();
-            json = null;
-        }
-
-        bool IDictionary.Contains (object key)
-        {
-            return EnsureDictionary ().Contains (key);
-        }
-
-        IDictionaryEnumerator IDictionary.GetEnumerator ()
-        {
-            return ((IOrderedDictionary) this).GetEnumerator ();
-        }
-
-        void IDictionary.Remove (object key)
-        {
-            EnsureDictionary ().Remove (key);
-
-            for (int i = 0; i < object_list.Count; i++) {
-                if (object_list[i].Key == (string) key) {
-                    object_list.RemoveAt (i);
-                    break;
-                }
-            }
-
-            json = null;
-        }
-        #endregion
-
-
-        #region IEnumerable Methods
-        IEnumerator IEnumerable.GetEnumerator ()
-        {
-            return EnsureCollection ().GetEnumerator ();
-        }
-        #endregion
-
-
-        #region IJsonWrapper Methods
-        bool IJsonWrapper.GetBoolean ()
-        {
-            if (type != JsonType.Boolean)
-                throw new InvalidOperationException (
-                    "JsonData instance doesn't hold a boolean");
-
-            return inst_boolean;
-        }
-
-        double IJsonWrapper.GetDouble ()
-        {
-            if (type != JsonType.Double)
-                throw new InvalidOperationException (
-                    "JsonData instance doesn't hold a double");
-
-            return inst_double;
-        }
-
-        int IJsonWrapper.GetInt ()
-        {
-            if (type != JsonType.Int)
-                throw new InvalidOperationException (
-                    "JsonData instance doesn't hold an int");
-
-            return inst_int;
-        }
-
-        long IJsonWrapper.GetLong ()
-        {
-            if (type != JsonType.Long)
-                throw new InvalidOperationException (
-                    "JsonData instance doesn't hold a long");
-
-            return inst_long;
-        }
-
-        string IJsonWrapper.GetString ()
-        {
-            if (type != JsonType.String)
-                throw new InvalidOperationException (
-                    "JsonData instance doesn't hold a string");
-
-            return inst_string;
-        }
-
-        void IJsonWrapper.SetBoolean (bool val)
-        {
-            type = JsonType.Boolean;
-            inst_boolean = val;
-            json = null;
-        }
-
-        void IJsonWrapper.SetDouble (double val)
-        {
-            type = JsonType.Double;
-            inst_double = val;
-            json = null;
-        }
-
-        void IJsonWrapper.SetInt (int val)
-        {
-            type = JsonType.Int;
-            inst_int = val;
-            json = null;
-        }
-
-        void IJsonWrapper.SetLong (long val)
-        {
-            type = JsonType.Long;
-            inst_long = val;
-            json = null;
-        }
-
-        void IJsonWrapper.SetString (string val)
-        {
-            type = JsonType.String;
-            inst_string = val;
-            json = null;
-        }
-
-        string IJsonWrapper.ToJson ()
-        {
-            return ToJson ();
-        }
-
-        void IJsonWrapper.ToJson (JsonWriter writer)
-        {
-            ToJson (writer);
-        }
-        #endregion
-
-
-        #region IList Methods
-        int IList.Add (object value)
-        {
-            return Add (value);
-        }
-
-        void IList.Clear ()
-        {
-            EnsureList ().Clear ();
-            json = null;
-        }
-
-        bool IList.Contains (object value)
-        {
-            return EnsureList ().Contains (value);
-        }
-
-        int IList.IndexOf (object value)
-        {
-            return EnsureList ().IndexOf (value);
-        }
-
-        void IList.Insert (int index, object value)
-        {
-            EnsureList ().Insert (index, value);
-            json = null;
-        }
-
-        void IList.Remove (object value)
-        {
-            EnsureList ().Remove (value);
-            json = null;
-        }
-
-        void IList.RemoveAt (int index)
-        {
-            EnsureList ().RemoveAt (index);
-            json = null;
-        }
-        #endregion
-
-
-        #region IOrderedDictionary Methods
-        IDictionaryEnumerator IOrderedDictionary.GetEnumerator ()
-        {
-            EnsureDictionary ();
-
-            return new OrderedDictionaryEnumerator (
-                object_list.GetEnumerator ());
-        }
-
-        void IOrderedDictionary.Insert (int idx, object key, object value)
-        {
-            string property = (string) key;
-            JsonData data  = ToJsonData (value);
-
-            this[property] = data;
-
-            KeyValuePair<string, JsonData> entry =
-                new KeyValuePair<string, JsonData> (property, data);
-
-            object_list.Insert (idx, entry);
-        }
-
-        void IOrderedDictionary.RemoveAt (int idx)
-        {
-            EnsureDictionary ();
-
-            inst_object.Remove (object_list[idx].Key);
-            object_list.RemoveAt (idx);
-        }
-        #endregion
-
-
-        #region Private Methods
-        private ICollection EnsureCollection ()
-        {
-            if (type == JsonType.Array)
-                return (ICollection) inst_array;
-
-            if (type == JsonType.Object)
-                return (ICollection) inst_object;
-
-            throw new InvalidOperationException (
-                "The JsonData instance has to be initialized first");
-        }
-
-        private IDictionary EnsureDictionary ()
-        {
-            if (type == JsonType.Object)
-                return (IDictionary) inst_object;
-
-            if (type != JsonType.None)
-                throw new InvalidOperationException (
-                    "Instance of JsonData is not a dictionary");
-
-            type = JsonType.Object;
-            inst_object = new Dictionary<string, JsonData> ();
-            object_list = new List<KeyValuePair<string, JsonData>> ();
-
-            return (IDictionary) inst_object;
-        }
-
-        private IList EnsureList ()
-        {
-            if (type == JsonType.Array)
-                return (IList) inst_array;
-
-            if (type != JsonType.None)
-                throw new InvalidOperationException (
-                    "Instance of JsonData is not a list");
-
-            type = JsonType.Array;
-            inst_array = new List<JsonData> ();
-
-            return (IList) inst_array;
-        }
-
-        private JsonData ToJsonData (object obj)
-        {
-            if (obj == null)
-                return null;
-
-            if (obj is JsonData)
-                return (JsonData) obj;
-
-            return new JsonData (obj);
-        }
-
-        private static void WriteJson (IJsonWrapper obj, JsonWriter writer)
-        {
-            if (obj == null) {
-                writer.Write (null);
-                return;
-            }
-
-            if (obj.IsString) {
-                writer.Write (obj.GetString ());
-                return;
-            }
-
-            if (obj.IsBoolean) {
-                writer.Write (obj.GetBoolean ());
-                return;
-            }
-
-            if (obj.IsDouble) {
-                writer.Write (obj.GetDouble ());
-                return;
-            }
-
-            if (obj.IsInt) {
-                writer.Write (obj.GetInt ());
-                return;
-            }
-
-            if (obj.IsLong) {
-                writer.Write (obj.GetLong ());
-                return;
-            }
-
-            if (obj.IsArray) {
-                writer.WriteArrayStart ();
-                foreach (object elem in (IList) obj)
-                    WriteJson ((JsonData) elem, writer);
-                writer.WriteArrayEnd ();
-
-                return;
-            }
-
-            if (obj.IsObject) {
-                writer.WriteObjectStart ();
-
-                foreach (DictionaryEntry entry in ((IDictionary) obj)) {
-                    writer.WritePropertyName ((string) entry.Key);
-                    WriteJson ((JsonData) entry.Value, writer);
-                }
-                writer.WriteObjectEnd ();
-
-                return;
-            }
-        }
-        #endregion
-
-
-        public int Add (object value)
-        {
-            JsonData data = ToJsonData (value);
-
-            json = null;
-
-            return EnsureList ().Add (data);
-        }
-
-        public void Clear ()
-        {
-            if (IsObject) {
-                ((IDictionary) this).Clear ();
-                return;
-            }
-
-            if (IsArray) {
-                ((IList) this).Clear ();
-                return;
-            }
-        }
-
-        public bool Equals (JsonData x)
-        {
-            if (x == null)
-                return false;
-
-            if (x.type != this.type)
-                return false;
-
-            switch (this.type) {
-            case JsonType.None:
-                return true;
-
-            case JsonType.Object:
-                return this.inst_object.Equals (x.inst_object);
-
-            case JsonType.Array:
-                return this.inst_array.Equals (x.inst_array);
-
-            case JsonType.String:
-                return this.inst_string.Equals (x.inst_string);
-
-            case JsonType.Int:
-                return this.inst_int.Equals (x.inst_int);
-
-            case JsonType.Long:
-                return this.inst_long.Equals (x.inst_long);
-
-            case JsonType.Double:
-                return this.inst_double.Equals (x.inst_double);
-
-            case JsonType.Boolean:
-                return this.inst_boolean.Equals (x.inst_boolean);
-            }
-
-            return false;
-        }
-
-        public JsonType GetJsonType ()
-        {
-            return type;
-        }
-
-        public void SetJsonType (JsonType type)
-        {
-            if (this.type == type)
-                return;
-
-            switch (type) {
-            case JsonType.None:
-                break;
-
-            case JsonType.Object:
-                inst_object = new Dictionary<string, JsonData> ();
-                object_list = new List<KeyValuePair<string, JsonData>> ();
-                break;
-
-            case JsonType.Array:
-                inst_array = new List<JsonData> ();
-                break;
-
-            case JsonType.String:
-                inst_string = default (String);
-                break;
-
-            case JsonType.Int:
-                inst_int = default (Int32);
-                break;
-
-            case JsonType.Long:
-                inst_long = default (Int64);
-                break;
-
-            case JsonType.Double:
-                inst_double = default (Double);
-                break;
-
-            case JsonType.Boolean:
-                inst_boolean = default (Boolean);
-                break;
-            }
-
-            this.type = type;
-        }
-
-        public string ToJson ()
-        {
-            if (json != null)
-                return json;
-
-            StringWriter sw = new StringWriter ();
-            JsonWriter writer = new JsonWriter (sw);
-            writer.Validate = false;
-
-            WriteJson (this, writer);
-            json = sw.ToString ();
-
-            return json;
-        }
-
-        public void ToJson (JsonWriter writer)
-        {
-            bool old_validate = writer.Validate;
-
-            writer.Validate = false;
-
-            WriteJson (this, writer);
-
-            writer.Validate = old_validate;
-        }
-
-        public override string ToString ()
-        {
-            switch (type) {
-            case JsonType.Array:
-                return "JsonData array";
-
-            case JsonType.Boolean:
-                return inst_boolean.ToString ();
-
-            case JsonType.Double:
-                return inst_double.ToString ();
-
-            case JsonType.Int:
-                return inst_int.ToString ();
-
-            case JsonType.Long:
-                return inst_long.ToString ();
-
-            case JsonType.Object:
-                return "JsonData object";
-
-            case JsonType.String:
-                return inst_string;
-            }
-
-            return "Uninitialized JsonData";
-        }
-    }
-
-
-    internal class OrderedDictionaryEnumerator : IDictionaryEnumerator
-    {
-        IEnumerator<KeyValuePair<string, JsonData>> list_enumerator;
-
-
-        public object Current {
-            get { return Entry; }
-        }
-
-        public DictionaryEntry Entry {
-            get {
-                KeyValuePair<string, JsonData> curr = list_enumerator.Current;
-                return new DictionaryEntry (curr.Key, curr.Value);
-            }
-        }
-
-        public object Key {
-            get { return list_enumerator.Current.Key; }
-        }
-
-        public object Value {
-            get { return list_enumerator.Current.Value; }
-        }
-
-
-        public OrderedDictionaryEnumerator (
-            IEnumerator<KeyValuePair<string, JsonData>> enumerator)
-        {
-            list_enumerator = enumerator;
-        }
-
-
-        public bool MoveNext ()
-        {
-            return list_enumerator.MoveNext ();
-        }
-
-        public void Reset ()
-        {
-            list_enumerator.Reset ();
-        }
-    }
-}

+ 0 - 60
Unity/Hotfix/Base/LitJson/JsonException.cs

@@ -1,60 +0,0 @@
-#region Header
-/**
- * JsonException.cs
- *   Base class throwed by LitJSON when a parsing error occurs.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-
-
-namespace LitJson
-{
-    public class JsonException : ApplicationException
-    {
-        public JsonException () : base ()
-        {
-        }
-
-        internal JsonException (ParserToken token) :
-            base (String.Format (
-                    "Invalid token '{0}' in input string", token))
-        {
-        }
-
-        internal JsonException (ParserToken token,
-                                Exception inner_exception) :
-            base (String.Format (
-                    "Invalid token '{0}' in input string", token),
-                inner_exception)
-        {
-        }
-
-        internal JsonException (int c) :
-            base (String.Format (
-                    "Invalid character '{0}' in input string", (char) c))
-        {
-        }
-
-        internal JsonException (int c, Exception inner_exception) :
-            base (String.Format (
-                    "Invalid character '{0}' in input string", (char) c),
-                inner_exception)
-        {
-        }
-
-
-        public JsonException (string message) : base (message)
-        {
-        }
-
-        public JsonException (string message, Exception inner_exception) :
-            base (message, inner_exception)
-        {
-        }
-    }
-}

+ 0 - 1049
Unity/Hotfix/Base/LitJson/JsonMapper.cs

@@ -1,1049 +0,0 @@
-#region Header
-/**
- * JsonMapper.cs
- *   JSON to .Net object and object to JSON conversions.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Reflection;
-using ILRuntime.Runtime.Intepreter;
-using ILRuntime.Runtime.Stack;
-using ILRuntime.CLR.Method;
-using ILRuntime.CLR.Utils;
-
-namespace LitJson
-{
-    internal struct PropertyMetadata
-    {
-        public MemberInfo Info;
-        public bool       IsField;
-        public Type       Type;
-    }
-
-
-    internal struct ArrayMetadata
-    {
-        private Type element_type;
-        private bool is_array;
-        private bool is_list;
-
-
-        public Type ElementType {
-            get {
-                if (element_type == null)
-                    return typeof (JsonData);
-
-                return element_type;
-            }
-
-            set { element_type = value; }
-        }
-
-        public bool IsArray {
-            get { return is_array; }
-            set { is_array = value; }
-        }
-
-        public bool IsList {
-            get { return is_list; }
-            set { is_list = value; }
-        }
-    }
-
-
-    internal struct ObjectMetadata
-    {
-        private Type element_type;
-        private bool is_dictionary;
-
-        private IDictionary<string, PropertyMetadata> properties;
-
-
-        public Type ElementType {
-            get {
-                if (element_type == null)
-                    return typeof (JsonData);
-
-                return element_type;
-            }
-
-            set { element_type = value; }
-        }
-
-        public bool IsDictionary {
-            get { return is_dictionary; }
-            set { is_dictionary = value; }
-        }
-
-        public IDictionary<string, PropertyMetadata> Properties {
-            get { return properties; }
-            set { properties = value; }
-        }
-    }
-
-
-    internal delegate void ExporterFunc    (object obj, JsonWriter writer);
-    public   delegate void ExporterFunc<T> (T obj, JsonWriter writer);
-
-    internal delegate object ImporterFunc                (object input);
-    public   delegate TValue ImporterFunc<TJson, TValue> (TJson input);
-
-    public delegate IJsonWrapper WrapperFactory ();
-
-
-    public class JsonMapper
-    {
-        #region Fields
-        private static int max_nesting_depth;
-
-        private static IFormatProvider datetime_format;
-
-        private static IDictionary<Type, ExporterFunc> base_exporters_table;
-        private static IDictionary<Type, ExporterFunc> custom_exporters_table;
-
-        private static IDictionary<Type,
-                IDictionary<Type, ImporterFunc>> base_importers_table;
-        private static IDictionary<Type,
-                IDictionary<Type, ImporterFunc>> custom_importers_table;
-
-        private static IDictionary<Type, ArrayMetadata> array_metadata;
-        private static readonly object array_metadata_lock = new Object ();
-
-        private static IDictionary<Type,
-                IDictionary<Type, MethodInfo>> conv_ops;
-        private static readonly object conv_ops_lock = new Object ();
-
-        private static IDictionary<Type, ObjectMetadata> object_metadata;
-        private static readonly object object_metadata_lock = new Object ();
-
-        private static IDictionary<Type,
-                IList<PropertyMetadata>> type_properties;
-        private static readonly object type_properties_lock = new Object ();
-
-        private static JsonWriter      static_writer;
-        private static readonly object static_writer_lock = new Object ();
-        #endregion
-
-
-        #region Constructors
-        static JsonMapper ()
-        {
-            max_nesting_depth = 100;
-
-            array_metadata = new Dictionary<Type, ArrayMetadata> ();
-            conv_ops = new Dictionary<Type, IDictionary<Type, MethodInfo>> ();
-            object_metadata = new Dictionary<Type, ObjectMetadata> ();
-            type_properties = new Dictionary<Type,
-                            IList<PropertyMetadata>> ();
-
-            static_writer = new JsonWriter ();
-
-            datetime_format = DateTimeFormatInfo.InvariantInfo;
-
-            base_exporters_table   = new Dictionary<Type, ExporterFunc> ();
-            custom_exporters_table = new Dictionary<Type, ExporterFunc> ();
-
-            base_importers_table = new Dictionary<Type,
-                                 IDictionary<Type, ImporterFunc>> ();
-            custom_importers_table = new Dictionary<Type,
-                                   IDictionary<Type, ImporterFunc>> ();
-
-            RegisterBaseExporters ();
-            RegisterBaseImporters ();
-        }
-        #endregion
-
-
-        #region Private Methods
-        private static void AddArrayMetadata (Type type)
-        {
-            if (array_metadata.ContainsKey (type))
-                return;
-
-            ArrayMetadata data = new ArrayMetadata ();
-
-            data.IsArray = type.IsArray;
-
-            if (type.GetInterface ("System.Collections.IList") != null)
-                data.IsList = true;
-
-            if (type is ILRuntime.Reflection.ILRuntimeWrapperType)
-            {
-                var wt = (ILRuntime.Reflection.ILRuntimeWrapperType)type;
-                if (data.IsArray)
-                {
-                    data.ElementType = wt.CLRType.ElementType.ReflectionType; 
-                }
-                else
-                {
-                    data.ElementType = wt.CLRType.GenericArguments[0].Value.ReflectionType;
-                }
-            }
-            else
-            {
-                foreach (PropertyInfo p_info in type.GetProperties())
-                {
-                    if (p_info.Name != "Item")
-                        continue;
-
-                    ParameterInfo[] parameters = p_info.GetIndexParameters();
-
-                    if (parameters.Length != 1)
-                        continue;
-
-                    if (parameters[0].ParameterType == typeof(int))
-                        data.ElementType = p_info.PropertyType;
-                }
-            }
-            lock (array_metadata_lock) {
-                try {
-                    array_metadata.Add (type, data);
-                } catch (ArgumentException) {
-                    return;
-                }
-            }
-        }
-
-        private static void AddObjectMetadata (Type type)
-        {
-            if (object_metadata.ContainsKey (type))
-                return;
-
-            ObjectMetadata data = new ObjectMetadata ();
-
-            if (type.GetInterface ("System.Collections.IDictionary") != null)
-                data.IsDictionary = true;
-
-            data.Properties = new Dictionary<string, PropertyMetadata> ();
-            foreach (PropertyInfo p_info in type.GetProperties ()) {
-                if (p_info.Name == "Item") {
-                    ParameterInfo[] parameters = p_info.GetIndexParameters ();
-
-                    if (parameters.Length != 1)
-                        continue;
-
-                    if (parameters[0].ParameterType == typeof(string))
-                    {
-                        if (type is ILRuntime.Reflection.ILRuntimeWrapperType)
-                        {
-                            data.ElementType = ((ILRuntime.Reflection.ILRuntimeWrapperType)type).CLRType.GenericArguments[1].Value.ReflectionType;
-                        }
-                        else
-                            data.ElementType = p_info.PropertyType;
-                    }
-
-                    continue;
-                }
-
-                PropertyMetadata p_data = new PropertyMetadata ();
-                p_data.Info = p_info;
-                p_data.Type = p_info.PropertyType;
-
-                data.Properties.Add (p_info.Name, p_data);
-            }
-
-            foreach (FieldInfo f_info in type.GetFields ()) {
-                PropertyMetadata p_data = new PropertyMetadata ();
-                p_data.Info = f_info;
-                p_data.IsField = true;
-                p_data.Type = f_info.FieldType;
-
-                data.Properties.Add (f_info.Name, p_data);
-            }
-
-            lock (object_metadata_lock) {
-                try {
-                    object_metadata.Add (type, data);
-                } catch (ArgumentException) {
-                    return;
-                }
-            }
-        }
-
-        private static void AddTypeProperties (Type type)
-        {
-            if (type_properties.ContainsKey (type))
-                return;
-
-            IList<PropertyMetadata> props = new List<PropertyMetadata> ();
-
-            foreach (PropertyInfo p_info in type.GetProperties ()) {
-                if (p_info.Name == "Item")
-                    continue;
-
-                PropertyMetadata p_data = new PropertyMetadata ();
-                p_data.Info = p_info;
-                p_data.IsField = false;
-                props.Add (p_data);
-            }
-
-            foreach (FieldInfo f_info in type.GetFields ()) {
-                PropertyMetadata p_data = new PropertyMetadata ();
-                p_data.Info = f_info;
-                p_data.IsField = true;
-
-                props.Add (p_data);
-            }
-
-            lock (type_properties_lock) {
-                try {
-                    type_properties.Add (type, props);
-                } catch (ArgumentException) {
-                    return;
-                }
-            }
-        }
-
-        private static MethodInfo GetConvOp (Type t1, Type t2)
-        {
-            lock (conv_ops_lock) {
-                if (! conv_ops.ContainsKey (t1))
-                    conv_ops.Add (t1, new Dictionary<Type, MethodInfo> ());
-            }
-
-            if (conv_ops[t1].ContainsKey (t2))
-                return conv_ops[t1][t2];
-
-            MethodInfo op = t1.GetMethod (
-                "op_Implicit", new Type[] { t2 });
-
-            lock (conv_ops_lock) {
-                try {
-                    conv_ops[t1].Add (t2, op);
-                } catch (ArgumentException) {
-                    return conv_ops[t1][t2];
-                }
-            }
-
-            return op;
-        }
-
-        private static object ReadValue (Type inst_type, JsonReader reader)
-        {
-            reader.Read ();
-
-            if (reader.Token == JsonToken.ArrayEnd)
-                return null;
-
-            //ILRuntime doesn't support nullable valuetype
-            Type underlying_type = inst_type;//Nullable.GetUnderlyingType(inst_type);
-            Type value_type = inst_type;
-
-            if (reader.Token == JsonToken.Null) {
-                if (inst_type.IsClass || underlying_type != null) {
-                    return null;
-                }
-
-                throw new JsonException (String.Format (
-                            "Can't assign null to an instance of type {0}",
-                            inst_type));
-            }
-
-            if (reader.Token == JsonToken.Double ||
-                reader.Token == JsonToken.Int ||
-                reader.Token == JsonToken.Long ||
-                reader.Token == JsonToken.String ||
-                reader.Token == JsonToken.Boolean) {
-
-                Type json_type = reader.Value.GetType();
-                var vt = value_type is ILRuntime.Reflection.ILRuntimeWrapperType ? ((ILRuntime.Reflection.ILRuntimeWrapperType)value_type).CLRType.TypeForCLR : value_type;
-
-                if (vt.IsAssignableFrom(json_type))
-                    return reader.Value;
-                if (vt is ILRuntime.Reflection.ILRuntimeType && ((ILRuntime.Reflection.ILRuntimeType)vt).ILType.IsEnum)
-                {
-                    if (json_type == typeof(int) || json_type == typeof(long) || json_type == typeof(short) || json_type == typeof(byte))
-                        return reader.Value;
-                }
-                // If there's a custom importer that fits, use it
-                if (custom_importers_table.ContainsKey (json_type) &&
-                    custom_importers_table[json_type].ContainsKey (
-                        vt)) {
-
-                    ImporterFunc importer =
-                        custom_importers_table[json_type][vt];
-
-                    return importer (reader.Value);
-                }
-
-                // Maybe there's a base importer that works
-                if (base_importers_table.ContainsKey (json_type) &&
-                    base_importers_table[json_type].ContainsKey (
-                        vt)) {
-
-                    ImporterFunc importer =
-                        base_importers_table[json_type][vt];
-
-                    return importer (reader.Value);
-                }
-
-                // Maybe it's an enum
-                if (vt.IsEnum)
-                    return Enum.ToObject (vt, reader.Value);
-
-                // Try using an implicit conversion operator
-                MethodInfo conv_op = GetConvOp (vt, json_type);
-
-                if (conv_op != null)
-                    return conv_op.Invoke (null,
-                                           new object[] { reader.Value });
-
-                // No luck
-                throw new JsonException (String.Format (
-                        "Can't assign value '{0}' (type {1}) to type {2}",
-                        reader.Value, json_type, inst_type));
-            }
-
-            object instance = null;
-
-            if (reader.Token == JsonToken.ArrayStart) {
-
-                AddArrayMetadata (inst_type);
-                ArrayMetadata t_data = array_metadata[inst_type];
-
-                if (! t_data.IsArray && ! t_data.IsList)
-                    throw new JsonException (String.Format (
-                            "Type {0} can't act as an array",
-                            inst_type));
-
-                IList list;
-                Type elem_type;
-
-                if (! t_data.IsArray) {
-                    list = (IList) Activator.CreateInstance (inst_type);
-                    elem_type = t_data.ElementType;
-                } else {
-                    list = new ArrayList ();
-                    elem_type = inst_type.GetElementType ();
-                }
-
-                while (true) {
-                    object item = ReadValue (elem_type, reader);
-                    if (item == null && reader.Token == JsonToken.ArrayEnd)
-                        break;
-                    var rt = elem_type is ILRuntime.Reflection.ILRuntimeWrapperType ? ((ILRuntime.Reflection.ILRuntimeWrapperType)elem_type).RealType : elem_type;
-                    item = rt.CheckCLRTypes(item);
-                    list.Add (item);
-                }
-
-                if (t_data.IsArray) {
-                    int n = list.Count;
-                    instance = Array.CreateInstance (elem_type, n);
-
-                    for (int i = 0; i < n; i++)
-                        ((Array) instance).SetValue (list[i], i);
-                } else
-                    instance = list;
-
-            } else if (reader.Token == JsonToken.ObjectStart) {
-                AddObjectMetadata (value_type);
-                ObjectMetadata t_data = object_metadata[value_type];
-                if (value_type is ILRuntime.Reflection.ILRuntimeType)
-                    instance = ((ILRuntime.Reflection.ILRuntimeType)value_type).ILType.Instantiate();
-                else
-                    instance = Activator.CreateInstance(value_type);
-                
-                while (true) {
-                    reader.Read ();
-
-                    if (reader.Token == JsonToken.ObjectEnd)
-                        break;
-
-                    string property = (string) reader.Value;
-
-                    if (t_data.Properties.ContainsKey (property)) {
-                        PropertyMetadata prop_data =
-                            t_data.Properties[property];
-
-                        if (prop_data.IsField) {
-                            ((FieldInfo) prop_data.Info).SetValue (
-                                instance, ReadValue (prop_data.Type, reader));
-                        } else {
-                            PropertyInfo p_info =
-                                (PropertyInfo) prop_data.Info;
-
-                            if (p_info.CanWrite)
-                                p_info.SetValue (
-                                    instance,
-                                    ReadValue (prop_data.Type, reader),
-                                    null);
-                            else
-                                ReadValue (prop_data.Type, reader);
-                        }
-
-                    } else {
-                        if (! t_data.IsDictionary) {
-
-                            if (! reader.SkipNonMembers) {
-                                throw new JsonException (String.Format (
-                                        "The type {0} doesn't have the " +
-                                        "property '{1}'",
-                                        inst_type, property));
-                            } else {
-                                ReadSkip (reader);
-                                continue;
-                            }
-                        }
-
-                        var rt = t_data.ElementType is ILRuntime.Reflection.ILRuntimeWrapperType ? ((ILRuntime.Reflection.ILRuntimeWrapperType)t_data.ElementType).RealType : t_data.ElementType;
-                        ((IDictionary) instance).Add (
-                            property, rt.CheckCLRTypes(ReadValue (
-                                t_data.ElementType, reader)));
-                    }
-
-                }
-
-            }
-
-            return instance;
-        }
-
-        private static IJsonWrapper ReadValue (WrapperFactory factory,
-                                               JsonReader reader)
-        {
-            reader.Read ();
-
-            if (reader.Token == JsonToken.ArrayEnd ||
-                reader.Token == JsonToken.Null)
-                return null;
-
-            IJsonWrapper instance = factory ();
-
-            if (reader.Token == JsonToken.String) {
-                instance.SetString ((string) reader.Value);
-                return instance;
-            }
-
-            if (reader.Token == JsonToken.Double) {
-                instance.SetDouble ((double) reader.Value);
-                return instance;
-            }
-
-            if (reader.Token == JsonToken.Int) {
-                instance.SetInt ((int) reader.Value);
-                return instance;
-            }
-
-            if (reader.Token == JsonToken.Long) {
-                instance.SetLong ((long) reader.Value);
-                return instance;
-            }
-
-            if (reader.Token == JsonToken.Boolean) {
-                instance.SetBoolean ((bool) reader.Value);
-                return instance;
-            }
-
-            if (reader.Token == JsonToken.ArrayStart) {
-                instance.SetJsonType (JsonType.Array);
-
-                while (true) {
-                    IJsonWrapper item = ReadValue (factory, reader);
-                    if (item == null && reader.Token == JsonToken.ArrayEnd)
-                        break;
-
-                    ((IList) instance).Add (item);
-                }
-            }
-            else if (reader.Token == JsonToken.ObjectStart) {
-                instance.SetJsonType (JsonType.Object);
-
-                while (true) {
-                    reader.Read ();
-
-                    if (reader.Token == JsonToken.ObjectEnd)
-                        break;
-
-                    string property = (string) reader.Value;
-
-                    ((IDictionary) instance)[property] = ReadValue (
-                        factory, reader);
-                }
-
-            }
-
-            return instance;
-        }
-
-        private static void ReadSkip (JsonReader reader)
-        {
-            ToWrapper (
-                delegate { return new JsonMockWrapper (); }, reader);
-        }
-
-        private static void RegisterBaseExporters ()
-        {
-            base_exporters_table[typeof (byte)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToInt32 ((byte) obj));
-                };
-
-            base_exporters_table[typeof (char)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToString ((char) obj));
-                };
-
-            base_exporters_table[typeof (DateTime)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToString ((DateTime) obj,
-                                                    datetime_format));
-                };
-
-            base_exporters_table[typeof (decimal)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write ((decimal) obj);
-                };
-
-            base_exporters_table[typeof (sbyte)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToInt32 ((sbyte) obj));
-                };
-
-            base_exporters_table[typeof (short)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToInt32 ((short) obj));
-                };
-
-            base_exporters_table[typeof (ushort)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToInt32 ((ushort) obj));
-                };
-
-            base_exporters_table[typeof (uint)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write (Convert.ToUInt64 ((uint) obj));
-                };
-
-            base_exporters_table[typeof (ulong)] =
-                delegate (object obj, JsonWriter writer) {
-                    writer.Write ((ulong) obj);
-                };
-        }
-
-        private static void RegisterBaseImporters ()
-        {
-            ImporterFunc importer;
-
-            importer = delegate (object input) {
-                return Convert.ToByte ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (byte), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToUInt64 ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (ulong), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToSByte ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (sbyte), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToInt16 ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (short), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToInt64((int)input);
-            };
-            RegisterImporter(base_importers_table, typeof(int),
-                              typeof(long), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToUInt16 ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (ushort), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToUInt32 ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (uint), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToSingle ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (float), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToDouble ((int) input);
-            };
-            RegisterImporter (base_importers_table, typeof (int),
-                              typeof (double), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToDecimal ((double) input);
-            };
-            RegisterImporter (base_importers_table, typeof (double),
-                              typeof (decimal), importer);
-
-
-            importer = delegate (object input) {
-                return Convert.ToUInt32 ((long) input);
-            };
-            RegisterImporter (base_importers_table, typeof (long),
-                              typeof (uint), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToChar ((string) input);
-            };
-            RegisterImporter (base_importers_table, typeof (string),
-                              typeof (char), importer);
-
-            importer = delegate (object input) {
-                return Convert.ToDateTime ((string) input, datetime_format);
-            };
-            RegisterImporter (base_importers_table, typeof (string),
-                              typeof (DateTime), importer);
-        }
-
-        private static void RegisterImporter (
-            IDictionary<Type, IDictionary<Type, ImporterFunc>> table,
-            Type json_type, Type value_type, ImporterFunc importer)
-        {
-            if (! table.ContainsKey (json_type))
-                table.Add (json_type, new Dictionary<Type, ImporterFunc> ());
-
-            table[json_type][value_type] = importer;
-        }
-
-        private static void WriteValue (object obj, JsonWriter writer,
-                                        bool writer_is_private,
-                                        int depth)
-        {
-            if (depth > max_nesting_depth)
-                throw new JsonException (
-                    String.Format ("Max allowed object depth reached while " +
-                                   "trying to export from type {0}",
-                                   obj.GetType ()));
-
-            if (obj == null) {
-                writer.Write (null);
-                return;
-            }
-
-            if (obj is IJsonWrapper) {
-                if (writer_is_private)
-                    writer.TextWriter.Write (((IJsonWrapper) obj).ToJson ());
-                else
-                    ((IJsonWrapper) obj).ToJson (writer);
-
-                return;
-            }
-
-            if (obj is String) {
-                writer.Write ((string) obj);
-                return;
-            }
-
-            if (obj is Double) {
-                writer.Write ((double) obj);
-                return;
-            }
-
-            if (obj is Int32) {
-                writer.Write ((int) obj);
-                return;
-            }
-
-            if (obj is Boolean) {
-                writer.Write ((bool) obj);
-                return;
-            }
-
-            if (obj is Int64) {
-                writer.Write ((long) obj);
-                return;
-            }
-
-            if (obj is Array) {
-                writer.WriteArrayStart ();
-
-                foreach (object elem in (Array) obj)
-                    WriteValue (elem, writer, writer_is_private, depth + 1);
-
-                writer.WriteArrayEnd ();
-
-                return;
-            }
-
-            if (obj is IList) {
-                writer.WriteArrayStart ();
-                foreach (object elem in (IList) obj)
-                    WriteValue (elem, writer, writer_is_private, depth + 1);
-                writer.WriteArrayEnd ();
-
-                return;
-            }
-
-            if (obj is IDictionary) {
-                writer.WriteObjectStart ();
-                foreach (DictionaryEntry entry in (IDictionary) obj) {
-                    writer.WritePropertyName ((string) entry.Key);
-                    WriteValue (entry.Value, writer, writer_is_private,
-                                depth + 1);
-                }
-                writer.WriteObjectEnd ();
-
-                return;
-            }
-
-            Type obj_type;
-            if (obj is ILRuntime.Runtime.Intepreter.ILTypeInstance)
-            {
-                obj_type = ((ILRuntime.Runtime.Intepreter.ILTypeInstance)obj).Type.ReflectionType;
-            }
-            else if(obj is ILRuntime.Runtime.Enviorment.CrossBindingAdaptorType)
-            {
-                obj_type = ((ILRuntime.Runtime.Enviorment.CrossBindingAdaptorType)obj).ILInstance.Type.ReflectionType;
-            }
-            else
-                obj_type = obj.GetType();
-
-            // See if there's a custom exporter for the object
-            if (custom_exporters_table.ContainsKey (obj_type)) {
-                ExporterFunc exporter = custom_exporters_table[obj_type];
-                exporter (obj, writer);
-
-                return;
-            }
-
-            // If not, maybe there's a base exporter
-            if (base_exporters_table.ContainsKey (obj_type)) {
-                ExporterFunc exporter = base_exporters_table[obj_type];
-                exporter (obj, writer);
-
-                return;
-            }
-
-            // Last option, let's see if it's an enum
-            if (obj is Enum) {
-                Type e_type = Enum.GetUnderlyingType (obj_type);
-
-                if (e_type == typeof (long)
-                    || e_type == typeof (uint)
-                    || e_type == typeof (ulong))
-                    writer.Write ((ulong) obj);
-                else
-                    writer.Write ((int) obj);
-
-                return;
-            }
-
-            // Okay, so it looks like the input should be exported as an
-            // object
-            AddTypeProperties (obj_type);
-            IList<PropertyMetadata> props = type_properties[obj_type];
-
-            writer.WriteObjectStart ();
-            foreach (PropertyMetadata p_data in props) {
-                if (p_data.IsField) {
-                    writer.WritePropertyName (p_data.Info.Name);
-                    WriteValue (((FieldInfo) p_data.Info).GetValue (obj),
-                                writer, writer_is_private, depth + 1);
-                }
-                else {
-                    PropertyInfo p_info = (PropertyInfo) p_data.Info;
-
-                    if (p_info.CanRead) {
-                        writer.WritePropertyName (p_data.Info.Name);
-                        WriteValue (p_info.GetValue (obj, null),
-                                    writer, writer_is_private, depth + 1);
-                    }
-                }
-            }
-            writer.WriteObjectEnd ();
-        }
-        #endregion
-
-
-        public static string ToJson (object obj)
-        {
-            lock (static_writer_lock) {
-                static_writer.Reset ();
-
-                WriteValue (obj, static_writer, true, 0);
-
-                return static_writer.ToString ();
-            }
-        }
-
-        public static void ToJson (object obj, JsonWriter writer)
-        {
-            WriteValue (obj, writer, false, 0);
-        }
-
-        public static JsonData ToObject (JsonReader reader)
-        {
-            return (JsonData) ToWrapper (
-                delegate { return new JsonData (); }, reader);
-        }
-
-        public static JsonData ToObject (TextReader reader)
-        {
-            JsonReader json_reader = new JsonReader (reader);
-
-            return (JsonData) ToWrapper (
-                delegate { return new JsonData (); }, json_reader);
-        }
-
-        public static JsonData ToObject (string json)
-        {
-            return (JsonData) ToWrapper (
-                delegate { return new JsonData (); }, json);
-        }
-
-        public static T ToObject<T> (JsonReader reader)
-        {
-            return (T) ReadValue (typeof (T), reader);
-        }
-
-        public static T ToObject<T> (TextReader reader)
-        {
-            JsonReader json_reader = new JsonReader (reader);
-
-            return (T) ReadValue (typeof (T), json_reader);
-        }
-
-        public static T ToObject<T> (string json)
-        {
-            JsonReader reader = new JsonReader (json);
-
-            return (T) ReadValue (typeof (T), reader);
-        }
-
-	    public static object ToObject(Type type, string json)
-	    {
-		    JsonReader reader = new JsonReader(json);
-
-		    return ReadValue(type, reader);
-	    }
-
-		public static IJsonWrapper ToWrapper (WrapperFactory factory,
-                                              JsonReader reader)
-        {
-            return ReadValue (factory, reader);
-        }
-
-        public static IJsonWrapper ToWrapper (WrapperFactory factory,
-                                              string json)
-        {
-            JsonReader reader = new JsonReader (json);
-
-            return ReadValue (factory, reader);
-        }
-
-        public static void RegisterExporter<T> (ExporterFunc<T> exporter)
-        {
-            ExporterFunc exporter_wrapper =
-                delegate (object obj, JsonWriter writer) {
-                    exporter ((T) obj, writer);
-                };
-
-            custom_exporters_table[typeof (T)] = exporter_wrapper;
-        }
-
-        public static void RegisterImporter<TJson, TValue> (
-            ImporterFunc<TJson, TValue> importer)
-        {
-            ImporterFunc importer_wrapper =
-                delegate (object input) {
-                    return importer ((TJson) input);
-                };
-
-            RegisterImporter (custom_importers_table, typeof (TJson),
-                              typeof (TValue), importer_wrapper);
-        }
-
-        public static void UnregisterExporters ()
-        {
-            custom_exporters_table.Clear ();
-        }
-
-        public static void UnregisterImporters ()
-        {
-            custom_importers_table.Clear ();
-        }
-
-        public unsafe static void RegisterILRuntimeCLRRedirection(ILRuntime.Runtime.Enviorment.AppDomain appdomain)
-        {
-            foreach(var i in typeof(JsonMapper).GetMethods())
-            {
-                if(i.Name == "ToObject" && i.IsGenericMethodDefinition)
-                {
-                    var param = i.GetParameters();
-                    if(param[0].ParameterType == typeof(string))
-                    {
-                        appdomain.RegisterCLRMethodRedirection(i, JsonToObject);
-                    }
-                    else if(param[0].ParameterType == typeof(JsonReader))
-                    {
-                        appdomain.RegisterCLRMethodRedirection(i, JsonToObject2);
-                    }
-                    else if (param[0].ParameterType == typeof(TextReader))
-                    {
-                        appdomain.RegisterCLRMethodRedirection(i, JsonToObject3);
-                    }
-                }
-            }
-        }
-
-        public unsafe static StackObject* JsonToObject(ILIntepreter intp, StackObject* esp, List<object> mStack, CLRMethod method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(esp, 1);
-            ptr_of_this_method = ILIntepreter.Minus(esp, 1);
-            System.String json = (System.String)typeof(System.String).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, mStack));
-            intp.Free(ptr_of_this_method);
-            var type = method.GenericArguments[0].ReflectionType;
-            var result_of_this_method = ReadValue(type, new JsonReader(json));
-
-            return ILIntepreter.PushObject(__ret, mStack, result_of_this_method);
-        }
-
-        public unsafe static StackObject* JsonToObject2(ILIntepreter intp, StackObject* esp, List<object> mStack, CLRMethod method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(esp, 1);
-            ptr_of_this_method = ILIntepreter.Minus(esp, 1);
-            JsonReader json = (JsonReader)typeof(JsonReader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, mStack));
-            intp.Free(ptr_of_this_method);
-            var type = method.GenericArguments[0].ReflectionType;
-            var result_of_this_method = ReadValue(type, json);
-
-            return ILIntepreter.PushObject(__ret, mStack, result_of_this_method);
-        }
-
-        public unsafe static StackObject* JsonToObject3(ILIntepreter intp, StackObject* esp, List<object> mStack, CLRMethod method, bool isNewObj)
-        {
-            ILRuntime.Runtime.Enviorment.AppDomain __domain = intp.AppDomain;
-            StackObject* ptr_of_this_method;
-            StackObject* __ret = ILIntepreter.Minus(esp, 1);
-            ptr_of_this_method = ILIntepreter.Minus(esp, 1);
-            TextReader json = (TextReader)typeof(TextReader).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, mStack));
-            intp.Free(ptr_of_this_method);
-            var type = method.GenericArguments[0].ReflectionType;
-            var result_of_this_method = ReadValue(type, new JsonReader(json));
-
-            return ILIntepreter.PushObject(__ret, mStack, result_of_this_method);
-        }
-    }
-}

+ 0 - 105
Unity/Hotfix/Base/LitJson/JsonMockWrapper.cs

@@ -1,105 +0,0 @@
-#region Header
-/**
- * JsonMockWrapper.cs
- *   Mock object implementing IJsonWrapper, to facilitate actions like
- *   skipping data more efficiently.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections;
-using System.Collections.Specialized;
-
-
-namespace LitJson
-{
-    public class JsonMockWrapper : IJsonWrapper
-    {
-        public bool IsArray   { get { return false; } }
-        public bool IsBoolean { get { return false; } }
-        public bool IsDouble  { get { return false; } }
-        public bool IsInt     { get { return false; } }
-        public bool IsLong    { get { return false; } }
-        public bool IsObject  { get { return false; } }
-        public bool IsString  { get { return false; } }
-
-        public bool     GetBoolean ()  { return false; }
-        public double   GetDouble ()   { return 0.0; }
-        public int      GetInt ()      { return 0; }
-        public JsonType GetJsonType () { return JsonType.None; }
-        public long     GetLong ()     { return 0L; }
-        public string   GetString ()   { return ""; }
-
-        public void SetBoolean  (bool val)      {}
-        public void SetDouble   (double val)    {}
-        public void SetInt      (int val)       {}
-        public void SetJsonType (JsonType type) {}
-        public void SetLong     (long val)      {}
-        public void SetString   (string val)    {}
-
-        public string ToJson ()                  { return ""; }
-        public void   ToJson (JsonWriter writer) {}
-
-
-        bool IList.IsFixedSize { get { return true; } }
-        bool IList.IsReadOnly  { get { return true; } }
-
-        object IList.this[int index] {
-            get { return null; }
-            set {}
-        }
-
-        int  IList.Add (object value)       { return 0; }
-        void IList.Clear ()                 {}
-        bool IList.Contains (object value)  { return false; }
-        int  IList.IndexOf (object value)   { return -1; }
-        void IList.Insert (int i, object v) {}
-        void IList.Remove (object value)    {}
-        void IList.RemoveAt (int index)     {}
-
-
-        int    ICollection.Count          { get { return 0; } }
-        bool   ICollection.IsSynchronized { get { return false; } }
-        object ICollection.SyncRoot       { get { return null; } }
-
-        void ICollection.CopyTo (Array array, int index) {}
-
-
-        IEnumerator IEnumerable.GetEnumerator () { return null; }
-
-
-        bool IDictionary.IsFixedSize { get { return true; } }
-        bool IDictionary.IsReadOnly  { get { return true; } }
-
-        ICollection IDictionary.Keys   { get { return null; } }
-        ICollection IDictionary.Values { get { return null; } }
-
-        object IDictionary.this[object key] {
-            get { return null; }
-            set {}
-        }
-
-        void IDictionary.Add (object k, object v) {}
-        void IDictionary.Clear ()                 {}
-        bool IDictionary.Contains (object key)    { return false; }
-        void IDictionary.Remove (object key)      {}
-
-        IDictionaryEnumerator IDictionary.GetEnumerator () { return null; }
-
-
-        object IOrderedDictionary.this[int idx] {
-            get { return null; }
-            set {}
-        }
-
-        IDictionaryEnumerator IOrderedDictionary.GetEnumerator () {
-            return null;
-        }
-        void IOrderedDictionary.Insert   (int i, object k, object v) {}
-        void IOrderedDictionary.RemoveAt (int i) {}
-    }
-}

+ 0 - 472
Unity/Hotfix/Base/LitJson/JsonReader.cs

@@ -1,472 +0,0 @@
-#region Header
-/**
- * JsonReader.cs
- *   Stream-like access to JSON text.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-
-namespace LitJson
-{
-    public enum JsonToken
-    {
-        None,
-
-        ObjectStart,
-        PropertyName,
-        ObjectEnd,
-
-        ArrayStart,
-        ArrayEnd,
-
-        Int,
-        Long,
-        Double,
-
-        String,
-
-        Boolean,
-        Null
-    }
-
-
-    public class JsonReader
-    {
-        #region Fields
-        private static IDictionary<int, IDictionary<int, int[]>> parse_table;
-
-        private Stack<int>    automaton_stack;
-        private int           current_input;
-        private int           current_symbol;
-        private bool          end_of_json;
-        private bool          end_of_input;
-        private Lexer         lexer;
-        private bool          parser_in_string;
-        private bool          parser_return;
-        private bool          read_started;
-        private TextReader    reader;
-        private bool          reader_is_owned;
-        private bool          skip_non_members;
-        private object        token_value;
-        private JsonToken     token;
-        #endregion
-
-
-        #region Public Properties
-        public bool AllowComments {
-            get { return lexer.AllowComments; }
-            set { lexer.AllowComments = value; }
-        }
-
-        public bool AllowSingleQuotedStrings {
-            get { return lexer.AllowSingleQuotedStrings; }
-            set { lexer.AllowSingleQuotedStrings = value; }
-        }
-
-        public bool SkipNonMembers {
-            get { return skip_non_members; }
-            set { skip_non_members = value; }
-        }
-
-        public bool EndOfInput {
-            get { return end_of_input; }
-        }
-
-        public bool EndOfJson {
-            get { return end_of_json; }
-        }
-
-        public JsonToken Token {
-            get { return token; }
-        }
-
-        public object Value {
-            get { return token_value; }
-        }
-        #endregion
-
-
-        #region Constructors
-        static JsonReader ()
-        {
-            PopulateParseTable ();
-        }
-
-        public JsonReader (string json_text) :
-            this (new StringReader (json_text), true)
-        {
-        }
-
-        public JsonReader (TextReader reader) :
-            this (reader, false)
-        {
-        }
-
-        private JsonReader (TextReader reader, bool owned)
-        {
-            if (reader == null)
-                throw new ArgumentNullException ("reader");
-
-            parser_in_string = false;
-            parser_return    = false;
-
-            read_started = false;
-            automaton_stack = new Stack<int> ();
-            automaton_stack.Push ((int) ParserToken.End);
-            automaton_stack.Push ((int) ParserToken.Text);
-
-            lexer = new Lexer (reader);
-
-            end_of_input = false;
-            end_of_json  = false;
-
-            skip_non_members = true;
-
-            this.reader = reader;
-            reader_is_owned = owned;
-        }
-        #endregion
-
-
-        #region Static Methods
-        private static void PopulateParseTable ()
-        {
-            // See section A.2. of the manual for details
-            parse_table = new Dictionary<int, IDictionary<int, int[]>> ();
-
-            TableAddRow (ParserToken.Array);
-            TableAddCol (ParserToken.Array, '[',
-                         '[',
-                         (int) ParserToken.ArrayPrime);
-
-            TableAddRow (ParserToken.ArrayPrime);
-            TableAddCol (ParserToken.ArrayPrime, '"',
-                         (int) ParserToken.Value,
-
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, '[',
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, ']',
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, '{',
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Number,
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.True,
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.False,
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-            TableAddCol (ParserToken.ArrayPrime, (int) ParserToken.Null,
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest,
-                         ']');
-
-            TableAddRow (ParserToken.Object);
-            TableAddCol (ParserToken.Object, '{',
-                         '{',
-                         (int) ParserToken.ObjectPrime);
-
-            TableAddRow (ParserToken.ObjectPrime);
-            TableAddCol (ParserToken.ObjectPrime, '"',
-                         (int) ParserToken.Pair,
-                         (int) ParserToken.PairRest,
-                         '}');
-            TableAddCol (ParserToken.ObjectPrime, '}',
-                         '}');
-
-            TableAddRow (ParserToken.Pair);
-            TableAddCol (ParserToken.Pair, '"',
-                         (int) ParserToken.String,
-                         ':',
-                         (int) ParserToken.Value);
-
-            TableAddRow (ParserToken.PairRest);
-            TableAddCol (ParserToken.PairRest, ',',
-                         ',',
-                         (int) ParserToken.Pair,
-                         (int) ParserToken.PairRest);
-            TableAddCol (ParserToken.PairRest, '}',
-                         (int) ParserToken.Epsilon);
-
-            TableAddRow (ParserToken.String);
-            TableAddCol (ParserToken.String, '"',
-                         '"',
-                         (int) ParserToken.CharSeq,
-                         '"');
-
-            TableAddRow (ParserToken.Text);
-            TableAddCol (ParserToken.Text, '[',
-                         (int) ParserToken.Array);
-            TableAddCol (ParserToken.Text, '{',
-                         (int) ParserToken.Object);
-
-            TableAddRow (ParserToken.Value);
-            TableAddCol (ParserToken.Value, '"',
-                         (int) ParserToken.String);
-            TableAddCol (ParserToken.Value, '[',
-                         (int) ParserToken.Array);
-            TableAddCol (ParserToken.Value, '{',
-                         (int) ParserToken.Object);
-            TableAddCol (ParserToken.Value, (int) ParserToken.Number,
-                         (int) ParserToken.Number);
-            TableAddCol (ParserToken.Value, (int) ParserToken.True,
-                         (int) ParserToken.True);
-            TableAddCol (ParserToken.Value, (int) ParserToken.False,
-                         (int) ParserToken.False);
-            TableAddCol (ParserToken.Value, (int) ParserToken.Null,
-                         (int) ParserToken.Null);
-
-            TableAddRow (ParserToken.ValueRest);
-            TableAddCol (ParserToken.ValueRest, ',',
-                         ',',
-                         (int) ParserToken.Value,
-                         (int) ParserToken.ValueRest);
-            TableAddCol (ParserToken.ValueRest, ']',
-                         (int) ParserToken.Epsilon);
-        }
-
-        private static void TableAddCol (ParserToken row, int col,
-                                         params int[] symbols)
-        {
-            parse_table[(int) row].Add (col, symbols);
-        }
-
-        private static void TableAddRow (ParserToken rule)
-        {
-            parse_table.Add ((int) rule, new Dictionary<int, int[]> ());
-        }
-        #endregion
-
-
-        #region Private Methods
-        private void ProcessNumber (string number)
-        {
-            if (number.IndexOf ('.') != -1 ||
-                number.IndexOf ('e') != -1 ||
-                number.IndexOf ('E') != -1) {
-
-				if (Double.TryParse(number, out double n_double))
-				{
-					token = JsonToken.Double;
-					token_value = n_double;
-
-					return;
-				}
-			}
-
-			if (Int32.TryParse(number, out int n_int32))
-			{
-				token = JsonToken.Int;
-				token_value = n_int32;
-
-				return;
-			}
-
-			if (Int64.TryParse(number, out long n_int64))
-			{
-				token = JsonToken.Long;
-				token_value = n_int64;
-
-				return;
-			}
-
-			if (UInt64.TryParse(number, out ulong n_uint64))
-			{
-				token = JsonToken.Long;
-				token_value = n_uint64;
-
-				return;
-			}
-
-			// Shouldn't happen, but just in case, return something
-			token = JsonToken.Int;
-            token_value = 0;
-        }
-
-        private void ProcessSymbol ()
-        {
-            if (current_symbol == '[')  {
-                token = JsonToken.ArrayStart;
-                parser_return = true;
-
-            } else if (current_symbol == ']')  {
-                token = JsonToken.ArrayEnd;
-                parser_return = true;
-
-            } else if (current_symbol == '{')  {
-                token = JsonToken.ObjectStart;
-                parser_return = true;
-
-            } else if (current_symbol == '}')  {
-                token = JsonToken.ObjectEnd;
-                parser_return = true;
-
-            } else if (current_symbol == '"')  {
-                if (parser_in_string) {
-                    parser_in_string = false;
-
-                    parser_return = true;
-
-                } else {
-                    if (token == JsonToken.None)
-                        token = JsonToken.String;
-
-                    parser_in_string = true;
-                }
-
-            } else if (current_symbol == (int) ParserToken.CharSeq) {
-                token_value = lexer.StringValue;
-
-            } else if (current_symbol == (int) ParserToken.False)  {
-                token = JsonToken.Boolean;
-                token_value = false;
-                parser_return = true;
-
-            } else if (current_symbol == (int) ParserToken.Null)  {
-                token = JsonToken.Null;
-                parser_return = true;
-
-            } else if (current_symbol == (int) ParserToken.Number)  {
-                ProcessNumber (lexer.StringValue);
-
-                parser_return = true;
-
-            } else if (current_symbol == (int) ParserToken.Pair)  {
-                token = JsonToken.PropertyName;
-
-            } else if (current_symbol == (int) ParserToken.True)  {
-                token = JsonToken.Boolean;
-                token_value = true;
-                parser_return = true;
-
-            }
-        }
-
-        private bool ReadToken ()
-        {
-            if (end_of_input)
-                return false;
-
-            lexer.NextToken ();
-
-            if (lexer.EndOfInput) {
-                Close ();
-
-                return false;
-            }
-
-            current_input = lexer.Token;
-
-            return true;
-        }
-        #endregion
-
-
-        public void Close ()
-        {
-            if (end_of_input)
-                return;
-
-            end_of_input = true;
-            end_of_json  = true;
-
-            if (reader_is_owned)
-                reader.Close ();
-
-            reader = null;
-        }
-
-        public bool Read ()
-        {
-            if (end_of_input)
-                return false;
-
-            if (end_of_json) {
-                end_of_json = false;
-                automaton_stack.Clear ();
-                automaton_stack.Push ((int) ParserToken.End);
-                automaton_stack.Push ((int) ParserToken.Text);
-            }
-
-            parser_in_string = false;
-            parser_return    = false;
-
-            token       = JsonToken.None;
-            token_value = null;
-
-            if (! read_started) {
-                read_started = true;
-
-                if (! ReadToken ())
-                    return false;
-            }
-
-
-            int[] entry_symbols;
-
-            while (true) {
-                if (parser_return) {
-                    if (automaton_stack.Peek () == (int) ParserToken.End)
-                        end_of_json = true;
-
-                    return true;
-                }
-
-                current_symbol = automaton_stack.Pop ();
-
-                ProcessSymbol ();
-
-                if (current_symbol == current_input) {
-                    if (! ReadToken ()) {
-                        if (automaton_stack.Peek () != (int) ParserToken.End)
-                            throw new JsonException (
-                                "Input doesn't evaluate to proper JSON text");
-
-                        if (parser_return)
-                            return true;
-
-                        return false;
-                    }
-
-                    continue;
-                }
-
-                try {
-
-                    entry_symbols =
-                        parse_table[current_symbol][current_input];
-
-                } catch (KeyNotFoundException e) {
-                    throw new JsonException ((ParserToken) current_input, e);
-                }
-
-                if (entry_symbols[0] == (int) ParserToken.Epsilon)
-                    continue;
-
-                for (int i = entry_symbols.Length - 1; i >= 0; i--)
-                    automaton_stack.Push (entry_symbols[i]);
-            }
-        }
-
-    }
-}

+ 0 - 463
Unity/Hotfix/Base/LitJson/JsonWriter.cs

@@ -1,463 +0,0 @@
-#region Header
-/**
- * JsonWriter.cs
- *   Stream-like facility to output JSON text.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Text;
-
-
-namespace LitJson
-{
-    internal enum Condition
-    {
-        InArray,
-        InObject,
-        NotAProperty,
-        Property,
-        Value
-    }
-
-    internal class WriterContext
-    {
-        public int  Count;
-        public bool InArray;
-        public bool InObject;
-        public bool ExpectingValue;
-        public int  Padding;
-    }
-
-    public class JsonWriter
-    {
-        #region Fields
-        private static NumberFormatInfo number_format;
-
-        private WriterContext        context;
-        private Stack<WriterContext> ctx_stack;
-        private bool                 has_reached_end;
-        private char[]               hex_seq;
-        private int                  indentation;
-        private int                  indent_value;
-        private StringBuilder        inst_string_builder;
-        private bool                 pretty_print;
-        private bool                 validate;
-        private TextWriter           writer;
-        #endregion
-
-
-        #region Properties
-        public int IndentValue {
-            get { return indent_value; }
-            set {
-                indentation = (indentation / indent_value) * value;
-                indent_value = value;
-            }
-        }
-
-        public bool PrettyPrint {
-            get { return pretty_print; }
-            set { pretty_print = value; }
-        }
-
-        public TextWriter TextWriter {
-            get { return writer; }
-        }
-
-        public bool Validate {
-            get { return validate; }
-            set { validate = value; }
-        }
-        #endregion
-
-
-        #region Constructors
-        static JsonWriter ()
-        {
-            number_format = NumberFormatInfo.InvariantInfo;
-        }
-
-        public JsonWriter ()
-        {
-            inst_string_builder = new StringBuilder ();
-            writer = new StringWriter (inst_string_builder);
-
-            Init ();
-        }
-
-        public JsonWriter (StringBuilder sb) :
-            this (new StringWriter (sb))
-        {
-        }
-
-        public JsonWriter (TextWriter writer)
-        {
-            if (writer == null)
-                throw new ArgumentNullException ("writer");
-
-            this.writer = writer;
-
-            Init ();
-        }
-        #endregion
-
-
-        #region Private Methods
-        private void DoValidation (Condition cond)
-        {
-            if (! context.ExpectingValue)
-                context.Count++;
-
-            if (! validate)
-                return;
-
-            if (has_reached_end)
-                throw new JsonException (
-                    "A complete JSON symbol has already been written");
-
-            switch (cond) {
-            case Condition.InArray:
-                if (! context.InArray)
-                    throw new JsonException (
-                        "Can't close an array here");
-                break;
-
-            case Condition.InObject:
-                if (! context.InObject || context.ExpectingValue)
-                    throw new JsonException (
-                        "Can't close an object here");
-                break;
-
-            case Condition.NotAProperty:
-                if (context.InObject && ! context.ExpectingValue)
-                    throw new JsonException (
-                        "Expected a property");
-                break;
-
-            case Condition.Property:
-                if (! context.InObject || context.ExpectingValue)
-                    throw new JsonException (
-                        "Can't add a property here");
-                break;
-
-            case Condition.Value:
-                if (! context.InArray &&
-                    (! context.InObject || ! context.ExpectingValue))
-                    throw new JsonException (
-                        "Can't add a value here");
-
-                break;
-            }
-        }
-
-        private void Init ()
-        {
-            has_reached_end = false;
-            hex_seq = new char[4];
-            indentation = 0;
-            indent_value = 4;
-            pretty_print = false;
-            validate = true;
-
-            ctx_stack = new Stack<WriterContext> ();
-            context = new WriterContext ();
-            ctx_stack.Push (context);
-        }
-
-        private static void IntToHex (int n, char[] hex)
-        {
-            int num;
-
-            for (int i = 0; i < 4; i++) {
-                num = n % 16;
-
-                if (num < 10)
-                    hex[3 - i] = (char) ('0' + num);
-                else
-                    hex[3 - i] = (char) ('A' + (num - 10));
-
-                n >>= 4;
-            }
-        }
-
-        private void Indent ()
-        {
-            if (pretty_print)
-                indentation += indent_value;
-        }
-
-
-        private void Put (string str)
-        {
-            if (pretty_print && ! context.ExpectingValue)
-                for (int i = 0; i < indentation; i++)
-                    writer.Write (' ');
-
-            writer.Write (str);
-        }
-
-        private void PutNewline ()
-        {
-            PutNewline (true);
-        }
-
-        private void PutNewline (bool add_comma)
-        {
-            if (add_comma && ! context.ExpectingValue &&
-                context.Count > 1)
-                writer.Write (',');
-
-            if (pretty_print && ! context.ExpectingValue)
-                writer.Write ('\n');
-        }
-
-        private void PutString (string str)
-        {
-            Put (String.Empty);
-
-            writer.Write ('"');
-
-            int n = str.Length;
-            for (int i = 0; i < n; i++) {
-                switch (str[i]) {
-                case '\n':
-                    writer.Write ("\\n");
-                    continue;
-
-                case '\r':
-                    writer.Write ("\\r");
-                    continue;
-
-                case '\t':
-                    writer.Write ("\\t");
-                    continue;
-
-                case '"':
-                case '\\':
-                    writer.Write ('\\');
-                    writer.Write (str[i]);
-                    continue;
-
-                case '\f':
-                    writer.Write ("\\f");
-                    continue;
-
-                case '\b':
-                    writer.Write ("\\b");
-                    continue;
-                }
-
-                if ((int) str[i] >= 32 && (int) str[i] <= 126) {
-                    writer.Write (str[i]);
-                    continue;
-                }
-
-                // Default, turn into a \uXXXX sequence
-                IntToHex ((int) str[i], hex_seq);
-                writer.Write ("\\u");
-                writer.Write (hex_seq);
-            }
-
-            writer.Write ('"');
-        }
-
-        private void Unindent ()
-        {
-            if (pretty_print)
-                indentation -= indent_value;
-        }
-        #endregion
-
-
-        public override string ToString ()
-        {
-            if (inst_string_builder == null)
-                return String.Empty;
-
-            return inst_string_builder.ToString ();
-        }
-
-        public void Reset ()
-        {
-            has_reached_end = false;
-
-            ctx_stack.Clear ();
-            context = new WriterContext ();
-            ctx_stack.Push (context);
-
-            if (inst_string_builder != null)
-                inst_string_builder.Remove (0, inst_string_builder.Length);
-        }
-
-        public void Write (bool boolean)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            Put (boolean ? "true" : "false");
-
-            context.ExpectingValue = false;
-        }
-
-        public void Write (decimal number)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            Put (Convert.ToString (number, number_format));
-
-            context.ExpectingValue = false;
-        }
-
-        public void Write (double number)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            string str = Convert.ToString (number, number_format);
-            Put (str);
-
-            if (str.IndexOf ('.') == -1 &&
-                str.IndexOf ('E') == -1)
-                writer.Write (".0");
-
-            context.ExpectingValue = false;
-        }
-
-        public void Write (int number)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            Put (Convert.ToString (number, number_format));
-
-            context.ExpectingValue = false;
-        }
-
-        public void Write (long number)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            Put (Convert.ToString (number, number_format));
-
-            context.ExpectingValue = false;
-        }
-
-        public void Write (string str)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            if (str == null)
-                Put ("null");
-            else
-                PutString (str);
-
-            context.ExpectingValue = false;
-        }
-
-        [CLSCompliant(false)]
-        public void Write (ulong number)
-        {
-            DoValidation (Condition.Value);
-            PutNewline ();
-
-            Put (Convert.ToString (number, number_format));
-
-            context.ExpectingValue = false;
-        }
-
-        public void WriteArrayEnd ()
-        {
-            DoValidation (Condition.InArray);
-            PutNewline (false);
-
-            ctx_stack.Pop ();
-            if (ctx_stack.Count == 1)
-                has_reached_end = true;
-            else {
-                context = ctx_stack.Peek ();
-                context.ExpectingValue = false;
-            }
-
-            Unindent ();
-            Put ("]");
-        }
-
-        public void WriteArrayStart ()
-        {
-            DoValidation (Condition.NotAProperty);
-            PutNewline ();
-
-            Put ("[");
-
-            context = new WriterContext ();
-            context.InArray = true;
-            ctx_stack.Push (context);
-
-            Indent ();
-        }
-
-        public void WriteObjectEnd ()
-        {
-            DoValidation (Condition.InObject);
-            PutNewline (false);
-
-            ctx_stack.Pop ();
-            if (ctx_stack.Count == 1)
-                has_reached_end = true;
-            else {
-                context = ctx_stack.Peek ();
-                context.ExpectingValue = false;
-            }
-
-            Unindent ();
-            Put ("}");
-        }
-
-        public void WriteObjectStart ()
-        {
-            DoValidation (Condition.NotAProperty);
-            PutNewline ();
-
-            Put ("{");
-
-            context = new WriterContext ();
-            context.InObject = true;
-            ctx_stack.Push (context);
-
-            Indent ();
-        }
-
-        public void WritePropertyName (string property_name)
-        {
-            DoValidation (Condition.Property);
-            PutNewline ();
-
-            PutString (property_name);
-
-            if (pretty_print) {
-                if (property_name.Length > context.Padding)
-                    context.Padding = property_name.Length;
-
-                for (int i = context.Padding - property_name.Length;
-                     i >= 0; i--)
-                    writer.Write (' ');
-
-                writer.Write (": ");
-            } else
-                writer.Write (':');
-
-            context.ExpectingValue = true;
-        }
-    }
-}

+ 0 - 912
Unity/Hotfix/Base/LitJson/Lexer.cs

@@ -1,912 +0,0 @@
-#region Header
-/**
- * Lexer.cs
- *   JSON lexer implementation based on a finite state machine.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Text;
-
-
-namespace LitJson
-{
-    internal class FsmContext
-    {
-        public bool  Return;
-        public int   NextState;
-        public Lexer L;
-        public int   StateStack;
-    }
-
-
-    internal class Lexer
-    {
-        #region Fields
-        private delegate bool StateHandler (FsmContext ctx);
-
-        private static int[]          fsm_return_table;
-        private static StateHandler[] fsm_handler_table;
-
-        private bool          allow_comments;
-        private bool          allow_single_quoted_strings;
-        private bool          end_of_input;
-        private FsmContext    fsm_context;
-        private int           input_buffer;
-        private int           input_char;
-        private TextReader    reader;
-        private int           state;
-        private StringBuilder string_buffer;
-        private string        string_value;
-        private int           token;
-        private int           unichar;
-        #endregion
-
-
-        #region Properties
-        public bool AllowComments {
-            get { return allow_comments; }
-            set { allow_comments = value; }
-        }
-
-        public bool AllowSingleQuotedStrings {
-            get { return allow_single_quoted_strings; }
-            set { allow_single_quoted_strings = value; }
-        }
-
-        public bool EndOfInput {
-            get { return end_of_input; }
-        }
-
-        public int Token {
-            get { return token; }
-        }
-
-        public string StringValue {
-            get { return string_value; }
-        }
-        #endregion
-
-
-        #region Constructors
-        static Lexer ()
-        {
-            PopulateFsmTables ();
-        }
-
-        public Lexer (TextReader reader)
-        {
-            allow_comments = true;
-            allow_single_quoted_strings = true;
-
-            input_buffer = 0;
-            string_buffer = new StringBuilder (128);
-            state = 1;
-            end_of_input = false;
-            this.reader = reader;
-
-            fsm_context = new FsmContext ();
-            fsm_context.L = this;
-        }
-        #endregion
-
-
-        #region Static Methods
-        private static int HexValue (int digit)
-        {
-            switch (digit) {
-            case 'a':
-            case 'A':
-                return 10;
-
-            case 'b':
-            case 'B':
-                return 11;
-
-            case 'c':
-            case 'C':
-                return 12;
-
-            case 'd':
-            case 'D':
-                return 13;
-
-            case 'e':
-            case 'E':
-                return 14;
-
-            case 'f':
-            case 'F':
-                return 15;
-
-            default:
-                return digit - '0';
-            }
-        }
-
-        private static void PopulateFsmTables ()
-        {
-            // See section A.1. of the manual for details of the finite
-            // state machine.
-            fsm_handler_table = new StateHandler[28] {
-                State1,
-                State2,
-                State3,
-                State4,
-                State5,
-                State6,
-                State7,
-                State8,
-                State9,
-                State10,
-                State11,
-                State12,
-                State13,
-                State14,
-                State15,
-                State16,
-                State17,
-                State18,
-                State19,
-                State20,
-                State21,
-                State22,
-                State23,
-                State24,
-                State25,
-                State26,
-                State27,
-                State28
-            };
-
-            fsm_return_table = new int[28] {
-                (int) ParserToken.Char,
-                0,
-                (int) ParserToken.Number,
-                (int) ParserToken.Number,
-                0,
-                (int) ParserToken.Number,
-                0,
-                (int) ParserToken.Number,
-                0,
-                0,
-                (int) ParserToken.True,
-                0,
-                0,
-                0,
-                (int) ParserToken.False,
-                0,
-                0,
-                (int) ParserToken.Null,
-                (int) ParserToken.CharSeq,
-                (int) ParserToken.Char,
-                0,
-                0,
-                (int) ParserToken.CharSeq,
-                (int) ParserToken.Char,
-                0,
-                0,
-                0,
-                0
-            };
-        }
-
-        private static char ProcessEscChar (int esc_char)
-        {
-            switch (esc_char) {
-            case '"':
-            case '\'':
-            case '\\':
-            case '/':
-                return Convert.ToChar (esc_char);
-
-            case 'n':
-                return '\n';
-
-            case 't':
-                return '\t';
-
-            case 'r':
-                return '\r';
-
-            case 'b':
-                return '\b';
-
-            case 'f':
-                return '\f';
-
-            default:
-                // Unreachable
-                return '?';
-            }
-        }
-
-        private static bool State1 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char == ' ' ||
-                    ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r')
-                    continue;
-
-                if (ctx.L.input_char >= '1' && ctx.L.input_char <= '9') {
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 3;
-                    return true;
-                }
-
-                switch (ctx.L.input_char) {
-                case '"':
-                    ctx.NextState = 19;
-                    ctx.Return = true;
-                    return true;
-
-                case ',':
-                case ':':
-                case '[':
-                case ']':
-                case '{':
-                case '}':
-                    ctx.NextState = 1;
-                    ctx.Return = true;
-                    return true;
-
-                case '-':
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 2;
-                    return true;
-
-                case '0':
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 4;
-                    return true;
-
-                case 'f':
-                    ctx.NextState = 12;
-                    return true;
-
-                case 'n':
-                    ctx.NextState = 16;
-                    return true;
-
-                case 't':
-                    ctx.NextState = 9;
-                    return true;
-
-                case '\'':
-                    if (! ctx.L.allow_single_quoted_strings)
-                        return false;
-
-                    ctx.L.input_char = '"';
-                    ctx.NextState = 23;
-                    ctx.Return = true;
-                    return true;
-
-                case '/':
-                    if (! ctx.L.allow_comments)
-                        return false;
-
-                    ctx.NextState = 25;
-                    return true;
-
-                default:
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State2 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            if (ctx.L.input_char >= '1' && ctx.L.input_char<= '9') {
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 3;
-                return true;
-            }
-
-            switch (ctx.L.input_char) {
-            case '0':
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 4;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State3 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') {
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    continue;
-                }
-
-                if (ctx.L.input_char == ' ' ||
-                    ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') {
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-                }
-
-                switch (ctx.L.input_char) {
-                case ',':
-                case ']':
-                case '}':
-                    ctx.L.UngetChar ();
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-
-                case '.':
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 5;
-                    return true;
-
-                case 'e':
-                case 'E':
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 7;
-                    return true;
-
-                default:
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        private static bool State4 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            if (ctx.L.input_char == ' ' ||
-                ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') {
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-            }
-
-            switch (ctx.L.input_char) {
-            case ',':
-            case ']':
-            case '}':
-                ctx.L.UngetChar ();
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            case '.':
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 5;
-                return true;
-
-            case 'e':
-            case 'E':
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 7;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State5 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') {
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 6;
-                return true;
-            }
-
-            return false;
-        }
-
-        private static bool State6 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9') {
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    continue;
-                }
-
-                if (ctx.L.input_char == ' ' ||
-                    ctx.L.input_char >= '\t' && ctx.L.input_char <= '\r') {
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-                }
-
-                switch (ctx.L.input_char) {
-                case ',':
-                case ']':
-                case '}':
-                    ctx.L.UngetChar ();
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-
-                case 'e':
-                case 'E':
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    ctx.NextState = 7;
-                    return true;
-
-                default:
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State7 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') {
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 8;
-                return true;
-            }
-
-            switch (ctx.L.input_char) {
-            case '+':
-            case '-':
-                ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                ctx.NextState = 8;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State8 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char >= '0' && ctx.L.input_char<= '9') {
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    continue;
-                }
-
-                if (ctx.L.input_char == ' ' ||
-                    ctx.L.input_char >= '\t' && ctx.L.input_char<= '\r') {
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-                }
-
-                switch (ctx.L.input_char) {
-                case ',':
-                case ']':
-                case '}':
-                    ctx.L.UngetChar ();
-                    ctx.Return = true;
-                    ctx.NextState = 1;
-                    return true;
-
-                default:
-                    return false;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State9 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'r':
-                ctx.NextState = 10;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State10 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'u':
-                ctx.NextState = 11;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State11 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'e':
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State12 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'a':
-                ctx.NextState = 13;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State13 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'l':
-                ctx.NextState = 14;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State14 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 's':
-                ctx.NextState = 15;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State15 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'e':
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State16 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'u':
-                ctx.NextState = 17;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State17 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'l':
-                ctx.NextState = 18;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State18 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'l':
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State19 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                switch (ctx.L.input_char) {
-                case '"':
-                    ctx.L.UngetChar ();
-                    ctx.Return = true;
-                    ctx.NextState = 20;
-                    return true;
-
-                case '\\':
-                    ctx.StateStack = 19;
-                    ctx.NextState = 21;
-                    return true;
-
-                default:
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    continue;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State20 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case '"':
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State21 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case 'u':
-                ctx.NextState = 22;
-                return true;
-
-            case '"':
-            case '\'':
-            case '/':
-            case '\\':
-            case 'b':
-            case 'f':
-            case 'n':
-            case 'r':
-            case 't':
-                ctx.L.string_buffer.Append (
-                    ProcessEscChar (ctx.L.input_char));
-                ctx.NextState = ctx.StateStack;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State22 (FsmContext ctx)
-        {
-            int counter = 0;
-            int mult    = 4096;
-
-            ctx.L.unichar = 0;
-
-            while (ctx.L.GetChar ()) {
-
-                if (ctx.L.input_char >= '0' && ctx.L.input_char <= '9' ||
-                    ctx.L.input_char >= 'A' && ctx.L.input_char <= 'F' ||
-                    ctx.L.input_char >= 'a' && ctx.L.input_char <= 'f') {
-
-                    ctx.L.unichar += HexValue (ctx.L.input_char) * mult;
-
-                    counter++;
-                    mult /= 16;
-
-                    if (counter == 4) {
-                        ctx.L.string_buffer.Append (
-                            Convert.ToChar (ctx.L.unichar));
-                        ctx.NextState = ctx.StateStack;
-                        return true;
-                    }
-
-                    continue;
-                }
-
-                return false;
-            }
-
-            return true;
-        }
-
-        private static bool State23 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                switch (ctx.L.input_char) {
-                case '\'':
-                    ctx.L.UngetChar ();
-                    ctx.Return = true;
-                    ctx.NextState = 24;
-                    return true;
-
-                case '\\':
-                    ctx.StateStack = 23;
-                    ctx.NextState = 21;
-                    return true;
-
-                default:
-                    ctx.L.string_buffer.Append ((char) ctx.L.input_char);
-                    continue;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State24 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case '\'':
-                ctx.L.input_char = '"';
-                ctx.Return = true;
-                ctx.NextState = 1;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State25 (FsmContext ctx)
-        {
-            ctx.L.GetChar ();
-
-            switch (ctx.L.input_char) {
-            case '*':
-                ctx.NextState = 27;
-                return true;
-
-            case '/':
-                ctx.NextState = 26;
-                return true;
-
-            default:
-                return false;
-            }
-        }
-
-        private static bool State26 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char == '\n') {
-                    ctx.NextState = 1;
-                    return true;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State27 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char == '*') {
-                    ctx.NextState = 28;
-                    return true;
-                }
-            }
-
-            return true;
-        }
-
-        private static bool State28 (FsmContext ctx)
-        {
-            while (ctx.L.GetChar ()) {
-                if (ctx.L.input_char == '*')
-                    continue;
-
-                if (ctx.L.input_char == '/') {
-                    ctx.NextState = 1;
-                    return true;
-                }
-
-                ctx.NextState = 27;
-                return true;
-            }
-
-            return true;
-        }
-        #endregion
-
-
-        private bool GetChar ()
-        {
-            if ((input_char = NextChar ()) != -1)
-                return true;
-
-            end_of_input = true;
-            return false;
-        }
-
-        private int NextChar ()
-        {
-            if (input_buffer != 0) {
-                int tmp = input_buffer;
-                input_buffer = 0;
-
-                return tmp;
-            }
-
-            return reader.Read ();
-        }
-
-        public bool NextToken ()
-        {
-            StateHandler handler;
-            fsm_context.Return = false;
-
-            while (true) {
-                handler = fsm_handler_table[state - 1];
-
-                if (! handler (fsm_context))
-                    throw new JsonException (input_char);
-
-                if (end_of_input)
-                    return false;
-
-                if (fsm_context.Return) {
-                    string_value = string_buffer.ToString ();
-                    string_buffer.Remove (0, string_buffer.Length);
-                    token = fsm_return_table[state - 1];
-
-                    if (token == (int) ParserToken.Char)
-                        token = input_char;
-
-                    state = fsm_context.NextState;
-
-                    return true;
-                }
-
-                state = fsm_context.NextState;
-            }
-        }
-
-        private void UngetChar ()
-        {
-            input_buffer = input_char;
-        }
-    }
-}

+ 0 - 44
Unity/Hotfix/Base/LitJson/ParserToken.cs

@@ -1,44 +0,0 @@
-#region Header
-/**
- * ParserToken.cs
- *   Internal representation of the tokens used by the lexer and the parser.
- *
- * The authors disclaim copyright to this source code. For more details, see
- * the COPYING file included with this distribution.
- **/
-#endregion
-
-
-namespace LitJson
-{
-    internal enum ParserToken
-    {
-        // Lexer tokens (see section A.1.1. of the manual)
-        None = System.Char.MaxValue + 1,
-        Number,
-        True,
-        False,
-        Null,
-        CharSeq,
-        // Single char
-        Char,
-
-        // Parser Rules (see section A.2.1 of the manual)
-        Text,
-        Object,
-        ObjectPrime,
-        Pair,
-        PairRest,
-        Array,
-        ArrayPrime,
-        Value,
-        ValueRest,
-        String,
-
-        // End of input
-        End,
-
-        // The empty rule
-        Epsilon
-    }
-}

+ 11 - 7
Unity/Hotfix/UI/UILobby/Component/UILobbyComponent.cs

@@ -13,22 +13,26 @@ namespace Hotfix
 			ReferenceCollector rc = this.GetOwner<UI>().GameObject.GetComponent<ReferenceCollector>();
 			GameObject createRoom = rc.Get<GameObject>("CreateRoom");
 			GameObject joinRoom = rc.Get<GameObject>("JoinRoom");
-			createRoom.GetComponent<Button>().onClick.Add(() => this.OnCreateRoom());
-			joinRoom.GetComponent<Button>().onClick.Add(() => this.OnJoinRoom());
+			createRoom.GetComponent<Button>().onClick.Add(OnCreateRoom);
+			joinRoom.GetComponent<Button>().onClick.Add(OnJoinRoom);
 		}
 
-		private async void OnCreateRoom()
+		private static async void OnCreateRoom()
 		{
 			Session session = null;
 			try
 			{
 				session = Hotfix.Scene.ModelScene.GetComponent<NetOuterComponent>().Create("127.0.0.1:10001");
-				R2C_Login r2CLogin = await session.Call<C2R_Login, R2C_Login>(new C2R_Login() { Account = "abcdef", Password = "111111" });
+				R2C_Login r2CLogin = await session.Call<R2C_Login>(new C2R_Login() { Account = "abcdef", Password = "111111" });
 				Session gateSession = Hotfix.Scene.ModelScene.GetComponent<NetOuterComponent>().Create(r2CLogin.Address);
-				G2C_LoginGate g2CLoginGate = await gateSession.Call<C2G_LoginGate, G2C_LoginGate>(new C2G_LoginGate(r2CLogin.Key));
+				G2C_LoginGate g2CLoginGate = await gateSession.Call<G2C_LoginGate>(new C2G_LoginGate(r2CLogin.Key));
+				
+				Log.Debug($"{JsonHelper.ToJson(g2CLoginGate)}");
 
 				Log.Info("登陆gate成功!");
-				
+
+				// 发送一个actor消息
+				gateSession.Send(new Actor_Test() { Info = "send to actor" });
 			}
 			catch (Exception e)
 			{
@@ -40,7 +44,7 @@ namespace Hotfix
 			}
 		}
 
-		private void OnJoinRoom()
+		private static void OnJoinRoom()
 		{
 
 		}

+ 0 - 10
Unity/Hotfix/Unity.Hotfix.csproj

@@ -60,18 +60,8 @@
     <Compile Include="Base\Message\IMHandler.cs" />
     <Compile Include="Component\MessageDispatherComponent.cs" />
     <Compile Include="Base\Helper\ArrayHelper.cs" />
-    <Compile Include="Base\Helper\JsonHelper.cs" />
     <Compile Include="Event\SessionRecvMessage_Dispatch.cs" />
     <Compile Include="Init.cs" />
-    <Compile Include="Base\LitJson\IJsonWrapper.cs" />
-    <Compile Include="Base\LitJson\JsonData.cs" />
-    <Compile Include="Base\LitJson\JsonException.cs" />
-    <Compile Include="Base\LitJson\JsonMapper.cs" />
-    <Compile Include="Base\LitJson\JsonMockWrapper.cs" />
-    <Compile Include="Base\LitJson\JsonReader.cs" />
-    <Compile Include="Base\LitJson\JsonWriter.cs" />
-    <Compile Include="Base\LitJson\Lexer.cs" />
-    <Compile Include="Base\LitJson\ParserToken.cs" />
     <Compile Include="AssetBundleHelper.cs" />
     <Compile Include="Component\ConfigComponent.cs" />
     <Compile Include="Component\EventComponent.cs" />

+ 1 - 0
Unity/Unity.csproj

@@ -372,6 +372,7 @@
     <Compile Include="Assets\Scripts\Base\IL\ILRedirection.cs" />
     <Compile Include="Assets\Scripts\Base\Log.cs" />
     <Compile Include="Assets\Scripts\Base\LogType.cs" />
+    <Compile Include="Assets\Scripts\Base\Message\AActorMessage.cs" />
     <Compile Include="Assets\Scripts\Base\Message\AMessage.cs" />
     <Compile Include="Assets\Scripts\Base\Message\AppType.cs" />
     <Compile Include="Assets\Scripts\Base\Message\ClientDispatcher.cs" />