diff --git a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs index e5c98b0..e24e9f6 100644 --- a/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs +++ b/AxibugEmuOnline.Client/Assets/Plugins/AxiReplay/NetReplay.cs @@ -4,7 +4,6 @@ namespace AxiReplay { public class NetReplay { - int MaxInFrame = 0; int mCurrPlayFrame = -1; Queue mQueueReplay; ReplayStep mNextReplay; @@ -13,20 +12,28 @@ namespace AxiReplay /// /// 服务器远端当前帧 /// - public int remoteFrameIdx { get; private set; } + public int mRemoteFrameIdx { get; private set; } /// /// 当前帧和服务器帧相差数量 /// - public int remoteFrameDiff => remoteFrameIdx - mCurrPlayFrame; + public int remoteFrameDiff => mRemoteFrameIdx - mCurrPlayFrame; public NetReplay() { mQueueReplay = new Queue(); } + + public void ResetData() + { + mQueueReplay.Clear(); + mRemoteFrameIdx = 0; + byFrameIdx = 0; + mNextReplay = default(ReplayStep); + mCurrReplay = default(ReplayStep); + } public void InData(ReplayStep inputData,int ServerFrameIdx) { mQueueReplay.Enqueue(inputData); - MaxInFrame = inputData.FrameStartID; - remoteFrameIdx = ServerFrameIdx; + mRemoteFrameIdx = inputData.FrameStartID; } public bool NextFrame(out ReplayStep data, out int FrameDiff) { @@ -55,17 +62,17 @@ namespace AxiReplay else { data = mCurrReplay; - FrameDiff = MaxInFrame - mCurrPlayFrame; + FrameDiff = mRemoteFrameIdx - mCurrPlayFrame; } return Changed; } void UpdateNextFrame(int targetFrame,out int FrameDiff) { - FrameDiff = MaxInFrame - targetFrame; + FrameDiff = mRemoteFrameIdx - targetFrame; //如果已经超过 while (targetFrame > mNextReplay.FrameStartID) { - if (mNextReplay.FrameStartID >= MaxInFrame) + if (mNextReplay.FrameStartID >= mRemoteFrameIdx) { //TODO //bEnd = true; diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppLogin.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppLogin.cs index ffb40f0..d396b58 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppLogin.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppLogin.cs @@ -3,9 +3,6 @@ using AxibugEmuOnline.Client.Common; using AxibugEmuOnline.Client.Network; using AxibugProtobuf; using System; -using System.Collections.Generic; -using System.Linq; -using System.Net.Sockets; namespace AxibugEmuOnline.Client.Manager { @@ -40,6 +37,9 @@ namespace AxibugEmuOnline.Client.Manager { App.log.Info("登录成功"); App.user.InitMainUserData(App.user.userdata.Account, msg.UID); + + App.log.Info("获取服务器列表"); + App.roomMgr.SendGetRoomList(); } else { diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs index 3e95763..95a2ba4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppRoom.cs @@ -7,7 +7,6 @@ using AxiReplay; using Google.Protobuf; using System.Collections.Generic; using System.Linq; -using UnityEngine; namespace AxibugEmuOnline.Client.Manager { @@ -96,10 +95,11 @@ namespace AxibugEmuOnline.Client.Manager public void InitRePlay() { netReplay = new NetReplay(); + netReplay.ResetData(); } public void ReleaseRePlay() { - + netReplay.ResetData(); } #endregion @@ -302,7 +302,7 @@ namespace AxibugEmuOnline.Client.Manager /// 上报即时存档 /// /// - public void SendLeavnRoom(byte[] RawData) + public void SendHostRaw(byte[] RawData) { //压缩 byte[] compressRawData = Helper.CompressByteArray(RawData); @@ -355,7 +355,6 @@ namespace AxibugEmuOnline.Client.Manager App.network.SendToServer((int)CommandID.CmdRoomSingelPlayerInput, ProtoBufHelper.Serizlize(_Protobuf_Room_SinglePlayerInputData)); } - void RecvHostSyn_RoomFrameAllInputData(byte[] reqData) { Protobuf_Room_Syn_RoomFrameAllInputData msg = ProtoBufHelper.DeSerizlize(reqData); diff --git a/AxibugEmuOnline.Server/Manager/ClientManager.cs b/AxibugEmuOnline.Server/Manager/ClientManager.cs index 27d55ca..13822bb 100644 --- a/AxibugEmuOnline.Server/Manager/ClientManager.cs +++ b/AxibugEmuOnline.Server/Manager/ClientManager.cs @@ -16,7 +16,6 @@ namespace AxibugEmuOnline.Server.Manager public DateTime LogOutDT { get; set; } public DateTime LogInDT { get; set; } public UserRoomState RoomState { get; set; } = new UserRoomState(); - public TimeSpan LastStartPingTime { get; set; } public int LastPingSeed { get; set; } public double AveNetDelay { get; set; } @@ -34,13 +33,11 @@ namespace AxibugEmuOnline.Server.Manager { ClearRoomData(); } - public void SetRoomData(int roomID, int playerIdx) { RoomID = roomID; PlayerIdx = playerIdx; } - public void ClearRoomData() { RoomID = -1; diff --git a/AxibugEmuOnline.Server/Manager/RoomManager.cs b/AxibugEmuOnline.Server/Manager/RoomManager.cs index 4e89dcf..71b4fc7 100644 --- a/AxibugEmuOnline.Server/Manager/RoomManager.cs +++ b/AxibugEmuOnline.Server/Manager/RoomManager.cs @@ -270,7 +270,12 @@ namespace AxibugEmuOnline.Server Data_RoomData room = GetRoomData(_c.RoomState.RoomID); if (room == null) return; - room.SetPlayerInput(_c.RoomState.PlayerIdx, msg.FrameID, (ushort)msg.InputData); + + //取玩家操作数据中的第一个 + ServerInputSnapShot temp = new ServerInputSnapShot(); + temp.all = msg.InputData; + + room.SetPlayerInput(_c.RoomState.PlayerIdx, msg.FrameID, temp.p1); } public void OnCmdScreen(Socket sk, byte[] reqData) @@ -540,14 +545,14 @@ namespace AxibugEmuOnline.Server return list; } - public void SetPlayerInput(int PlayerIdx, long mFrameID, ushort input) + public void SetPlayerInput(int PlayerIdx, long mFrameID, byte input) { switch (PlayerIdx) { - case 0: mCurrInputData.p1 = input; break; - case 1: mCurrInputData.p2 = input; break; - case 2: mCurrInputData.p3 = input; break; - case 3: mCurrInputData.p4 = input; break; + case 0: mCurrInputData.p1_byte = input; break; + case 1: mCurrInputData.p2_byte = input; break; + case 2: mCurrInputData.p3_byte = input; break; + case 3: mCurrInputData.p4_byte = input; break; } } @@ -753,18 +758,28 @@ namespace AxibugEmuOnline.Server } } - [StructLayout(LayoutKind.Explicit)] + [StructLayout(LayoutKind.Explicit, Size = 8)] public struct ServerInputSnapShot { [FieldOffset(0)] public UInt64 all; + [FieldOffset(0)] - public ushort p1; + public byte p1_byte; + [FieldOffset(1)] + public byte p2_byte; [FieldOffset(2)] - public ushort p2; + public byte p3_byte; + [FieldOffset(3)] + public byte p4_byte; + + [FieldOffset(0)] + public ushort p1_ushort; + [FieldOffset(2)] + public ushort p2_ushort; [FieldOffset(4)] - public ushort p3; + public ushort p3_ushort; [FieldOffset(6)] - public ushort p4; + public ushort p4_ushort; } } \ No newline at end of file diff --git a/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user b/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user index 13b45c5..3b8b226 100644 --- a/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/AxibugEmuOnline.Server/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. --> - True|2024-09-13T05:39:28.9591993Z||;True|2024-09-12T17:48:43.1521740+08:00||;True|2024-09-12T17:43:57.0504432+08:00||;True|2024-09-12T17:19:48.6392091+08:00||;True|2024-09-12T13:38:45.0141937+08:00||;False|2024-09-12T13:37:57.6131232+08:00||;True|2024-06-28T16:25:59.3159172+08:00||;True|2024-06-28T15:30:49.8257235+08:00||; + True|2024-09-14T08:39:29.4677979Z||;True|2024-09-14T16:38:22.2398996+08:00||;True|2024-09-13T13:39:28.9591993+08:00||;True|2024-09-12T17:48:43.1521740+08:00||;True|2024-09-12T17:43:57.0504432+08:00||;True|2024-09-12T17:19:48.6392091+08:00||;True|2024-09-12T13:38:45.0141937+08:00||;False|2024-09-12T13:37:57.6131232+08:00||;True|2024-06-28T16:25:59.3159172+08:00||;True|2024-06-28T15:30:49.8257235+08:00||; \ No newline at end of file diff --git a/AxibugEmuOnline.Web/AxibugEmuOnline.Web.csproj.user b/AxibugEmuOnline.Web/AxibugEmuOnline.Web.csproj.user new file mode 100644 index 0000000..8a55449 --- /dev/null +++ b/AxibugEmuOnline.Web/AxibugEmuOnline.Web.csproj.user @@ -0,0 +1,6 @@ + + + + G:\Sin365\AxibugEmuOnline\AxibugEmuOnline.Web\Properties\PublishProfiles\FolderProfile.pubxml + + \ No newline at end of file diff --git a/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml b/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..05d373f --- /dev/null +++ b/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,22 @@ + + + + + false + false + true + Release + Any CPU + FileSystem + bin\Release\net8.0\publish\ + FileSystem + <_TargetId>Folder + + net8.0 + win-x64 + 52a13383-be2d-4945-83b6-bbc54cf39f83 + false + + \ No newline at end of file diff --git a/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml.user b/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml.user new file mode 100644 index 0000000..09bae63 --- /dev/null +++ b/AxibugEmuOnline.Web/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -0,0 +1,11 @@ + + + + + <_PublishTargetUrl>G:\Sin365\AxibugEmuOnline\AxibugEmuOnline.Web\bin\Release\net8.0\publish\ + True|2024-09-12T06:18:38.6992653Z||;True|2024-09-12T14:08:58.4526827+08:00||;True|2024-08-22T14:13:06.3067002+08:00||;True|2024-08-14T10:33:10.9180984+08:00||;True|2024-08-13T18:28:27.5050523+08:00||;True|2024-08-13T18:25:47.6591234+08:00||;True|2024-08-13T18:25:17.5344107+08:00||;True|2024-08-13T17:46:23.4523329+08:00||; + + + \ No newline at end of file diff --git a/AxibugEmuOnline.sln b/AxibugEmuOnline.sln index b532585..be6aecd 100644 --- a/AxibugEmuOnline.sln +++ b/AxibugEmuOnline.sln @@ -3,7 +3,25 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.8.34511.84 MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugEmuOnline.Web", "AxibugEmuOnline.Web\AxibugEmuOnline.Web.csproj", "{52A13383-BE2D-4945-83B6-BBC54CF39F83}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AxibugEmuOnline.Server", "AxibugEmuOnline.Server\AxibugEmuOnline.Server.csproj", "{9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}" +EndProject Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52A13383-BE2D-4945-83B6-BBC54CF39F83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52A13383-BE2D-4945-83B6-BBC54CF39F83}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52A13383-BE2D-4945-83B6-BBC54CF39F83}.Release|Any CPU.ActiveCfg = Release|Any CPU + {52A13383-BE2D-4945-83B6-BBC54CF39F83}.Release|Any CPU.Build.0 = Release|Any CPU + {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9F509DB4-CDB4-4CDB-9C10-805C5E644EEF}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection