void OnReceivedClientInput(NetworkDataMessage message) { if (ReceivedInputs == null) { return; } var inputSet = message.ReadAs <InputSetMessage>(); ReceivedInputs(message.Connection.Id, inputSet.StartTimestamp, inputSet.Inputs.GetSlice(inputSet.InputCount)); }
internal void Execute(INetworkConnection connection, NetworkReader reader) { byte header = reader.ReadByte(); var handler = handlers[header]; if (handler == null) { return; } var message = new NetworkDataMessage(connection, reader); handler(message); }
void OnReceivedClientInput(NetworkDataMessage message) { NetworkClientPlayer client; if (!clients.TryGetValue(message.Connection, out client)) { return; } var inputSet = message.ReadAs <InputSetMessage>(); InvokeRecievedInputs(client.PlayerID, inputSet.StartTimestamp, inputSet.AsArraySegment()); }
void OnClientReady(NetworkDataMessage dataMsg) { NetworkClientPlayer client; if (!clients.TryGetValue(dataMsg.Connection, out client)) { return; } var message = dataMsg.ReadAs <PeerReadyMessage>(); client.IsReady = message.IsReady; InvokePlayerUpdated(client); }
void OnClientConfigUpdated(NetworkDataMessage dataMsg) { NetworkClientPlayer client; if (!clients.TryGetValue(dataMsg.Connection.Id, out client)) { return; } var message = dataMsg.ReadAs <ClientUpdateConfigMessage>(); client.Config = message.PlayerConfig; client.Config.PlayerID = client.PlayerID; PlayerUpdated?.Invoke(client); }