コード例 #1
0
ファイル: UnitListPanel.cs プロジェクト: LeaderEnemyBoss/ELCP
 public void OnForceShiftCB(GameObject obj)
 {
     if (this.Garrison != null)
     {
         DepartmentOfScience agency = this.Garrison.Empire.GetAgency <DepartmentOfScience>();
         if (agency == null || agency.GetTechnologyState("TechnologyDefinitionOrbUnlock17WinterShifters") != DepartmentOfScience.ConstructibleElement.State.Researched)
         {
             return;
         }
         List <Unit> list = new List <Unit>(this.selectedUnits);
         list.RemoveAll((Unit unit) => !unit.IsShifter() || !unit.IsInCurrentSeasonForm());
         if (list.Count > 0)
         {
             OrderForceShiftUnits order = new OrderForceShiftUnits(this.Garrison.Empire.Index, list.ToArray());
             IPlayerControllerRepositoryService service = base.Game.Services.GetService <IPlayerControllerRepositoryService>();
             Ticket ticket;
             service.ActivePlayerController.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.OnOrderResponse));
             EventForceShift eventToNotify = new EventForceShift(this.Garrison.Empire, list.Count, true);
             IEventService   service2      = Services.GetService <IEventService>();
             if (service2 != null)
             {
                 service2.Notify(eventToNotify);
             }
         }
     }
 }
コード例 #2
0
    private bool CanPathToRegion(Region region)
    {
        foreach (Region region2 in this.worldPositionningService.GetNeighbourRegions(region, false, false))
        {
            if (region2.Owner != null && region2.Owner.Index == base.AIEntity.Empire.Index)
            {
                return(true);
            }
        }
        PathfindingContext pathfindingContext;

        if (this.PathingOrigin is Army)
        {
            pathfindingContext = (this.PathingOrigin as Army).GenerateContext();
        }
        else
        {
            pathfindingContext = new PathfindingContext(GameEntityGUID.Zero, base.AIEntity.Empire, PathfindingMovementCapacity.Ground);
            pathfindingContext.AddMovementCapacity(PathfindingMovementCapacity.FrozenWater);
            pathfindingContext.RefreshProperties(1f, 100f, false, false, 100f, 100f);
            DepartmentOfScience agency = base.AIEntity.Empire.GetAgency <DepartmentOfScience>();
            DepartmentOfScience.ConstructibleElement technology;
            if (agency.TechnologyDatabase.TryGetValue("TechnologyDefinitionShip", out technology) && agency.GetTechnologyState(technology) == DepartmentOfScience.ConstructibleElement.State.Researched)
            {
                pathfindingContext.AddMovementCapacity(PathfindingMovementCapacity.Water);
            }
        }
        WorldPosition[] worldPositions = region.WorldPositions;
        int             j = 0;

        while (j < worldPositions.Length)
        {
            WorldPosition worldPosition = worldPositions[j];
            if (!this.worldPositionningService.IsWaterTile(worldPosition) && !this.worldPositionningService.HasRidge(worldPosition) && this.pathfindingService.IsTileStopable(worldPosition, pathfindingContext, (PathfindingFlags)0, null))
            {
                if (this.pathfindingService.FindPath(pathfindingContext, (this.PathingOrigin as IWorldPositionable).WorldPosition, worldPosition, PathfindingManager.RequestMode.Default, null, PathfindingFlags.IgnoreArmies | PathfindingFlags.IgnoreEncounterAreas | PathfindingFlags.IgnoreFogOfWar | PathfindingFlags.IgnorePOI | PathfindingFlags.IgnoreSieges | PathfindingFlags.IgnoreTerraformDevices | PathfindingFlags.IgnoreKaijuGarrisons, null) == null)
                {
                    if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools)
                    {
                        Diagnostics.Log("ELCP {0}/{1} AILayer_Colonization:CanPathToRegion FAILED! from {3} to {2}/{5} with {4}", new object[]
                        {
                            base.AIEntity.Empire,
                            this.PathingOrigin.LocalizedName,
                            worldPosition,
                            (this.PathingOrigin as IWorldPositionable).WorldPosition,
                            pathfindingContext.MovementCapacities,
                            region.LocalizedName
                        });
                    }
                    return(false);
                }
                return(true);
            }
            else
            {
                j++;
            }
        }
        return(false);
    }
コード例 #3
0
ファイル: UnitListPanel.cs プロジェクト: LeaderEnemyBoss/ELCP
    public virtual void Bind(IGarrison garrison, IGarrison militia = null, GameObject parent = null)
    {
        this.Unbind();
        IPlayerControllerRepositoryService service = base.Game.Services.GetService <IPlayerControllerRepositoryService>();

        this.IsOtherEmpire = (service.ActivePlayerController.Empire != garrison.Empire);
        this.Garrison      = garrison;
        this.Militia       = militia;
        this.guiUnits.Clear();
        for (int i = 0; i < this.Garrison.StandardUnits.Count; i++)
        {
            this.guiUnits.Add(new GuiUnit(this.Garrison.StandardUnits[i], null));
        }
        if (this.Militia != null)
        {
            for (int j = 0; j < this.Militia.StandardUnits.Count; j++)
            {
                this.guiUnits.Add(new GuiUnit(this.Militia.StandardUnits[j], null));
            }
        }
        this.DepartmentOfTheTreasury = this.Garrison.Empire.GetAgency <DepartmentOfTheTreasury>();
        this.DepartmentOfScience     = this.Garrison.Empire.GetAgency <DepartmentOfScience>();
        Diagnostics.Assert(this.Garrison.Empire != null, "Garrison has not assigned Empire");
        this.departmentOfDefense     = this.Garrison.Empire.GetAgency <DepartmentOfDefense>();
        this.departmentOfTheInterior = this.Garrison.Empire.GetAgency <DepartmentOfTheInterior>();
        this.parent = parent;
    }
