protected override void RecordPopupListState(string popupListName, string selectionName) {
     base.RecordPopupListState(popupListName, selectionName);
     UniverseSize universeSize;
     if (Enums<UniverseSize>.TryParse(selectionName, true, out universeSize)) {
         //D.Log("UniverseSize recorded as {0}.".Inject(selectionName));
         _universeSize = universeSize;
     }
     Races playerRace;
     if (Enums<Races>.TryParse(selectionName, true, out playerRace)) {
         //D.Log("Player recorded as {0}.".Inject(selectionName));
         _playerRace = playerRace;
     }
     GameColor playerColor;
     if (Enums<GameColor>.TryParse(selectionName, true, out playerColor)) {
         _playerColor = playerColor;
     }
 }
    protected override void RecordPopupListState(GuiElementID popupListID, string selection) {
        base.RecordPopupListState(popupListID, selection);
        //D.Log("{0}.RecordPopupListState() called. ID = {1}, Selection = {2}.", GetType().Name, popupListID.GetName(), selectionName);
        switch (popupListID) {
            case GuiElementID.UniverseSizePopupList:
                _universeSizeSelection = Enums<UniverseSizeGuiSelection>.Parse(selection);
                UniverseSize = _universeSizeSelection.Convert();
                break;

            case GuiElementID.UserPlayerSpeciesPopupList:
                _userPlayerSpeciesSelection = Enums<SpeciesGuiSelection>.Parse(selection);
                _userPlayerSpecies = _userPlayerSpeciesSelection.Convert();
                break;
            case GuiElementID.AIPlayer1SpeciesPopupList:
                _aiPlayerSpeciesSelections[0] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[0] = _aiPlayerSpeciesSelections[0].Convert();
                break;
            case GuiElementID.AIPlayer2SpeciesPopupList:
                _aiPlayerSpeciesSelections[1] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[1] = _aiPlayerSpeciesSelections[1].Convert();
                break;
            case GuiElementID.AIPlayer3SpeciesPopupList:
                _aiPlayerSpeciesSelections[2] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[2] = _aiPlayerSpeciesSelections[2].Convert();
                break;
            case GuiElementID.AIPlayer4SpeciesPopupList:
                _aiPlayerSpeciesSelections[3] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[3] = _aiPlayerSpeciesSelections[3].Convert();
                break;
            case GuiElementID.AIPlayer5SpeciesPopupList:
                _aiPlayerSpeciesSelections[4] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[4] = _aiPlayerSpeciesSelections[4].Convert();
                break;
            case GuiElementID.AIPlayer6SpeciesPopupList:
                _aiPlayerSpeciesSelections[5] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[5] = _aiPlayerSpeciesSelections[5].Convert();
                break;
            case GuiElementID.AIPlayer7SpeciesPopupList:
                _aiPlayerSpeciesSelections[6] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[6] = _aiPlayerSpeciesSelections[6].Convert();
                break;

            case GuiElementID.UserPlayerColorPopupList:
                _userPlayerColor = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer1ColorPopupList:
                _aiPlayerColors[0] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer2ColorPopupList:
                _aiPlayerColors[1] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer3ColorPopupList:
                _aiPlayerColors[2] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer4ColorPopupList:
                _aiPlayerColors[3] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer5ColorPopupList:
                _aiPlayerColors[4] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer6ColorPopupList:
                _aiPlayerColors[5] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer7ColorPopupList:
                _aiPlayerColors[6] = Enums<GameColor>.Parse(selection);
                break;
            default:
                throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(popupListID));
        }
    }
