private void RefreshDLC13Tooltip()
    {
        if (this.LobbyDescription.DownloadableContentSharedByServer != 0u)
        {
            uint downloadableContentSharedByServer = this.LobbyDescription.DownloadableContentSharedByServer;
            IDownloadableContentService service    = Services.GetService <IDownloadableContentService>();
            if (service != null)
            {
                foreach (DownloadableContent downloadableContent in service)
                {
                    uint num = 1u << (int)downloadableContent.Number;
                    if ((downloadableContentSharedByServer & num) != 0u && downloadableContent.Type == DownloadableContentType.Exclusive && downloadableContent.Name == DownloadableContent13.ReadOnlyName)
                    {
                        string     key        = (!this.LobbyDescription.AdvancedSeasons) ? "%GameOptionSeasonDifficultyVanillaTitle" : ("%GameOptionSeasonDifficulty" + this.LobbyDescription.SeasonDifficulty + "Title");
                        AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip;
                        ageTooltip.Content = ageTooltip.Content + "\n" + AgeLocalizer.Instance.LocalizeString("%AdvancedWinterSettingTooltip").Replace("$WinterSetting", AgeLocalizer.Instance.LocalizeString(key));
                        break;
                    }
                }
            }
        }
        string     key2        = "%GameOptionEmpireInfoAccessibility" + this.LobbyDescription.EmpireInfoAccessibility + "Title";
        AgeTooltip ageTooltip2 = this.AgeTransform.AgeTooltip;

        ageTooltip2.Content = ageTooltip2.Content + "\n" + AgeLocalizer.Instance.LocalizeString("%EmpireScoresSettingTooltip").Replace("$ScoresSetting", AgeLocalizer.Instance.LocalizeString(key2));
        this.AgeTransform.StopSearchingForTooltips = true;
    }
Esempio n. 2
0
    private void SetupGuiFaction(AgeTransform tableItem, GuiFaction guiFaction, int index)
    {
        FactionCard component = tableItem.GetComponent <FactionCard>();

        component.SetContent(guiFaction, base.gameObject);
        ISessionService service = Services.GetService <ISessionService>();

        Diagnostics.Assert(service != null);
        bool lobbyData = service.Session.GetLobbyData <bool>("CustomFactions", true);

        if (guiFaction.IsCustom && !lobbyData)
        {
            component.AgeTransform.Enable             = false;
            component.AgeTransform.AgeTooltip.Content = "%CustomFactionsNotAllowed";
        }
        else
        {
            component.AgeTransform.Enable             = true;
            component.AgeTransform.AgeTooltip.Content = string.Empty;
        }
        IDownloadableContentService service2 = Services.GetService <IDownloadableContentService>();
        bool flag;

        if (service2 != null && service2.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFaction, component.GuiFaction.Faction.Name, out flag) && !flag)
        {
            component.AgeTransform.Enable             = false;
            component.AgeTransform.AgeTooltip.Content = "%RestrictedDownloadableContentTitle";
        }
        if ((service.Session.SessionMode == SessionMode.Single || !service.Session.GetLobbyData <bool>("SpectatorMode", false) || service.Session.GetLobbyData <int>("NumberOfMajorFactions", 0) < 3) && guiFaction.Name == "FactionELCPSpectator")
        {
            component.AgeTransform.Enable             = false;
            component.AgeTransform.AgeTooltip.Content = "%GameOptionSpectatorModeDisabled";
        }
    }
Esempio n. 3
0
    private void OnDoubleClickGuiFaction(GuiFaction guiFaction)
    {
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null)
        {
            bool flag;
            if (service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFaction, guiFaction.Faction.Name, out flag) && !flag)
            {
                return;
            }
            if (guiFaction.Faction.Affinity != null && service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFactionAffinity, guiFaction.Faction.Affinity.Name, out flag) && !flag)
            {
                return;
            }
            foreach (FactionTrait factionTrait in Faction.EnumerableTraits(guiFaction.Faction))
            {
                if (!service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFactionTrait, factionTrait.Name, out flag) || !flag)
                {
                    return;
                }
            }
        }
        this.OnToggleGuiFaction(guiFaction);
        this.OnSelectCB(null);
    }
Esempio n. 4
0
    public override IEnumerator Initialize(AIEntity aiEntity)
    {
        yield return(base.Initialize(aiEntity));

        this.colossusTags.AddTag(DownloadableContent9.TagColossus);
        this.departmentOfDefense        = base.AIEntity.Empire.GetAgency <DepartmentOfDefense>();
        this.departmentOfTheTreasury    = base.AIEntity.Empire.GetAgency <DepartmentOfTheTreasury>();
        this.departmentOfTheInterior    = base.AIEntity.Empire.GetAgency <DepartmentOfTheInterior>();
        this.departmentOfForeignAffairs = base.AIEntity.Empire.GetAgency <DepartmentOfForeignAffairs>();
        this.unitDesignDataRepository   = AIScheduler.Services.GetService <IAIUnitDesignDataRepository>();
        this.aiDataRepositoryHelper     = AIScheduler.Services.GetService <IAIDataRepositoryAIHelper>();
        this.worldAtlasAIHelper         = AIScheduler.Services.GetService <IWorldAtlasAIHelper>();
        this.empireDataAIHelper         = AIScheduler.Services.GetService <IAIEmpireDataAIHelper>();
        this.endTurnService             = Services.GetService <IEndTurnService>();
        this.gameService             = Services.GetService <IGameService>();
        this.worldPositioningService = this.gameService.Game.Services.GetService <IWorldPositionningService>();
        this.colossusMissionDatabase = Databases.GetDatabase <ColossusMissionDefinition>(false);
        this.updateColossusMissions.Add(new Func <ColossusMission, Unit, ColossusMission>(this.UpdateArmySupportMission));
        this.updateColossusMissions.Add(new Func <ColossusMission, Unit, ColossusMission>(this.UpdateHarassingMission));
        this.updateColossusMissions.Add(new Func <ColossusMission, Unit, ColossusMission>(this.UpdateCityDefenseMission));
        this.refreshColossusMissions.Add(new Action <ColossusMission, Unit>(this.RefreshArmySupportMission));
        this.refreshColossusMissions.Add(new Action <ColossusMission, Unit>(this.RefreshHarassingMission));
        this.refreshColossusMissions.Add(new Action <ColossusMission, Unit>(this.RefreshCityDefenseMission));
        IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();

        if (downloadableContentService.IsShared(DownloadableContent9.ReadOnlyName))
        {
            base.AIEntity.RegisterPass(AIEntity.Passes.RefreshObjectives.ToString(), "AILayer_Colossus_RefreshObjectives", new AIEntity.AIAction(this.RefreshObjectives), this, new StaticString[0]);
            base.AIEntity.RegisterPass(AIEntity.Passes.ExecuteNeeds.ToString(), "AILayer_Colossus_ExecuteNeeds", new AIEntity.AIAction(this.ExecuteNeeds), this, new StaticString[0]);
        }
        yield break;
    }
Esempio n. 5
0
    private void OnApplyCB(GameObject obj)
    {
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null)
        {
            foreach (DownloadableContent downloadableContent in service)
            {
                bool flag;
                if (this.downloadableContentActivationState.TryGetValue(downloadableContent.Name, out flag))
                {
                    if (flag)
                    {
                        downloadableContent.Accessibility |= DownloadableContentAccessibility.Activated;
                    }
                    else
                    {
                        downloadableContent.Accessibility &= ~DownloadableContentAccessibility.Activated;
                    }
                    string x = string.Format("Preferences/DownloadableContents/DownloadableContent{0}/Activated", downloadableContent.Number);
                    Amplitude.Unity.Framework.Application.Registry.SetValue <bool>(x, flag);
                    base.GuiService.GetGuiPanel <MenuMainScreen>().RefreshContent();
                }
            }
        }
        DepartmentOfScience.ConstructibleElement.ReleaseUnlocksByTechnology();
        this.Hide(false);
    }
Esempio n. 6
0
    public FactionRandomizer(Session session)
    {
        List <Faction> list = (from faction in Databases.GetDatabase <Faction>(true)
                               where faction.IsStandard && !faction.IsHidden && !faction.HasToBeRandomized
                               select faction).ToList <Faction>();
        IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();

        if (downloadableContentService != null)
        {
            bool result;
            list.RemoveAll((Faction faction) => downloadableContentService.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.Faction, faction.Name, out result) && !result);
            list.RemoveAll((Faction faction) => faction.Affinity != null && downloadableContentService.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.FactionAffinity, faction.Affinity, out result) && !result);
        }
        if (session != null)
        {
            for (int i = list.Count - 1; i >= 0; i--)
            {
                Faction faction2 = list[i];
                if (Faction.IsOptionDefinitionConstrained(faction2, session) || faction2.Name == "FactionELCPSpectator")
                {
                    list.RemoveAt(i);
                }
            }
        }
        this.factions = list.ToArray();
    }