コード例 #4
0
ファイル: Auction_Unit.cs プロジェクト: LeaderEnemyBoss/ELCP
    protected override Amplitude.Unity.Game.Orders.Order SellOne(Empire empire, AuctionItem_GameEntity item, ref List <AuctionInstruction> instructions)
    {
        Unit   unit       = item.GameEntity as Unit;
        string parentName = string.Empty;

        if (unit.Garrison is City)
        {
            parentName = (unit.Garrison as City).LocalizedName;
        }
        else if (unit.Garrison is Army)
        {
            parentName = (unit.Garrison as Army).LocalizedName;
        }
        DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>();

        if (agency != null && agency.GetTechnologyState(TechnologyDefinition.Names.MarketplaceMercenaries) == DepartmentOfScience.ConstructibleElement.State.Researched)
        {
            instructions.Add(new AuctionInstruction(AuctionInstruction.AuctionType.Unit, AuctionInstruction.AuctionAction.Sell, unit.UnitDesign.LocalizedName, 1, parentName));
        }
        else
        {
            instructions.Add(new AuctionInstruction(AuctionInstruction.AuctionType.Unit, AuctionInstruction.AuctionAction.Destroy, unit.UnitDesign.LocalizedName, 1, parentName));
        }
        return(new OrderSelloutTradableUnits(empire.Index, new GameEntityGUID[]
        {
            item.ItemGuid
        }));
    }
コード例 #5
0
    private void BuildTags()
    {
        this.TagsList.Clear();
        this.TagsList.AddRange(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(this.TechnologyDefinition)).ToUpper().Split(new char[]
        {
            ' '
        }));
        this.TagsList.Add(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetCategoryTitle(this.TechnologyDefinition)).ToUpper());
        this.TagsList.Add(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetSubCategoryTitle(this.TechnologyDefinition)).ToUpper());
        List <ConstructibleElement> unlocksByTechnology = this.TechnologyDefinition.GetUnlocksByTechnology();

        if (unlocksByTechnology != null && unlocksByTechnology.Count > 1)
        {
            for (int i = 0; i < unlocksByTechnology.Count; i++)
            {
                IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;
                GuiElement      guiElement;
                if (guiPanelHelper.TryGetGuiElement(unlocksByTechnology[i].Name, out guiElement))
                {
                    this.TagsList.AddRange(AgeLocalizer.Instance.LocalizeString(guiElement.Title).ToUpper().Split(new char[]
                    {
                        ' '
                    }));
                }
            }
        }
    }
コード例 #6
0
    public int GetCurrentUnitLevel()
    {
        int   maxEraNumber  = DepartmentOfScience.GetMaxEraNumber();
        float propertyValue = base.Empire.GetPropertyValue("MinorEmpireDifficultyFactor");

        return(Mathf.FloorToInt((float)maxEraNumber * this.eraFactorForUnitLevel * propertyValue + (float)this.EndTurnService.Turn * this.turnFactorForUnitLevel * propertyValue));
    }
コード例 #7
0
    private void OnVisibityRefreshed(object sender, VisibilityRefreshedEventArgs args)
    {
        MajorEmpire majorEmpire = args.Empire as MajorEmpire;

        if (majorEmpire == null)
        {
            return;
        }
        DepartmentOfScience agency = majorEmpire.GetAgency <DepartmentOfScience>();

        for (int i = 0; i < this.majorEmpires.Length; i++)
        {
            global::Empire empire = this.majorEmpires[i];
            if (majorEmpire.Index != empire.Index)
            {
                WorldPosition worldPosition = this.CheckMetting(majorEmpire, empire);
                if (worldPosition != WorldPosition.Invalid)
                {
                    WorldPosition worldPosition2 = this.CheckMetting(empire, majorEmpire);
                    if (worldPosition2 != WorldPosition.Invalid)
                    {
                        this.OnEmpireSymetricDiscovery(majorEmpire, empire, worldPosition, worldPosition2);
                    }
                    else if (agency.GetTechnologyState(this.technologyDefinitionDrakkenVisionDuringFirstTurn) == DepartmentOfScience.ConstructibleElement.State.Researched)
                    {
                        this.OnEmpireAsymetricDiscovery(majorEmpire, empire, worldPosition);
                    }
                }
            }
        }
    }
コード例 #8
0
ファイル: AILayer_Altar.cs プロジェクト: LeaderEnemyBoss/ELCP
    private static float UtilityFunc_EmpireLuxury(SeasonEffect aiEvaluableElement, InterpreterContext context, float aiParameterValue, AIHeuristicAnalyser.Context debugContext)
    {
        global::Empire empire = context.Get("Empire") as global::Empire;

        Diagnostics.Assert(empire != null);
        DepartmentOfScience     agency  = empire.GetAgency <DepartmentOfScience>();
        DepartmentOfTheInterior agency2 = empire.GetAgency <DepartmentOfTheInterior>();
        float num;
        float num2;

        AILayer_Altar.GetResourceUnitMarketPrice(empire, out num, out num2);
        float b = 0f;

        if (agency.GetTechnologyState(TechnologyDefinition.Names.MarketplaceResources) == DepartmentOfScience.ConstructibleElement.State.Researched)
        {
            float propertyValue = empire.GetPropertyValue(SimulationProperties.NetEmpireMoney);
            b = num2 / Mathf.Max(propertyValue, 1f);
        }
        float technologyUnlockedCount = agency.GetTechnologyUnlockedCount();
        float a    = (float)agency2.Cities.Count;
        float a2   = technologyUnlockedCount / (15f * Mathf.Max(a, 1f));
        float num3 = Mathf.Max(a2, b);

        return(aiParameterValue * num3);
    }
