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

消息限制不能使用new,统一用Create创建

tanghai 2 лет назад
Родитель
Сommit
f282f5c02d
26 измененных файлов с 102 добавлено и 70 удалено
  1. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs
  2. 5 4
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs
  3. 2 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Login/EnterMapHelper.cs
  4. 2 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Move/MoveHelper.cs
  5. 8 2
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs
  6. 1 1
      Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs
  7. 1 1
      Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs
  8. 7 3
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs
  9. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs
  10. 8 8
      Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Move/MoveHelper.cs
  11. 4 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs
  12. 2 2
      Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs
  13. 3 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs
  14. 1 1
      Unity/Assets/Scripts/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs
  15. 3 2
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs
  16. 7 5
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs
  17. 3 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs
  18. 3 2
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs
  19. 3 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs
  20. 5 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs
  21. 1 1
      Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs
  22. 27 10
      Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs
  23. 1 1
      Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs
  24. 2 2
      Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs
  25. 1 1
      Unity/Assets/Scripts/Model/Share/LockStep/FrameBuffer.cs
  26. 0 13
      Unity/Assets/Scripts/Model/Share/LockStep/OneFrameInputs.cs

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/AI/AI_Attack.cs

@@ -23,7 +23,7 @@ namespace ET.Client
             }
 
             // 停在当前位置
-            fiber.Root.GetComponent<ClientSenderCompnent>().Send(new C2M_Stop());
+            fiber.Root.GetComponent<ClientSenderCompnent>().Send(C2M_Stop.Create());
             
             Log.Debug("开始攻击");
 

+ 5 - 4
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/ClientSenderCompnentSystem.cs

@@ -35,10 +35,11 @@ namespace ET.Client
             self.fiberId = await FiberManager.Instance.Create(SchedulerType.ThreadPool, 0, SceneType.NetClient, "");
             self.netClientActorId = new ActorId(self.Fiber().Process, self.fiberId);
 
-            NetClient2Main_Login response = await self.Root().GetComponent<ProcessInnerSender>().Call(self.netClientActorId, new Main2NetClient_Login()
-            {
-                OwnerFiberId = self.Fiber().Id, Account = account, Password = password
-            }) as NetClient2Main_Login;
+            Main2NetClient_Login main2NetClientLogin = Main2NetClient_Login.Create();
+            main2NetClientLogin.OwnerFiberId = self.Fiber().Id;
+            main2NetClientLogin.Account = account;
+            main2NetClientLogin.Password = password;
+            NetClient2Main_Login response = await self.Root().GetComponent<ProcessInnerSender>().Call(self.netClientActorId, main2NetClientLogin) as NetClient2Main_Login;
             return response.PlayerId;
         }
 

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