Esempio n. 7
0
    protected override bool Initialize(AIBehaviorTree aiBehaviorTree)
    {
        this.isDlcActive = true;
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (!service.IsShared(DownloadableContent13.ReadOnlyName))
        {
            this.isDlcActive = false;
        }
        if (!(aiBehaviorTree.AICommander.Empire is MajorEmpire))
        {
            this.isDlcActive = false;
        }
        if (this.isDlcActive)
        {
            IGameService service2 = Services.GetService <IGameService>();
            Diagnostics.Assert(service2 != null);
            this.gameEntityRepositoryService = service2.Game.Services.GetService <IGameEntityRepositoryService>();
            this.aiDataRepositoryHelper      = AIScheduler.Services.GetService <IAIDataRepositoryAIHelper>();
            this.orbAIHelper          = AIScheduler.Services.GetService <IOrbAIHelper>();
            this.intelligenceAiHelper = AIScheduler.Services.GetService <IIntelligenceAIHelper>();
            AIEntity_Empire entity = aiBehaviorTree.AICommander.AIPlayer.GetEntity <AIEntity_Empire>();
            this.accountManager = entity.GetLayer <AILayer_AccountManager>();
        }
        return(base.Initialize(aiBehaviorTree));
    }
Esempio n. 8
0
    private int Refill()
    {
        if (this.pool.Count > 0)
        {
            return(0);
        }
        IDatabase <UnitProfile> database = Databases.GetDatabase <UnitProfile>(false);

        if (database == null)
        {
            Diagnostics.LogError("Cannot refill the hero pool because the unit profiles database does not exist.");
            return(-1);
        }
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        foreach (UnitProfile unitProfile in database)
        {
            if (unitProfile.IsHero && unitProfile.Tags.Contains(HeroPool.Poolable) && (!unitProfile.Tags.Contains("DiscardAffinityMimics") || !this.IsAnyAffinityMimicsPlaying()))
            {
                if (service != null)
                {
                    bool flag;
                    if (service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.UnitDesign, unitProfile.Name, out flag) && !flag)
                    {
                        continue;
                    }
                    bool flag2 = true;
                    foreach (Prerequisite prerequisite in unitProfile.Prerequisites)
                    {
                        if (prerequisite is DownloadableContentPrerequisite)
                        {
                            DownloadableContentPrerequisite downloadableContentPrerequisite = prerequisite as DownloadableContentPrerequisite;
                            if (!service.IsShared(downloadableContentPrerequisite.DownloadableContentName))
                            {
                                flag2 = false;
                                break;
                            }
                        }
                    }
                    if (!flag2)
                    {
                        continue;
                    }
                }
                HeroPool.HeroDescriptor value = new HeroPool.HeroDescriptor(unitProfile);
                this.pool.Add(new HeroPool.HeroDescriptor?(value));
            }
        }
        this.pool = this.pool.Randomize(null);
        this.TurnWhenLastRefilled = base.Game.Turn;
        int i = this.GenerationNumber;

        this.GenerationNumber = i + 1;
        return(this.pool.Count);
    }
Esempio n. 9
0
    public void Bind(City city, IGuiPanelHelper helper)
    {
        this.Unbind();
        this.City      = city;
        this.GuiEmpire = new GuiEmpire(this.City.Empire);
        DepartmentOfIndustry agency = this.City.Empire.GetAgency <DepartmentOfIndustry>();

        this.ConstructionQueue = agency.GetConstructionQueue(this.City);
        this.guiPanelHelper    = helper;
        IGameService service = Services.GetService <IGameService>();

        this.game = (service.Game as global::Game);
        this.playerControllerRepository = service.Game.Services.GetService <IPlayerControllerRepositoryService>();
        this.regionalEffectsService     = service.Game.Services.GetService <IRegionalEffectsService>();
        this.PanelSpying.Visible        = false;
        this.AgeTransform.Height        = this.ModifierPosition.StartHeight;
        IDownloadableContentService service2 = Services.GetService <IDownloadableContentService>();

        if (service2 != null && service2.IsShared(DownloadableContent11.ReadOnlyName))
        {
            this.PanelSpying.Visible = true;
            this.AgeTransform.Height = this.ModifierPosition.EndHeight;
        }
        this.PanelOvergrownCity.Visible = false;
        if (service2 != null && service2.IsShared(DownloadableContent20.ReadOnlyName) && this.City.IsInfected)
        {
            this.PanelSpying.Visible        = false;
            this.PanelOvergrownCity.Visible = true;
            this.AgeTransform.Height        = this.ModifierPosition.EndHeight;
            this.GuiPreviousEmpire          = new GuiEmpire(this.City.LastNonInfectedOwner);
            if (this.GuiPreviousEmpire != null)
            {
                this.PreviousEmpireFactionIcon.TintColor     = this.GuiPreviousEmpire.Color;
                this.PreviousEmpireFactionIcon.Image         = this.GuiPreviousEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true);
                this.PreviousEmpireFactionTooltip.Class      = "Descriptor";
                this.PreviousEmpireFactionTooltip.ClientData = this.GuiEmpire.Empire;
                Faction faction = this.GuiPreviousEmpire.Empire.Faction;
                if (faction != null)
                {
                    new List <string>();
                    foreach (SimulationDescriptor simulationDescriptor in faction.GetIntegrationDescriptors())
                    {
                        this.PreviousEmpireFactionTooltip.Content = simulationDescriptor.Name;
                    }
                }
            }
        }
        this.infiltrationCostResourceName = DepartmentOfTheTreasury.Resources.InfiltrationCost;
        ResourceDefinition resourceDefinition;

        if (Databases.GetDatabase <ResourceDefinition>(false).TryGetValue(DepartmentOfTheTreasury.Resources.InfiltrationCost, out resourceDefinition))
        {
            this.infiltrationCostResourceName = resourceDefinition.GetName(this.playerControllerRepository.ActivePlayerController.Empire);
        }
    }
Esempio n. 10
0
    private bool CanUseAltar()
    {
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service == null || !service.IsShared(DownloadableContent13.ReadOnlyName))
        {
            return(false);
        }
        DepartmentOfTheInterior agency = base.AIEntity.Empire.GetAgency <DepartmentOfTheInterior>();

        return(agency.IsAltarBuilt());
    }
Esempio n. 11
0
 private void OnConfirmDeleteCustomFaction(object sender, MessagePanelResultEventArgs e)
 {
     if (e.Result == MessagePanelResult.Ok)
     {
         this.DestroyFactionButton.AgeTransform.Enable = false;
         if (this.SelectedGuiFaction != null && this.SelectedGuiFaction.Faction != null)
         {
             if (!string.IsNullOrEmpty(this.SelectedGuiFaction.Faction.FileName))
             {
                 try
                 {
                     File.Delete(this.SelectedGuiFaction.Faction.FileName);
                 }
                 catch
                 {
                 }
             }
             IDatabase <Faction> database = Databases.GetDatabase <Faction>(false);
             if (database != null)
             {
                 database.Remove(this.SelectedGuiFaction.Faction.Name);
             }
             IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
             base.GuiService.GetGuiPanel <MenuNewGameScreen>().OnCustomFactionDeleted(this.SelectedGuiFaction.Faction.Name);
             this.guiFactions.Remove(this.SelectedGuiFaction);
             if (this.guiFactions.Count > 0)
             {
                 this.SelectedGuiFaction = this.guiFactions[0];
                 if (service != null)
                 {
                     bool flag = false;
                     if (!service.TryCheckAgainstRestrictions(DownloadableContentRestrictionCategory.LobbyFaction, this.guiFactions[0].Name, out flag) || !flag)
                     {
                         Faction faction = database.FirstOrDefault((Faction iterator) => iterator.IsStandard && !iterator.IsHidden);
                         for (int i = 0; i < this.guiFactions.Count; i++)
                         {
                             if (this.guiFactions[i].Faction.Name == faction.Name)
                             {
                                 this.SelectedGuiFaction = this.guiFactions[i];
                                 break;
                             }
                         }
                     }
                 }
             }
             else
             {
                 this.SelectedGuiFaction = null;
             }
         }
     }
     this.RefreshContent();
 }
