Beispiel #1
0
        /// <summary>
        /// Creates the column that shows the rules selections.
        /// </summary>
        private void CreateRulesColumn()
        {
            // --- Rules Gridview ---

            Label_ColumnHeaderRules.Text = KalahaResources.I.GetRes("Label_ColumnHeaderRules");

            SimpleButton captureSeedsAtEndButton = new SimpleButton
            {
                Label = KalahaResources.I.GetRes("Label_Rule_CaptureSeedsAtEnd"),
                Id = 1
            };

            SimpleButton pieRuleButton = new SimpleButton
            {
                Label = KalahaResources.I.GetRes("Label_Rule_PieRule"),
                Id = 2
            };

            gridView_Rules.Items.Add(captureSeedsAtEndButton);
       //     gridView_Rules.Items.Add(pieRuleButton);

            gridView_Rules.IsItemClickEnabled = false;
            gridView_Rules.SelectionMode = ListViewSelectionMode.Multiple;

            if (Rules.I.CaptureSeedsAtEndOfGame())
            {
                gridView_Rules.SelectedItems.Add(captureSeedsAtEndButton);
            }

            if (Rules.I.PieRuleIsEnabled())
            {
                gridView_Rules.SelectedItems.Add(pieRuleButton);
            }

            gridView_Rules.SelectionChanged += Rules_SelectionChanged;


            // --- Capture type ---

            // Create the "toggle" button:
            SimpleButton captureTypeButton = new SimpleButton
            {
                Id = (int)Rules.I.GetCaptureType(),
                Label = KalahaResources.I.GetRes("Label_CaptureType_" + ((int)Rules.I.GetCaptureType()).ToString())
            };

            // Create the gridview with the one "toggle" button for the capture type:
            Label_CaptureType.Text = KalahaResources.I.GetRes("Label_CaptureType");
            gridView_CaptureType.Items.Add(captureTypeButton);
            gridView_CaptureType.SelectionMode = ListViewSelectionMode.Multiple;
            gridView_CaptureType.SelectedItem = captureTypeButton;
            gridView_CaptureType.SelectionChanged += CaptureType_Clicked;


            // --- Sowing direction in the settings ---

            // Create the "toggle" button:
            SimpleButton directionSowingButton = new SimpleButton
            {
                Id = (int)Rules.I.GetDirectionOfSowing(),
                Label = KalahaResources.I.GetRes("Label_DirOfSowing_" + ((int)Rules.I.GetDirectionOfSowing()).ToString())
            };

            // Create the gridview with the one "toggle" button for the direction of sowing:
            Label_SelectSowingDirection.Text = KalahaResources.I.GetRes("Label_SelectSowingDirection");
            gridView_SowingDirection.Items.Add(directionSowingButton);
            gridView_SowingDirection.SelectionMode = ListViewSelectionMode.Multiple;
            gridView_SowingDirection.SelectedItem = directionSowingButton;
            gridView_SowingDirection.SelectionChanged += DirectionSowing_Clicked;
        }