コード例 #9
0
    private void StartNextBooster()
    {
        if (base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1))
        {
            return;
        }
        DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>();
        bool flag  = base.Empire.GetAgency <DepartmentOfForeignAffairs>().IsInWarWithSomeone();
        bool flag2 = agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel1") == DepartmentOfScience.ConstructibleElement.State.Researched || agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel2") == DepartmentOfScience.ConstructibleElement.State.Researched;

        if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") <= 16f || flag2 || flag)
        {
            if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") >= 23f && !flag2)
            {
                return;
            }
            for (int i = 0; i < this.departmentOfEducation.VaultCount; i++)
            {
                BoosterDefinition boosterDefinition = this.departmentOfEducation.VaultItems[i].Constructible as BoosterDefinition;
                if (boosterDefinition != null && boosterDefinition.Name == "BoosterScience")
                {
                    OrderBuyoutAndActivateBooster order = new OrderBuyoutAndActivateBooster(base.Empire.Index, boosterDefinition.Name, this.departmentOfEducation.VaultItems[i].GUID, false);
                    Ticket ticket;
                    base.Empire.PlayerControllers.AI.PostOrder(order, out ticket, new EventHandler <TicketRaisedEventArgs>(this.BuyoutAndActivateBooster_TicketRaised));
                    return;
                }
            }
        }
    }
コード例 #10
0
    private void OnSelectOrbUnlockCB(GameObject obj)
    {
        if (this.empire == null)
        {
            Diagnostics.LogError("Empire is null");
            return;
        }
        DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>();

        DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition);
        ConstructionQueue constructionQueueForTech = agency.GetConstructionQueueForTech(this.TechnologyDefinition);

        if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available && agency.OrbUnlockQueue.Length < 2)
        {
            this.AgeTransform.Enable = false;
            if (agency.OrbUnlockQueue.Length > 0)
            {
                Construction construction = constructionQueueForTech.Peek();
                this.CancelResearch(construction);
            }
            this.QueueResearch();
            this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver);
        }
        else if (technologyState == DepartmentOfScience.ConstructibleElement.State.InProgress || technologyState == DepartmentOfScience.ConstructibleElement.State.Queued)
        {
            this.AgeTransform.Enable = false;
            Construction construction2 = constructionQueueForTech.Get(this.TechnologyDefinition);
            this.CancelResearch(construction2);
            this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver);
        }
    }
コード例 #11
0
 public override void Bind(Empire empire)
 {
     base.Bind(empire);
     this.DepartmentOfScience = base.Empire.GetAgency <DepartmentOfScience>();
     this.UpdateSalablePanelVisibility();
     base.NeedRefresh = true;
 }
コード例 #12
0
    private void FillDecisionMakerVariables()
    {
        if (this.decisionMaker.Context == null)
        {
            return;
        }
        this.decisionMaker.Context.Register("GlobalWarNeed", this.aiLayerDiplomacy.GetGlobalWarNeed());
        this.decisionMaker.Context.Register("IndustryReferenceTurnCount", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.IndustryReferenceTurnCount));
        this.decisionMaker.Context.Register("TechnologyReferenceTurnCount", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.TechnologyReferenceTurnCount));
        this.decisionMaker.Context.Register("MoneyReferenceRatio", this.aiLayerResourceAmas.Amas.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.MoneyReferenceRatio));
        int num  = this.departmentOfScience.CurrentTechnologyEraNumber - 1;
        int num2 = 0;
        int num3 = 0;

        foreach (DepartmentOfScience.ConstructibleElement constructibleElement in this.departmentOfScience.TechnologyDatabase)
        {
            TechnologyDefinition technologyDefinition = constructibleElement as TechnologyDefinition;
            if (technologyDefinition != null)
            {
                int technologyEraNumber = DepartmentOfScience.GetTechnologyEraNumber(technologyDefinition);
                DepartmentOfScience.ConstructibleElement.State technologyState = this.departmentOfScience.GetTechnologyState(constructibleElement);
                if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available)
                {
                    num3++;
                    if (technologyEraNumber < num)
                    {
                        num2++;
                    }
                }
            }
        }
        float num4 = 0f;

        if (num3 > 0)
        {
            num4 = (float)num2 / (float)num3;
        }
        this.decisionMaker.Context.Register("OldTechnologyRatio", num4);
        AILayer_Strategy layer      = base.AIEntity.GetLayer <AILayer_Strategy>();
        float            agentValue = layer.StrategicNetwork.GetAgentValue("Expansion");

        this.decisionMaker.Context.Register("ColonizationPriority", agentValue);
        DepartmentOfTheInterior agency = base.AIEntity.Empire.GetAgency <DepartmentOfTheInterior>();
        float num5 = 0f;

        if (agency.Cities.Count > 0)
        {
            for (int i = 0; i < agency.Cities.Count; i++)
            {
                AgentGroup cityAgentGroup = this.aiLayerResourceAmas.GetCityAgentGroup(agency.Cities[i]);
                if (cityAgentGroup != null)
                {
                    num5 += cityAgentGroup.GetAgentCriticityMaxIntensity(AILayer_ResourceAmas.AgentNames.PopulationReferenceTurnCount);
                }
            }
            num5 /= (float)agency.Cities.Count;
        }
        this.decisionMaker.Context.Register("PopulationReferenceTurnCount", num5);
    }
