protected override void RecordCheckboxState(GuiElementID checkboxID, bool isChecked) {
     base.RecordCheckboxState(checkboxID, isChecked);
     switch (checkboxID) {
         case GuiElementID.ElementIconsCheckbox:
             _isElementIconsEnabled = isChecked;
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(checkboxID));
     }
 }
 protected override void RecordPopupListState(GuiElementID popupListID, string selection, string convertedSelection) {
     base.RecordPopupListState(popupListID, selection, convertedSelection);
     switch (popupListID) {
         case GuiElementID.GameSpeedOnLoadPopupList:
             _gameSpeedOnLoad = Enums<GameSpeed>.Parse(selection);
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(popupListID));
     }
 }
 protected override void RecordPopupListState(GuiElementID popupListID, string selection, string convertedSelection) {
     base.RecordPopupListState(popupListID, selection, convertedSelection);
     switch (popupListID) {
         case GuiElementID.QualitySettingPopupList:
             _qualitySetting = selection;
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(popupListID));
     }
 }
 protected override void RecordCheckboxState(GuiElementID checkboxID, bool isChecked) {
     base.RecordCheckboxState(checkboxID, isChecked);
     switch (checkboxID) {
         case GuiElementID.PauseOnLoadCheckbox:
             _isPauseOnLoadEnabled = isChecked;
             break;
         case GuiElementID.CameraRollCheckbox:
             _isCameraRollEnabled = isChecked;
             break;
         case GuiElementID.ResetOnFocusCheckbox:
             _isResetOnFocusEnabled = isChecked;
             break;
         case GuiElementID.ZoomOutOnCursorCheckbox:
             _isZoomOutOnCursorEnabled = isChecked;
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(checkboxID));
     }
 }
Пример #5
0
 private UILabel GetLabel(Transform row, GuiElementID elementID) {
     return GetGuiElement(row, elementID).gameObject.GetSingleComponentInChildren<UILabel>();
 }
Пример #6
0
 protected int CompareSpeed(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.SpeedLabel;
     var rowASpeedLabel = GetLabel(rowA, GuiElementID.SpeedLabel);
     var rowBSpeedLabel = GetLabel(rowB, GuiElementID.SpeedLabel);
     return (int)_sortDirection * CompareEmbeddedFloat(rowASpeedLabel.text, rowBSpeedLabel.text);
 }
    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));
        }
    }
Пример #8
0
 private GuiElement GetGuiElement(Transform row, GuiElementID elementID) {
     var rowElements = row.gameObject.GetSafeMonoBehavioursInImmediateChildrenOnly<GuiElement>();
     return rowElements.Single(e => e.gameObject.GetSafeMonoBehaviour<GuiElement>().elementID == elementID);
 }
Пример #9
0
 private void ResetSortDirectionState() {
     _sortDirection = SortDirection.Descending;
     _lastSortTopic = GuiElementID.None;
     _lastSortDirection = SortDirection.Descending;
 }
Пример #10
0
 protected int CompareParticulates(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.ParticulatesLabel;
     var rowAParticulatesLabel = GetLabel(rowA, GuiElementID.ParticulatesLabel);
     var rowBParticulatesLabel = GetLabel(rowB, GuiElementID.ParticulatesLabel);
     return (int)_sortDirection * CompareEmbeddedFloat(rowAParticulatesLabel.text, rowBParticulatesLabel.text);
 }
Пример #11
0
 protected int CompareComposition(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Composition;
     var rowACompElement = GetGuiElement(rowA, GuiElementID.Composition) as ACompositionGuiElement;
     var rowBCompElement = GetGuiElement(rowB, GuiElementID.Composition) as ACompositionGuiElement;
     return (int)_sortDirection * rowACompElement.CompareTo(rowBCompElement);
 }
Пример #12
0
 private int CompareLocation(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Location;
     var rowALocationElement = GetGuiElement(rowA, GuiElementID.Location) as LocationGuiElement;
     var rowBLocationElement = GetGuiElement(rowB, GuiElementID.Location) as LocationGuiElement;
     return (int)_sortDirection * rowALocationElement.CompareTo(rowBLocationElement);
 }
Пример #13
0
 protected int CompareStrategicResources(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Resources;
     var rowAResourcesElement = GetGuiElement(rowA, GuiElementID.Resources) as ResourcesGuiElement;
     var rowBResourcesElement = GetGuiElement(rowB, GuiElementID.Resources) as ResourcesGuiElement;
     return (int)_sortDirection * rowAResourcesElement.CompareTo(rowBResourcesElement);
 }
