コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: alanjg/MajorDomo
        private void newSinglePlayerGameRandom(object sender, RoutedEventArgs e)
        {
            if (App.CurrentGame != null)
            {
                App.CurrentGame.CancelGame();
            }

            Game game = new LocalGame();
            App.CurrentGame = game;
            Kingdom kingdom = new Kingdom(null, App.ProhibitedCards.ProhibitedCards, null, App.SupportedSets.AllowedSets, 2, App.Settings.UseColonies, App.Settings.UseShelters, App.Settings.StartingHandType, App.Settings.UseRandomCardsFromChosenSetsOnly);
            game.GamePageModel.Kingdom = kingdom;
            game.PlayGame();
            App.RootFrame.Navigate(new Uri("/GamePage.xaml", UriKind.Relative));
        }
コード例 #2
0
        private void Click_OK(object sender, RoutedEventArgs e)
        {
            if (this.Model.SelectedCards.Count == 10)
            {
                if (App.CurrentGame != null)
                {
                    App.CurrentGame.CancelGame();
                }

                Game game = new LocalGame();
                App.CurrentGame = game;
                IList<CardModel> cards = this.Model.SelectedCards.Select(c => c.CardModel).ToList();
                CardModel bane = this.Model.BaneCard != null ? this.Model.BaneCard.CardModel : null;
                Kingdom kingdom = new Kingdom(cards, App.ProhibitedCards.ProhibitedCards, bane, App.SupportedSets.AllowedSets, 2, App.Settings.UseColonies, App.Settings.UseShelters, App.Settings.StartingHandType, App.Settings.UseRandomCardsFromChosenSetsOnly);
                game.GamePageModel.Kingdom = kingdom;
                game.PlayGame();

                App.RootFrame.Navigate(new Uri("/GamePage.xaml", UriKind.Relative));
            }
        }