public void SendReadyToStart() { var msg = new ReadyToStart(); m_netMsgSerializer.Serialize(msg); m_com.Send(m_netMsgSerializer.Data, m_netMsgSerializer.DataSize, m_serverAddress); }
public void SendReadyToStart() { var msg = new ReadyToStart(); m_netMsgSerializer.Serialize(msg); OutMessages.Enqueue(new RawData(m_netMsgSerializer.Data, m_netMsgSerializer.DataSize)); }
private void ProcessReadyToStart(GameServer gameServer, ReadyToStart msg, INetworkAddress address) { Debug.LogFormat("ReadyToStart, Address: {0}", address.ToString()); var clientInfo = gameServer.GetClientInfoByAddress(address); if (clientInfo != null && clientInfo.IsReadyToStart) { return; } gameServer.SetReadyToStart(address); }
/// <summary> /// Attempts to start playback. Waits for all player clocks to have available frames for up to <see cref="MAXIMUM_START_DELAY"/> milliseconds. /// </summary> /// <returns>Whether playback was started and syncing should occur.</returns> private bool attemptStart() { if (hasStarted) { return(true); } if (playerClocks.Count == 0) { return(false); } int readyCount = playerClocks.Count(s => !s.WaitingOnFrames.Value); if (readyCount == playerClocks.Count) { return(performStart()); } if (readyCount > 0) { firstStartAttemptTime ??= Time.Current; if (Time.Current - firstStartAttemptTime > MAXIMUM_START_DELAY) { return(performStart()); } } bool performStart() { ReadyToStart?.Invoke(); return(hasStarted = true); } return(false); }
public void Serialize(ReadyToStart message) { m_writer.Reset(); m_writer.Write(NetworkMessageType.ReadyToStart); m_writer.Flush(); }