Пример #14
0
 private int CompareOwner(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Owner;
     var rowAOwnerElement = GetGuiElement(rowA, GuiElementID.Owner) as OwnerGuiElement;
     var rowBOwnerElement = GetGuiElement(rowB, GuiElementID.Owner) as OwnerGuiElement;
     return (int)_sortDirection * rowAOwnerElement.CompareTo(rowBOwnerElement);
 }
Пример #15
0
    // Note 1: These comparison algorithms will be called multiple times when doing the sort so _sortDirection must be setup outside before sorting starts
    // Note 2: All Compare methods are located here. Only a subset are used by any particular Table Screen Manager

    private int CompareName(Transform rowA, Transform rowB) {
        _lastSortTopic = GuiElementID.ItemNameLabel;
        var rowANameLabel = GetLabel(rowA, GuiElementID.ItemNameLabel);
        var rowBNameLabel = GetLabel(rowB, GuiElementID.ItemNameLabel);
        return (int)_sortDirection * rowANameLabel.text.CompareTo(rowBNameLabel.text);
    }
Пример #16
0
 private static UILabel GetLabel(Transform row, GuiElementID elementID) {
     var rowLabels = row.gameObject.GetSafeMonoBehavioursInChildren<UILabel>();
     return rowLabels.Single(label => label.gameObject.GetSafeMonoBehaviour<GuiElement>().elementID == elementID);
 }
Пример #17
0
 private AGuiElement GetGuiElement(Transform row, GuiElementID elementID) {
     var rowElements = row.gameObject.GetSafeComponentsInImmediateChildren<AGuiElement>();
     return rowElements.Single(e => e.ElementID == elementID);
 }
Пример #18
0
 protected int CompareHealth(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Health;
     var rowAHealthElement = GetGuiElement(rowA, GuiElementID.Health) as HealthGuiElement;
     var rowBHealthElement = GetGuiElement(rowB, GuiElementID.Health) as HealthGuiElement;
     return (int)_sortDirection * rowAHealthElement.CompareTo(rowBHealthElement);
 }
Пример #19
0
 /// <summary>
 /// Assesses the sort direction needed and returns it. Records any 
 /// resulting sorting state changes in prep for the next query.
 /// </summary>
 /// <param name="sortTopic">The current sort topic.</param>
 /// <returns></returns>
 protected SortDirection DetermineSortDirection(GuiElementID sortTopic) {
     SortDirection sortDirection;
     if (_lastSortTopic != sortTopic) {
         // new sort topic so direction should be descending
         sortDirection = SortDirection.Descending;
         //_lastSortTopic = sortTopic;   // now set in Comparison method as the comparison method is called by UITable on Start
     }
     else {
         // same sort topic so direction should be the 'other' direction
         sortDirection = ToggleSortDirection();
     }
     _lastSortDirection = sortDirection;
     //D.Log("{0}.AssessSortDirection(Topic: {1}): Direction: {2}, Value: {3}.", DebugName, sortTopic.GetValueName(), sortDirection.GetValueName(), (int)sortDirection);
     return sortDirection;
 }
Пример #20
0
 private void AssignValueTo(GuiElementID id) {
     switch (id) {
         case GuiElementID.ItemNameLabel:
             AssignValueToNameGuiElement();
             break;
         case GuiElementID.Owner:
             AssignValueToOwnerGuiElement();
             break;
         case GuiElementID.Approval:
             AssignValueToApprovalGuiElement();
             break;
         case GuiElementID.Composition:
             AssignValueToCompositionGuiElement();
             break;
         case GuiElementID.CultureLabel:
             AssignValueToCultureGuiElement();
             break;
         case GuiElementID.DefensiveStrength:
             AssignValueToDefensiveStrengthGuiElement();
             break;
         case GuiElementID.EnergyLabel:
             AssignValueToEnergyGuiElement();
             break;
         case GuiElementID.Health:
             AssignValueToHealthGuiElement();
             break;
         case GuiElementID.Hero:
             AssignValueToHeroGuiElement();
             break;
         case GuiElementID.Location:
             AssignValueToLocationGuiElement();
             break;
         case GuiElementID.NetIncome:
             AssignValueToNetIncomeGuiElement();
             break;
         case GuiElementID.OffensiveStrength:
             AssignValueToOffensiveStrengthGuiElement();
             break;
         case GuiElementID.OrganicsLabel:
             AssignValueToOrganicsGuiElement();
             break;
         case GuiElementID.ParticulatesLabel:
             AssignValueToParticulatesGuiElement();
             break;
         case GuiElementID.PopulationLabel:
             AssignValueToPopulationGuiElement();
             break;
         case GuiElementID.Production:
             AssignValueToProductionGuiElement();
             break;
         case GuiElementID.ScienceLabel:
             AssignValueToScienceGuiElement();
             break;
         case GuiElementID.SpeedLabel:
             AssignValueToSpeedGuiElement();
             break;
         case GuiElementID.Resources:
             AssignValueToStrategicResourcesGuiElement();
             break;
         default:
             throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(id));
     }
 }
 private GuiElement GetGuiElement(GuiElementID id) {
     return gameObject.GetSafeMonoBehavioursInChildren<GuiElement>().Single(e => e.elementID == id);
 }
