mirror of
https://github.com/Impostor/Impostor.git
synced 2026-10-19 15:51:42 +00:00
Make GameLogicComponent methods async
This commit is contained in:
4 files changed
+8
-8
No files matched your search
@@ -51,14 +51,14 @@ internal abstract class InnerGameManager : InnerNetObject, IInnerGameManager
|
||||
return _logicComponents.IndexOf(logic);
|
||||
}
|
||||
|
||||
public override ValueTask<bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer? target, RpcCalls call, IMessageReader reader)
|
||||
public override async ValueTask<bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer? target, RpcCalls call, IMessageReader reader)
|
||||
{
|
||||
foreach (var logicComponent in _logicComponents)
|
||||
{
|
||||
logicComponent.HandleRpc(call, reader);
|
||||
await logicComponent.HandleRpcAsync(call, reader);
|
||||
}
|
||||
|
||||
return ValueTask.FromResult(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override ValueTask<bool> SerializeAsync(IMessageWriter writer, bool initialState)
|
||||
|
||||
@@ -6,12 +6,12 @@ namespace Impostor.Server.Net.Inner.Objects.GameManager.Logic;
|
||||
|
||||
internal abstract class GameLogicComponent
|
||||
{
|
||||
public virtual void HandleRpc(RpcCalls callId, IMessageReader reader)
|
||||
public virtual ValueTask HandleRpcAsync(RpcCalls callId, IMessageReader reader)
|
||||
{
|
||||
throw new NotImplementedException($"Unhandled RpcCall {callId}");
|
||||
}
|
||||
|
||||
public virtual bool Serialize(IMessageWriter writer, bool initialState)
|
||||
public virtual ValueTask<bool> SerializeAsync(IMessageWriter writer, bool initialState)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@ internal abstract class LogicOptions : GameLogicComponent
|
||||
_eventManager = eventManager;
|
||||
}
|
||||
|
||||
public override bool Serialize(IMessageWriter writer, bool initialState)
|
||||
public override ValueTask<bool> SerializeAsync(IMessageWriter writer, bool initialState)
|
||||
{
|
||||
GameOptionsFactory.Serialize(writer, _game.Options);
|
||||
return true;
|
||||
return ValueTask.FromResult(true);
|
||||
}
|
||||
|
||||
public override async ValueTask DeserializeAsync(IMessageReader reader, bool initialState)
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Impostor.Server.Net.State
|
||||
writer.WritePacked(GameNet.GameManager.NetId);
|
||||
|
||||
writer.StartMessage((byte)gameOptionsTag);
|
||||
GameNet.GameManager.LogicOptions.Serialize(writer, false);
|
||||
await GameNet.GameManager.LogicOptions.SerializeAsync(writer, false);
|
||||
|
||||
writer.EndMessage();
|
||||
writer.EndMessage();
|
||||
|
||||
Reference in new issue
Block a user