@@ -9,7 +9,7 @@ namespace ET.Client
         {
             try
             {
-                G2C_EnterMap g2CEnterMap = await root.GetComponent<ClientSenderCompnent>().Call(new C2G_EnterMap()) as G2C_EnterMap;
+                G2C_EnterMap g2CEnterMap = await root.GetComponent<ClientSenderCompnent>().Call(C2G_EnterMap.Create()) as G2C_EnterMap;
                 
                 // 等待场景切换完成
                 await root.GetComponent<ObjectWait>().Wait<Wait_SceneChangeFinish>();
@@ -26,7 +26,7 @@ namespace ET.Client
         {
             try
             {
-                G2C_Match g2CEnterMap = await fiber.Root.GetComponent<ClientSenderCompnent>().Call(new C2G_Match()) as G2C_Match;
+                G2C_Match g2CEnterMap = await fiber.Root.GetComponent<ClientSenderCompnent>().Call(C2G_Match.Create()) as G2C_Match;
             }
             catch (Exception e)
             {

+ 2 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/Main/Move/MoveHelper.cs

@@ -9,7 +9,8 @@ namespace ET.Client
         // 可以多次调用,多次调用的话会取消上一次的协程
         public static async ETTask<int> MoveToAsync(this Unit unit, float3 targetPos, ETCancellationToken cancellationToken = null)
         {
-            C2M_PathfindingResult msg = new C2M_PathfindingResult() { Position = targetPos };
+            C2M_PathfindingResult msg = C2M_PathfindingResult.Create();
+            msg.Position = targetPos;
             unit.Root().GetComponent<ClientSenderCompnent>().Send(msg);
 
             ObjectWait objectWait = unit.GetComponent<ObjectWait>();

+ 8 - 2
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Main2NetClient_LoginHandler.cs

@@ -27,14 +27,20 @@ namespace ET.Client
             R2C_Login r2CLogin;
             using (Session session = await netComponent.CreateRouterSession(realmAddress, account, password))
             {
-                r2CLogin = (R2C_Login)await session.Call(new C2R_Login() { Account = account, Password = password });
+                C2R_Login c2RLogin = C2R_Login.Create();
+                c2RLogin.Account = account;
+                c2RLogin.Password = password;
+                r2CLogin = (R2C_Login)await session.Call(c2RLogin);
             }
 
             // 创建一个gate Session,并且保存到SessionComponent中
             Session gateSession = await netComponent.CreateRouterSession(NetworkHelper.ToIPEndPoint(r2CLogin.Address), account, password);
             gateSession.AddComponent<ClientSessionErrorComponent>();
             root.AddComponent<SessionComponent>().Session = gateSession;
-            G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(new C2G_LoginGate() { Key = r2CLogin.Key, GateId = r2CLogin.GateId });
+            C2G_LoginGate c2GLoginGate = C2G_LoginGate.Create();
+            c2GLoginGate.Key = r2CLogin.Key;
+            c2GLoginGate.GateId = r2CLogin.GateId;
+            G2C_LoginGate g2CLoginGate = (G2C_LoginGate)await gateSession.Call(c2GLoginGate);
 
             Log.Debug("登陆gate成功!");
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/Demo/NetClient/Ping/PingComponentSystem.cs

@@ -35,7 +35,7 @@ namespace ET.Client
                     }
                     
                     // C2G_Ping不需要调用dispose,Call中会判断,如果用了对象池会自动回收
-                    C2G_Ping c2GPing = C2G_Ping.Create(true);
+                    C2G_Ping c2GPing = C2G_Ping.Create();
                     // 这里response要用using才能回收到池,默认不回收
                     using G2C_Ping response = await session.Call(c2GPing) as G2C_Ping;
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Client/LockStep/LSSceneChangeHelper.cs

@@ -14,7 +14,7 @@ namespace ET.Client
             // 等待表现层订阅的事件完成
             await EventSystem.Instance.PublishAsync(root, new LSSceneChangeStart() {Room = room});
 
-            root.GetComponent<ClientSenderCompnent>().Send(new C2Room_ChangeSceneFinish());
+            root.GetComponent<ClientSenderCompnent>().Send(C2Room_ChangeSceneFinish.Create());
             
             // 等待Room2C_EnterMap消息
             WaitType.Wait_Room2C_Start waitRoom2CStart = await root.GetComponent<ObjectWait>().Wait<WaitType.Wait_Room2C_Start>();

+ 7 - 3
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/C2G_LoginGateHandler.cs

@@ -58,11 +58,15 @@ namespace ET.Server
         {
             Fiber fiber = player.Fiber();
             await fiber.WaitFrameFinish();
-            
+
+            G2Room_Reconnect g2RoomReconnect = G2Room_Reconnect.Create();
+            g2RoomReconnect.PlayerId = player.Id;
             using Room2G_Reconnect room2GateReconnect = await fiber.Root.GetComponent<MessageSender>().Call(
                 player.GetComponent<PlayerRoomComponent>().RoomActorId,
-                new G2Room_Reconnect() { PlayerId = player.Id }) as Room2G_Reconnect;
-            G2C_Reconnect g2CReconnect = new() { StartTime = room2GateReconnect.StartTime, Frame = room2GateReconnect.Frame };
+                g2RoomReconnect) as Room2G_Reconnect;
+            G2C_Reconnect g2CReconnect = G2C_Reconnect.Create();
+            g2CReconnect.StartTime = room2GateReconnect.StartTime;
+            g2CReconnect.Frame = room2GateReconnect.Frame;
             g2CReconnect.UnitInfos.AddRange(room2GateReconnect.UnitInfos);
             session.Send(g2CReconnect);
             

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Gate/SessionPlayerComponentSystem.cs

@@ -12,7 +12,7 @@
                 return;
             }
             // 发送断线消息
-            root.GetComponent<MessageLocationSenderComponent>().Get(LocationType.Unit).Send(self.Player.Id, new G2M_SessionDisconnect());
+            root.GetComponent<MessageLocationSenderComponent>().Get(LocationType.Unit).Send(self.Player.Id, G2M_SessionDisconnect.Create());
         }
         
         [EntitySystem]

+ 8 - 8
Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Move/MoveHelper.cs

@@ -15,7 +15,7 @@ namespace ET.Server
                 return;
             }
 
-            M2C_PathfindingResult m2CPathfindingResult = new();
+            M2C_PathfindingResult m2CPathfindingResult = M2C_PathfindingResult.Create();
             unit.GetComponent<PathfindingComponent>().Find(unit.Position, target, m2CPathfindingResult.Points);
 
             if (m2CPathfindingResult.Points.Count < 2)
@@ -46,13 +46,13 @@ namespace ET.Server
         // error: 0表示协程走完正常停止
         public static void SendStop(this Unit unit, int error)
         {
-            MapMessageHelper.Broadcast(unit, new M2C_Stop()
-            {
-                Error = error,
-                Id = unit.Id, 
-                Position = unit.Position,
-                Rotation = unit.Rotation,
-            });
+            M2C_Stop m2CStop = M2C_Stop.Create();
+            m2CStop.Error = error;
+            m2CStop.Id = unit.Id;
+            m2CStop.Position = unit.Position;
+            m2CStop.Rotation = unit.Rotation;
+            
+            MapMessageHelper.Broadcast(unit, m2CStop);
         }
     }
 }