Esempio n. 12
0
    private static float UtilityFunc_WorldNavy(SeasonEffect aiEvaluableElement, InterpreterContext context, float aiParameterValue, AIHeuristicAnalyser.Context debugContext)
    {
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (!service.IsShared(DownloadableContent16.ReadOnlyName))
        {
            return(0f);
        }
        global::Empire empire = context.Get("Empire") as global::Empire;

        Diagnostics.Assert(empire != null);
        float num = AILayer_Altar.ComputeMyNavyImportance(empire);

        return(aiParameterValue * (num - 1f));
    }
 private void RefreshDownloadableContentsTooltip()
 {
     if (this.LobbyDescription.DownloadableContentSharedByServer != 0u)
     {
         string text = string.Empty;
         uint   num  = this.LobbyDescription.DownloadableContentSharedByServer;
         IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
         if (service != null)
         {
             foreach (DownloadableContent downloadableContent in service)
             {
                 uint num2 = 1u << (int)downloadableContent.Number;
                 if ((num & num2) != 0u)
                 {
                     if (downloadableContent.Type == DownloadableContentType.Exclusive)
                     {
                         IDatabase <GuiElement> database           = Databases.GetDatabase <GuiElement>(true);
                         ExtendedGuiElement     extendedGuiElement = database.GetValue(downloadableContent.Name) as ExtendedGuiElement;
                         if (extendedGuiElement != null && !string.IsNullOrEmpty(extendedGuiElement.SymbolString))
                         {
                             string text2 = text;
                             text = string.Concat(new string[]
                             {
                                 text2,
                                 extendedGuiElement.SymbolString,
                                 " ",
                                 AgeLocalizer.Instance.LocalizeString(extendedGuiElement.Title),
                                 "\n"
                             });
                         }
                     }
                     num &= ~num2;
                     if (num == 0u)
                     {
                         break;
                     }
                 }
             }
             if (!string.IsNullOrEmpty(text))
             {
                 string     str        = AgeLocalizer.Instance.LocalizeStringDefaults("%DownloadableContentSharedByServerTooltip", "Shared Content: $SBS").Replace("$SBS", text);
                 AgeTooltip ageTooltip = this.AgeTransform.AgeTooltip;
                 ageTooltip.Content += str;
                 this.AgeTransform.StopSearchingForTooltips = true;
             }
         }
     }
 }
Esempio n. 14
0
    private void OnStoreCB(GameObject obj)
    {
        AgeControlButton            component = obj.GetComponent <AgeControlButton>();
        StaticString                name      = component.OnActivateData;
        IDownloadableContentService service   = Services.GetService <IDownloadableContentService>();
        DownloadableContent         downloadableContent;

        if (service != null && service.TryGetValue(name, out downloadableContent) && downloadableContent.SteamAppId != 0u && downloadableContent.SteamAppId != 4294967295u)
        {
            Steamworks.SteamFriends steamFriends = Steamworks.SteamAPI.SteamFriends;
            if (steamFriends != null)
            {
                steamFriends.ActivateGameOverlayToStore(downloadableContent.SteamAppId, Steamworks.EOverlayToStoreFlag.k_EOverlayToStoreFlag_None);
            }
        }
    }
Esempio n. 15
0
    private void UpdateButtonsAvailability()
    {
        if (this.DepartmentOfScience.HaveResearchedAtLeastOneTradeTechnology() || base.Empire.SimulationObject.Tags.Contains(global::Empire.TagEmpireEliminated))
        {
            this.MarketplaceToggle.AgeTransform.Enable             = true;
            this.MarketplaceToggle.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%MarketplaceScreenShortcutDescription");
        }
        else
        {
            this.MarketplaceToggle.AgeTransform.Enable = false;
            string          text           = string.Empty;
            IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;
            Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper");
            for (int i = 1; i < this.DepartmentOfScience.TechnologiesToUnlockMarketplace.Length; i++)
            {
                GuiElement guiElement;
                if (guiPanelHelper.TryGetGuiElement(this.DepartmentOfScience.TechnologiesToUnlockMarketplace[i], out guiElement))
                {
                    text = text + "\n - " + AgeLocalizer.Instance.LocalizeString(guiElement.Title);
                }
            }
            this.MarketplaceToggle.AgeTransform.AgeTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString("%MarketplaceScreenShortcutDisabledDescription"), text);
        }
        bool isActivated = TutorialManager.IsActivated;

        this.EmpireToggle.AgeTransform.Enable          = (!isActivated || this.DepartmentOfScience.GetTechnologyState("TechnologyDefinitionTutorialUnlockEmpire") == DepartmentOfScience.ConstructibleElement.State.Researched);
        this.ResearchToggle.AgeTransform.Enable        = (!isActivated || this.DepartmentOfScience.GetTechnologyState("TechnologyDefinitionTutorialUnlockResearch") == DepartmentOfScience.ConstructibleElement.State.Researched);
        this.QuestToggle.AgeTransform.Enable           = (!isActivated || this.DepartmentOfScience.GetTechnologyState("TechnologyDefinitionTutorialUnlockQuest") == DepartmentOfScience.ConstructibleElement.State.Researched);
        this.CityListToggle.AgeTransform.Enable        = !isActivated;
        this.AcademyToggle.AgeTransform.Enable         = (!isActivated || this.DepartmentOfScience.GetTechnologyState("TechnologyDefinitionTutorialUnlockAcademy") == DepartmentOfScience.ConstructibleElement.State.Researched);
        this.MilitaryToggle.AgeTransform.Enable        = (!isActivated || this.DepartmentOfScience.GetTechnologyState("TechnologyDefinitionTutorialUnlockMilitary") == DepartmentOfScience.ConstructibleElement.State.Researched);
        this.DiplomacyToggle.AgeTransform.Enable       = !isActivated;
        this.EspionageplaceToggle.AgeTransform.Visible = false;
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName))
        {
            this.EspionageplaceToggle.AgeTransform.Visible = true;
            this.EspionageplaceToggle.AgeTransform.Enable  = !isActivated;
        }
        if (this.EspionageplaceToggle.AgeTransform.Visible)
        {
            this.ControlTable.HorizontalSpacing = this.WideSpacing * AgeUtils.CurrentUpscaleFactor();
            return;
        }
        this.ControlTable.HorizontalSpacing = this.StandardSpacing * AgeUtils.CurrentUpscaleFactor();
    }
Esempio n. 16
0
    public static void ShowHidePopulationBuyoutButton(Amplitude.Unity.Game.Empire observer, City city, AgeTransform populationBuyoutButton, AgeTransform populationGaugeBackground, AgeTransform nextPopulationTurns, AgeTransform nextPopulationHourglass, AgeTransform gaugePopulationTooltip)
    {
        bool flag = false;
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName))
        {
            DepartmentOfIntelligence agency = observer.GetAgency <DepartmentOfIntelligence>();
            if (agency != null)
            {
                flag = agency.IsEmpireInfiltrated(city.Empire);
            }
        }
        if (DepartmentOfTheInterior.CanBuyoutPopulation(city) && city.Empire == observer)
        {
            populationBuyoutButton.Visible = true;
            if (populationGaugeBackground != null)
            {
                populationGaugeBackground.Visible = false;
            }
            gaugePopulationTooltip.Visible  = false;
            nextPopulationTurns.Visible     = false;
            nextPopulationHourglass.Visible = false;
        }
        else if (DepartmentOfTheInterior.CanBuyoutPopulation(city) && flag)
        {
            populationBuyoutButton.Visible = false;
            if (populationGaugeBackground != null)
            {
                populationGaugeBackground.Visible = false;
            }
            gaugePopulationTooltip.Visible  = false;
            nextPopulationTurns.Visible     = false;
            nextPopulationHourglass.Visible = false;
        }
        else
        {
            populationBuyoutButton.Visible = false;
            if (populationGaugeBackground != null)
            {
                populationGaugeBackground.Visible = true;
            }
            gaugePopulationTooltip.Visible  = true;
            nextPopulationTurns.Visible     = true;
            nextPopulationHourglass.Visible = true;
        }
    }
Esempio n. 17
0
    protected override IEnumerator OnLoad()
    {
        yield return(base.OnLoad());

        this.currentY = 0f;
        this.downloadableContentActivationState.Clear();
        IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();

        if (downloadableContentService != null)
        {
            this.downloadableContents = (from downloadableContent in downloadableContentService
                                         where downloadableContent.Type != DownloadableContentType.Undefined
                                         select downloadableContent).ToList <DownloadableContent>();
            this.downloadableContents.Sort((DownloadableContent left, DownloadableContent right) => left.ReleaseDate.CompareTo(right.ReleaseDate));
        }
        yield break;
    }
Esempio n. 18
0
    public void Bind(Empire lookingEmpire, Empire ambassadorEmpire, Empire playerEmpire, GameDiplomacyScreen parent)
    {
        this.LookingEmpire        = lookingEmpire;
        this.AmbassadorEmpire     = ambassadorEmpire;
        this.PlayerEmpire         = playerEmpire;
        this.parent               = parent;
        this.EmpireNameLabel.Text = this.AmbassadorEmpire.LocalizedName;
        this.NegotiateButton.AgeTransform.Enable = (this.AmbassadorEmpire != this.PlayerEmpire);
        if (this.CanSeeAllInformation())
        {
            this.RelationshipGroup.AgeTransform.Visible  = true;
            this.UnknownRelationshipGroup.Visible        = false;
            this.DiplomaticAbilitiesTable.Visible        = true;
            this.UnknownDiplomaticAbilitiesGroup.Visible = false;
        }
        else
        {
            this.RelationshipGroup.AgeTransform.Visible  = false;
            this.UnknownRelationshipGroup.Visible        = true;
            this.DiplomaticAbilitiesTable.Visible        = false;
            this.UnknownDiplomaticAbilitiesGroup.Visible = true;
        }
        this.RelationshipGroup.Bind(this.LookingEmpire, this.AmbassadorEmpire);
        this.EspionageGroup.Visible = false;
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName))
        {
            DepartmentOfIntelligence agency = this.LookingEmpire.GetAgency <DepartmentOfIntelligence>();
            if (agency != null)
            {
                if (agency.IsEmpireInfiltrated(this.AmbassadorEmpire) && this.PlayerEmpire.Index == this.LookingEmpire.Index)
                {
                    this.EspionageGroup.Visible = true;
                }
                else
                {
                    this.EspionageGroup.Visible = false;
                }
            }
        }
    }
