예제 #1
0
        // --------------------------------------------------------------------------------------------------------------------------------

        private void designDropdown_SelectedIndexChanged(object sender, EventArgs e)
        {
            DesignEnum chosenDesign = PAPIApplication.GetDesign();

            switch (design_dropdown.SelectedIndex)
            {
            case 0:
                chosenDesign = DesignEnum.PAPYRUS;
                break;

            case 1:
                chosenDesign = DesignEnum.DIGITAL;
                break;

            case 2:
                chosenDesign = DesignEnum.NOVEL;
                break;

            default:
                break;
            }
            if (chosenDesign != PAPIApplication.GetDesign())
            {
                PAPIApplication.SetDesign(chosenDesign);
                WfLogger.Log(this, LogLevel.DEBUG, "Set design to " + PAPIApplication.GetDesign() + " in dropdown");
                SetDesign();
                SetButtonDesign();
            }
        }
예제 #2
0
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Sets the desisgn of the buttons to the same as the view
        /// </summary>
        protected void SetButtonDesign()
        {
            foreach (Button button in _buttons)
            {
                button.BackColor = BackColor;
                button.ForeColor = ForeColor;
                button.FlatStyle = FlatStyle.Flat;
                if (button.Text != "")
                {
                    button.Size = new Size(200, 40);
                }
                else
                {
                    button.Size = new Size(40, 40);
                }
            }
            WfLogger.Log(this, LogLevel.DEBUG, "Button design was set to " + PAPIApplication.GetDesign());
        }
예제 #3
0
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Sets the design of the view to the one, that was set in the settings
        /// </summary>
        protected void SetDesign()
        {
            switch (PAPIApplication.GetDesign())
            {
            case DesignEnum.PAPYRUS:
                BackColor = System.Drawing.Color.AntiqueWhite;
                ForeColor = System.Drawing.Color.Black;
                Font      = new Font("Papyrus", 12, FontStyle.Bold);
                break;

            case DesignEnum.DIGITAL:
                BackColor = System.Drawing.Color.Black;
                ForeColor = System.Drawing.Color.Lime;
                Font      = new Font("Consolas", 12);
                break;

            default:
                BackColor = System.Drawing.Color.White;
                ForeColor = System.Drawing.Color.Black;
                Font      = new Font("Calibri", 12);
                break;
            }
            FormBorderStyle = FormBorderStyle.Sizable;
            StartPosition   = FormStartPosition.Manual;
            if (ViewController.lastView != null)
            {
                Location = ViewController.lastView.Location;
                Size     = ViewController.lastView.Size;
            }
            else
            {
                Location = new Point(0, 0);
                Size     = new Size(800, 600);
            }
            WindowState   = FormWindowState.Normal;
            MaximizeBox   = true;
            MinimizeBox   = true;
            ShowIcon      = false;
            ShowInTaskbar = true;
            AutoScaleMode = AutoScaleMode.None;
            ControlBox    = true;
            WfLogger.Log(this, LogLevel.DEBUG, "Design was set to " + PAPIApplication.GetDesign());
            SetButtonDesign();
        }
        // --------------------------------------------------------------------------------------------------------------------------------

        /// <summary>
        /// Puts all saved games to the table
        /// </summary>
        private void ShowSavedGamesTranslation(ResXResourceSet resSet)
        {
            // Show all saved Games
            int rowNr = 1;

            foreach (PAPIGame game in _savedGames)
            {
                if (_shownGames.Contains(game))
                {
                    continue;
                }

                WfLogger.Log(this, LogLevel.DEBUG, "Added game to list of saved games: " + game._genre + ", " + game._dateOfLastSession.ToString());

                // Add Genre
                gameTable.Controls.Add(new Label()
                {
                    Text   = TranslatedString(resSet, "genre_" + _savedGames[rowNr - 1]._genre.ToString().ToLower()),
                    Anchor = AnchorStyles.Left | AnchorStyles.Top,
                    Width  = 250
                }, 0, rowNr);

                // Date of creation label
                gameTable.Controls.Add(new Label()
                {
                    Text   = game._dateOfCreation.ToShortDateString(),
                    Anchor = AnchorStyles.Left | AnchorStyles.Top,
                }, 1, rowNr);

                // Date of last save label
                gameTable.Controls.Add(new Label()
                {
                    Text   = game._dateOfLastSession.ToShortDateString(),
                    Anchor = AnchorStyles.Left | AnchorStyles.Top,
                }, 2, rowNr);


                // Add show Game Button to current row
                Button showGameBtn = new Button()
                {
                    Text      = "",
                    FlatStyle = FlatStyle.Flat,
                    Anchor    = AnchorStyles.Right | AnchorStyles.Top,
                    Size      = new Size(40, 40),
                    Name      = "load_game_button_" + rowNr
                };
                string imagePath = GameDirectory.GetFilePath_Images(PAPIApplication.GetDesign()) + "\\show.bmp";
                Image  image     = Image.FromFile(imagePath);
                showGameBtn.Image = (Image)(new Bitmap(image, new Size(40, 40)));
                _gameButtons.Add(game, showGameBtn);
                gameTable.Controls.Add(showGameBtn, 2, rowNr++);
                _buttons.Add(showGameBtn);
                _shownGames.Add(game);
            }

            // Set size of each row to same
            foreach (RowStyle rowStyle in gameTable.RowStyles)
            {
                rowStyle.SizeType = SizeType.Absolute;
                rowStyle.Height   = 44;
            }

            _buttons.Add(return_button);
            _buttons.Add(game_creator_button);
            SetButtonDesign();

            // Add eventhandler for click on every show game button
            foreach (KeyValuePair <PAPIGame, Button> button in _gameButtons)
            {
                button.Value.Click += Load_Game_Button_Click;
            }
        }