+ 4 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Transfer/M2M_UnitTransferRequestHandler.cs

@@ -27,11 +27,13 @@ namespace ET.Server
             unit.AddComponent<MailBoxComponent, MailBoxType>(MailBoxType.OrderedMessage);
 
             // 通知客户端开始切场景
-            M2C_StartSceneChange m2CStartSceneChange = new() { SceneInstanceId = scene.InstanceId, SceneName = scene.Name };
+            M2C_StartSceneChange m2CStartSceneChange = M2C_StartSceneChange.Create();
+            m2CStartSceneChange.SceneInstanceId = scene.InstanceId;
+            m2CStartSceneChange.SceneName = scene.Name;
             MapMessageHelper.SendToClient(unit, m2CStartSceneChange);
 
             // 通知客户端创建My Unit
-            M2C_CreateMyUnit m2CCreateUnits = new();
+            M2C_CreateMyUnit m2CCreateUnits = M2C_CreateMyUnit.Create();
             m2CCreateUnits.Unit = UnitHelper.CreateUnitInfo(unit);
             MapMessageHelper.SendToClient(unit, m2CCreateUnits);
 

+ 2 - 2
Unity/Assets/Scripts/Hotfix/Server/Demo/Map/Unit/UnitHelper.cs

@@ -9,7 +9,7 @@ namespace ET.Server
     {
         public static UnitInfo CreateUnitInfo(Unit unit)
         {
-            UnitInfo unitInfo = new();
+            UnitInfo unitInfo = UnitInfo.Create();
             NumericComponent nc = unit.GetComponent<NumericComponent>();
             unitInfo.UnitId = unit.Id;
             unitInfo.ConfigId = unit.ConfigId;
@@ -22,7 +22,7 @@ namespace ET.Server
             {
                 if (!moveComponent.IsArrived())
                 {
-                    unitInfo.MoveInfo = new MoveInfo();
+                    unitInfo.MoveInfo = MoveInfo.Create();
                     unitInfo.MoveInfo.Points.Add(unit.Position);
                     for (int i = moveComponent.N; i < moveComponent.Targets.Count; ++i)
                     {

+ 3 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Realm/C2R_LoginHandler.cs

@@ -14,8 +14,10 @@ namespace ET.Server
 			Log.Debug($"gate address: {config}");
 			
 			// 向gate请求一个key,客户端可以拿着这个key连接gate
+			R2G_GetLoginKey r2GGetLoginKey = R2G_GetLoginKey.Create();
+			r2GGetLoginKey.Account = request.Account;
 			G2R_GetLoginKey g2RGetLoginKey = (G2R_GetLoginKey) await session.Fiber().Root.GetComponent<MessageSender>().Call(
-				config.ActorId, new R2G_GetLoginKey() {Account = request.Account});
+				config.ActorId, r2GGetLoginKey);
 
 			response.Address = config.InnerIPPort.ToString();
 			response.Key = g2RGetLoginKey.Key;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/Demo/Router/HttpGetRouterHandler.cs

@@ -10,7 +10,7 @@ namespace ET.Server
     {
         public async ETTask Handle(Scene scene, HttpListenerContext context)
         {
-            HttpGetRouterResponse response = new();
+            HttpGetRouterResponse response = HttpGetRouterResponse.Create();
             foreach (StartSceneConfig startSceneConfig in StartSceneConfigCategory.Instance.Realms)
             {
                 response.Realms.Add(startSceneConfig.InnerIPPort.ToString());

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Server/LockStep/Gate/C2G_MatchHandler.cs

@@ -9,8 +9,9 @@
 
 			StartSceneConfig startSceneConfig = StartSceneConfigCategory.Instance.Match;
 
-			await session.Root().GetComponent<MessageSender>().Call(startSceneConfig.ActorId,
-				new G2Match_Match() { Id = player.Id });
+			G2Match_Match g2MatchMatch = G2Match_Match.Create();
+			g2MatchMatch.Id = player.Id;
+			await session.Root().GetComponent<MessageSender>().Call(startSceneConfig.ActorId, g2MatchMatch);
 		}
 	}
 }

+ 7 - 5
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/C2Room_ChangeSceneFinishHandler.cs

@@ -21,13 +21,15 @@ namespace ET.Server
             
             await room.Fiber.Root.GetComponent<TimerComponent>().WaitAsync(1000);
 
-            Room2C_Start room2CStart = new() { StartTime = TimeInfo.Instance.ServerFrameTime() };
+            Room2C_Start room2CStart = Room2C_Start.Create();
+            room2CStart.StartTime = TimeInfo.Instance.ServerFrameTime();
             foreach (RoomPlayer rp in roomServerComponent.Children.Values)
             {
-                room2CStart.UnitInfo.Add(new LockStepUnitInfo()
-                {
-                    PlayerId = rp.Id, Position = new TSVector(20, 0, -10), Rotation = TSQuaternion.identity
-                });
+                LockStepUnitInfo lockStepUnitInfo = LockStepUnitInfo.Create();
+                lockStepUnitInfo.PlayerId = rp.Id;
+                lockStepUnitInfo.Position = new TSVector(20, 0, -10);
+                lockStepUnitInfo.Rotation = TSQuaternion.identity;
+                room2CStart.UnitInfo.Add(lockStepUnitInfo);
             }
 
             room.Init(room2CStart.UnitInfo, room2CStart.StartTime);

+ 3 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Map/FrameMessageHandler.cs

@@ -17,7 +17,9 @@ namespace ET.Server
                 long nowFrameTime = room.FixedTimeCounter.FrameTime(message.Frame);
                 int diffTime = (int)(nowFrameTime - TimeInfo.Instance.ServerFrameTime());
 
-                room.Root().GetComponent<MessageLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, new Room2C_AdjustUpdateTime() {DiffTime = diffTime});
+                Room2C_AdjustUpdateTime room2CAdjustUpdateTime = Room2C_AdjustUpdateTime.Create();
+                room2CAdjustUpdateTime.DiffTime = diffTime;
+                room.Root().GetComponent<MessageLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CAdjustUpdateTime);
             }
 
             if (message.Frame < room.AuthorityFrame)  // 小于AuthorityFrame,丢弃

+ 3 - 2
Unity/Assets/Scripts/Hotfix/Server/LockStep/Match/MatchComponentSystem.cs

@@ -23,7 +23,7 @@ namespace ET.Server
             
             // 申请一个房间
             StartSceneConfig startSceneConfig = RandomGenerator.RandomArray(StartSceneConfigCategory.Instance.Maps);
-            Match2Map_GetRoom match2MapGetRoom = new();
+            Match2Map_GetRoom match2MapGetRoom = Match2Map_GetRoom.Create();
             foreach (long id in self.waitMatchPlayers)
             {
                 match2MapGetRoom.PlayerIds.Add(id);
@@ -35,7 +35,8 @@ namespace ET.Server
             Map2Match_GetRoom map2MatchGetRoom = await root.GetComponent<MessageSender>().Call(
                 startSceneConfig.ActorId, match2MapGetRoom) as Map2Match_GetRoom;
 
-            Match2G_NotifyMatchSuccess match2GNotifyMatchSuccess = new() { ActorId = map2MatchGetRoom.ActorId };
+            Match2G_NotifyMatchSuccess match2GNotifyMatchSuccess = Match2G_NotifyMatchSuccess.Create();
+            match2GNotifyMatchSuccess.ActorId = map2MatchGetRoom.ActorId;
             MessageLocationSenderComponent messageLocationSenderComponent = root.GetComponent<MessageLocationSenderComponent>();
             
             foreach (long id in match2MapGetRoom.PlayerIds) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用

+ 3 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/C2Room_CheckHashHandler.cs

@@ -10,7 +10,9 @@ namespace ET.Server
             if (message.Hash != hash)
             {
                 byte[] bytes = room.FrameBuffer.Snapshot(message.Frame).ToArray();
-                Room2C_CheckHashFail room2CCheckHashFail = new() { Frame = message.Frame, LSWorldBytes = bytes };
+                Room2C_CheckHashFail room2CCheckHashFail = Room2C_CheckHashFail.Create();
+                room2CCheckHashFail.Frame = message.Frame;
+                room2CCheckHashFail.LSWorldBytes = bytes;
                 room.Root().GetComponent<MessageLocationSenderComponent>().Get(LocationType.GateSession).Send(message.PlayerId, room2CCheckHashFail);
             }
             await ETTask.CompletedTask;

+ 5 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/G2Room_ReconnectHandler.cs

@@ -13,7 +13,11 @@ namespace ET.Server
             foreach (long playerId in room.PlayerIds)
             {
                 LSUnit lsUnit = lsUnitComponent.GetChild<LSUnit>(playerId);
-                response.UnitInfos.Add(new LockStepUnitInfo() {PlayerId = playerId, Position = lsUnit.Position, Rotation = lsUnit.Rotation});    
+                LockStepUnitInfo lockStepUnitInfo = LockStepUnitInfo.Create();
+                lockStepUnitInfo.PlayerId = playerId;
+                lockStepUnitInfo.Position = lsUnit.Position;
+                lockStepUnitInfo.Rotation = lsUnit.Rotation;
+                response.UnitInfos.Add(lockStepUnitInfo);    
             }
 
             response.Frame = room.AuthorityFrame;

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Server/LockStep/Room/LSServerUpdaterSystem.cs

@@ -29,7 +29,7 @@ namespace ET.Server
             OneFrameInputs oneFrameInputs = self.GetOneFrameMessage(frame);
             ++room.AuthorityFrame;
 
-            OneFrameInputs sendInput = new();
+            OneFrameInputs sendInput = OneFrameInputs.Create();
             oneFrameInputs.CopyTo(sendInput);
 
             RoomMessageHelper.BroadCast(room, sendInput);

+ 27 - 10
Unity/Assets/Scripts/Hotfix/Server/Module/ActorLocation/LocationProxyComponentSystem.cs

@@ -13,32 +13,47 @@ namespace ET.Server
         {
             Fiber fiber = self.Fiber();
             Log.Info($"location proxy add {key}, {actorId} {TimeInfo.Instance.ServerNow()}");
-            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key),
-                new ObjectAddRequest() { Type = type, Key = key, ActorId = actorId });
+            ObjectAddRequest objectAddRequest = ObjectAddRequest.Create();
+            objectAddRequest.Type = type;
+            objectAddRequest.Key = key;
+            objectAddRequest.ActorId = actorId;
+            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key), objectAddRequest);
         }
 
         public static async ETTask Lock(this LocationProxyComponent self, int type, long key, ActorId actorId, int time = 60000)
         {
             Fiber fiber = self.Fiber();
             Log.Info($"location proxy lock {key}, {actorId} {TimeInfo.Instance.ServerNow()}");
-            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key),
-                new ObjectLockRequest() { Type = type, Key = key, ActorId = actorId, Time = time });
+
+            ObjectLockRequest objectLockRequest = ObjectLockRequest.Create();
+            objectLockRequest.Type = type;
+            objectLockRequest.Key = key;
+            objectLockRequest.ActorId = actorId;
+            objectLockRequest.Time = time;
+            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key), objectLockRequest);
         }
 
         public static async ETTask UnLock(this LocationProxyComponent self, int type, long key, ActorId oldActorId, ActorId newActorId)
         {
             Fiber fiber = self.Fiber();
             Log.Info($"location proxy unlock {key}, {newActorId} {TimeInfo.Instance.ServerNow()}");
-            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key),
-                new ObjectUnLockRequest() { Type = type, Key = key, OldActorId = oldActorId, NewActorId = newActorId });
+            ObjectUnLockRequest objectUnLockRequest = ObjectUnLockRequest.Create();
+            objectUnLockRequest.Type = type;
+            objectUnLockRequest.Key = key;
+            objectUnLockRequest.OldActorId = oldActorId;
+            objectUnLockRequest.NewActorId = newActorId;
+            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key), objectUnLockRequest);
         }
 
         public static async ETTask Remove(this LocationProxyComponent self, int type, long key)
         {
             Fiber fiber = self.Fiber();
             Log.Info($"location proxy add {key}, {TimeInfo.Instance.ServerNow()}");
-            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key),
-                new ObjectRemoveRequest() { Type = type, Key = key });
+
+            ObjectRemoveRequest objectRemoveRequest = ObjectRemoveRequest.Create();
+            objectRemoveRequest.Type = type;
+            objectRemoveRequest.Key = key;
+            await fiber.Root.GetComponent<MessageSender>().Call(GetLocationSceneId(key), objectRemoveRequest);
         }
 
         public static async ETTask<ActorId> Get(this LocationProxyComponent self, int type, long key)