Esempio n. 19
0
    private void RefreshCurrentResearch()
    {
        DepartmentOfScience         agency       = base.Empire.GetAgency <DepartmentOfScience>();
        DepartmentOfTheTreasury     agency2      = base.Empire.GetAgency <DepartmentOfTheTreasury>();
        Construction                construction = agency.ResearchQueue.Peek();
        IDownloadableContentService service      = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1))
        {
            this.ResearchBuyoutButton.AgeTransform.Visible = true;
            this.ResearchBuyoutLabel.AgeTransform.Visible  = true;
            this.CurrentResearchTitle.AgeTransform.Visible = false;
            this.EmpireResearchPanel.Enable                = true;
            this.EmpireResearchPanel.AgeTooltip.Class      = string.Empty;
            this.EmpireResearchPanel.AgeTooltip.Content    = string.Empty;
            this.EmpireResearchPanel.AgeTooltip.ClientData = null;
            ConstructibleElement technology = null;
            if (this.departmentOfScience.ResearchQueue.Peek() != null)
            {
                technology = this.departmentOfScience.ResearchQueue.Peek().ConstructibleElement;
            }
            float  buyOutTechnologyCost = this.departmentOfScience.GetBuyOutTechnologyCost(technology);
            float  num      = -buyOutTechnologyCost;
            string newValue = GuiFormater.FormatInstantCost(base.Empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0);
            string content;
            if (construction != null)
            {
                this.ResearchBuyoutLabel.AgeTransform.Alpha = 1f;
                TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition;
                if (technologyDefinition != null)
                {
                    AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition)), this.ResearchBuyoutLabel, out this.format, '.');
                    DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.ResearchBuyoutLabel.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal);
                }
                if (agency2.IsTransferOfResourcePossible(base.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num) && this.interactionsAllowed)
                {
                    this.ResearchBuyoutButton.AgeTransform.Enable = true;
                    this.ResearchBuyoutButton.AgeTransform.Alpha  = 1f;
                    this.ResearchBuyoutLabel.Text = this.format;
                    content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutAvailableFormat").Replace("$Cost", newValue);
                }
                else
                {
                    this.ResearchBuyoutButton.AgeTransform.Enable = false;
                    this.ResearchBuyoutButton.AgeTransform.Alpha  = 0.5f;
                    this.ResearchBuyoutLabel.Text = this.format;
                    content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutUnavailableFormat").Replace("$Cost", newValue);
                }
            }
            else
            {
                this.ResearchBuyoutButton.AgeTransform.Enable = false;
                this.ResearchBuyoutButton.AgeTransform.Alpha  = 0.5f;
                this.ResearchBuyoutLabel.Text = "%ResearchNoneTitle";
                this.ResearchBuyoutLabel.AgeTransform.Alpha = 0.5f;
                content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutNoSelection");
                this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Class      = string.Empty;
                this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Content    = "%ResearchNoneDescription";
                this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.ClientData = null;
            }
            if (this.ResearchBuyoutButton.AgeTransform.AgeTooltip != null)
            {
                this.ResearchBuyoutButton.AgeTransform.AgeTooltip.Content = content;
                return;
            }
        }
        else
        {
            this.ResearchBuyoutButton.AgeTransform.Visible = false;
            this.ResearchBuyoutLabel.AgeTransform.Visible  = false;
            this.CurrentResearchTitle.AgeTransform.Visible = true;
            if (construction != null)
            {
                this.EmpireResearchPanel.Enable = true;
                int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction);
                if (num2 == 2147483647)
                {
                    this.format = string.Format("$Tech ({0})", GuiFormater.Infinite.ToString());
                }
                else
                {
                    this.format = string.Format("$Tech ({0})", QueueGuiItem.FormatNumberOfTurns(num2));
                }
                TechnologyDefinition technologyDefinition2 = construction.ConstructibleElement as TechnologyDefinition;
                if (technologyDefinition2 != null)
                {
                    AgeUtils.TruncateStringWithSubst(this.format, "$Tech", AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition2)), this.CurrentResearchTitle, out this.format, '.');
                    this.CurrentResearchTitle.Text = this.format;
                    DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition2, base.Empire, this.EmpireResearchPanel.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal);
                }
            }
            else
            {
                this.EmpireResearchPanel.Enable = false;
                AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%ResearchNoneTitle"), this.CurrentResearchTitle, out this.format, '.');
                this.CurrentResearchTitle.Text                 = this.format;
                this.EmpireResearchPanel.AgeTooltip.Class      = string.Empty;
                this.EmpireResearchPanel.AgeTooltip.Content    = "%ResearchNoneDescription";
                this.EmpireResearchPanel.AgeTooltip.ClientData = null;
            }
            this.CurrentResearchTitle.Text = this.format;
        }
    }
Esempio n. 20
0
    private void RefreshTableVisibility()
    {
        List <Village> convertedVillages = (base.Empire as MajorEmpire).ConvertedVillages;
        ReadOnlyCollection <Fortress> occupiedFortresses = (base.Empire as MajorEmpire).GetAgency <DepartmentOfTheInterior>().OccupiedFortresses;
        ReadOnlyCollection <City>     infectedCities     = (base.Empire as MajorEmpire).GetAgency <DepartmentOfTheInterior>().InfectedCities;

        if (convertedVillages.Count > 0)
        {
            if (!this.VillageListPanel.IsVisible)
            {
                this.VillageListPanel.Show(new object[]
                {
                    null,
                    base.gameObject
                });
            }
        }
        else if (this.VillageListPanel.IsVisible)
        {
            this.VillageListPanel.Hide(true);
        }
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service.IsShared(DownloadableContent16.ReadOnlyName))
        {
            if (occupiedFortresses.Count > 0)
            {
                if (!this.OceanicRegionListPanel.IsVisible)
                {
                    this.OceanicRegionListPanel.Show(new object[]
                    {
                        null,
                        base.gameObject
                    });
                }
            }
            else if (this.OceanicRegionListPanel.IsVisible)
            {
                this.OceanicRegionListPanel.Hide(true);
            }
        }
        else if (this.OceanicRegionListPanel.IsVisible)
        {
            this.OceanicRegionListPanel.Hide(true);
        }
        if (service.IsShared(DownloadableContent20.ReadOnlyName))
        {
            if (infectedCities.Count > 0)
            {
                if (!this.InfectedCitiesListPanel.IsVisible)
                {
                    this.InfectedCitiesListPanel.Show(new object[]
                    {
                        null,
                        base.gameObject
                    });
                }
            }
            else if (this.InfectedCitiesListPanel.IsVisible)
            {
                this.InfectedCitiesListPanel.Hide(true);
            }
            if ((base.Empire as MajorEmpire).RootedKaijus.Count > 0)
            {
                if (!this.KaijuListPanel.IsVisible)
                {
                    this.KaijuListPanel.Show(new object[]
                    {
                        null,
                        base.gameObject
                    });
                }
            }
            else if (this.KaijuListPanel.IsVisible)
            {
                this.KaijuListPanel.Hide(true);
            }
        }
        else
        {
            if (this.InfectedCitiesListPanel.IsVisible)
            {
                this.InfectedCitiesListPanel.Hide(true);
            }
            if (this.KaijuListPanel.IsVisible)
            {
                this.KaijuListPanel.Hide(true);
            }
        }
    }
    public static List <GuiElement> GetFilteredDiplomaticAbilityGuiElements(global::Empire thisEmpire, global::Empire otherEmpire)
    {
        IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;

        Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper");
        DepartmentOfForeignAffairs agency             = thisEmpire.GetAgency <DepartmentOfForeignAffairs>();
        DiplomaticRelation         diplomaticRelation = agency.GetDiplomaticRelation(otherEmpire);
        List <GuiElement>          list = new List <GuiElement>();
        bool flag  = false;
        bool flag2 = false;
        ReadOnlyCollection <DiplomaticAbility> diplomaticAbilities = diplomaticRelation.DiplomaticAbilities;
        GuiElement item;

        for (int i = 0; i < diplomaticAbilities.Count; i++)
        {
            StaticString name = diplomaticAbilities[i].Name;
            if (name == DiplomaticAbilityDefinition.CloseBorders && !thisEmpire.SimulationObject.Tags.Contains("SeasonEffectDiplomacy1"))
            {
                flag = true;
            }
            else if (diplomaticAbilities[i].IsActive)
            {
                IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
                if (!(name == DiplomaticAbilityDefinition.ImmuneToDefensiveImprovements) || service.IsShared(DownloadableContent13.ReadOnlyName))
                {
                    if (guiPanelHelper.TryGetGuiElement("DiplomaticAbility" + name, out item))
                    {
                        list.Add(item);
                    }
                }
            }
        }
        DepartmentOfForeignAffairs agency2             = otherEmpire.GetAgency <DepartmentOfForeignAffairs>();
        DiplomaticRelation         diplomaticRelation2 = agency2.GetDiplomaticRelation(thisEmpire);

        if (diplomaticRelation2.HasActiveAbility(DiplomaticAbilityDefinition.CloseBorders) && !otherEmpire.SimulationObject.Tags.Contains("SeasonEffectDiplomacy1"))
        {
            flag2 = true;
        }
        if (flag && flag2)
        {
            if (guiPanelHelper.TryGetGuiElement("DiplomaticAbilityMutualCloseBorders", out item))
            {
                list.Add(item);
            }
        }
        else if (flag)
        {
            if (guiPanelHelper.TryGetGuiElement("DiplomaticAbilityPersonaNonGrata", out item))
            {
                list.Add(item);
            }
        }
        else if (flag2 && guiPanelHelper.TryGetGuiElement("DiplomaticAbilityLockedOut", out item))
        {
            list.Add(item);
        }
        if (diplomaticRelation2.HasActiveAbility(DiplomaticAbilityDefinition.MarketBan) && guiPanelHelper.TryGetGuiElement("DiplomaticAbilityMarketBanner", out item))
        {
            list.Add(item);
        }
        return(list);
    }