Пример #22
0
 private void OnColorSelectionChanged(GameColor selectedColor, GuiElementID elementID) {
     D.Log("{0}.OnColorSelectionChanged event received from {1}, selected color = {2}.", GetType().Name, elementID.GetValueName(), selectedColor.GetValueName());
     if (elementID == GuiElementID.UserPlayerColorPopupList) {
         OnUserPlayerColorSelectionChanged(selectedColor);
     }
     else {
         OnAIPlayerColorSelectionChanged(selectedColor, elementID);
     }
 }
Пример #23
0
 protected int CompareDefensiveStrength(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.DefensiveStrength;
     var rowAStrengthElement = GetGuiElement(rowA, GuiElementID.DefensiveStrength) as StrengthGuiElement;
     var rowBStrengthElement = GetGuiElement(rowB, GuiElementID.DefensiveStrength) as StrengthGuiElement;
     return (int)_sortDirection * rowAStrengthElement.CompareTo(rowBStrengthElement);
 }
Пример #24
0
 private UILabel GetLabel(Transform row, GuiElementID elementID) {
     return GetGuiElement(row, elementID).gameObject.GetSafeFirstMonoBehaviourInChildren<UILabel>();
 }
    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));
        }
    }
Пример #26
0
 protected int CompareNetIncome(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.NetIncome;
     var rowANetIncomeElement = GetGuiElement(rowA, GuiElementID.NetIncome) as NetIncomeGuiElement;
     var rowBNetIncomeElement = GetGuiElement(rowB, GuiElementID.NetIncome) as NetIncomeGuiElement;
     return (int)_sortDirection * rowANetIncomeElement.CompareTo(rowBNetIncomeElement);
 }
Пример #27
0
 private void OnAIPlayerColorSelectionChanged(GameColor selectedColor, GuiElementID elementID) {
     if (selectedColor == _unusedColorUsedToSetSelection) {
         // this is the Selection change event generated by SetSelection below so don't propogate
         _unusedColorUsedToSetSelection = default(GameColor);
     }
     else {
         GuiPlayerColorPopupList aiPlayerPopupListAlreadyUsingColor;
         if (_aiPlayerColorsInUse.TryGetValue(selectedColor, out aiPlayerPopupListAlreadyUsingColor)) {
             // newly selected ai color is already used by another ai player
             var unusedColor = GetRandomUnusedColor();
             _unusedColorUsedToSetSelection = unusedColor;
             D.Log("{0} setting {1} selection to {2}.", GetType().Name, aiPlayerPopupListAlreadyUsingColor.ElementID.GetValueName(), unusedColor.GetValueName());
             aiPlayerPopupListAlreadyUsingColor.SetSelection(unusedColor);
         }
     }
     RefreshAIPlayerColorsInUse();
 }
Пример #28
0
 protected int ComparePopulation(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.PopulationLabel;
     var rowAPopulationLabel = GetLabel(rowA, GuiElementID.PopulationLabel);
     var rowBPopulationLabel = GetLabel(rowB, GuiElementID.PopulationLabel);
     return (int)_sortDirection * CompareEmbeddedInt(rowAPopulationLabel.text, rowBPopulationLabel.text);
 }
Пример #29
0
 protected int CompareApproval(Transform rowA, Transform rowB) {
     _lastSortTopic = GuiElementID.Approval;
     var rowAApprovalElement = GetGuiElement(rowA, GuiElementID.Approval) as ApprovalGuiElement;
     var rowBApprovalElement = GetGuiElement(rowB, GuiElementID.Approval) as ApprovalGuiElement;
     return (int)_sortDirection * rowAApprovalElement.CompareTo(rowBApprovalElement);
 }
Пример #30
0
 /// <summary>
 /// Records the value of the slider that has <c>sliderID</c>.
 /// </summary>
 /// <param name="sliderID">The slider identifier.</param>
 /// <param name="value">The slider value.</param>
 protected virtual void RecordSliderState(GuiElementID sliderID, float value) { }