Esempio n. 3
0
 public UniverseParamsBuilder WithSize(UniverseSize universeSize)
 {
     _universeParams.Size = universeSize;
     return(this);
 }
    protected override void RecordPopupListState(GuiElementID popupListID, string selection, string convertedSelection) {
        base.RecordPopupListState(popupListID, selection, convertedSelection);
        //D.Log("{0}.RecordPopupListState() called. ID = {1}, Selection = {2}.", GetType().Name, popupListID.GetValueName(), selectionName);
        switch (popupListID) {
            case GuiElementID.UniverseSizePopupList:
                _universeSizeSelection = Enums<UniverseSizeGuiSelection>.Parse(selection);
                _universeSize = Enums<UniverseSize>.Parse(convertedSelection);
                break;
            case GuiElementID.SystemDensityPopupList:
                _systemDensitySelection = Enums<SystemDensityGuiSelection>.Parse(selection);
                _systemDensity = Enums<SystemDensity>.Parse(convertedSelection);
                break;
            case GuiElementID.PlayerCountPopupList:
                _playerCount = int.Parse(selection);
                break;

            case GuiElementID.UserPlayerSpeciesPopupList:
                _userPlayerSpeciesSelection = Enums<SpeciesGuiSelection>.Parse(selection);
                _userPlayerSpecies = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer1SpeciesPopupList:
                _aiPlayersSpeciesSelections[0] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[0] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer2SpeciesPopupList:
                _aiPlayersSpeciesSelections[1] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[1] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer3SpeciesPopupList:
                _aiPlayersSpeciesSelections[2] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[2] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer4SpeciesPopupList:
                _aiPlayersSpeciesSelections[3] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[3] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer5SpeciesPopupList:
                _aiPlayersSpeciesSelections[4] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[4] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer6SpeciesPopupList:
                _aiPlayersSpeciesSelections[5] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[5] = Enums<Species>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer7SpeciesPopupList:
                _aiPlayersSpeciesSelections[6] = Enums<SpeciesGuiSelection>.Parse(selection);
                _aiPlayersSpecies[6] = Enums<Species>.Parse(convertedSelection);
                break;

            case GuiElementID.UserPlayerColorPopupList:
                _userPlayerColor = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer1ColorPopupList:
                _aiPlayersColors[0] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer2ColorPopupList:
                _aiPlayersColors[1] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer3ColorPopupList:
                _aiPlayersColors[2] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer4ColorPopupList:
                _aiPlayersColors[3] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer5ColorPopupList:
                _aiPlayersColors[4] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer6ColorPopupList:
                _aiPlayersColors[5] = Enums<GameColor>.Parse(selection);
                break;
            case GuiElementID.AIPlayer7ColorPopupList:
                _aiPlayersColors[6] = Enums<GameColor>.Parse(selection);
                break;

            case GuiElementID.AIPlayer1IQPopupList:
                _aiPlayersIQs[0] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer2IQPopupList:
                _aiPlayersIQs[1] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer3IQPopupList:
                _aiPlayersIQs[2] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer4IQPopupList:
                _aiPlayersIQs[3] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer5IQPopupList:
                _aiPlayersIQs[4] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer6IQPopupList:
                _aiPlayersIQs[5] = Enums<IQ>.Parse(selection);
                break;
            case GuiElementID.AIPlayer7IQPopupList:
                _aiPlayersIQs[6] = Enums<IQ>.Parse(selection);
                break;

            case GuiElementID.UserPlayerTeamPopupList:
                _userPlayerTeam = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer1TeamPopupList:
                _aiPlayersTeams[0] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer2TeamPopupList:
                _aiPlayersTeams[1] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer3TeamPopupList:
                _aiPlayersTeams[2] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer4TeamPopupList:
                _aiPlayersTeams[3] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer5TeamPopupList:
                _aiPlayersTeams[4] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer6TeamPopupList:
                _aiPlayersTeams[5] = Enums<TeamID>.Parse(selection);
                break;
            case GuiElementID.AIPlayer7TeamPopupList:
                _aiPlayersTeams[6] = Enums<TeamID>.Parse(selection);
                break;

            case GuiElementID.UserPlayerStartLevelPopupList:
                _userPlayerStartLevelSelection = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _userPlayerStartLevel = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer1StartLevelPopupList:
                _aiPlayersStartLevelSelections[0] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[0] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer2StartLevelPopupList:
                _aiPlayersStartLevelSelections[1] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[1] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer3StartLevelPopupList:
                _aiPlayersStartLevelSelections[2] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[2] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer4StartLevelPopupList:
                _aiPlayersStartLevelSelections[3] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[3] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer5StartLevelPopupList:
                _aiPlayersStartLevelSelections[4] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[4] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer6StartLevelPopupList:
                _aiPlayersStartLevelSelections[5] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[5] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer7StartLevelPopupList:
                _aiPlayersStartLevelSelections[6] = Enums<EmpireStartLevelGuiSelection>.Parse(selection);
                _aiPlayersStartLevels[6] = Enums<EmpireStartLevel>.Parse(convertedSelection);
                break;

            case GuiElementID.UserPlayerHomeDesirabilityPopupList:
                _userPlayerHomeSystemDesirabilitySelection = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _userPlayerHomeSystemDesirability = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer1HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[0] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[0] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer2HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[1] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[1] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer3HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[2] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[2] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer4HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[3] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[3] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer5HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[4] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[4] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer6HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[5] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[5] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer7HomeDesirabilityPopupList:
                _aiPlayersHomeSystemDesirabilitySelections[6] = Enums<SystemDesirabilityGuiSelection>.Parse(selection);
                _aiPlayersHomeSystemDesirability[6] = Enums<SystemDesirability>.Parse(convertedSelection);
                break;

            case GuiElementID.AIPlayer1UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[0] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[0] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer2UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[1] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[1] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer3UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[2] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[2] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer4UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[3] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[3] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer5UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[4] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[4] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer6UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[5] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[5] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;
            case GuiElementID.AIPlayer7UserSeparationPopupList:
                _aiPlayersUserSeparationSelections[6] = Enums<PlayerSeparationGuiSelection>.Parse(selection);
                _aiPlayersUserSeparations[6] = Enums<PlayerSeparation>.Parse(convertedSelection);
                break;

            default:
                throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(popupListID));
        }
    }