Esempio n. 1
0
        public bool SelectSelectorStateArea(Button selectedArea, int selectorPlayerNumber)
        {
            int selectedStateNumber = selectedTakeOverAreaNodes.First().ownedStateNumber;

            if (IsSelectorPlayerState(selectedArea, selectorPlayerNumber))
            {
                if (IsAreaAdjacent(selectedArea, selectedStateNumber, selectorBetAreaNodes))
                {
                    AreaSelectNode saverButton = new AreaSelectNode()
                    {
                        ownedStateNumber = StateFlag.GetPlayerNumberWithFlag(selectedArea.BackColor),
                        currentFlag      = selectedArea.BackColor,
                        areaNumber       = int.Parse(selectedArea.Name)
                    };

                    selectorBetAreaNodes.Push(saverButton);

                    selectedArea.BackColor = Color.White;

                    return(true);
                }
                else
                {
                    WarningMessager.AreaNotAdjacent();
                }
            }

            else
            {
                WarningMessager.NotSelectorPlayerState();
            }

            return(false);
        }
Esempio n. 2
0
        public bool SelectOtherStateArea(Button selectedArea, int selectorPlayerNumber)
        {
            if (!IsSelectorPlayerState(selectedArea, selectorPlayerNumber))
            {
                if (!IsStateOfAnotherEnemyPlayer(selectedArea))
                {
                    if (IsAreaAdjacent(selectedArea, selectorPlayerNumber, selectedTakeOverAreaNodes))
                    {
                        AreaSelectNode areaNode = new AreaSelectNode()
                        {
                            ownedStateNumber = StateFlag.GetPlayerNumberWithFlag(selectedArea.BackColor),
                            currentFlag      = selectedArea.BackColor,
                            areaNumber       = int.Parse(selectedArea.Name)
                        };

                        selectedTakeOverAreaNodes.Push(areaNode);

                        selectedArea.BackColor = Color.Black;

                        return(true);
                    }
                    else
                    {
                        WarningMessager.AreaNotAdjacent();
                    }
                }

                else
                {
                    WarningMessager.StateOfEnemyPlayer();
                }
            }

            else
            {
                WarningMessager.SelectorPlayerState();
            }

            return(false);
        }