@@ -49,9 +64,11 @@ namespace ET.Server
             }
 
             // location server配置到共享区,一个大战区可以配置N多个location server,这里暂时为1
+            ObjectGetRequest objectGetRequest = ObjectGetRequest.Create();
+            objectGetRequest.Type = type;
+            objectGetRequest.Key = key;
             ObjectGetResponse response =
-                    (ObjectGetResponse) await self.Root().GetComponent<MessageSender>().Call(GetLocationSceneId(key),
-                        new ObjectGetRequest() { Type = type, Key = key });
+                    (ObjectGetResponse) await self.Root().GetComponent<MessageSender>().Call(GetLocationSceneId(key), objectGetRequest);
             return response.ActorId;
         }
 

+ 1 - 1
Unity/Assets/Scripts/Hotfix/Share/LockStep/RoomSystem.cs

@@ -86,7 +86,7 @@ namespace ET
                 return;
             }
             OneFrameInputs oneFrameInputs = self.FrameBuffer.FrameInputs(frame);
-            OneFrameInputs saveInput = new();
+            OneFrameInputs saveInput = OneFrameInputs.Create();
             oneFrameInputs.CopyTo(saveInput);
             self.Replay.FrameInputs.Add(saveInput);
             if (frame % LSConstValue.SaveLSWorldFrameCount == 0)

