public void CreateMap(int numberPlayers, string[] stateNames) { CreateGameStates(numberPlayers, stateNames); CreateStateAreas(currentAreas, gameStates); const int FIRSTXCOORDINATE = 60; int xCoordinate = FIRSTXCOORDINATE; int yCoordinate = 0; for (int buttonRecorder = 0; buttonRecorder < currentAreas.Length; buttonRecorder++) { int playerNumber = FindPlayerNumberWithArea(numberPlayers, buttonRecorder); gameStates[playerNumber].ownedAreas.Add(buttonRecorder); CreateButtonProperties(buttonRecorder, xCoordinate, yCoordinate, StateFlag.GetFlag(playerNumber)); if (xCoordinate - FIRSTXCOORDINATE >= 580) { yCoordinate += 20; xCoordinate = FIRSTXCOORDINATE; } else { xCoordinate += 20; } } }
private string[] GetDefaultStateName(int numberPlayers) { string[] stateNames = new string[numberPlayers]; for (int stateNameRecorder = 0; stateNameRecorder < stateNames.Length; stateNameRecorder++) { stateNames[stateNameRecorder] = StateFlag.GetFlag(stateNameRecorder).Name; } return(stateNames); }
private void AnnexAreas(int annextationStateNumber, int requestedStateNumber, Stack <AreaSelectNode> annexedAreas) { while (annexedAreas.Count != 0) { AreaSelectNode oldAreaNode = annexedAreas.Pop(); currentAreas[oldAreaNode.areaNumber].BackColor = StateFlag.GetFlag(annextationStateNumber); gameStates[annextationStateNumber].ownedAreas.Add(oldAreaNode.areaNumber); gameStates[requestedStateNumber].ownedAreas.Remove(oldAreaNode.areaNumber); } }
private void CreateGameStates(int numberPlayers, string [] stateNames) { gameStates = new GameState[numberPlayers]; for (int playerRecorder = 0; playerRecorder < gameStates.Length; playerRecorder++) { GameState newGameState = new GameState { name = stateNames[playerRecorder], ownedAreas = new List <object>(), flag = StateFlag.GetFlag(playerRecorder) }; gameStates[playerRecorder] = newGameState; } }
private bool IsSelectorPlayerState(Button selectedArea, int selectorPlayerNumber) { return(selectedArea.BackColor == StateFlag.GetFlag(selectorPlayerNumber)); }