コード例 #13
0
    private void CreateEmpireFilters(List <global::Empire> empiresToSelect = null)
    {
        if (empiresToSelect != null && empiresToSelect.Count == 1 && empiresToSelect[0] == base.Empire)
        {
            empiresToSelect.Clear();
        }
        this.empireToFilter.Clear();
        DepartmentOfIntelligence agency = base.Empire.GetAgency <DepartmentOfIntelligence>();
        bool         flag = DepartmentOfTheInterior.CanSeeAllExchangeTransactions(base.Empire);
        global::Game game = base.Game as global::Game;

        for (int i = 0; i < game.Empires.Length; i++)
        {
            MajorEmpire majorEmpire = game.Empires[i] as MajorEmpire;
            if (majorEmpire != null)
            {
                if (base.Empire.Index == majorEmpire.Index)
                {
                    this.empireToFilter.Add(majorEmpire);
                }
                else if (!majorEmpire.IsEliminated)
                {
                    DepartmentOfScience agency2 = majorEmpire.GetAgency <DepartmentOfScience>();
                    if (agency2.CanTradeHeroes(true) || agency2.CanTradeUnits(true) || agency2.CanTradeResourcesAndBoosters(true))
                    {
                        if (flag)
                        {
                            this.empireToFilter.Add(majorEmpire);
                        }
                        else if (agency != null && agency.IsEmpireInfiltrated(majorEmpire))
                        {
                            this.empireToFilter.Add(majorEmpire);
                        }
                    }
                }
            }
        }
        this.empireFilterWidth = Mathf.Floor((this.EmpireFiltersContainer.Width - this.EmpireFiltersContainer.HorizontalSpacing * (float)(this.empireToFilter.Count - 1)) / (float)this.empireToFilter.Count);
        this.EmpireFiltersContainer.ReserveChildren(this.empireToFilter.Count, this.EmpireFilterPrefab, "EmpireFilterToggle");
        this.EmpireFiltersContainer.RefreshChildrenIList <global::Empire>(this.empireToFilter, new AgeTransform.RefreshTableItem <global::Empire>(this.SetupEmpireFilterToggle), true, false);
        this.EmpireFiltersContainer.ArrangeChildren();
        if (empiresToSelect != null && empiresToSelect.Count > 0)
        {
            this.SetEmpiresToShow(empiresToSelect);
        }
        else
        {
            this.SetEmpiresToShow(this.empireToFilter);
        }
        AgeTooltip ageTooltip = this.EmpireFilterPrefab.GetComponent <AgeTransform>().AgeTooltip;

        if (ageTooltip != null)
        {
            ageTooltip.Content = "%MarketplaceEmpireFilterDescription";
        }
    }
コード例 #14
0
 public override void Bind(global::Empire empire)
 {
     base.Bind(empire);
     this.DepartmentOfScience = base.Empire.GetAgency <DepartmentOfScience>();
     this.keyMapperService    = Services.GetService <IKeyMappingService>();
     Diagnostics.Assert(this.keyMapperService != null);
     if (base.IsVisible)
     {
         this.UpdateButtonsAvailability();
     }
 }
コード例 #15
0
    private bool ArmyCanConvert(Army army, List <StaticString> failureFlags = null)
    {
        if (army.Empire == null || army.Empire.Faction == null)
        {
            if (failureFlags != null)
            {
                failureFlags.Add(ArmyAction.NoCanDoWhileHidden);
            }
            return(false);
        }
        DepartmentOfScience agency = army.Empire.GetAgency <DepartmentOfScience>();
        bool flag  = army.Empire.SimulationObject.Tags.Contains("FactionTraitCultists14");
        bool flag2 = agency.GetTechnologyState("TechnologyDefinitionCultists5") == DepartmentOfScience.ConstructibleElement.State.Researched;

        if (!flag && !flag2)
        {
            if (failureFlags != null)
            {
                failureFlags.Add(ArmyAction.NoCanDoWhileHidden);
            }
            return(false);
        }
        if (army.IsInEncounter)
        {
            if (failureFlags != null)
            {
                failureFlags.Add(ArmyAction.NoCanDoWhileLockedInBattle);
            }
            return(false);
        }
        if (!flag2 && flag)
        {
            if (!army.Units.Any((Unit unit) => !unit.SimulationObject.Tags.Contains("UnitFactionTypeMinorFaction") && !unit.SimulationObject.Tags.Contains(TradableUnit.ReadOnlyMercenary)))
            {
                if (failureFlags != null)
                {
                    failureFlags.Add(ArmyAction_Convert.NoCanDoWhileMinorUnitsOnly);
                }
                return(false);
            }
        }
        DepartmentOfTheInterior agency2 = army.Empire.GetAgency <DepartmentOfTheInterior>();

        if (agency2 != null && agency2.MainCity == null && agency2.Cities.Count < 1)
        {
            if (failureFlags != null)
            {
                failureFlags.Add(ArmyAction_Convert.NoCanDoWhileMainCityIsNotSettled);
            }
            return(false);
        }
        return(true);
    }
