/// <summary> /// Setup the station and then begin the round for the selected game mode /// </summary> public void StartRound() { waitForStart = false; // Only do this stuff on the server if (CustomNetworkManager.Instance._isServer) { if (string.IsNullOrEmpty(NextGameMode) || NextGameMode == "Random") { SetRandomGameMode(); } else { //Set game mode to the selected game mode SetGameMode(NextGameMode); //Then reset it to the default game mode set in the config for next round. NextGameMode = InitialGameMode; } // Game mode specific setup GameMode.SetupRound(); // Standard round start setup stationTime = new DateTime().AddHours(12); counting = true; RespawnCurrentlyAllowed = GameMode.CanRespawn; StartCoroutine(WaitToInitEscape()); StartCoroutine(WaitToStartGameMode()); // Tell all clients that the countdown has finished UpdateCountdownMessage.Send(true, 0); CurrentRoundState = RoundState.Started; EventManager.Broadcast(EVENT.RoundStarted); } }
public void StartCountdown() { // Calculate when the countdown will end relative to the NetworkTime CountdownEndTime = NetworkTime.time + PreRoundTime; waitForStart = true; string msg = GameManager.Instance.SecretGameMode ? "Secret" : $"{GameManager.Instance.GameMode}"; string message = $"A new round is starting on {ServerData.ServerConfig.ServerName}.\nThe current gamemode is: {msg}\nThe current map is: {SubSceneManager.ServerChosenMainStation}\n"; var playerNumber = PlayerList.Instance.ConnectionCount > PlayerList.LastRoundPlayerCount ? PlayerList.Instance.ConnectionCount : PlayerList.LastRoundPlayerCount; if (playerNumber == 1) { message += "There is 1 player online.\n"; } else { message += $"There are {playerNumber} players online.\n"; } DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAnnouncementURL, message, ""); DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookOOCURL, "\n A new round has started \n", ""); UpdateCountdownMessage.Send(waitForStart, PreRoundTime); }
public static UpdateCountdownMessage Send(bool started, float time) { UpdateCountdownMessage msg = new UpdateCountdownMessage { Started = started, Time = time }; msg.SendToAll(); return msg; }
/// <summary> /// Calculates when the countdown will end from the time left and sends it to all clients /// </summary> /// <param name="started">Has the countdown started or stopped?</param> /// <param name="time">How much time is left on the countdown?</param> /// <returns></returns> public static UpdateCountdownMessage Send(bool started, float time) { // Calculate when the countdown will end relative to the current NetworkTime double endTime = NetworkTime.time + time; UpdateCountdownMessage msg = new UpdateCountdownMessage { Started = started, EndTime = endTime }; msg.SendToAll(); return(msg); }
/// <summary> /// Setup the station and then begin the round for the selected game mode /// </summary> public void StartRound() { waitForStart = false; // Only do this stuff on the server if (CustomNetworkManager.Instance._isServer == false) { return; } //Clear jobs for next round if (CrewManifestManager.Instance != null) { CrewManifestManager.Instance.ServerClearList(); } LogPlayersAntagPref(); if (string.IsNullOrEmpty(NextGameMode) || NextGameMode == "Random") { SetRandomGameMode(); } else { //Set game mode to the selected game mode SetGameMode(NextGameMode); //Then reset it to the default game mode set in the config for next round. NextGameMode = InitialGameMode; } DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAdminLogURL, $"{GameMode.Name} chosen", "[GameMode]"); // Game mode specific setup GameMode.SetupRound(); // Standard round start setup stationTime = new DateTime().AddHours(12); counting = true; RespawnCurrentlyAllowed = GameMode.CanRespawn; StartCoroutine(WaitToInitEscape()); StartCoroutine(WaitToStartGameMode()); // Tell all clients that the countdown has finished UpdateCountdownMessage.Send(true, 0); EventManager.Broadcast(Event.PostRoundStarted); }
public void StartCountdown() { CountdownTime = PreRoundTime; waitForStart = true; string message; if (PlayerList.Instance.ConnectionCount == 1) { message = $"A new round is starting on {ServerData.ServerConfig.ServerName}.\n\n There is 1 player online.\n"; } else { message = $"A new round is starting on {ServerData.ServerConfig.ServerName}.\n\n There are {PlayerList.Instance.ConnectionCount} players online.\n"; } DiscordWebhookMessage.Instance.AddWebHookMessageToQueue(DiscordWebhookURLs.DiscordWebhookAnnouncementURL, message, ""); UpdateCountdownMessage.Send(waitForStart, CountdownTime); }
public void StartCountdown() { startTime = PreRoundTime; waitForStart = true; UpdateCountdownMessage.Send(waitForStart, startTime); }