Esempio n. 22
0
    private IEnumerator CheckShortcut()
    {
        while (this.doCheckShortcut)
        {
            if (Amplitude.Unity.Gui.GuiModalPanel.GuiModalManager.CurrentModalPanel == null)
            {
                if (GuiPlayerControllerScreen.LastSelection != null && GuiPlayerControllerScreen.LastSelection.IsVisible && GuiPlayerControllerScreen.LastSelection is GameAcademyScreen)
                {
                    if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsHeroRight))
                    {
                        ((GameAcademyScreen)GuiPlayerControllerScreen.LastSelection).OnNextHero(null, 1);
                    }
                    else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsHeroRight))
                    {
                        ((GameAcademyScreen)GuiPlayerControllerScreen.LastSelection).OnNextHero(null, -1);
                    }
                }
                if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsControlBanner))
                {
                    yield return(base.StartCoroutine(this.OnNextItem(null, 0, true)));
                }
                else if (GuiPlayerControllerScreen.LastSelection != null && GuiPlayerControllerScreen.LastSelection.IsVisible)
                {
                    if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsNextItem))
                    {
                        yield return(base.StartCoroutine(this.OnNextItem(null, 1, false)));
                    }
                    else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsPreviousItem))
                    {
                        yield return(base.StartCoroutine(this.OnNextItem(null, -1, false)));
                    }
                }
                if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsEmpire) && this.EmpireToggle.AgeTransform.Enable)
                {
                    this.OnEmpireCB(this.EmpireToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsCityList) && this.CityListToggle.AgeTransform.Enable)
                {
                    this.OnCityListCB(this.CityListToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsResearch) && this.ResearchToggle.AgeTransform.Enable)
                {
                    this.OnResearchCB(this.ResearchToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsQuest) && this.QuestToggle.AgeTransform.Enable)
                {
                    this.OnQuestCB(this.QuestToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsAcademy) && this.AcademyToggle.AgeTransform.Enable)
                {
                    this.OnAcademyCB(this.AcademyToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsMilitary) && this.MilitaryToggle.AgeTransform.Enable)
                {
                    this.OnMilitaryCB(this.MilitaryToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsDiplomacy) && this.DiplomacyToggle.AgeTransform.Enable)
                {
                    this.OnDiplomacyCB(this.DiplomacyToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsMarket) && this.MarketplaceToggle.AgeTransform.Enable)
                {
                    this.OnMarketplaceCB(this.MarketplaceToggle.gameObject);
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsEspionage) && this.EspionageplaceToggle.AgeTransform.Enable)
                {
                    IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();
                    if (downloadableContentService != null && downloadableContentService.IsShared(DownloadableContent11.ReadOnlyName))
                    {
                        this.OnEspionageplaceCB(this.EspionageplaceToggle.gameObject);
                    }
                }
                else if (this.keyMapperService.GetKeyDown(KeyAction.ControlBindingsGameStatus) && this.EmpireToggle.AgeTransform.Enable)
                {
                    if (base.GuiService.GetGuiPanel <GameStatusScreen>().IsVisible)
                    {
                        base.GuiService.GetGuiPanel <GameWorldScreen>().Show(new object[0]);
                    }
                    else
                    {
                        if (!base.GuiService.GetGuiPanel <GameEmpireScreen>().IsVisible)
                        {
                            base.GuiService.Hide(typeof(CurrentQuestPanel));
                            base.GuiService.GetGuiPanel <GameEmpireScreen>().Show(new object[0]);
                        }
                        yield return(null);

                        base.GuiService.GetGuiPanel <GameStatusScreen>().Show(new object[0]);
                    }
                }
            }
            yield return(null);
        }
        yield break;
    }
Esempio n. 23
0
    public override IEnumerator BindServices(IServiceContainer serviceContainer)
    {
        yield return(base.BindServices(serviceContainer));

        IGameService gameService = Services.GetService <IGameService>();

        if (gameService != null)
        {
            this.game = (gameService.Game as global::Game);
        }
        this.eventService = Services.GetService <IEventService>();
        if (this.eventService == null)
        {
            Diagnostics.LogError("Wasn't able to find the event service.");
        }
        yield return(base.BindService <IPathfindingService>(serviceContainer, delegate(IPathfindingService service)
        {
            this.pathfindingService = service;
        }));

        yield return(base.BindService <ISeasonService>(serviceContainer, delegate(ISeasonService service)
        {
            this.seasonService = service;
        }));

        IDatabase <WeatherDefinition> weatherDefinitionDatabase = Databases.GetDatabase <WeatherDefinition>(false);

        Diagnostics.Assert(weatherDefinitionDatabase != null);
        this.weatherDefinitions = weatherDefinitionDatabase.GetValues();
        Array.Sort <WeatherDefinition>(this.weatherDefinitions, (WeatherDefinition left, WeatherDefinition right) => left.Name.CompareHandleTo(right.Name));
        List <WeatherDefinition>    availableWeathers          = new List <WeatherDefinition>(this.weatherDefinitions);
        IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();

        if (downloadableContentService == null)
        {
            Diagnostics.LogError("Wasn't able to find the Downloadable Content Service.");
        }
        else if (downloadableContentService == null)
        {
            Diagnostics.LogError("Wasn't able to find the Downloadable Content Service.");
        }
        else
        {
            for (int weatherIndex = availableWeathers.Count - 1; weatherIndex >= 0; weatherIndex--)
            {
                if (string.IsNullOrEmpty(availableWeathers[weatherIndex].RequiredDLC) || !downloadableContentService.IsShared(availableWeathers[weatherIndex].RequiredDLC))
                {
                    availableWeathers.RemoveAt(weatherIndex);
                }
            }
        }
        this.availableWeathersForGeneneration = availableWeathers.ToArray();
        this.droplistDatabase = Databases.GetDatabase <Droplist>(false);
        Diagnostics.Assert(this.droplistDatabase != null);
        this.simulationDescriptorsDatabase = Databases.GetDatabase <SimulationDescriptor>(true);
        Diagnostics.Assert(this.simulationDescriptorsDatabase != null);
        this.weatherDifficulty = Amplitude.Unity.Framework.Application.Registry.GetValue <string>(WeatherManager.WeatherDifficulty, "Random");
        if (this.weatherDifficulty != "Easy" && this.weatherDifficulty != "Normal" && this.weatherDifficulty != "Hard")
        {
            this.weatherDifficulty = "Random";
        }
        if (!float.TryParse(Amplitude.Unity.Runtime.Runtime.Registry.GetValue("Gameplay/Ancillaries/Weather/LightningDamageInPercent"), out this.lightningDamageInPercent))
        {
            Diagnostics.LogError("Fail getting lightning damage percent value.");
        }
        this.WeatherControlCooldown   = -1;
        this.WeatherControlStartTurn  = -1;
        this.WeatherControlTurnToLast = -1;
        serviceContainer.AddService <IWeatherService>(this);
        yield return(base.BindService <IWorldPositionningService>(serviceContainer, delegate(IWorldPositionningService service)
        {
            this.worldPositionService = service;
        }));

        if (this.worldPositionService == null)
        {
            Diagnostics.LogError("Wasn't able to find the world positionning service.");
        }
        yield break;
    }