コード例 #16
0
 public static void ComputeCostAndTurn(Amplitude.Unity.Gui.IGuiService guiService, ReadOnlyCollection <Construction> constructibles, DepartmentOfTheTreasury departmentOfTheTreasury, SimulationObjectWrapper context, out string costString, out int turn)
 {
     PanelFeatureCost.costByResource.Clear();
     for (int i = 0; i < constructibles.Count; i++)
     {
         ConstructibleElement constructibleElement = constructibles[i].ConstructibleElement;
         if (constructibleElement.Costs != null)
         {
             if (constructibleElement is TechnologyDefinition && context.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1) && (constructibleElement as TechnologyDefinition).TechnologyFlags != DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock && (constructibleElement as TechnologyDefinition).TechnologyFlags != DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock)
             {
                 costString = string.Empty;
                 turn       = -1;
                 global::Empire empire = context as global::Empire;
                 if (empire == null)
                 {
                     Diagnostics.LogError("Empire is null.");
                     return;
                 }
                 DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>();
                 if (agency == null)
                 {
                     Diagnostics.LogError("Department of science is null");
                     return;
                 }
                 float buyOutTechnologyCost = agency.GetBuyOutTechnologyCost(constructibleElement);
                 if (buyOutTechnologyCost != 3.40282347E+38f)
                 {
                     costString = GuiFormater.FormatInstantCost(empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0);
                     return;
                 }
                 costString = "-";
                 return;
             }
             else
             {
                 for (int j = 0; j < constructibleElement.Costs.Length; j++)
                 {
                     if (constructibleElement.Costs[j] is PopulationConstructionCost)
                     {
                         PopulationConstructionCost populationConstructionCost = constructibleElement.Costs[j] as PopulationConstructionCost;
                         PanelFeatureCost.AppendCost(SimulationProperties.Population, populationConstructionCost.PopulationValue, true);
                     }
                     else
                     {
                         float productionCostWithBonus = DepartmentOfTheTreasury.GetProductionCostWithBonus(context, constructibleElement, constructibleElement.Costs[j], true);
                         PanelFeatureCost.AppendCost(constructibleElement.Costs[j].ResourceName, productionCostWithBonus, constructibleElement.Costs[j].Instant || constructibleElement.Costs[j].InstantOnCompletion);
                     }
                 }
             }
         }
     }
     PanelFeatureCost.GetCostAndTurn(guiService, departmentOfTheTreasury, context, out costString, out turn);
 }
コード例 #17
0
    private void RefreshVFXEffects(bool endlessDay, bool dustDeposits)
    {
        string text = base.PointOfInterest.Type;

        if (text != null && (text == "NavalQuestLocation" || text == "QuestLocation"))
        {
            bool   flag  = (base.PlayerControllerRepositoryService.ActivePlayerController.Empire.Bits & base.PointOfInterest.Interaction.Bits) != 0;
            int    num   = this.NumberOfSetBits(base.PointOfInterest.Interaction.Bits);
            string text2 = string.Empty;
            if (flag)
            {
                text2 = "Searched";
            }
            else if (num == 0)
            {
                text2 = "Blank";
            }
            else
            {
                text2 = "Other";
            }
            if (base.PointOfInterest.UntappedDustDeposits && dustDeposits)
            {
                text2 += "_DustDeposit";
            }
            else if (this.sensibleToEndlessDay && endlessDay)
            {
                text2 += "_EndlessDay";
            }
            this.interpreterContext.Register("Interaction", text2);
            this.DestroyPointOfInterestIcon();
            this.CreatePointOfInterestIcon();
            this.CreateOrRegeneratePointOfInterestFXTypeIFN();
            if (flag && this.interactionBitsBound)
            {
                DepartmentOfScience agency = base.PlayerControllerRepositoryService.ActivePlayerController.Empire.GetAgency <DepartmentOfScience>();
                Diagnostics.Assert(agency != null);
                if (StaticString.IsNullOrEmpty(agency.ArcheologyTechnologyDefinitionName))
                {
                    base.PointOfInterest.Interaction.PointOfInterestInteractionChange -= this.Interaction_PointOfInterestInteractionChange;
                    this.interactionBitsBound = false;
                }
                else if (agency.GetTechnologyState(agency.ArcheologyTechnologyDefinitionName) == DepartmentOfScience.ConstructibleElement.State.Researched)
                {
                    base.PointOfInterest.Interaction.PointOfInterestInteractionChange -= this.Interaction_PointOfInterestInteractionChange;
                    this.interactionBitsBound = false;
                }
            }
            base.UpdatePointOfInterestVisibility();
        }
    }
コード例 #18
0
    public StaticString GetUpToDateDesignName()
    {
        int          maxEraNumber = DepartmentOfScience.GetMaxEraNumber();
        StaticString tag          = "Era" + maxEraNumber;

        foreach (UnitDesign unitDesign in this.departmentOfDefense.UnitDesignDatabase.GetAvailableUnitDesignsAsEnumerable())
        {
            if (!unitDesign.CheckAgainstTag(DownloadableContent16.SeafaringUnit) && !unitDesign.CheckAgainstTag("ConvertedVillageUnit") && !unitDesign.CheckAgainstTag("WildLiceArmy") && unitDesign.CheckAgainstTag(tag) && !unitDesign.Name.Contains("Mercenary"))
            {
                return(unitDesign.Name);
            }
        }
        return(StaticString.Empty);
    }
