コード例 #1
0
 private void GameLogControl_Load(object sender, EventArgs e)
 {
     PopupDeckWindow = new DeckWindow();
     PopupDeckWindow.ShouldHideOnMouseLeave = true;
     PopupDeckWindow.StartPosition          = FormStartPosition.Manual;
     GameLogDisplay.Width  = BestWidth;
     GameLogDisplay.Height = BestHeight;
 }
コード例 #2
0
 /// <summary>
 /// Set associated deck windows
 /// </summary>
 /// <param name="playerActiveDeckWindow"></param>
 /// <param name="playerDrawnCardsWindow"></param>
 /// <param name="playerPlayedCardsWindow"></param>
 /// <param name="opponentPlayedCardsWindow"></param>
 public void SetDeckWindows(
     DeckWindow playerActiveDeckWindow,
     DeckWindow playerDrawnCardsWindow,
     DeckWindow playerPlayedCardsWindow,
     DeckWindow opponentPlayedCardsWindow)
 {
     PlayerActiveDeckWindow    = playerActiveDeckWindow;
     PlayerDrawnCardsWindow    = playerDrawnCardsWindow;
     PlayerPlayedCardsWindow   = playerPlayedCardsWindow;
     OpponentPlayedCardsWindow = opponentPlayedCardsWindow;
 }
コード例 #3
0
        private DeckWindow CreateDeckWindow(string title, DeckControl.DeckScale deckScale, double opacity,
                                            bool showWindow, int posX, int posY)
        {
            DeckWindow deckWindow = new DeckWindow();

            deckWindow.CreateControl();
            deckWindow.Title               = title;
            deckWindow.CustomDeckScale     = deckScale;
            deckWindow.ShouldShowDeckStats = Properties.Settings.Default.ShowDeckStats;
            deckWindow.Show();
            deckWindow.IsNonEmptyDeckVisible = showWindow;
            deckWindow.SetBounds(posX, posY, 0, 0, BoundsSpecified.Location);
            deckWindow.Opacity = opacity;
            deckWindow.UpdateDeck(null, null);
            return(deckWindow);
        }
コード例 #4
0
        /// <summary>
        /// Runs after all sets are downloaded and processed.
        /// Initializes the StaticDeck windows and deck tracking objects.
        /// </summary>
        public async void OnAllSetsDownloaded()
        {
            await Task.Run(() => CardLibrary.LoadAllCards(MyProgressDisplay));

            await Task.Run(() => GameHistory.LoadAllGames(MyProgressDisplay));

            DeckControl.DeckScale deckScale = DeckControl.DeckScale.Medium;
            if (Properties.Settings.Default.DeckDrawSize == 0)
            {
                deckScale = DeckControl.DeckScale.Small;
            }
            if (Properties.Settings.Default.DeckDrawSize == 2)
            {
                deckScale = DeckControl.DeckScale.Large;
            }

            double deckOpacity = Properties.Settings.Default.DeckTransparency / 100.0;

            PlayerActiveDeckWindow = CreateDeckWindow("No Active Deck", deckScale, deckOpacity,
                                                      Properties.Settings.Default.ShowPlayerDeck,
                                                      Properties.Settings.Default.PlayerDeckLocation.X,
                                                      Properties.Settings.Default.PlayerDeckLocation.Y);
            PlayerDrawnCardsWindow = CreateDeckWindow("Drawn Cards", deckScale, deckOpacity,
                                                      Properties.Settings.Default.ShowPlayerDrawnCards,
                                                      Properties.Settings.Default.PlayerDrawnCardsLocation.X,
                                                      Properties.Settings.Default.PlayerDrawnCardsLocation.Y);
            PlayerGraveyardWindow = CreateDeckWindow("Graveyard", deckScale, deckOpacity,
                                                     Properties.Settings.Default.ShowPlayerGraveyard,
                                                     Properties.Settings.Default.PlayerPlayedCardsLocation.X,
                                                     Properties.Settings.Default.PlayerPlayedCardsLocation.Y);
            OpponentGraveyardWindow = CreateDeckWindow("Opponent Graveyard", deckScale, deckOpacity,
                                                       Properties.Settings.Default.ShowOpponentGraveyard,
                                                       Properties.Settings.Default.OpponentPlayedCardsLocation.X,
                                                       Properties.Settings.Default.OpponentPlayedCardsLocation.Y);

            PlayerActiveDeckWindow.HideZeroCountCards = Properties.Settings.Default.HideZeroCountInDeck;

            ActiveLogWindow = new LogWindow();
            ActiveLogWindow.CreateControl();
            if (Properties.Settings.Default.ActiveLogWindowBounds.Width > 0 &&
                Properties.Settings.Default.ActiveLogWindowBounds.Left > 0)
            {
                ActiveLogWindow.StartPosition = FormStartPosition.Manual;
                ActiveLogWindow.SetBounds(
                    Properties.Settings.Default.ActiveLogWindowBounds.X,
                    Properties.Settings.Default.ActiveLogWindowBounds.Y,
                    Properties.Settings.Default.ActiveLogWindowBounds.Width,
                    Properties.Settings.Default.ActiveLogWindowBounds.Height,
                    BoundsSpecified.All);
            }

            {
                // Show and hide active log window to make sure it's loaded ahead of time
                ActiveLogWindow.Show();
                ActiveLogWindow.Hide();
            }
            Log.SetLogWindow(ActiveLogWindow);

            // Special debigging window is shown if D key is held during load
            if (!string.IsNullOrEmpty(Constants.PlayBackDeckPath) || Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                OverlayWindow = new GameBoardWatchWindow();
                OverlayWindow.Show();
            }

            CurrentPlayState = new CardsInPlayWorker(this);
            if (string.IsNullOrEmpty(Constants.PlayBackDeckPath))
            {
                CurrentExpedition = new Expedition(this);
            }

            // Hide the progress display and make all the other UI elements visible
            MyProgressDisplay.Visible         = false;
            DecksListCtrl.Visible             = true;
            HighlightedGameLogControl.Visible = true;
            TheMenuBar.Visible = true;

            // Load all games. We do this in reverse as AddDeckToList expects them
            // in chronological order
            for (int i = GameHistory.Games.Count - 1; i >= 0; i--)
            {
                DecksListCtrl.AddToDeckList(GameHistory.Games[i]);
            }

            Utilities.CallActionSafelyAndWait(DecksListCtrl, new Action(() => { DecksListCtrl.SwitchDeckView(false); }));

            CurrentPlayState.Start(string.IsNullOrEmpty(Constants.PlayBackDeckPath)
                ? null : Constants.GetLocalGamesPath() + "\\" + Constants.PlayBackDeckPath);
        }