Esempio n. 24
0
    private IEnumerator OnNextItem(GameObject obj, int direction = 1, bool ignoreMetapanels = false)
    {
        if (!ignoreMetapanels)
        {
            MetaPanelCity metaPanelCity = base.GuiService.GetGuiPanel <MetaPanelCity>();
            if (metaPanelCity.IsVisible)
            {
                yield break;
            }
            MetaPanelArmy metaPanelArmy = base.GuiService.GetGuiPanel <MetaPanelArmy>();
            if (metaPanelArmy.IsVisible)
            {
                yield break;
            }
        }
        IDownloadableContentService downloadableContentService = Services.GetService <IDownloadableContentService>();
        int lastIndex = (this.navigationEnabledScreens.Length - direction) % this.navigationEnabledScreens.Length;

        if (GuiPlayerControllerScreen.LastSelection != null)
        {
            int indexOf = Array.IndexOf <GuiPlayerControllerScreen>(this.navigationEnabledScreens, GuiPlayerControllerScreen.LastSelection);
            if (indexOf != -1)
            {
                if (GuiPlayerControllerScreen.LastSelection.IsVisible)
                {
                    lastIndex = indexOf;
                }
                else
                {
                    lastIndex = (indexOf + this.navigationEnabledScreens.Length - direction) % this.navigationEnabledScreens.Length;
                }
            }
        }
        GuiPlayerControllerScreen nextNavigableScreen = null;

        while (nextNavigableScreen == null)
        {
            lastIndex = (lastIndex + this.navigationEnabledScreens.Length + direction) % this.navigationEnabledScreens.Length;
            GuiPlayerControllerScreen nextPotentialNavigableScreen = this.navigationEnabledScreens[lastIndex];
            if (!(nextPotentialNavigableScreen is GameMarketplaceScreen) || this.MarketplaceToggle.AgeTransform.Enable)
            {
                if (nextPotentialNavigableScreen is GameEspionageScreen)
                {
                    if (downloadableContentService == null || !downloadableContentService.IsShared(DownloadableContent11.ReadOnlyName))
                    {
                        continue;
                    }
                }
                if (nextPotentialNavigableScreen is GameAltarOfAurigaScreen)
                {
                    if (downloadableContentService == null || !downloadableContentService.IsShared(DownloadableContent13.ReadOnlyName))
                    {
                        continue;
                    }
                }
                nextNavigableScreen = nextPotentialNavigableScreen;
            }
        }
        if (nextNavigableScreen != null)
        {
            ControlBanner.LastPendingSelection = nextNavigableScreen;
            if (nextNavigableScreen is GameEmpireScreen && this.EmpireToggle.AgeTransform.Enable)
            {
                this.OnEmpireCB(this.EmpireToggle.gameObject);
            }
            else if (nextNavigableScreen is GameCityListScreen && this.CityListToggle.AgeTransform.Enable)
            {
                this.OnCityListCB(this.CityListToggle.gameObject);
            }
            else if (nextNavigableScreen is GameResearchScreen && this.ResearchToggle.AgeTransform.Enable)
            {
                this.OnResearchCB(this.ResearchToggle.gameObject);
            }
            else if (nextNavigableScreen is GameQuestScreen && this.QuestToggle.AgeTransform.Enable)
            {
                this.OnQuestCB(this.QuestToggle.gameObject);
            }
            else if (nextNavigableScreen is GameAcademyScreen && this.AcademyToggle.AgeTransform.Enable)
            {
                this.OnAcademyCB(this.AcademyToggle.gameObject);
            }
            else if (nextNavigableScreen is GameMilitaryScreen && this.MilitaryToggle.AgeTransform.Enable)
            {
                this.OnMilitaryCB(this.MilitaryToggle.gameObject);
            }
            else if (nextNavigableScreen is GameDiplomacyScreen && this.DiplomacyToggle.AgeTransform.Enable)
            {
                this.OnDiplomacyCB(this.DiplomacyToggle.gameObject);
            }
            else if (nextNavigableScreen is GameMarketplaceScreen && this.MarketplaceToggle.AgeTransform.Enable)
            {
                this.OnMarketplaceCB(this.MarketplaceToggle.gameObject);
            }
            else if (nextNavigableScreen is GameEspionageScreen && this.EspionageplaceToggle.AgeTransform.Enable)
            {
                this.OnEspionageplaceCB(this.EspionageplaceToggle.gameObject);
            }
            else if (nextNavigableScreen is GameStatusScreen && this.EmpireToggle.AgeTransform.Enable)
            {
                if (!base.GuiService.GetGuiPanel <GameEmpireScreen>().IsVisible)
                {
                    base.GuiService.Hide(typeof(CurrentQuestPanel));
                    base.GuiService.GetGuiPanel <GameEmpireScreen>().Show(new object[0]);
                }
                yield return(null);

                base.GuiService.GetGuiPanel <GameStatusScreen>().Show(new object[0]);
            }
            else if (nextNavigableScreen is GameAltarOfAurigaScreen)
            {
                base.GuiService.GetGuiPanel <GameAltarOfAurigaScreen>().Show(new object[0]);
            }
            else
            {
                ControlBanner.LastPendingSelection = null;
            }
        }
        yield break;
    }
Esempio n. 25
0
    private bool CanUseDissent()
    {
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        return(service != null && service.IsShared(DownloadableContent16.ReadOnlyName) && base.AIEntity.Empire.SimulationObject.Tags.Contains(DownloadableContent16.FactionTraitDissent));
    }
Esempio n. 26
0
    private IEnumerator RunAsync()
    {
        if (this.EventService != null)
        {
            this.EventService.Notify(new EventBeginTurn(base.GameClient.Game.Turn));
            if (base.GameClient.Game.Turn == 0 && TutorialManager.IsActivated)
            {
                IPlayerControllerRepositoryService service = base.GameClient.Game.Services.GetService <IPlayerControllerRepositoryService>();
                this.EventService.Notify(new EventTutorialGameStarted(service.ActivePlayerController.Empire));
            }
            if (base.GameClient.Game.Turn == 0)
            {
                IDownloadableContentService service2 = Services.GetService <IDownloadableContentService>();
                if (service2 != null)
                {
                    List <DownloadableContent> list = new List <DownloadableContent>();
                    foreach (DownloadableContent downloadableContent in service2)
                    {
                        DownloadableContentType type = downloadableContent.Type;
                        if ((type == DownloadableContentType.Exclusive || type == DownloadableContentType.Personal) && service2.IsShared(downloadableContent.Name))
                        {
                            list.Add(downloadableContent);
                        }
                    }
                    if (list.Count > 0)
                    {
                        for (int i = list.Count - 1; i >= 0; i--)
                        {
                            StaticString key = string.Format("DownloadableContent/{0}/RunOnce/Notified", list[i].Name);
                            if (!Amplitude.Unity.Framework.Application.Registry.GetValue <bool>(key, false))
                            {
                                Amplitude.Unity.Framework.Application.Registry.SetValue <bool>(key, true);
                                this.EventService.Notify(new EventDownloadableContentPresentation(list[i]));
                            }
                        }
                    }
                    Empire clientEmpire = base.GameClient.GetClientEmpire();
                    if (clientEmpire != null && !clientEmpire.Faction.IsCustom && clientEmpire.Faction.IsStandard)
                    {
                        this.EventService.Notify(new EventFactionPresentation(clientEmpire.Faction));
                    }
                }
            }
        }
        SeasonManager seasonManager = base.GameClient.Game.GetService <ISeasonService>() as SeasonManager;

        if (seasonManager != null)
        {
            seasonManager.GameClient_Turn_Begin();
        }
        PillarManager pillarManager = base.GameClient.Game.GetService <IPillarService>() as PillarManager;

        if (pillarManager != null)
        {
            pillarManager.OnBeginTurn();
        }
        TerraformDeviceManager terraformDeviceManager = base.GameClient.Game.GetService <ITerraformDeviceService>() as TerraformDeviceManager;

        if (terraformDeviceManager != null)
        {
            terraformDeviceManager.GameClient_Turn_Begin();
        }
        WorldEffectManager worldEffectManager = base.GameClient.Game.GetService <IWorldEffectService>() as WorldEffectManager;

        if (worldEffectManager != null)
        {
            worldEffectManager.OnBeginTurn();
        }
        LeechManager leechManager = base.GameClient.Game.GetService <ILeechService>() as LeechManager;

        if (leechManager != null)
        {
            leechManager.OnBeginTurn();
        }
        CooldownManager cooldownManager = base.GameClient.Game.GetService <ICooldownManagementService>() as CooldownManager;

        if (cooldownManager != null)
        {
            cooldownManager.OnBeginTurn();
        }
        MapBoostManager mapBoostManager = base.GameClient.Game.GetService <IMapBoostService>() as MapBoostManager;

        if (mapBoostManager != null)
        {
            mapBoostManager.GameClient_OnBeginTurn();
        }
        RegionalEffectsManager regionalEffectsManager = base.GameClient.Game.GetService <IRegionalEffectsService>() as RegionalEffectsManager;

        if (regionalEffectsManager != null)
        {
            regionalEffectsManager.GameClient_Turn_Begin();
        }
        WeatherManager weatherManager = base.GameClient.Game.GetService <IWeatherService>() as WeatherManager;

        if (weatherManager != null)
        {
            weatherManager.GameClient_Turn_Begin();
        }
        int num;

        for (int index = 0; index < base.GameClient.Game.Empires.Length; index = num + 1)
        {
            yield return(base.GameClient.Game.Empires[index].DoPasses("GameClientState_Turn_Begin"));

            base.GameClient.Game.Empires[index].Refresh(true);
            num = index;
        }
        IVisibilityService service3 = base.GameClient.Game.GetService <IVisibilityService>();

        if (service3 != null)
        {
            IPlayerControllerRepositoryService service4 = base.GameClient.Game.GetService <IPlayerControllerRepositoryService>();
            if (service4 != null && service4.ActivePlayerController != null && service4.ActivePlayerController.Empire != null)
            {
                service3.NotifyVisibilityHasChanged((Empire)service4.ActivePlayerController.Empire);
            }
        }
        IVictoryManagementService service5 = base.GameClient.Game.GetService <IVictoryManagementService>();

        if (service5 != null)
        {
            service5.CheckForAlerts(base.GameClient.Game.Turn - 1);
        }
        IWorldPositionningService service6 = base.GameClient.Game.GetService <IWorldPositionningService>();

        if (service6 != null)
        {
            service6.RefreshDefensiveTowerMapForEveryone();
        }
        yield break;
    }