コード例 #19
0
 public int CompareTo(GuiDiplomaticTerm other)
 {
     if (this.Type != other.Type)
     {
         return(this.Type.CompareTo(other.Type));
     }
     if ((this.Type == GuiDiplomaticTerm.TermType.Strategic || this.Type == GuiDiplomaticTerm.TermType.Luxury) && this.ResourceGuiElement != null)
     {
         return(this.ResourceGuiElement.Title.CompareTo(other.ResourceGuiElement.Title));
     }
     if (this.Type == GuiDiplomaticTerm.TermType.City)
     {
         DiplomaticTermCityExchange diplomaticTermCityExchange  = this.Term as DiplomaticTermCityExchange;
         DiplomaticTermCityExchange diplomaticTermCityExchange2 = other.Term as DiplomaticTermCityExchange;
         if (diplomaticTermCityExchange != null && diplomaticTermCityExchange2 != null)
         {
             return(diplomaticTermCityExchange.CityGUID.CompareTo(diplomaticTermCityExchange2.CityGUID));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Fortress)
     {
         DiplomaticTermFortressExchange diplomaticTermFortressExchange  = this.Term as DiplomaticTermFortressExchange;
         DiplomaticTermFortressExchange diplomaticTermFortressExchange2 = other.Term as DiplomaticTermFortressExchange;
         if (diplomaticTermFortressExchange != null && diplomaticTermFortressExchange2 != null)
         {
             return(diplomaticTermFortressExchange.FortressGUID.CompareTo(diplomaticTermFortressExchange2.FortressGUID));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Technology)
     {
         DiplomaticTermTechnologyExchange diplomaticTermTechnologyExchange  = this.Term as DiplomaticTermTechnologyExchange;
         DiplomaticTermTechnologyExchange diplomaticTermTechnologyExchange2 = other.Term as DiplomaticTermTechnologyExchange;
         int technologyEraNumber  = DepartmentOfScience.GetTechnologyEraNumber(diplomaticTermTechnologyExchange.TechnologyDefinition);
         int technologyEraNumber2 = DepartmentOfScience.GetTechnologyEraNumber(diplomaticTermTechnologyExchange2.TechnologyDefinition);
         if (technologyEraNumber != technologyEraNumber2)
         {
             return(technologyEraNumber.CompareTo(technologyEraNumber2));
         }
     }
     if (this.Type == GuiDiplomaticTerm.TermType.Prisoner)
     {
         DiplomaticTermPrisonerExchange diplomaticTermPrisonerExchange  = this.Term as DiplomaticTermPrisonerExchange;
         DiplomaticTermPrisonerExchange diplomaticTermPrisonerExchange2 = other.Term as DiplomaticTermPrisonerExchange;
         if (diplomaticTermPrisonerExchange != null && diplomaticTermPrisonerExchange2 != null)
         {
             return(diplomaticTermPrisonerExchange.HeroGuid.CompareTo(diplomaticTermPrisonerExchange2.HeroGuid));
         }
     }
     return(this.Term.Definition.Name.CompareTo(other.Term.Definition.Name));
 }
コード例 #20
0
ファイル: UnitListPanel.cs プロジェクト: LeaderEnemyBoss/ELCP
 public virtual void Unbind()
 {
     if (this.Garrison != null)
     {
         if (this.departmentOfDefense != null)
         {
             this.departmentOfDefense = null;
         }
         this.DepartmentOfTheTreasury = null;
         this.DepartmentOfScience     = null;
         this.guiUnits.Clear();
         this.Garrison = null;
         this.Militia  = null;
     }
     this.IsOtherEmpire = true;
 }
コード例 #21
0
ファイル: UnitListPanel.cs プロジェクト: LeaderEnemyBoss/ELCP
    private void RefreshForceShiftingButton()
    {
        if (this.ForceShiftButton == null || this.Garrison == null || this.Garrison.Empire == null)
        {
            return;
        }
        this.ForceShiftButton.Visible = false;
        this.ForceShiftButton.Enable  = false;
        if (this.IsOtherEmpire || !this.interactionsAllowed)
        {
            return;
        }
        DepartmentOfScience agency = this.Garrison.Empire.GetAgency <DepartmentOfScience>();

        if (agency == null || agency.GetTechnologyState("TechnologyDefinitionOrbUnlock17WinterShifters") != DepartmentOfScience.ConstructibleElement.State.Researched)
        {
            return;
        }
        if (this.selectedUnits.Count > 0)
        {
            List <Unit> list = new List <Unit>(this.selectedUnits);
            list.RemoveAll((Unit match) => !match.IsShifter() || !match.IsInCurrentSeasonForm());
            if (list.Count > 0)
            {
                ConstructionCost[] unitForceShiftingCost = this.DepartmentOfTheTreasury.GetUnitForceShiftingCost(list);
                AgeUtils.CleanLine(GuiFormater.FormatCost(this.garrison.Empire, unitForceShiftingCost, false, 1, null), ref this.monochromaticFormat);
                this.ForceShiftButtonPriceLabel.Text = GuiFormater.FormatCost(this.garrison.Empire, unitForceShiftingCost, false, 0, null);
                this.ForceShiftButton.Visible        = true;
                if (this.DepartmentOfTheTreasury.CanAfford(unitForceShiftingCost))
                {
                    if (!this.garrison.IsInEncounter)
                    {
                        this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ForceShiftTabOKFormat").Replace("$Value", this.monochromaticFormat.ToString());
                        this.ForceShiftButton.Enable             = true;
                    }
                    else
                    {
                        this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyLockedInBattleDescription");
                    }
                }
                else
                {
                    this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ForceShiftTabCannotAffordDescription") + " : " + this.monochromaticFormat;
                }
            }
        }
    }
コード例 #22
0
    private SynchronousJobState SynchronousJob_StartBooster()
    {
        SynchronousJobState result;

        if (this.boosterDefinitionWrappers == null || base.AIEntity == null || base.AIEntity.AIPlayer == null)
        {
            result = SynchronousJobState.Failure;
        }
        else
        {
            DepartmentOfScience agency = base.AIEntity.Empire.GetAgency <DepartmentOfScience>();
            bool flag = agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel1") == DepartmentOfScience.ConstructibleElement.State.Researched || agency.GetTechnologyState("TechnologyDefinitionAllBoosterLevel2") == DepartmentOfScience.ConstructibleElement.State.Researched;
            for (int i = this.boosterDefinitionWrappers.Count - 1; i >= 0; i--)
            {
                CityBoosterNeeds cityBoosterNeeds = null;
                if (this.boosterDefinitionWrappers[i] != null && base.AIEntity.AIPlayer.Blackboard.TryGetMessage <CityBoosterNeeds>(this.boosterDefinitionWrappers[i].CurrentMessageId, out cityBoosterNeeds) && cityBoosterNeeds.AvailabilityState == CityBoosterNeeds.CityBoosterState.Available)
                {
                    StaticString x = this.boosterDefinitionWrappers[i].BoosterDefinitionName;
                    if (x == "BoosterIndustry" || x == "FlamesIndustryBooster")
                    {
                        if (this.aiEntityCity.City.SimulationObject.Children.Exists((SimulationObject C) => C.Tags.Contains("BoosterDecreaseCityProduction4")))
                        {
                            goto IL_275;
                        }
                    }
                    if (agency.GetResearchPropertyValue("UnlockedTechnologyCount") <= 16f || flag || x == "BoosterFood" || x == "BoosterCadavers")
                    {
                        if (cityBoosterNeeds.BoosterGuid.IsValid && this.departmentOfEducation[cityBoosterNeeds.BoosterGuid] != null && this.departmentOfEducation[cityBoosterNeeds.BoosterGuid].Constructible != null)
                        {
                            x = this.departmentOfEducation[cityBoosterNeeds.BoosterGuid].Constructible.Name;
                        }
                        OrderBuyoutAndActivateBooster orderBuyoutAndActivateBooster = new OrderBuyoutAndActivateBooster(base.AIEntity.Empire.Index, x, cityBoosterNeeds.BoosterGuid, false);
                        orderBuyoutAndActivateBooster.TargetGUID = this.aiEntityCity.City.GUID;
                        base.AIEntity.Empire.PlayerControllers.AI.PostOrder(orderBuyoutAndActivateBooster);
                        this.boosterDefinitionWrappers[i].CurrentMessageId = 0UL;
                        cityBoosterNeeds.BoosterGuid       = 0UL;
                        cityBoosterNeeds.AvailabilityState = CityBoosterNeeds.CityBoosterState.Success;
                        base.AIEntity.AIPlayer.Blackboard.CancelMessage(cityBoosterNeeds);
                    }
                }
                IL_275 :;
            }
            result = SynchronousJobState.Success;
        }
        return(result);
    }
コード例 #23
0
ファイル: KaijuCouncil.cs プロジェクト: LeaderEnemyBoss/ELCP
    public static void UpdateTameCosts()
    {
        IDatabase <ArmyAction> database = Databases.GetDatabase <ArmyAction>(false);

        Diagnostics.Assert(database != null);
        int maxEraNumber = DepartmentOfScience.GetMaxEraNumber();

        for (int i = 0; i < database.Count <ArmyAction>(); i++)
        {
            ArmyAction armyAction = database.ElementAt(i);
            if (armyAction is IArmyActionWithKaijuTameCost)
            {
                KaijuTameCost tameCost = (armyAction as IArmyActionWithKaijuTameCost).TameCost;
                tameCost.UpdateActiveCost(maxEraNumber);
            }
        }
    }
コード例 #24
0
    private void OnOrderResponse(object sender, TicketRaisedEventArgs args)
    {
        this.AgeTransform.Enable = true;
        DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>();

        DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition);
        if (this.TechnologyDefinition.HasTechnologyFlag(DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock))
        {
            IGameService service = Services.GetService <IGameService>();
            if (service == null || service.Game == null)
            {
                Diagnostics.LogError("GameService or GameService.Game is null");
                return;
            }
            IKaijuTechsService service2 = service.Game.Services.GetService <IKaijuTechsService>();
            technologyState = service2.GetTechnologyState(this.TechnologyDefinition, this.empire);
        }
        this.Refresh(this.empire, technologyState);
    }
コード例 #25
0
ファイル: Kaiju.cs プロジェクト: LeaderEnemyBoss/ELCP
    private void Client_TurnBegin_SpawnLiceUnit()
    {
        int turn         = (this.GameService.Game as global::Game).Turn;
        int maxEraNumber = DepartmentOfScience.GetMaxEraNumber();

        if (this.CanSpawnMilitiaUnit() && this.NextTurnToSpawnUnit > 0 && this.NextTurnToSpawnUnit == turn)
        {
            GameEntityGUID guid = this.KaijuGarrison.GUID;
            StaticString   name = this.KaijuEmpire.FindLiceDesign(true).Name;
            if (this.OnArmyMode() && this.KaijuArmy != null)
            {
                guid = this.KaijuArmy.GUID;
            }
            global::PlayerController server = this.Empire.PlayerControllers.Server;
            if (server != null)
            {
                OrderSpawnUnit order = new OrderSpawnUnit(this.Empire.Index, maxEraNumber, false, name, guid, false);
                server.PostOrder(order);
            }
            this.ComputeNextTurnToSpawnUnits(true);
        }
    }
コード例 #26
0
 public override void Reset()
 {
     base.Reset();
     if (!base.Enable)
     {
         return;
     }
     if (!DepartmentOfScience.CanBuyoutResearch(this.empire))
     {
         base.Enable = false;
         return;
     }
     if (this.departmentOfScience == null)
     {
         Diagnostics.LogError("The agent {0} can't get the department of science.", new object[]
         {
             base.Name
         });
         base.Enable = false;
         return;
     }
 }
コード例 #27
0
 private void TryForceShipyardResearch()
 {
     DepartmentOfScience.ConstructibleElement constructibleElement;
     if (base.AIEntity.Empire.GetAgency <DepartmentOfScience>().TechnologyDatabase.TryGetValue("TechnologyDefinitionShip", out constructibleElement) && base.AIEntity.Empire.GetAgency <DepartmentOfScience>().GetTechnologyState(constructibleElement) == DepartmentOfScience.ConstructibleElement.State.Available)
     {
         bool flag = false;
         using (IEnumerator <City> enumerator = this.departmentOfTheInterior.Cities.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 for (int i = 0; i < enumerator.Current.Region.Borders.Length; i++)
                 {
                     if (this.worldPositionningService.GetRegion(enumerator.Current.Region.Borders[i].NeighbourRegionIndex).IsOcean)
                     {
                         flag = true;
                         break;
                     }
                 }
             }
         }
         if (flag)
         {
             if (!DepartmentOfScience.CanBuyoutResearch(base.AIEntity.Empire))
             {
                 OrderQueueResearch order = new OrderQueueResearch(base.AIEntity.Empire.Index, constructibleElement, true);
                 base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order);
                 return;
             }
             float num = -base.AIEntity.Empire.GetAgency <DepartmentOfScience>().GetBuyOutTechnologyCost(constructibleElement) * 1.05f;
             if (base.AIEntity.Empire.GetAgency <DepartmentOfTheTreasury>().IsTransferOfResourcePossible(base.AIEntity.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num))
             {
                 OrderBuyOutTechnology order2 = new OrderBuyOutTechnology(base.AIEntity.Empire.Index, "TechnologyDefinitionShip");
                 Ticket ticket;
                 base.AIEntity.Empire.PlayerControllers.AI.PostOrder(order2, out ticket, null);
             }
         }
     }
 }
