public override async ValueTask <bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader) { switch (call) { case RpcCalls.Close: { if (!await ValidateHost(call, sender)) { return(false); } Rpc22Close.Deserialize(reader); break; } case RpcCalls.VotingComplete: { if (!await ValidateHost(call, sender)) { return(false); } Rpc23VotingComplete.Deserialize(reader, out var states, out var playerId, out var tie); await HandleVotingComplete(sender, states, playerId, tie); break; } case RpcCalls.CastVote: { Rpc24CastVote.Deserialize(reader, out var playerId, out var suspectPlayerId); return(await HandleCastVote(sender, target, playerId, suspectPlayerId)); } case RpcCalls.ClearVote: { if (!await ValidateHost(call, sender)) { return(false); } Rpc25ClearVote.Deserialize(reader); break; } case RpcCalls.CustomRpc: return(await HandleCustomRpc(reader, _game)); default: return(await UnregisteredCall(call, sender)); } return(true); }
public override async ValueTask <bool> HandleRpcAsync(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader) { switch (call) { case RpcCalls.Close: { if (!await ValidateHost(call, sender)) { return(false); } Rpc22Close.Deserialize(reader); break; } case RpcCalls.VotingComplete: { if (!await ValidateHost(call, sender)) { return(false); } Rpc23VotingComplete.Deserialize(reader, out ReadOnlyMemory <byte> states, out byte playerId, out bool tie); await HandleVotingComplete(sender, states, playerId, tie); break; } case RpcCalls.CastVote: { Rpc24CastVote.Deserialize(reader, out byte playerId, out sbyte suspectPlayerId); return(await HandleCastVote(sender, target, playerId, suspectPlayerId)); } case RpcCalls.ClearVote: { if (!await ValidateHost(call, sender)) { return(false); } Rpc25ClearVote.Deserialize(reader); break; } default: return(await base.HandleRpcAsync(sender, target, call, reader)); } return(true); }
public override async ValueTask <bool> HandleRpc(ClientPlayer sender, ClientPlayer?target, RpcCalls call, IMessageReader reader) { if (!await TestRpc(sender, target, call, Rpcs)) { return(false); } switch (call) { case RpcCalls.Close: { Rpc22Close.Deserialize(reader); break; } case RpcCalls.VotingComplete: { Rpc23VotingComplete.Deserialize(reader, out var states, out var playerId, out var tie); await HandleVotingComplete(sender, states, playerId, tie); break; } case RpcCalls.CastVote: { Rpc24CastVote.Deserialize(reader, out var playerId, out var suspectPlayerId); return(await HandleCastVote(sender, target, playerId, suspectPlayerId)); } case RpcCalls.ClearVote: { Rpc25ClearVote.Deserialize(reader); break; } } return(true); }