Beispiel #2
0
        /// <summary>
        /// Creates the two columns that show the player selections.
        /// </summary>
        private void CreatePlayerColumns()
        {
            // --- Define buttons for player selection (both south and north) ---

            SimpleButton humanButtonSouth = new SimpleButton
            {
                Label = Presenter.I.GetSouthPlayersHumanName(),
                Id = 1,
                Position = 0  // indicating that this is a south button (for later use in events)
            };

            SimpleButton humanButtonNorth = new SimpleButton
            {
                Label = Presenter.I.GetNorthPlayersHumanName(),
                Id = 1,
                Position = 1  // indicating that this is a north button (for later use in events)
            };

            SimpleButton computerEasyButton = new SimpleButton
            {
                Label = KalahaResources.I.GetLayoutRes("ComputerEasyName") + " (" + KalahaResources.I.GetRes("Label_ComputerEasy") + ")",
                Id = 2
            };
            
            SimpleButton computerMediumButton = new SimpleButton
            {
                Label = KalahaResources.I.GetLayoutRes("ComputerMediumName") + " (" + KalahaResources.I.GetRes("Label_ComputerMedium") + ")",
                Id = 3
            };
            
            SimpleButton computerHardButton = new SimpleButton
            {
                Label = KalahaResources.I.GetLayoutRes("ComputerHardName") + " (" + KalahaResources.I.GetRes("Label_ComputerHard") + ")",
                Id = 4
            };


            // --- GridView for the southern player ---

            Label_ColumnHeaderPlayerSouth.Text = KalahaResources.I.GetRes("Label_ColumnHeaderPlayerSouth");
            gridView_PlayerSpeciesSouth.Items.Add(humanButtonSouth);
            gridView_PlayerSpeciesSouth.Items.Add(computerEasyButton);
            gridView_PlayerSpeciesSouth.Items.Add(computerMediumButton);
            gridView_PlayerSpeciesSouth.Items.Add(computerHardButton);
            gridView_PlayerSpeciesSouth.IsHoldingEnabled = true;
            gridView_PlayerSpeciesSouth.Holding += gridView_PlayerSpecies_Holding;
            gridView_PlayerSpeciesSouth.SelectionMode = ListViewSelectionMode.Single;

            // Set the selection of the species button according to the currently set species:
            if (Presenter.I.SouthPlayerIsHuman())
            {
                gridView_PlayerSpeciesSouth.SelectedItem = humanButtonSouth;
            }
            else
            {
                switch (Presenter.I.GetSouthernComputerStrength())
                {
                    case Player.ComputerStrength.Easy:
                        gridView_PlayerSpeciesSouth.SelectedItem = computerEasyButton;
                        break;
                    case Player.ComputerStrength.Medium:
                        gridView_PlayerSpeciesSouth.SelectedItem = computerMediumButton;
                        break;
                    case Player.ComputerStrength.Hard:
                        gridView_PlayerSpeciesSouth.SelectedItem = computerHardButton;
                        break;
                }
            }

            gridView_PlayerSpeciesSouth.SelectionChanged += SpeciesSouth_SelectionChanged;


            // --- GridView for the northern player ---

            Label_ColumnHeaderPlayerNorth.Text = KalahaResources.I.GetRes("Label_ColumnHeaderPlayerNorth");
            gridView_PlayerSpeciesNorth.Items.Add(humanButtonNorth);
            gridView_PlayerSpeciesNorth.Items.Add(computerEasyButton);
            gridView_PlayerSpeciesNorth.Items.Add(computerMediumButton);
            gridView_PlayerSpeciesNorth.Items.Add(computerHardButton);
            gridView_PlayerSpeciesNorth.IsHoldingEnabled = true;
            gridView_PlayerSpeciesNorth.Holding += gridView_PlayerSpecies_Holding;
            gridView_PlayerSpeciesNorth.SelectionMode = ListViewSelectionMode.Single;
            // Set the selection of the species button according to the currently set species:
            if (Presenter.I.NorthPlayerIsHuman())
            {
                gridView_PlayerSpeciesNorth.SelectedItem = humanButtonNorth;
            }
            else
            {
                switch (Presenter.I.GetNorthernComputerStrength())
                {
                    case Player.ComputerStrength.Easy:
                        gridView_PlayerSpeciesNorth.SelectedItem = computerEasyButton;
                        break;
                    case Player.ComputerStrength.Medium:
                        gridView_PlayerSpeciesNorth.SelectedItem = computerMediumButton;
                        break;
                    case Player.ComputerStrength.Hard:
                        gridView_PlayerSpeciesNorth.SelectedItem = computerHardButton;
                        break;
                }
            }

            gridView_PlayerSpeciesNorth.SelectionChanged += SpeciesNorth_SelectionChanged;
        }