コード例 #28
0
    private void OnSelectTechnologyCB(GameObject obj)
    {
        if (this.empire == null)
        {
            Diagnostics.LogError("Empire is null");
            return;
        }
        DepartmentOfScience agency = this.empire.GetAgency <DepartmentOfScience>();

        DepartmentOfScience.ConstructibleElement.State technologyState = agency.GetTechnologyState(this.TechnologyDefinition);
        ConstructionQueue constructionQueueForTech = agency.GetConstructionQueueForTech(this.TechnologyDefinition);

        if (technologyState == DepartmentOfScience.ConstructibleElement.State.Available)
        {
            this.AgeTransform.Enable = false;
            if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools && Input.GetKey(KeyCode.G))
            {
                this.ForceUnlockTechnology();
            }
            else
            {
                this.QueueResearch();
            }
            this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver);
            return;
        }
        if (technologyState == DepartmentOfScience.ConstructibleElement.State.InProgress || technologyState == DepartmentOfScience.ConstructibleElement.State.Queued)
        {
            this.AgeTransform.Enable = false;
            Construction construction = constructionQueueForTech.Get(this.TechnologyDefinition);
            this.CancelResearch(construction);
            if (Amplitude.Unity.Framework.Application.Preferences.EnableModdingTools && Input.GetKey(KeyCode.G))
            {
                this.ForceUnlockTechnology();
            }
            this.selectionClient.SendMessage("OnSelectTechnology", this.AgeTransform, SendMessageOptions.RequireReceiver);
        }
    }