+ 2 - 2
Unity/Assets/Scripts/HotfixView/Client/Demo/Opera/OperaComponentSystem.cs

@@ -22,7 +22,7 @@ namespace ET.Client
                 RaycastHit hit;
                 if (Physics.Raycast(ray, out hit, 1000, self.mapMask))
                 {
-                    C2M_PathfindingResult c2MPathfindingResult = new C2M_PathfindingResult();
+                    C2M_PathfindingResult c2MPathfindingResult = C2M_PathfindingResult.Create();
                     c2MPathfindingResult.Position = hit.point;
                     self.Root().GetComponent<ClientSenderCompnent>().Send(c2MPathfindingResult);
                 }
@@ -36,7 +36,7 @@ namespace ET.Client
         
             if (Input.GetKeyDown(KeyCode.T))
             {
-                C2M_TransferMap c2MTransferMap = new();
+                C2M_TransferMap c2MTransferMap = C2M_TransferMap.Create();
                 self.Root().GetComponent<ClientSenderCompnent>().Call(c2MTransferMap).Coroutine();
             }
         }

+ 1 - 1
Unity/Assets/Scripts/Model/Share/LockStep/FrameBuffer.cs

@@ -21,7 +21,7 @@ namespace ET
             for (int i = 0; i < this.snapshots.Capacity; ++i)
             {
                 this.hashs.Add(0);
-                this.frameInputs.Add(new OneFrameInputs());
+                this.frameInputs.Add(OneFrameInputs.Create());
                 MemoryBuffer memoryBuffer = new(10240);
                 memoryBuffer.SetLength(0);
                 memoryBuffer.Seek(0, SeekOrigin.Begin);

+ 0 - 13
Unity/Assets/Scripts/Model/Share/LockStep/OneFrameInputs.cs

@@ -44,11 +44,6 @@ namespace ET
             return HashCode.Combine(this.Inputs);
         }
 
-        public OneFrameInputs()
-        {
-            this.Inputs = new Dictionary<long, LSInput>(LSConstValue.MatchCount);
-        }
-
         public static bool operator==(OneFrameInputs a, OneFrameInputs b)
         {
             if (a is null || b is null)
@@ -86,12 +81,4 @@ namespace ET
             return !(a == b);
         }
     }
-    
-    public partial class Room2C_Start
-    {
-        public Room2C_Start()
-        {
-            this.UnitInfo = new List<LockStepUnitInfo>(LSConstValue.MatchCount);
-        }
-    }
 }