Esempio n. 27
0
    public override void RefreshContent()
    {
        base.RefreshContent();
        base.Empire.Refresh(false);
        DepartmentOfScience     agency  = base.Empire.GetAgency <DepartmentOfScience>();
        DepartmentOfTheTreasury agency2 = base.Empire.GetAgency <DepartmentOfTheTreasury>();

        this.ComputeCurrentEraNumber();
        this.CurrentEraNumber.Text = AgeUtils.ToRoman(this.currentEraNumber);
        this.ResearchErasTable.RefreshChildrenIList <ResearchEraFrame.TechnologyEra>(this.eras, this.refreshEraDelegate, true, false);
        Construction construction = agency.ResearchQueue.Peek();
        bool         flag         = construction != null;
        float        quantity;

        if (flag)
        {
            quantity = DepartmentOfTheTreasury.GetProductionCostWithBonus(base.Empire.SimulationObject, construction.ConstructibleElement, DepartmentOfTheTreasury.Resources.EmpireResearch);
        }
        else
        {
            quantity = agency.GetResearchPropertyValue(SimulationProperties.TechnologyCost);
        }
        this.TechnologyCostValue.Text = GuiFormater.FormatQuantity(quantity, SimulationProperties.EmpireResearch, 1);
        float quantity2;

        agency2.TryGetNetResourceValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpireResearch, out quantity2, false);
        this.EmpireOutputValue.Text = GuiFormater.FormatQuantity(quantity2, SimulationProperties.EmpireResearch, 0);
        if (flag)
        {
            float num = agency2.ComputeConstructionProgress(base.Empire, construction);
            this.ResearchProgress.Text = Mathf.RoundToInt(num * 100f).ToString() + "%";
            int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction);
            num2 = Mathf.Max(num2, 1);
            if (num2 == 2147483647)
            {
                this.ResearchTurns.Text = GuiFormater.Infinite.ToString();
            }
            else
            {
                this.ResearchTurns.Text = num2.ToString();
            }
            TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition;
            if (technologyDefinition != null)
            {
                this.TechnologyName.Text   = DepartmentOfScience.GetTechnologyTitle(technologyDefinition);
                this.TechnologyImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, GuiPanel.IconSize.Small);
            }
            DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.TechnologyName.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal);
        }
        else
        {
            this.TechnologyName.Text   = "%ResearchNoneTitle";
            this.TechnologyImage.Image = null;
            this.ResearchProgress.Text = "%ResearchVoidSymbol";
            this.ResearchTurns.Text    = "%ResearchVoidSymbol";
            if (this.TechnologyName.AgeTransform.AgeTooltip != null)
            {
                this.TechnologyName.AgeTransform.AgeTooltip.Class      = string.Empty;
                this.TechnologyName.AgeTransform.AgeTooltip.Content    = string.Empty;
                this.TechnologyName.AgeTransform.AgeTooltip.ClientData = null;
            }
            if (this.TechnologyImage.AgeTransform.AgeTooltip != null)
            {
                this.TechnologyImage.AgeTransform.AgeTooltip.Class      = string.Empty;
                this.TechnologyImage.AgeTransform.AgeTooltip.Content    = string.Empty;
                this.TechnologyImage.AgeTransform.AgeTooltip.ClientData = null;
            }
        }
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1))
        {
            this.TechnologyStatsGroup.Visible = false;
            this.ResearchBuyoutButton.AgeTransform.Visible = true;
            this.ResearchCompletionGroup.Visible           = false;
            this.RefreshBuyout(this.ResearchBuyoutButton);
            return;
        }
        this.TechnologyStatsGroup.Visible = true;
        this.ResearchBuyoutButton.AgeTransform.Visible = false;
        this.ResearchCompletionGroup.Visible           = true;
    }
