This commit is contained in:
2025-12-14 01:19:31 +01:00
8 changed files with 289 additions and 134 deletions

View File

@@ -81,7 +81,7 @@ namespace KCM.Packets.Game
public override void HandlePacketServer()
{
// Server doesn't need to handle this packet
// Server relay is handled automatically by PacketHandler unless [NoServerRelay] is used.
}
}
}

View File

@@ -15,6 +15,14 @@ namespace KCM.Packets.Handlers
{
public class PacketHandler
{
[ThreadStatic]
private static bool isHandlingPacket;
public static bool IsHandlingPacket
{
get { return isHandlingPacket; }
}
public static Dictionary<ushort, PacketRef> Packets = new Dictionary<ushort, PacketRef>();
public class PacketRef
{
@@ -183,6 +191,7 @@ namespace KCM.Packets.Handlers
{
try
{
isHandlingPacket = true;
packet.HandlePacketClient();
}
catch (Exception ex)
@@ -205,6 +214,10 @@ namespace KCM.Packets.Handlers
Main.helper.Log(ex.InnerException.StackTrace);
}
}
finally
{
isHandlingPacket = false;
}
}
/* if (PacketHandlers.TryGetValue(id, out PacketHandlerDelegate handler))

View File

@@ -117,6 +117,14 @@ namespace KCM.Packets.Lobby
{
Main.SetMultiplayerSaveLoadInProgress(false);
}
try
{
RunPostLoadRebuild("Save transfer complete");
}
catch
{
}
Broadcast.OnLoadedEvent.Broadcast(new OnLoadedEvent());
try

View File

@@ -25,6 +25,7 @@ namespace KCM.Packets.Lobby
try
{
int desiredSpeed = 1;
if (!LobbyManager.loadingSave)
{
SpeedControlUI.inst.SetSpeed(0);
@@ -39,31 +40,13 @@ namespace KCM.Packets.Lobby
Main.helper.Log(ex.ToString());
}
try
{
GameState.inst.SetNewMode(GameState.inst.playingMode);
Main.helper.Log("StartGame: forced playing mode");
}
catch (Exception ex)
{
Main.helper.Log("StartGame: failed forcing playing mode");
Main.helper.Log(ex.ToString());
}
try
{
Main.RunPostLoadRebuild("StartGame");
}
catch
{
}
SpeedControlUI.inst.SetSpeed(0);
SpeedControlUI.inst.SetSpeed(desiredSpeed);
}
else
{
LobbyManager.loadingSave = false;
GameState.inst.SetNewMode(GameState.inst.playingMode);
SpeedControlUI.inst.SetSpeed(desiredSpeed);
}
}
catch (Exception ex)