コード例 #29
0
    public override void Reset()
    {
        base.Reset();
        if (!base.Enable)
        {
            return;
        }
        if (DepartmentOfScience.CanBuyoutResearch(this.empire))
        {
            base.Enable = false;
            return;
        }
        if (this.departmentOfScience == null)
        {
            Diagnostics.LogError("The agent {0} can't get the department of science.", new object[]
            {
                base.Name
            });
            base.Enable = false;
            return;
        }
        Agent[] validatedAgents = new AgentGroupPath("ResourceEvaluationAmas/CityAgentGroup").GetValidatedAgents(base.ParentGroup, "NetCityResearch");
        SimulationNormalizedAgent[] array;
        if (validatedAgents != null)
        {
            array = Array.ConvertAll <Agent, SimulationNormalizedAgent>(validatedAgents, (Agent agent) => agent as SimulationNormalizedAgent);
        }
        else
        {
            array = new SimulationNormalizedAgent[0];
        }
        this.netCityResearchAgents = array;
        Diagnostics.Assert(this.netCityResearchAgents != null);
        AIEntity_Empire entity = (base.ContextObject as AIPlayer_MajorEmpire).GetEntity <AIEntity_Empire>();

        this.aILayer_Victory = entity.GetLayer <AILayer_Victory>();
    }
コード例 #30
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;
        }
    }