private void OnDisable() { GameRoom.ShowCamera(); BombActive = false; EnableDisableInput(); bool claimsEnabled = TwitchModule.ClaimsEnabled; TwitchModule.ClearUnsupportedModules(); if (!claimsEnabled) { TwitchModule.ClaimsEnabled = true; } StopAllCoroutines(); Leaderboard.Instance.BombsAttempted++; // ReSharper disable once DelegateSubtraction ParentService.GetComponent <KMGameInfo>().OnLightsChange -= OnLightsChange; TwitchPlaysService.Instance.SetHeaderVisbility(false); LogUploader.Instance.GetBombUrl(); ParentService.StartCoroutine(SendDelayedMessage(1.0f, GetBombResult(), SendAnalysisLink)); if (!claimsEnabled) { ParentService.StartCoroutine(SendDelayedMessage(1.1f, "Claims have been enabled.")); } if (ModuleCameras != null) { ModuleCameras.gameObject.SetActive(false); } foreach (var bomb in Bombs.Where(x => x != null)) { Destroy(bomb.gameObject, 2.0f); } Bombs.Clear(); DestroyComponentHandles(); MusicPlayer.StopAllMusic(); GameRoom.Instance?.OnDisable(); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); File.WriteAllText(path, SettingsConverter.Serialize(LastClaimedModule)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't write TwitchPlaysLastClaimed.json:"); } }
private void OnDisable() { GameRoom.ShowCamera(); BombActive = false; EnableDisableInput(); bool claimsEnabled = TwitchModule.ClaimsEnabled; TwitchModule.ClearUnsupportedModules(); if (!claimsEnabled) { TwitchModule.ClaimsEnabled = true; } StopAllCoroutines(); GoodPlayers.Clear(); EvilPlayers.Clear(); VSSetFlag = false; QueueEnabled = false; Leaderboard.Instance.BombsAttempted++; // ReSharper disable once DelegateSubtraction ParentService.GetComponent <KMGameInfo>().OnLightsChange -= OnLightsChange; ParentService.AddStateCoroutine(ParentService.AnimateHeaderVisibility(false)); LogUploader.Instance.GetBombUrl(); ParentService.AddStateCoroutine(DelayBombResult()); if (!claimsEnabled) { ParentService.AddStateCoroutine(SendDelayedMessage(1.1f, "Claims have been enabled.")); } if (ModuleCameras != null) { ModuleCameras.StartCoroutine(ModuleCameras.DisableCameras()); } // Award users who maintained modules. var methods = Modules.SelectMany(module => module.ScoreMethods); var awardedPoints = new Dictionary <string, int>(); foreach (var player in methods.SelectMany(method => method.Players).Distinct()) { int points = (methods.Sum(method => method.CalculateScore(player)) * OtherModes.ScoreMultiplier).RoundToInt(); if (points != 0) { awardedPoints[player] = points; Leaderboard.Instance.AddScore(player, points); } } if (awardedPoints.Count > 0) { IRCConnection.SendMessage($"These players have been awarded points for managing a needy: {awardedPoints.Select(pair => $"{pair.Key} ({pair.Value})").Join(", ")}"); } GameCommands.unclaimedModules = null; DestroyComponentHandles(); MusicPlayer.StopAllMusic(); GameRoom.Instance?.OnDisable(); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); File.WriteAllText(path, SettingsConverter.Serialize(LastClaimedModule)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't write TwitchPlaysLastClaimed.json:"); } }
private void OnDisable() { GameRoom.ShowCamera(); BombActive = false; EnableDisableInput(); bool claimsEnabled = TwitchModule.ClaimsEnabled; TwitchModule.ClearUnsupportedModules(); if (!claimsEnabled) { TwitchModule.ClaimsEnabled = true; } StopAllCoroutines(); Leaderboard.Instance.BombsAttempted++; // ReSharper disable once DelegateSubtraction ParentService.GetComponent <KMGameInfo>().OnLightsChange -= OnLightsChange; TwitchPlaysService.Instance.SetHeaderVisbility(false); LogUploader.Instance.GetBombUrl(); ParentService.StartCoroutine(DelayBombResult()); if (!claimsEnabled) { ParentService.StartCoroutine(SendDelayedMessage(1.1f, "Claims have been enabled.")); } if (ModuleCameras != null) { ModuleCameras.gameObject.SetActive(false); } // Award users who maintained needy modules. if (!OtherModes.ZenModeOn) { Dictionary <string, int> AwardedNeedyPoints = new Dictionary <string, int>(); foreach (TwitchModule twitchModule in Modules) { ModuleInformation ModInfo = twitchModule.Solver.ModInfo; ScoreMethod scoreMethod = ModInfo.scoreMethod; if (scoreMethod == ScoreMethod.Default) { continue; } foreach (var pair in twitchModule.PlayerNeedyStats) { string playerName = pair.Key; var needyStats = pair.Value; int points = Mathf.RoundToInt((scoreMethod == ScoreMethod.NeedySolves ? needyStats.Solves : needyStats.ActiveTime) * ModInfo.moduleScore); if (points != 0) { if (!AwardedNeedyPoints.ContainsKey(playerName)) { AwardedNeedyPoints[playerName] = 0; } AwardedNeedyPoints[playerName] += points; Leaderboard.Instance.AddScore(playerName, points); } } } if (AwardedNeedyPoints.Count > 0) { IRCConnection.SendMessage($"These players have been awarded points for managing a needy: {AwardedNeedyPoints.Select(pair => $"{pair.Key} ({pair.Value})").Join(", ")}"); } } GameCommands.unclaimedModules = null; DestroyComponentHandles(); MusicPlayer.StopAllMusic(); GameRoom.Instance?.OnDisable(); try { string path = Path.Combine(Application.persistentDataPath, "TwitchPlaysLastClaimed.json"); File.WriteAllText(path, SettingsConverter.Serialize(LastClaimedModule)); } catch (Exception ex) { DebugHelper.LogException(ex, "Couldn't write TwitchPlaysLastClaimed.json:"); } }