Exemple #1
0
        public void HandleInMenu()
        {
            if (_game.IsInMenu)
            {
                return;
            }

            if (Config.Instance.RecordReplays && _game.Entities.Count > 0 && !_game.SavedReplay && _game.CurrentGameStats != null &&
                _game.CurrentGameStats.ReplayFile == null && RecordCurrentGameMode)
            {
                _game.CurrentGameStats.ReplayFile = ReplayMaker.SaveToDisk();
            }

            SaveAndUpdateStats();

            _game.IsInMenu = true;
            TurnTimer.Instance.Stop();
            Helper.MainWindow.Overlay.HideTimers();
            Helper.MainWindow.Overlay.HideSecrets();
            if (Config.Instance.KeyPressOnGameEnd != "None" && Helper.MainWindow.EventKeys.Contains(Config.Instance.KeyPressOnGameEnd))
            {
                SendKeys.SendWait("{" + Config.Instance.KeyPressOnGameEnd + "}");
                Logger.WriteLine("Sent keypress: " + Config.Instance.KeyPressOnGameEnd, "GameEventHandler");
            }
            if (!Config.Instance.KeepDecksVisible)
            {
                var deck = DeckList.Instance.ActiveDeckVersion;
                if (deck != null)
                {
                    _game.SetPremadeDeck((Deck)deck.Clone());
                }
            }
            if (!_game.IsUsingPremade)
            {
                _game.DrawnLastGame = new List <Card>(_game.PlayerDrawn);
            }
            HsLogReaderV2.Instance.ClearLog();
            if (!Config.Instance.KeepDecksVisible)
            {
                _game.Reset(false);
            }
            if (_game.CurrentGameStats != null && _game.CurrentGameStats.Result != GameResult.None)
            {
                _game.CurrentGameStats = null;
            }
            if (_game.CurrentGameMode == GameMode.Spectator)
            {
                SetGameMode(GameMode.None);
            }
            GameEvents.OnInMenu.Execute();
        }
Exemple #2
0
 private void CheckboxRemoveCards_Checked(object sender, RoutedEventArgs e)
 {
     if (!_initialized || !_game.IsUsingPremade)
     {
         return;
     }
     Config.Instance.RemoveCardsFromDeck = true;
     SaveConfig(false);
     _game.Reset();
     if (DeckList.Instance.ActiveDeck != null)
     {
         _game.SetPremadeDeck((Deck)DeckList.Instance.ActiveDeck.Clone());
     }
     HsLogReaderV2.Instance.Reset(true);
     Helper.MainWindow.Overlay.Update(true);
 }
Exemple #3
0
        private async void CheckboxRemoveCards_Checked(object sender, RoutedEventArgs e)
        {
            if (!_initialized || !_game.IsUsingPremade)
            {
                return;
            }
            Config.Instance.RemoveCardsFromDeck = true;
            SaveConfig(false);
            _game.Reset();
            if (DeckList.Instance.ActiveDeck != null)
            {
                _game.SetPremadeDeck((Deck)DeckList.Instance.ActiveDeck.Clone());
            }
            await LogReaderManager.Restart();

            Core.Overlay.Update(true);
        }