Esempio n. 28
0
    public void RefreshContent(Dictionary <string, string> optionValuesByName, bool readOnly)
    {
        if (this.OptionDefinition == null)
        {
            return;
        }
        if (!string.IsNullOrEmpty(this.OptionDefinition.EnableOn))
        {
            string empty = string.Empty;
            if (optionValuesByName.TryGetValue(this.OptionDefinition.EnableOn, out empty))
            {
                this.AgeTransform.Enable = (empty == "True");
            }
        }
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && this.OptionDefinition.OptionDefinitionConstraints != null)
        {
            foreach (OptionDefinitionConstraint optionDefinitionConstraint in from element in this.OptionDefinition.OptionDefinitionConstraints
                     where element.Type == OptionDefinitionConstraintType.DownloadableContentConditional
                     select element)
            {
                if (string.IsNullOrEmpty(optionDefinitionConstraint.OptionName))
                {
                    this.AgeTransform.Enable = false;
                    break;
                }
                if (!service.IsShared(optionDefinitionConstraint.OptionName))
                {
                    this.AgeTransform.Enable = false;
                    this.Title.AgeTransform.AgeTooltip.Content = "%RestrictedDownloadableContentTitle";
                    break;
                }
            }
            ISessionService service2 = Services.GetService <ISessionService>();
            if (service2 != null && service2.Session != null)
            {
                foreach (OptionDefinitionConstraint optionDefinitionConstraint2 in from element in this.OptionDefinition.OptionDefinitionConstraints
                         where element.Type == OptionDefinitionConstraintType.Conditional
                         select element)
                {
                    if (!string.IsNullOrEmpty(optionDefinitionConstraint2.OptionName) && optionDefinitionConstraint2.OptionName == "Multiplayer" && service2.Session.SessionMode == SessionMode.Single)
                    {
                        this.AgeTransform.Enable = false;
                        this.Title.AgeTransform.AgeTooltip.Content = "%MultiplayerOnlyTitle";
                        break;
                    }
                }
            }
        }
        string value;

        if (!optionValuesByName.TryGetValue(this.OptionDefinition.Name, out value))
        {
            this.AgeTransform.Visible = false;
            return;
        }
        this.AgeTransform.Visible = true;
        string a;

        if (!string.IsNullOrEmpty(this.OptionDefinition.SubCategory) && this.OptionDefinition.SubCategory != this.OptionDefinition.Name && optionValuesByName.TryGetValue(this.OptionDefinition.SubCategory, out a) && a == "Random")
        {
            this.SetAvailable(false);
            return;
        }
        this.SetAvailable(true);
        if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeToggle)
        {
            this.RefreshToggle(value, readOnly);
            return;
        }
        if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeDropList)
        {
            this.RefreshDropList(value, readOnly);
            if (this.OptionDefinition.ItemDefinitions != null)
            {
                for (int i = 0; i < this.OptionDefinition.ItemDefinitions.Length; i++)
                {
                    OptionDefinition.ItemDefinition itemDefinition = this.OptionDefinition.ItemDefinitions[i];
                    if (itemDefinition.OptionDefinitionConstraints != null)
                    {
                        bool flag = true;
                        foreach (OptionDefinitionConstraint optionDefinitionConstraint3 in from element in itemDefinition.OptionDefinitionConstraints
                                 where element.Type == OptionDefinitionConstraintType.Conditional
                                 select element)
                        {
                            if (string.IsNullOrEmpty(optionDefinitionConstraint3.OptionName))
                            {
                                flag = false;
                                break;
                            }
                            string text;
                            if (!optionValuesByName.TryGetValue(optionDefinitionConstraint3.OptionName, out text))
                            {
                                Diagnostics.LogWarning("Unhandled constraint on option '{0}' from option definition '{1}', item '{2}'.", new object[]
                                {
                                    optionDefinitionConstraint3.OptionName,
                                    this.OptionDefinition.Name,
                                    itemDefinition.Name
                                });
                            }
                            else if (string.IsNullOrEmpty(text))
                            {
                                Diagnostics.LogWarning("Unhandled constraint on option '{0}' from option definition '{1}', item '{2}'.", new object[]
                                {
                                    optionDefinitionConstraint3.OptionName,
                                    this.OptionDefinition.Name,
                                    itemDefinition.Name
                                });
                            }
                            else
                            {
                                if (optionDefinitionConstraint3.Keys == null || optionDefinitionConstraint3.Keys.Length == 0)
                                {
                                    flag = false;
                                    break;
                                }
                                if (!optionDefinitionConstraint3.Keys.Select((OptionDefinitionConstraint.Key key) => key.Name).Contains(text))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        if (flag && service != null)
                        {
                            foreach (OptionDefinitionConstraint optionDefinitionConstraint4 in from element in itemDefinition.OptionDefinitionConstraints
                                     where element.Type == OptionDefinitionConstraintType.DownloadableContentConditional
                                     select element)
                            {
                                if (string.IsNullOrEmpty(optionDefinitionConstraint4.OptionName))
                                {
                                    flag = false;
                                    break;
                                }
                                if (!service.IsShared(optionDefinitionConstraint4.OptionName))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        this.DropList.EnableItem(i, flag);
                    }
                }
                return;
            }
        }
        else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeTextField)
        {
            this.RefreshTextField(value, readOnly);
        }
    }
Esempio n. 29
0
    public void RefreshContent(global::Session session, bool readOnly)
    {
        if (this.OptionDefinition == null)
        {
            return;
        }
        if (!string.IsNullOrEmpty(this.OptionDefinition.EnableOn))
        {
            string a = session.GetLobbyData(this.OptionDefinition.EnableOn) as string;
            this.AgeTransform.Enable = (a == "True");
        }
        if (!string.IsNullOrEmpty(this.OptionDefinition.SubCategory) && this.OptionDefinition.SubCategory != this.OptionDefinition.Name)
        {
            string lobbyData = session.GetLobbyData <string>(this.OptionDefinition.SubCategory, null);
            if (lobbyData == "Random")
            {
                this.SetAvailable(false);
                return;
            }
        }
        this.SetAvailable(true);
        string lobbyData2 = session.GetLobbyData <string>(this.OptionDefinition.Name, null);

        if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeToggle)
        {
            this.RefreshToggle(lobbyData2, readOnly);
        }
        else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeDropList)
        {
            this.RefreshDropList(lobbyData2, readOnly);
            if (this.OptionDefinition.ItemDefinitions != null)
            {
                for (int i = 0; i < this.OptionDefinition.ItemDefinitions.Length; i++)
                {
                    OptionDefinition.ItemDefinition itemDefinition = this.OptionDefinition.ItemDefinitions[i];
                    if (itemDefinition.OptionDefinitionConstraints != null)
                    {
                        bool flag = true;
                        foreach (OptionDefinitionConstraint optionDefinitionConstraint in from element in itemDefinition.OptionDefinitionConstraints
                                 where element.Type == OptionDefinitionConstraintType.Conditional
                                 select element)
                        {
                            if (string.IsNullOrEmpty(optionDefinitionConstraint.OptionName))
                            {
                                flag = false;
                                break;
                            }
                            string lobbyData3 = session.GetLobbyData <string>(optionDefinitionConstraint.OptionName, null);
                            if (string.IsNullOrEmpty(lobbyData3))
                            {
                                Diagnostics.LogWarning("Unhandled constraint on option '{0}' from option definition '{1}', item '{2}'.", new object[]
                                {
                                    optionDefinitionConstraint.OptionName,
                                    this.OptionDefinition.Name,
                                    itemDefinition.Name
                                });
                            }
                            else
                            {
                                if (optionDefinitionConstraint.Keys == null || optionDefinitionConstraint.Keys.Length == 0)
                                {
                                    flag = false;
                                    break;
                                }
                                if (!optionDefinitionConstraint.Keys.Select((OptionDefinitionConstraint.Key key) => key.Name).Contains(lobbyData3))
                                {
                                    flag = false;
                                    break;
                                }
                            }
                        }
                        if (flag)
                        {
                            IDownloadableContentService service = Services.GetService <IDownloadableContentService>();
                            if (service != null)
                            {
                                foreach (OptionDefinitionConstraint optionDefinitionConstraint2 in from element in itemDefinition.OptionDefinitionConstraints
                                         where element.Type == OptionDefinitionConstraintType.DownloadableContentConditional
                                         select element)
                                {
                                    if (string.IsNullOrEmpty(optionDefinitionConstraint2.OptionName))
                                    {
                                        flag = false;
                                        break;
                                    }
                                    if (!service.IsShared(optionDefinitionConstraint2.OptionName))
                                    {
                                        flag = false;
                                        break;
                                    }
                                }
                            }
                        }
                        this.DropList.EnableItem(i, flag);
                    }
                }
            }
        }
        else if (this.OptionDefinition.GuiControlType == MenuSetting.GuiControlTypeTextField)
        {
            this.RefreshTextField(lobbyData2, readOnly);
        }
    }
Esempio n. 30
0
    public void SetupTechnology(global::Empire empire, TechnologyDefinition technologyDefinition, GameObject client)
    {
        this.empire = empire;
        this.TechnologyDefinition = technologyDefinition;
        this.selectionClient      = client;
        if (this.TagsList == null)
        {
            this.TagsList = new List <string>();
        }
        else
        {
            this.TagsList.Clear();
        }
        if (this.empire == null)
        {
            return;
        }
        this.BuildTags();
        if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Quest))
        {
            this.EraLabel.Text = string.Empty;
            AgePrimitiveLabel eraLabel = this.EraLabel;
            eraLabel.Text += (char)this.QuestCharNumber;
        }
        else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Medal))
        {
            this.EraLabel.Text = string.Empty;
            AgePrimitiveLabel eraLabel2 = this.EraLabel;
            eraLabel2.Text += (char)this.MedalCharNumber;
        }
        else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Affinity))
        {
            this.EraLabel.Text = string.Empty;
            AgePrimitiveLabel eraLabel3 = this.EraLabel;
            eraLabel3.Text += GuiEmpire.GetFactionSymbolString(this.empire, this.empire);
        }
        else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock))
        {
            this.EraLabel.Text = string.Empty;
        }
        else if (technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock))
        {
            this.EraLabel.Text = string.Empty;
        }
        else
        {
            int technologyEraNumber = DepartmentOfScience.GetTechnologyEraNumber(technologyDefinition);
            if (technologyEraNumber > 0)
            {
                this.EraLabel.Text = AgeUtils.ToRoman(technologyEraNumber);
            }
            else
            {
                this.EraLabel.Text = "-";
            }
        }
        this.GlowImage.AgeTransform.Visible = false;
        IDownloadableContentService service = Services.GetService <IDownloadableContentService>();

        if (service != null && service.IsShared(DownloadableContent9.ReadOnlyName) && technologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.Unique))
        {
            this.GlowImage.AgeTransform.Visible = true;
        }
        if (this.UnlockImage != null)
        {
            this.UnlockImage.Image = DepartmentOfScience.GetTechnologyImage(technologyDefinition, global::GuiPanel.IconSize.Small);
        }
        this.CategoryIcon.Image     = DepartmentOfScience.GetCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small);
        this.CategoryFullIcon.Image = this.CategoryIcon.Image;
        if (this.SubCategoryIcon.Image != null)
        {
            this.CategoryIcon.AgeTransform.PixelOffsetLeft     = -this.CategoryIcon.AgeTransform.Width;
            this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -this.CategoryFullIcon.AgeTransform.Width;
        }
        else
        {
            this.CategoryIcon.AgeTransform.PixelOffsetLeft     = -(0.5f * this.CategoryIcon.AgeTransform.Width);
            this.CategoryFullIcon.AgeTransform.PixelOffsetLeft = -(0.5f * this.CategoryFullIcon.AgeTransform.Width);
        }
        this.SubCategoryIcon.Image     = DepartmentOfScience.GetSubCategoryIcon(technologyDefinition, global::GuiPanel.IconSize.Small);
        this.SubCategoryFullIcon.Image = this.SubCategoryIcon.Image;
        DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, this.empire, this.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal);
        this.InProgressSector.TintColor = this.InProgressColor;
        this.MarkupGroup.Visible        = false;
        DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>();

        DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(technologyDefinition);
        this.Refresh(empire, technologyState);
    }