Example #1
0
    public void SetupPortrait(Kaiju kaiju, Empire playerEmpire)
    {
        this.Kaiju = kaiju;
        if (this.Portrait != null)
        {
            IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper;
            Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper");
            Texture2D image;
            if (guiPanelHelper.TryGetTextureFromIcon(this.KaijuGuiElement, global::GuiPanel.IconSize.Large, out image))
            {
                this.Portrait.Image = image;
            }
        }
        Amplitude.Unity.Gui.IGuiService service = Services.GetService <global::IGuiService>();
        Diagnostics.Assert(service != null);
        KaijuTameCost kaijuTameCost = KaijuCouncil.GetKaijuTameCost();

        this.CostGroup.Visible = this.Kaiju.IsWild();
        KaijuCouncil agency = this.Kaiju.KaijuEmpire.GetAgency <KaijuCouncil>();

        this.CostValue.Text = GuiFormater.FormatGui(kaijuTameCost.GetValue(playerEmpire), false, true, false, 0) + service.FormatSymbol(ELCPUtilities.UseELCPSymbiosisBuffs ? agency.ELCPResourceName : kaijuTameCost.ResourceName);
        if (this.Background != null)
        {
            this.Background.TintColor = this.Kaiju.Empire.Color;
        }
        this.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString(KaijuTechPortrait.PortraitClickTooltip);
    }
Example #2
0
    private void RefreshPopulationCount()
    {
        float propertyValue  = this.City.GetPropertyValue(SimulationProperties.Population);
        float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.PopulationBonus);

        this.PopulationCount.Text = GuiFormater.FormatGui(propertyValue, false, true, false, 1) + " + " + GuiFormater.FormatGui(propertyValue2, false, true, false, 1);
    }
Example #3
0
    private void RefreshPopulationGrowth()
    {
        float propertyValue            = this.City.GetPropertyValue(SimulationProperties.Population);
        float propertyValue2           = this.City.GetPropertyValue(SimulationProperties.CityGrowthStock);
        float propertyValue3           = this.City.GetPropertyValue(SimulationProperties.NetCityGrowth);
        DepartmentOfTheInterior agency = this.City.Empire.GetAgency <DepartmentOfTheInterior>();
        float num;
        float num2;

        agency.GetGrowthLimits(propertyValue, out num, out num2);
        this.GaugePopulation.PercentRight = Mathf.Clamp((propertyValue2 - num) / (num2 - num) * 100f, 0f, 100f);
        float num3 = Mathf.Round(100f * propertyValue3 / (num2 - num));

        if (num3 > 0f)
        {
            this.GaugeProgress.Visible = true;
            this.GaugeProgress.GetComponent <AgePrimitiveImage>().TintColor = this.GrowingPopulationColor;
            this.GaugeProgress.PercentLeft  = this.GaugePopulation.PercentRight;
            this.GaugeProgress.PercentRight = Mathf.Min(100f, this.GaugeProgress.PercentLeft + num3);
            this.NextPopulationTurns.Text   = GuiFormater.FormatGui((float)Mathf.Max(1, Mathf.CeilToInt((num2 - propertyValue2) / propertyValue3)), false, true, false, 1);
        }
        else if (num3 < 0f)
        {
            this.GaugeProgress.Visible = true;
            this.GaugeProgress.GetComponent <AgePrimitiveImage>().TintColor = this.LosingPopulationColor;
            this.GaugeProgress.PercentRight = this.GaugePopulation.PercentRight;
            this.GaugeProgress.PercentLeft  = Mathf.Max(0f, this.GaugeProgress.PercentRight + num3);
            this.NextPopulationTurns.Text   = GuiFormater.FormatGui((float)Mathf.Max(1, Mathf.CeilToInt((propertyValue2 - num) / -propertyValue3)), false, true, false, 1);
        }
        else
        {
            this.GaugeProgress.Visible    = false;
            this.NextPopulationTurns.Text = "-";
        }
    }
Example #4
0
    public static string FormatInstantCost(Empire empire, float cost, StaticString resourceName, bool monochromatic = false, int decimals = 1)
    {
        DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>();
        float num;

        if (!agency.TryGetResourceStockValue(empire.SimulationObject, resourceName, out num, false))
        {
            Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[]
            {
                resourceName,
                empire.SimulationObject.Name
            });
        }
        StringBuilder stringBuilder = new StringBuilder();
        bool          flag          = false;

        if (!monochromatic && num < cost)
        {
            AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false);
            flag = true;
        }
        stringBuilder.Append(GuiFormater.FormatGui(cost, false, decimals == 0, false, decimals));
        if (!monochromatic && flag)
        {
            stringBuilder.Append("#REVERT#");
        }
        stringBuilder.Append(" ");
        stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(resourceName));
        return(stringBuilder.ToString());
    }
Example #5
0
 private void AnimateFIDSChange(AgePrimitiveLabel control, AgePrimitiveLabel modifier, float delta)
 {
     modifier.Text      = GuiFormater.FormatGui(delta, false, true, true, 1);
     modifier.TintColor = ((delta < 0f) ? Color.red : Color.green);
     control.AgeTransform.StartAllModifiers(true, false);
     modifier.AgeTransform.StartAllModifiers(true, false);
 }
Example #6
0
 private void RefreshParticipantScoreLine(AgeTransform tableitem, EmpireInfo empireInfo, int index)
 {
     tableitem.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
     if (this.visibleEmpires.Contains(empireInfo.EmpireIndex))
     {
         tableitem.Visible = true;
         ParticipantScoreLine component = tableitem.GetComponent <ParticipantScoreLine>();
         component.ParticipantName.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
         component.ParticipantScore.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale);
         component.ParticipantLogoBackground.TintColor = empireInfo.FactionColor;
         component.ParticipantName.Text = empireInfo.LocalizedName;
         GuiFaction guiFaction = new GuiFaction(empireInfo.Faction);
         component.ParticipantLogo.Image = guiFaction.GetImageTexture(GuiPanel.IconSize.LogoLarge, true);
         Snapshot[] snapshots = this.Snapshot.Snapshots;
         string     name      = string.Format("Turn #{0}", snapshots.Length - 1);
         Snapshot   snapshot;
         Snapshot   snapshot2;
         if (this.Snapshot.TryGetSnapshot(name, out snapshot) && snapshot.TryGetSnapshot(empireInfo.EmpireName, out snapshot2))
         {
             float num;
             snapshot2.TryRead(this.CurrentScoreDefinition.Name, out num);
             string str      = "";
             int    decimals = 0;
             component.ParticipantScore.WordWrap = false;
             if (num >= 1000f)
             {
                 str = "k";
                 if (num <= 10000f)
                 {
                     num      = Mathf.Round(num / 100f);
                     num     /= 10f;
                     decimals = 1;
                 }
                 else if (num <= 999999f)
                 {
                     num = Mathf.Round(num / 1000f);
                 }
                 else if (num <= 9999999f)
                 {
                     num      = Mathf.Round(num / 100000f);
                     num     /= 10f;
                     str      = "M";
                     decimals = 1;
                 }
                 else if (num > 9999999f)
                 {
                     num = Mathf.Round(num / 1000000f);
                     str = "M";
                 }
             }
             component.ParticipantScore.Text = GuiFormater.FormatGui(num, false, false, false, decimals) + str;
             return;
         }
     }
     else
     {
         tableitem.Visible = false;
     }
 }
Example #7
0
 public static string FormatStock(float stockValue, StaticString resourceName, int decimals = 1, bool useKilo = false)
 {
     if (useKilo)
     {
         return(string.Format("{0} {1}", (stockValue < 1000f) ? GuiFormater.FormatGui(Mathf.Floor(stockValue), false, false, false, 0) : ((stockValue < 10000f) ? (GuiFormater.FormatGui(Mathf.Floor(stockValue / 1000f), false, false, false, 0) + "." + GuiFormater.FormatGui(Mathf.Floor(stockValue % 1000f / 100f), false, false, false, 0) + "k") : (GuiFormater.FormatGui(Mathf.Floor(stockValue / 1000f), false, false, false, 0) + "k")), Services.GetService <IGuiService>().FormatSymbol(resourceName)));
     }
     return(string.Format("{0} {1}", GuiFormater.FormatGui(Mathf.Floor(stockValue), false, false, true, 0), Services.GetService <IGuiService>().FormatSymbol(resourceName)));
 }
Example #8
0
 private void ChangeQuantityIfValid()
 {
     this.ClampEnteredQuantity();
     if (this.CheckQuantityValidity())
     {
         float f;
         float.TryParse(this.QuantityTextField.AgePrimitiveLabel.Text, out f);
         this.CurrentQuantity = Mathf.FloorToInt(f);
     }
     else
     {
         this.QuantityTextField.ReplaceInputText(GuiFormater.FormatGui(this.CurrentQuantity));
     }
 }
Example #9
0
 public void RefreshContent()
 {
     if (this.empire == null)
     {
         Diagnostics.LogWarning("Trying to refresh a BoosterStock while the current empire is null");
         return;
     }
     this.IconImage.Image                    = this.guiStackedBooster.IconTexture;
     this.IconImage.TintColor                = this.guiStackedBooster.IconColor;
     this.QuantityLabel.Text                 = GuiFormater.FormatGui(Mathf.Floor((float)this.guiStackedBooster.Quantity), false, false, false, 1);
     this.AgeTransform.AgeTooltip.Class      = this.guiStackedBooster.BoosterDefinition.TooltipClass;
     this.AgeTransform.AgeTooltip.Content    = this.guiStackedBooster.BoosterDefinition.Name;
     this.AgeTransform.AgeTooltip.ClientData = this.guiStackedBooster;
     this.RefreshBoosterAvailability();
 }
Example #10
0
    protected virtual void DisplayPriceLevel()
    {
        this.PriceLevelLabel.Text = GuiFormater.FormatGui(this.PriceLevel, false, false, true, 1);
        string     priceLevelName = this.GetPriceLevelName();
        GuiElement guiElement;

        if (!this.guiPanelHelper.TryGetGuiElement(priceLevelName, out guiElement))
        {
            Diagnostics.LogError("Cannot find a GuiElement for the price level {0}", new object[]
            {
                priceLevelName
            });
            return;
        }
        Texture2D image;

        if (!this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image))
        {
            Diagnostics.LogError("Cannot find a texture for the large icon of GuiElement {0}", new object[]
            {
                guiElement.Name
            });
            return;
        }
        this.PriceLevelImage.Image = image;
        AgeTooltip ageTooltip = this.PriceLevelGroup.GetComponent <AgeTransform>().AgeTooltip;

        if (ageTooltip != null)
        {
            float referencePriceWithSalesTaxes = this.Tradable.GetReferencePriceWithSalesTaxes(TradableTransactionType.Buyout, this.empire);
            ageTooltip.Content = string.Concat(new string[]
            {
                AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMaximumPrice"),
                ": ",
                GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MaximumPriceMultiplier, false, false, false, 1),
                "\n",
                AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableStandardPrice"),
                ": ",
                GuiFormater.FormatGui(referencePriceWithSalesTaxes, false, false, false, 1),
                "\n",
                AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMinimumPrice"),
                ": ",
                GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MinimumPriceMultiplier, false, false, false, 1)
            });
        }
    }
Example #11
0
    public static string FormatCost(Empire empire, IConstructionCost[] costs, bool monochromatic = false, int decimals = 1, SimulationObject context = null)
    {
        DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>();

        if (context == null)
        {
            context = empire.SimulationObject;
        }
        StringBuilder stringBuilder = new StringBuilder();

        if (costs != null)
        {
            bool flag = false;
            for (int i = 0; i < costs.Length; i++)
            {
                float value = costs[i].GetValue(empire);
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(" ");
                }
                float num;
                if (!agency.TryGetResourceStockValue(context, costs[i].ResourceName, out num, false))
                {
                    Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[]
                    {
                        costs[i].ResourceName,
                        empire.SimulationObject.Name
                    });
                }
                if (!monochromatic && (costs[i].Instant || costs[i].InstantOnCompletion) && num < value)
                {
                    AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false);
                    flag = true;
                }
                stringBuilder.Append(GuiFormater.FormatGui(value, false, decimals == 0, false, decimals));
                if (!monochromatic && flag)
                {
                    stringBuilder.Append("#REVERT#");
                    flag = false;
                }
                stringBuilder.Append(" ");
                stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(costs[i].ResourceName));
            }
        }
        return(stringBuilder.ToString());
    }
Example #12
0
    private void ClampEnteredQuantity()
    {
        float num;

        if (!float.TryParse(this.QuantityTextField.AgePrimitiveLabel.Text, out num))
        {
            this.QuantityTextField.ReplaceInputText(GuiFormater.FormatGui(this.CurrentQuantity));
            return;
        }
        if (num <= 1f)
        {
            Diagnostics.Assert(this.SelectedTradableLine.Tradable.Quantity >= 1f);
            this.QuantityTextField.ReplaceInputText("1");
        }
        else if (num > this.SelectedTradableLine.Tradable.Quantity)
        {
            this.QuantityTextField.ReplaceInputText(Mathf.FloorToInt(this.SelectedTradableLine.Tradable.Quantity).ToString());
        }
    }
Example #13
0
    public static string FormatStockCost(Empire empire, ConstructionResourceStock[] stockCosts, bool monochromatic = false, int decimals = 1)
    {
        DepartmentOfTheTreasury agency        = empire.GetAgency <DepartmentOfTheTreasury>();
        StringBuilder           stringBuilder = new StringBuilder();

        if (stockCosts != null)
        {
            bool flag = false;
            for (int i = 0; i < stockCosts.Length; i++)
            {
                float stock = stockCosts[i].Stock;
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(" ");
                }
                float num;
                if (!agency.TryGetResourceStockValue(empire.SimulationObject, stockCosts[i].PropertyName, out num, false))
                {
                    Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[]
                    {
                        stockCosts[i].PropertyName,
                        empire.SimulationObject.Name
                    });
                }
                if (!monochromatic)
                {
                    AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false);
                    flag = true;
                }
                stringBuilder.Append(GuiFormater.FormatGui(stock, false, decimals == 0, false, decimals));
                if (!monochromatic && flag)
                {
                    stringBuilder.Append("#REVERT#");
                    flag = false;
                }
                stringBuilder.Append(" ");
                stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(stockCosts[i].PropertyName));
            }
        }
        return(stringBuilder.ToString());
    }
 public override void RefreshContent()
 {
     base.RefreshContent();
     this.AffinityDropList.SelectedItem = this.affinityGuiTraits.IndexOf(this.SelectedAffinity);
     this.OverrideSelectedAffinityTooltip();
     this.SelectedAffinityMapping = this.SelectedAffinity.DefaultGuiAffinityMapping;
     Diagnostics.Assert(this.SelectedAffinityMapping != null);
     this.PortraitImage.Image = this.SelectedAffinityMapping.GetImageTexture(GuiPanel.IconSize.Leader);
     this.BuildListOfAvailableTraits();
     this.AvailableTraitsTable.Height = 0f;
     this.AvailableTraitsTable.ReserveChildren(this.availableGuiTraits.Count, this.CustomTraitPrefab, "AvailableTrait");
     this.AvailableTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.availableGuiTraits, this.setupAvailableGuiTraitDelegate, true, false);
     this.AvailableTraitsTable.ArrangeChildren();
     this.AvailableTraitsScrollView.OnPositionRecomputed();
     this.PreselectedTraitsTable.Height = 0f;
     this.PreselectedTraitsTable.ReserveChildren(this.preselectedGuiTraits.Count, this.CustomTraitPrefab, "PreselectedTrait");
     this.PreselectedTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.preselectedGuiTraits, this.setupSelectedGuiTraitDelegate, true, false);
     this.PreselectedTraitsTable.ArrangeChildren();
     this.SelectedTraitsTable.Height = 0f;
     this.SelectedTraitsTable.ReserveChildren(this.selectedGuiTraits.Count, this.CustomTraitPrefab, "SelectedTrait");
     this.SelectedTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.selectedGuiTraits, this.setupSelectedGuiTraitDelegate, true, false);
     this.SelectedTraitsTable.ArrangeChildren();
     this.SelectedTraitsTable.Y = this.PreselectedTraitsTable.Y + this.PreselectedTraitsTable.Height + this.SelectedTraitsScrollView.VirtualArea.VerticalSpacing;
     this.SelectedTraitsScrollView.VirtualArea.Height = this.SelectedTraitsTable.Y + this.SelectedTraitsTable.Height;
     this.SelectedTraitsScrollView.OnPositionRecomputed();
     this.totalPoints             = this.ComputePointsSpent();
     this.PointsCounterLabel.Text = GuiFormater.FormatGui(this.totalPoints) + "/" + GuiFormater.FormatGui(this.SelectedAffinity.MaxPoints);
     if (this.totalPoints <= this.SelectedAffinity.MaxPoints)
     {
         this.PointsCounterBackground.TintColor = this.PointsCounterBackgroundColors[0];
     }
     else
     {
         this.PointsCounterBackground.TintColor = this.PointsCounterBackgroundColors[1];
     }
     this.RefreshButtons();
     this.AvailableTraitsSortsContainer.RefreshSortContent();
     this.SelectedTraitsSortsContainer.RefreshSortContent();
 }
Example #15
0
    public void SetContent(MajorEmpire empire, VictoryCondition victoryCondition, PlayerController playerController, int victoryRank)
    {
        this.Comparable = 0f;
        bool flag = true;

        if (empire != playerController.Empire && !playerController.Empire.SimulationObject.Tags.Contains(Empire.TagEmpireEliminated))
        {
            flag = false;
            Diagnostics.Assert(playerController.Empire != null);
            EmpireInfo.Accessibility lastAccessibilityLevel = EmpireInfo.LastAccessibilityLevel;
            if (lastAccessibilityLevel != EmpireInfo.Accessibility.Default)
            {
                if (lastAccessibilityLevel == EmpireInfo.Accessibility.Partial)
                {
                    DepartmentOfIntelligence agency = playerController.Empire.GetAgency <DepartmentOfIntelligence>();
                    if (agency != null && agency.IsEmpireInfiltrated(empire))
                    {
                        flag = true;
                    }
                }
            }
            else
            {
                DepartmentOfForeignAffairs agency2 = playerController.Empire.GetAgency <DepartmentOfForeignAffairs>();
                if (agency2 != null)
                {
                    DiplomaticRelation diplomaticRelation = agency2.GetDiplomaticRelation(empire);
                    flag |= (diplomaticRelation != null && diplomaticRelation.State != null && diplomaticRelation.State.Name != DiplomaticRelationState.Names.Unknown);
                }
                if (!flag)
                {
                    DepartmentOfIntelligence agency3 = playerController.Empire.GetAgency <DepartmentOfIntelligence>();
                    if (agency3 != null && agency3.IsEmpireInfiltrated(empire))
                    {
                        flag = true;
                    }
                }
            }
        }
        if (!empire.VictoryConditionStatuses.ContainsKey(victoryCondition.Name) || !flag)
        {
            base.GetComponent <AgeTransform>().Visible = false;
            return;
        }
        base.GetComponent <AgeTransform>().Visible = true;
        this.format = AgeLocalizer.Instance.LocalizeString(victoryCondition.Progression.Format);
        for (int i = 0; i < victoryCondition.Progression.Vars.Length; i++)
        {
            if (this.format.Contains(victoryCondition.Progression.Vars[i].Name))
            {
                this.varName = "$" + victoryCondition.Progression.Vars[i].Name;
                this.format  = this.format.Replace(this.varName, GuiFormater.FormatGui(empire.VictoryConditionStatuses[victoryCondition.Name].Variables[i], victoryCondition.Progression.Vars[i].Name == "Ratio", false, false, 0));
            }
            if (victoryCondition.Progression.Vars[i].Name == victoryCondition.Progression.SortVariable)
            {
                this.Comparable = empire.VictoryConditionStatuses[victoryCondition.Name].Variables[i];
            }
        }
        this.Title.Text = empire.LocalizedName;
        this.Value.Text = this.format;
        this.Value.AgeTransform.Width            = this.Value.Font.ComputeTextWidth(this.Value.Text, false, false);
        this.Title.AgeTransform.PixelMarginRight = this.Value.AgeTransform.PixelMarginRight + this.Value.AgeTransform.PixelMarginLeft + this.Value.AgeTransform.Width;
        this.Title.TintColor = empire.Color;
        this.Value.TintColor = empire.Color;
        if (empire == playerController.Empire)
        {
            this.TitleModifier.StartDelay = 0.3f * (float)victoryRank;
            this.TitleModifier.StartAnimation();
            return;
        }
        this.TitleModifier.Reset();
        this.Title.AgeTransform.Alpha = 1f;
    }
Example #16
0
    public void RefreshContent()
    {
        this.AgeTransform.Enable = true;
        this.AgeTransform.StopSearchingForTooltips = false;
        this.AgeTransform.AgeTooltip.Content       = string.Empty;
        this.ArmySize.TintColor = Color.white;
        this.HeroCard.HeroPortrait.TintColor = Color.white;
        if (this.ArmyNameLabel != null)
        {
            AgeUtils.TruncateString(this.Army.LocalizedName, this.ArmyNameLabel, out this.temp, '.');
            this.ArmyNameLabel.Text = this.temp;
            if (this.Army.IsInEncounter)
            {
                this.ArmyNameLabel.TintColor = this.ColorIfInBattle;
                this.ArmyNameLabel.AgeTransform.AgeTooltip.Content = "%ArmyLockedInBattleDescription";
            }
            else
            {
                this.ArmyNameLabel.TintColor = Color.white;
                this.ArmyNameLabel.AgeTransform.AgeTooltip.Content = string.Empty;
            }
        }
        if (this.HeroCard != null)
        {
            this.HeroCard.RefreshContent(this.isColossusArmy, this.isKaijuArmy);
        }
        if (this.ArmySize != null)
        {
            this.ArmySize.Text = this.Army.CurrentUnitSlot.ToString() + "/" + this.Army.MaximumUnitSlot.ToString();
            AgeTooltip ageTooltip = this.ArmySize.AgeTransform.AgeTooltip;
            if (ageTooltip != null)
            {
                if (this.Army.CurrentUnitSlot > this.Army.MaximumUnitSlot)
                {
                    ageTooltip.Content      = "%ArmyCapacityExceededDescription";
                    this.ArmySize.TintColor = Color.red;
                }
                else
                {
                    ageTooltip.Content = string.Empty;
                }
            }
        }
        if (this.ArmyHPLabel != null)
        {
            float propertyValue  = this.Army.GetPropertyValue(SimulationProperties.Health);
            float propertyValue2 = this.Army.GetPropertyValue(SimulationProperties.MaximumHealth);
            float num            = 0f;
            if (propertyValue2 > 0f)
            {
                num = 100f * (propertyValue / propertyValue2);
            }
            this.ArmyHPGauge.AgeTransform.PercentRight = num;
            if (num >= 75f)
            {
                this.ArmyHPGauge.TintColor = this.FullLifeColor;
            }
            else if (num >= 25f)
            {
                this.ArmyHPGauge.TintColor = this.HalfLifeColor;
            }
            else
            {
                this.ArmyHPGauge.TintColor = this.CriticalLifeColor;
            }
            this.ArmyHPLabel.Text = GuiFormater.FormatGui(Mathf.Floor(propertyValue), false, false, false, 1) + "/" + GuiFormater.FormatGui(Mathf.Floor(propertyValue2), false, false, false, 1);
        }
        if (this.ArmyMovement != null)
        {
            string str  = GuiFormater.FormatGui(this.Army.GetPropertyValue(SimulationProperties.Movement), false, false, false, 1);
            string str2 = GuiFormater.FormatGui(this.Army.GetPropertyValue(SimulationProperties.MaximumMovement), false, false, false, 1);
            this.ArmyMovement.Text = str + "/" + str2;
        }
        if (this.ArmyLocation != null)
        {
            IGameService service = Services.GetService <IGameService>();
            this.ArmyLocation.Text = service.Game.Services.GetService <IWorldPositionningService>().GetRegion(this.Army.WorldPosition).LocalizedName;
        }
        if (this.ArmyUpkeep != null)
        {
            float propertyValue3 = this.Army.GetPropertyValue(SimulationProperties.MilitaryUpkeep);
            this.ArmyUpkeep.Text = GuiFormater.FormatQuantity(-propertyValue3, SimulationProperties.MilitaryUpkeep, 0);
        }
        if (this.HeroCard != null)
        {
            this.HeroCard.AgeTransform.Enable = !this.ReadOnly;
        }
        bool flag;

        if (this.Army.StandardUnits.Count > 0)
        {
            flag = this.Army.StandardUnits.All((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent9.TagColossus));
        }
        else
        {
            flag = false;
        }
        bool flag2 = flag;
        bool flag3;

        if (this.Army.StandardUnits.Count > 0)
        {
            flag3 = this.Army.StandardUnits.Any((Unit unit) => unit.UnitDesign.Tags.Contains(DownloadableContent20.TagKaijuMonster));
        }
        else
        {
            flag3 = false;
        }
        bool flag4 = flag3;

        this.ArmySize.AgeTransform.Visible          = (!flag2 && !flag4);
        this.ColossusArmyLabel.AgeTransform.Visible = flag2;
        if (flag2)
        {
            this.ColossusArmyLabel.Text = "\\7805\\";
            this.ColossusArmyLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyWithColossusDescription");
        }
        this.KaijuArmyLabel.AgeTransform.Visible = flag4;
        if (flag4)
        {
            string text = this.ArmySize.Text;
            this.KaijuArmyLabel.Text = "\\7100\\ " + text;
            this.KaijuArmyLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyWithKaijuMonsterDescription");
        }
        AgeTransform ageTransform = this.ArmyStatusLabel.AgeTransform.GetParent();

        if (this.Army.IsCamouflaged)
        {
            this.ArmyStatusLabel.AgeTransform.Visible = true;
            this.ArmyStatusLabel.Text       = "\\7815\\";
            ageTransform.AgeTooltip.Content = "%ArmyCamouflagedDescription";
        }
        else if (this.Army.IsNaval)
        {
            this.ArmyStatusLabel.AgeTransform.Visible = true;
            this.ArmyStatusLabel.Text       = "\\7825\\";
            ageTransform.AgeTooltip.Content = "%ArmyIsSeafaringDescription";
        }
        else
        {
            this.ArmyStatusLabel.AgeTransform.Visible = false;
            ageTransform.AgeTooltip.Content           = string.Empty;
        }
        this.SelectionToggle.State = false;
    }
Example #17
0
 public static string FormatQuantity(float quantity, StaticString resourceName, int decimals = 1)
 {
     return(GuiFormater.FormatGui(quantity, false, false, false, decimals) + " " + Services.GetService <IGuiService>().FormatSymbol(resourceName));
 }
    public override void RefreshContent()
    {
        base.RefreshContent();
        this.previousConstructionSurplus.Clear();
        this.alreadyPassedTurns = 0;
        bool isIntegrated = this.City.IsIntegrated;

        this.TotalValuesTable.Visible = isIntegrated;
        this.FIDSIBackground.Visible  = isIntegrated;
        for (int i = 0; i < this.typesFIDS.Count; i++)
        {
            if (i < this.valuesFIDS.Count)
            {
                this.valuesFIDS[i].AgeTransform.Alpha = 1f;
                this.valuesFIDS[i].AgeTransform.ResetAllModifiers(true, false);
                float propertyValue = this.City.GetPropertyValue(this.typesFIDS[i]);
                this.valuesFIDS[i].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0);
            }
        }
        bool flag = this.GetCurrentConstructionRaze() != null;
        DepartmentOfPlanificationAndDevelopment agency = this.Empire.GetAgency <DepartmentOfPlanificationAndDevelopment>();

        if (this.ConstructionQueue.PendingConstructions.Count > 0 && !flag && !agency.HasIntegratedFaction(this.City.LastNonInfectedOwner.Faction))
        {
            int  num2;
            bool flag2;
            int  num = this.ComputeRemainingTurn(this.City, this.ConstructionQueue.Peek(), this.previousConstructionSurplus, ref this.alreadyPassedTurns, out num2, out flag2);
            this.IntegrateStatusTitle.Text      = string.Format(AgeLocalizer.Instance.LocalizeString("%IntegratingCityRemainTurns"), num);
            this.IntegrateStatusTitle.TintColor = Color.white;
        }
        else
        {
            this.IntegrateStatusTitle.Text      = AgeLocalizer.Instance.LocalizeString("%IntegratingCityComplete");
            this.IntegrateStatusTitle.TintColor = Color.green;
        }
        Faction faction = this.City.LastNonInfectedOwner.Faction;

        if (faction.Affinity.Name == this.City.Empire.Faction.Affinity.Name)
        {
            this.IntegratedTraitTitle.Text = "%OCPanelIntegratedFactionSameAffinityTitle";
            this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Class      = string.Empty;
            this.IntegratedTraitTitle.AgeTransform.AgeTooltip.ClientData = null;
            this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Content    = "%OCPanelIntegratedFactionSameAffinityTooltip";
            this.IntegratedFactionIconTooltip.Class      = string.Empty;
            this.IntegratedFactionIconTooltip.ClientData = null;
            this.IntegratedFactionIconTooltip.Content    = "%OCPanelIntegratedFactionSameAffinityTooltip";
        }
        bool flag3 = this.CanRazeCity();
        bool flag4 = this.OvergrownCityRazeCooldownReached();

        this.ActionToogle.AgeTransform.Enable           = flag3;
        this.ActionToogle.AgeTransform.Alpha            = ((!flag3) ? 0.5f : 1f);
        this.ConstructibleActionIcon.AgeTransform.Alpha = ((!flag3) ? 0.5f : 1f);
        this.ActionToogle.State = false;
        if (this.City.BesiegingEmpire != null)
        {
            this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityNotAvailableCityUnderSiegeString;
        }
        else if (flag)
        {
            this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityQueuedDescriptionString;
            this.ActionToogle.State = true;
        }
        else if (flag4)
        {
            this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityDescriptionString;
        }
        else
        {
            int num3 = this.OvergrownCityRazeCooldownRemainTurns();
            this.ActionToogle.AgeTransform.AgeTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString(OvergrownCityPanel.RazeOvergrownCityOnCooldownDescriptionString), num3);
        }
        if (this.ActionToogle.State && !this.ModifierSector.IsStarted())
        {
            this.ModifierSector.StartAnimation();
        }
        else if (!this.ActionToogle.State && this.ModifierSector.IsStarted())
        {
            this.ModifierSector.Reset();
        }
    }
Example #19
0
    public void Bind(City city)
    {
        GuiElement guiElement = null;

        this.City = city;
        this.DepartmentOfScience     = this.City.Empire.GetAgency <DepartmentOfScience>();
        this.DepartmentOfTheTreasury = this.City.Empire.GetAgency <DepartmentOfTheTreasury>();
        base.GuiService.GetGuiPanel <CityManagementPanel>().Bind(this.City);
        this.CityWorkersPanel.Bind(this.City);
        for (int i = 0; i < this.typesFIDS.Count; i++)
        {
            base.GuiService.GuiPanelHelper.TryGetGuiElement(this.typesFIDS[i], out guiElement, this.City.Empire.Faction.Name);
            if (guiElement != null)
            {
                ExtendedGuiElement extendedGuiElement = (ExtendedGuiElement)guiElement;
                if (i < this.TotalValuesTable.GetChildren().Count)
                {
                    AgeTransform ageTransform = this.TotalValuesTable.GetChildren()[i];
                    for (int j = 0; j < ageTransform.GetChildren().Count; j++)
                    {
                        AgeTooltip component = ageTransform.GetComponent <AgeTooltip>();
                        if (component != null)
                        {
                            component.Class   = "Simple";
                            component.Content = extendedGuiElement.Description;
                        }
                        AgeTransform ageTransform2 = ageTransform.GetChildren()[j];
                        if (ageTransform2.name == "1Symbol")
                        {
                            Texture2D image;
                            if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
                            {
                                ageTransform2.GetComponent <AgePrimitiveImage>().Image     = image;
                                ageTransform2.GetComponent <AgePrimitiveImage>().TintColor = extendedGuiElement.Color;
                            }
                            break;
                        }
                    }
                }
            }
            SimulationPropertyTooltipData simulationPropertyTooltipData = this.valuesFIDS[i].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
            if (simulationPropertyTooltipData != null)
            {
                simulationPropertyTooltipData.Context = this.City;
            }
        }
        for (int k = 0; k < this.typesFIDS.Count; k++)
        {
            this.previousFIDS[k] = this.City.GetPropertyValue(this.typesFIDS[k]);
            if (k < this.valuesFIDS.Count)
            {
                this.valuesFIDS[k].Text = GuiFormater.FormatGui(this.previousFIDS[k], false, true, false, 1);
            }
        }
        if (this.ApprovalGaugeTooltip.AgeTooltip != null)
        {
            SimulationPropertyTooltipData simulationPropertyTooltipData = this.ApprovalGaugeTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData;
            if (simulationPropertyTooltipData != null)
            {
                simulationPropertyTooltipData.Context = this.City;
            }
        }
        if (this.ApprovalState.AgeTransform.AgeTooltip != null)
        {
            this.ApprovalState.AgeTransform.AgeTooltip.ClientData = this.City;
        }
        if (this.GaugePopulationTooltip.AgeTooltip != null)
        {
            SimulationPropertyTooltipData simulationPropertyTooltipData = this.GaugePopulationTooltip.AgeTooltip.ClientData as SimulationPropertyTooltipData;
            if (simulationPropertyTooltipData != null)
            {
                simulationPropertyTooltipData.Context = this.City;
            }
        }
        if (this.PopulationCountGroup != null && this.PopulationCountGroup.AgeTooltip != null)
        {
            SimulationPropertyTooltipData simulationPropertyTooltipData = this.PopulationCountGroup.AgeTooltip.ClientData as SimulationPropertyTooltipData;
            if (simulationPropertyTooltipData != null)
            {
                simulationPropertyTooltipData.Context = this.City;
            }
        }
        CityInfoPanel.ShowHidePopulationBuyoutButton(this.playerControllerRepository.ActivePlayerController.Empire, this.City, this.PopulationBuyoutButton.AgeTransform, this.GaugePopulationBackground, this.NextPopulationTurns.AgeTransform, this.NextPopulationHourglass, this.GaugePopulationTooltip);
        CityInfoPanel.ShowHidePopulationSacrificeButton(this.playerControllerRepository.ActivePlayerController.Empire, this.DepartmentOfScience, this.PopulationSacrificeButton);
    }
Example #20
0
 private void RefreshVerticalGridLine(AgeTransform tableitem, float value, int index)
 {
     tableitem.Y = this.verticalGridHeights[index];
     tableitem.GetComponent <ScoreGridLabel>().GridLabel.Text = GuiFormater.FormatGui(this.verticalGridValues[index], false, false, false, 0);
 }
Example #21
0
    public override void RefreshContent()
    {
        base.RefreshContent();
        float propertyValue = this.City.GetPropertyValue(SimulationProperties.NetCityApproval);

        this.ApprovalGauge.PercentRight = Mathf.Clamp(propertyValue, 0f, 100f);
        this.ApprovalValue.Text         = GuiFormater.FormatGui(propertyValue * 0.01f, true, false, false, 1);
        StaticString descriptorNameFromType = this.City.GetDescriptorNameFromType("ApprovalStatus");
        GuiElement   guiElement;

        if (base.GuiService.GuiPanelHelper.TryGetGuiElement(descriptorNameFromType, out guiElement, this.City.Empire.Faction.Name))
        {
            this.ApprovalState.Text = guiElement.Title;
            ExtendedGuiElement extendedGuiElement = guiElement as ExtendedGuiElement;
            if (extendedGuiElement != null)
            {
                this.ApprovalGauge.AgePrimitive.TintColor = extendedGuiElement.Color;
                this.ApprovalState.TintColor = extendedGuiElement.Color;
            }
        }
        else
        {
            this.ApprovalState.Text = "%ApprovalStatusUnknown";
        }
        if (this.ApprovalState.AgeTransform.AgeTooltip != null)
        {
            this.ApprovalState.AgeTransform.AgeTooltip.Content = descriptorNameFromType.ToString();
        }
        this.RefreshPopulationCount();
        this.RefreshPopulationGrowth();
        int num = Mathf.CeilToInt(this.City.GetPropertyValue(SimulationProperties.CityMoneyUpkeep));

        this.UpkeepValue.Text = GuiFormater.FormatQuantity((float)(-(float)num), SimulationProperties.CityMoneyUpkeep, 1);
        AgeTooltip ageTooltip = this.UpkeepValue.AgeTransform.AgeTooltip;

        ageTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString("%BuildingsUpkeepFormatDescription"), this.UpkeepValue.Text);
        this.UpkeepIcon1.AgeTooltip.Copy(ageTooltip);
        this.UpkeepIcon2.AgeTooltip.Copy(ageTooltip);
        for (int i = 0; i < this.typesFIDS.Count; i++)
        {
            if (i < this.valuesFIDS.Count && i < this.deltaFIDS.Count)
            {
                if (!this.valuesFIDS[i].AgeTransform.ModifiersRunning)
                {
                    this.valuesFIDS[i].AgeTransform.Alpha = 1f;
                    this.valuesFIDS[i].AgeTransform.ResetAllModifiers(true, false);
                    this.deltaFIDS[i].AgeTransform.Alpha = 0f;
                    this.deltaFIDS[i].AgeTransform.ResetAllModifiers(true, false);
                }
                float propertyValue2 = this.City.GetPropertyValue(this.typesFIDS[i]);
                this.valuesFIDS[i].Text = GuiFormater.FormatGui(propertyValue2, false, false, false, 0);
                if (propertyValue2 != this.previousFIDS[i])
                {
                    this.AnimateFIDSChange(this.valuesFIDS[i], this.deltaFIDS[i], propertyValue2 - this.previousFIDS[i]);
                    this.previousFIDS[i] = propertyValue2;
                }
            }
        }
        for (int j = 0; j < this.workerTypes.Count; j++)
        {
            if (j < this.workersFIDS.Count)
            {
                this.workersFIDS[j].Text = this.City.GetPropertyValue(this.workerTypes[j]).ToString();
            }
        }
        if (this.CityWorkersPanel.IsVisible)
        {
            this.CityWorkersPanel.RefreshContent();
        }
        this.RefreshButtons();
    }
    public void RefreshActionAvailability(DepartmentOfTheTreasury departmentOfTheTreasury, int infiltrationLevel, InterpreterContext interpreterContext, Amplitude.Unity.Gui.IGuiService guiService)
    {
        this.CurrentAction = this.InfiltrationActions.FirstOrDefault((InfiltrationAction infiltrationAction) => infiltrationAction.Level == infiltrationLevel);
        if (this.CurrentAction == null)
        {
            this.CurrentAction = (from infiltrationAction in this.InfiltrationActions
                                  where infiltrationAction.Level < infiltrationLevel
                                  select infiltrationAction).LastOrDefault <InfiltrationAction>();
            if (this.CurrentAction == null)
            {
                this.CurrentAction = (from infiltrationAction in this.InfiltrationActions
                                      where infiltrationAction.Level > infiltrationLevel
                                      select infiltrationAction).FirstOrDefault <InfiltrationAction>();
            }
        }
        this.FailuresFlags.Clear();
        if (interpreterContext != null)
        {
            this.IsValid = this.CurrentAction.CanExecute(interpreterContext, ref this.failuresFlags, new object[0]);
            if (!this.IsValid)
            {
                this.IsValid = !this.failuresFlags.Contains(ConstructionFlags.Discard);
            }
            this.IsValid &= (this.CurrentAction.Level <= infiltrationLevel);
        }
        else
        {
            this.failuresFlags.Add(InfiltrationAction.NoCanDoWithoutInfiltratedSpy);
            this.IsValid = false;
        }
        GuiInfiltrationActionGroup.ComputeInfiltrationActionGuiElement(guiService, this.CurrentAction, out this.actionGuiElement);
        GuiInfiltrationActionGroup.ComputeInfiltrationActionSubCategoryTexture(guiService, this.CurrentAction, out this.subCategoryTexture);
        this.InfiltrationActionCostString.Clear();
        List <string> list = new List <string>();
        int           i    = 0;

        while (i < this.InfiltrationActions.Count)
        {
            list.Clear();
            if (interpreterContext == null || departmentOfTheTreasury == null)
            {
                goto IL_228;
            }
            this.InfiltrationActions[i].ComputeConstructionCost(interpreterContext);
            if (InfiltrationAction.Context.ConstructionCosts == null)
            {
                goto IL_228;
            }
            for (int j = 0; j < InfiltrationAction.Context.ConstructionCosts.Length; j++)
            {
                ConstructionCost constructionCost = InfiltrationAction.Context.ConstructionCosts[j];
                string           item             = ((!departmentOfTheTreasury.CanAfford(constructionCost.Value, constructionCost.ResourceName)) ? "#DF1010#" : string.Empty) + string.Format("{0}{1}", GuiFormater.FormatGui(constructionCost.Value, false, true, false, 1), guiService.FormatSymbol(constructionCost.ResourceName));
                list.Add(item);
            }
            this.InfiltrationActionCostString.Add(string.Join(" ", list.ToArray()));
IL_238:
            i++;
            continue;
IL_228:
            this.InfiltrationActionCostString.Add("-");
            goto IL_238;
        }
    }
Example #23
0
    public override void RefreshContent()
    {
        base.RefreshContent();
        if (this.Fortress == null)
        {
            return;
        }
        if (this.Fortress.Occupant != null)
        {
            GuiEmpire guiEmpire = new GuiEmpire(this.Fortress.Occupant);
            this.OwningEmpireImage.Image = guiEmpire.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, this.playerControllerRepositoryService.ActivePlayerController.Empire as global::Empire);
        }
        string text = string.Empty;

        this.NextStockpileLabel.AgeTransform.Visible = false;
        this.WeatherControlGroup.Visible             = false;
        GuiElement guiElement;

        if (base.GuiService.GuiPanelHelper.TryGetGuiElement(this.Fortress.PointOfInterest.PointOfInterestDefinition.PointOfInterestTemplateName, out guiElement))
        {
            if (this.Fortress.Orientation == Fortress.CardinalOrientation.Center)
            {
                text = AgeLocalizer.Instance.LocalizeString(guiElement.Title);
            }
            else
            {
                text = AgeLocalizer.Instance.LocalizeString("%FortressGeolocalizedNameFormat").Replace("$FortressName", AgeLocalizer.Instance.LocalizeString(guiElement.Title));
                text = text.Replace("$FortressPosition", AgeLocalizer.Instance.LocalizeString("%" + this.Fortress.Orientation.ToString() + "GeolocalizationTitle"));
            }
            this.CitadelTitle.Text = text;
            if (this.CitadelTitle.AgeTransform.AgeTooltip != null)
            {
                this.CitadelTitle.AgeTransform.AgeTooltip.Class      = Fortress.Facility;
                this.CitadelTitle.AgeTransform.AgeTooltip.Content    = guiElement.Name;
                this.CitadelTitle.AgeTransform.AgeTooltip.ClientData = this.Fortress.PointOfInterest.PointOfInterestImprovement;
            }
            Texture2D image;
            if (base.GuiService.GuiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image))
            {
                this.CitadelImage.Image = image;
                this.CitadelImage.AgeTransform.AgeTooltip.Copy(this.CitadelTitle.AgeTransform.AgeTooltip);
            }
        }
        else
        {
            this.CitadelTitle.Text = this.Fortress.PointOfInterest.PointOfInterestDefinition.PointOfInterestTemplateName;
        }
        List <PointOfInterest> facilities = this.Fortress.Facilities;

        for (int i = 0; i < facilities.Count; i++)
        {
            if (facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile1) || facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile2) || facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.StockPile3))
            {
                this.NextStockpileLabel.AgeTransform.Visible = true;
                int num;
                if (this.Fortress.Region.NavalEmpire.GetAgency <PirateCouncil>().Stockpiles.TryGetValue(facilities[i].GUID, out num))
                {
                    if (num > 1)
                    {
                        this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatPlural").Replace("$Timer", num.ToString());
                    }
                    else
                    {
                        this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatSingle").Replace("$Timer", num.ToString());
                    }
                }
                else
                {
                    this.NextStockpileLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoNextStockpileGenerationFormatPlural").Replace("$Timer", "???");
                }
            }
            if (facilities[i].SimulationObject.Tags.Contains(Fortress.UniqueFacilityNames.WeatherControl) && this.weatherService != null)
            {
                this.WeatherControlGroup.Visible = true;
                List <string> list  = new List <string>();
                List <string> list2 = new List <string>();
                list.Add("%FortressInfoWeatherControlNoPresetTitle");
                list2.Add("%FortressInfoWeatherControlNoPresetDescription");
                bool   flag = this.weatherService.WeatherControlCooldown <= 0 || this.weatherService.WeatherControlStartTurn == (base.Game as global::Game).Turn + 1;
                int    weatherControlTurnDurationFor = this.weatherService.GetWeatherControlTurnDurationFor(this.fortress.Occupant);
                string newValue = string.Empty;
                for (int j = 0; j < this.presetNames.Count; j++)
                {
                    GuiElement guiElement2;
                    if (base.GuiService.GuiPanelHelper.TryGetGuiElement("Weather" + this.presetNames[j], out guiElement2))
                    {
                        list.Add(guiElement2.Title);
                        if (!flag)
                        {
                            newValue = (weatherControlTurnDurationFor - ((base.Game as global::Game).Turn + 1 - this.weatherService.WeatherControlStartTurn)).ToString();
                        }
                        else
                        {
                            newValue = weatherControlTurnDurationFor.ToString();
                        }
                        list2.Add(AgeLocalizer.Instance.LocalizeString(guiElement2.Description).Replace("$Timer", newValue));
                    }
                }
                this.WeatherControlDroplist.ItemTable    = list.ToArray();
                this.WeatherControlDroplist.TooltipTable = list2.ToArray();
                if (this.presetNames.Contains(this.weatherService.PresetName))
                {
                    this.WeatherControlDroplist.SelectedItem = this.presetNames.IndexOf(this.weatherService.PresetName) + 1;
                }
                else
                {
                    this.WeatherControlDroplist.SelectedItem = 0;
                }
                if (flag)
                {
                    this.WeatherControlLabel.Text = "%FortressInfoWeatherControlUseTitle";
                    this.WeatherControlLabel.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlUseDescription").Replace("$Timer", weatherControlTurnDurationFor.ToString());
                    this.WeatherControlDroplist.AgeTransform.Enable          = true;
                }
                else if (this.weatherService.WeatherControlCooldown > 0)
                {
                    this.WeatherControlDroplist.AgeTransform.Enable = false;
                    this.WeatherControlLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlEndOfCooldownFormatSingle").Replace("$Timer", this.weatherService.WeatherControlCooldown.ToString());
                    this.WeatherControlLabel.AgeTransform.AgeTooltip.Content = "%FortressInfoWeatherControlEndOfCooldownDescription";
                    if (this.weatherService.WeatherControlCooldown > 1)
                    {
                        this.WeatherControlLabel.Text = AgeLocalizer.Instance.LocalizeString("%FortressInfoWeatherControlEndOfCooldownFormatPlural").Replace("$Timer", this.weatherService.WeatherControlCooldown.ToString());
                    }
                }
            }
        }
        for (int k = 0; k < this.typesFIDS.Count; k++)
        {
            if (k < this.valuesFIDS.Count)
            {
                this.valuesFIDS[k].AgeTransform.Alpha = 1f;
                this.valuesFIDS[k].AgeTransform.ResetAllModifiers(true, false);
                float propertyValue = this.Fortress.GetPropertyValue(this.typesFIDS[k]);
                this.valuesFIDS[k].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0);
            }
        }
        this.PlayerEmpire = (this.PlayerController.Empire as global::Empire);
        this.FacilitiesTable.ReserveChildren(facilities.Count, this.FacilityOccurencePrefab, Fortress.Facility);
        this.FacilitiesTable.RefreshChildrenIList <PointOfInterest>(facilities, this.updateFacilityDelegate, false, false);
    }
Example #24
0
    public void RefreshContent()
    {
        if (this.City == null)
        {
            return;
        }
        if (this.City.Empire == null)
        {
            return;
        }
        if (this.GuiEmpire.Index != this.City.Empire.Index)
        {
            if (this.guiEmpire == null)
            {
                this.Unbind();
                return;
            }
            this.GuiEmpire = new GuiEmpire(this.City.Empire);
            DepartmentOfIndustry agency = this.City.Empire.GetAgency <DepartmentOfIndustry>();
            this.ConstructionQueue = agency.GetConstructionQueue(this.City);
        }
        if (this.GuiEmpire != null)
        {
            this.FactionBackground.TintColor = this.GuiEmpire.Color;
            this.PopulationSymbol.TintColor  = this.GuiEmpire.Color;
            this.FactionSymbol.TintColor     = this.GuiEmpire.Color;
            this.PinLine.TintColor           = this.GuiEmpire.Color;
            this.PopulationNumber.Text       = GuiFormater.FormatGui(this.City.GetPropertyValue(SimulationProperties.Population), false, false, false, 1);
            this.FactionSymbol.Image         = this.GuiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true);
        }
        string content = "%CityCurrentConstructionDescription";

        if (this.City.IsInfected)
        {
            this.PanelSpying.Visible        = false;
            this.PanelOvergrownCity.Visible = true;
            this.AgeTransform.Height        = this.ModifierPosition.EndHeight;
            if (this.GuiPreviousEmpire == null)
            {
                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;
                    }
                }
            }
            if (this.ConstructionQueue.PendingConstructions.Count > 0)
            {
                Construction construction = this.ConstructionQueue.Peek();
                if (construction.ConstructibleElement.SubCategory == "SubCategoryAssimilation" && construction.ConstructibleElement.Name != "CityConstructibleActionInfectedRaze")
                {
                    content = "%IntegratingFactionUnderConstructionDescription";
                }
            }
        }
        this.ConstructionGroup.AgeTooltip.Content = content;
        this.RefreshCityName();
        DepartmentOfIntelligence agency2 = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfIntelligence>();
        bool flag = this.playerControllerRepository.ActivePlayerController.Empire.SimulationObject.Tags.Contains(global::Empire.TagEmpireEliminated);

        if (flag && ELCPUtilities.SpectatorSpyFocus >= 0)
        {
            agency2 = this.game.Empires[ELCPUtilities.SpectatorSpyFocus].GetAgency <DepartmentOfIntelligence>();
        }
        Unit hero = null;

        InfiltrationProcessus.InfiltrationState infiltrationState = InfiltrationProcessus.InfiltrationState.None;
        bool flag2 = false;

        if (this.playerControllerRepository != null)
        {
            if (this.City.Empire == this.playerControllerRepository.ActivePlayerController.Empire)
            {
                flag2 = true;
            }
            else if (this.PanelSpying.Visible && agency2 != null && agency2.TryGetSpyOnGarrison(this.City, out hero, out infiltrationState) && infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated)
            {
                flag2 = true;
            }
            else if (flag)
            {
                flag2 = true;
            }
        }
        if (!flag2)
        {
            if (this.City.Empire == null)
            {
                this.CompetitorTitle.Text = string.Empty;
            }
            else
            {
                DiplomaticRelation diplomaticRelation = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(this.City.Empire);
                Diagnostics.Assert(diplomaticRelation != null);
                if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Alliance)
                {
                    AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelAlliedTitle"), this.CompetitorTitle, out this.temp, '.');
                    this.CompetitorTitle.Text = this.temp;
                }
                else if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Peace)
                {
                    AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelFriendlyTitle"), this.CompetitorTitle, out this.temp, '.');
                    this.CompetitorTitle.Text = this.temp;
                }
                else
                {
                    AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelEnemyTitle"), this.CompetitorTitle, out this.temp, '.');
                    this.CompetitorTitle.Text = this.temp;
                }
            }
        }
        this.SelectionButton.AgeTransform.Enable = flag2;
        this.PlayerSpecificGroup.Visible         = flag2;
        this.CompetitorSpecificGroup.Visible     = !flag2;
        float propertyValue  = this.City.GetPropertyValue(SimulationProperties.CityDefensePoint);
        float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.MaximumCityDefensePoint);
        float propertyValue3 = this.City.GetPropertyValue(SimulationProperties.CityDefensePointRecoveryPerTurn);
        float propertyValue4 = this.City.GetPropertyValue(SimulationProperties.Ownership);

        Diagnostics.Assert(this.UnitNumber != null);
        Diagnostics.Assert(this.City.StandardUnits != null);
        int num = (this.City.Militia == null) ? 0 : this.City.Militia.StandardUnits.Count;

        this.UnitNumber.Text    = GuiFormater.FormatGui(this.City.StandardUnits.Count + num);
        this.DefenseNumber.Text = GuiFormater.FormatStock(propertyValue, SimulationProperties.CityDefensePoint, 0, true);
        float propertyValue5 = this.City.GetPropertyValue(SimulationProperties.DefensivePower);

        this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseDescription");
        this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("fortificationCityLabel", false);
        if (propertyValue5 > 0f)
        {
            this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseWithDefensivePowerDescription").Replace("$DefensivePowerValue", GuiFormater.FormatGui(propertyValue5, false, true, false, 1));
            this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("retaliationCityLabel", false);
        }
        this.DefenseGroup.AgeTooltip.Content = this.DefenseGroup.AgeTooltip.Content.Replace("$CityDefenseValue", GuiFormater.FormatGui(propertyValue, false, true, false, 1));
        if (propertyValue4 < 1f && !this.City.IsInfected)
        {
            this.OwnershipPercentage.AgeTransform.Visible = true;
            this.OwnershipPercentage.Text = GuiFormater.FormatGui(propertyValue4, true, false, false, 1);
        }
        else
        {
            this.OwnershipPercentage.AgeTransform.Visible = false;
        }
        if (this.City.BesiegingEmpire != null || this.City.BesiegingSeafaringArmies.Count != 0 || this.City.IsUnderEarthquake)
        {
            float num2 = DepartmentOfTheInterior.GetBesiegingPower(this.City, true);
            num2 += DepartmentOfTheInterior.GetCityPointEarthquakeDamage(this.City);
            this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(-num2, false, true, true, 1) + ")";
        }
        else if (propertyValue < propertyValue2)
        {
            this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(propertyValue3, false, true, true, 1) + ")";
        }
        else
        {
            this.DefenseTendency.Text = string.Empty;
        }
        if (flag2)
        {
            Construction construction2 = null;
            if (this.ConstructionQueue != null)
            {
                construction2 = this.ConstructionQueue.Peek();
            }
            if (this.City.IsInfected && construction2 == null)
            {
                this.PlayerSpecificGroup.Visible = false;
            }
            if (construction2 != null)
            {
                IImageFeatureProvider imageFeatureProvider = construction2.ConstructibleElement as IImageFeatureProvider;
                GuiElement            guiElement;
                if (imageFeatureProvider != null)
                {
                    Texture2D image;
                    if (imageFeatureProvider.TryGetTextureFromIcon(global::GuiPanel.IconSize.Small, out image))
                    {
                        this.ConstructionImage.Image = image;
                    }
                }
                else if (this.guiPanelHelper.TryGetGuiElement(construction2.ConstructibleElement.Name, out guiElement))
                {
                    Texture2D image2;
                    if (this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image2))
                    {
                        this.ConstructionImage.Image = image2;
                    }
                }
                else
                {
                    this.ConstructionImage.Image = null;
                }
                CityLabel.emptyList.Clear();
                int   b;
                float num3;
                float num4;
                bool  flag3;
                QueueGuiItem.GetConstructionTurnInfos(this.City, construction2, CityLabel.emptyList, out b, out num3, out num4, out flag3);
                int numberOfTurn = Mathf.Max(1, b);
                this.ConstructionTurns.Text = QueueGuiItem.FormatNumberOfTurns(numberOfTurn);
            }
            else
            {
                this.ConstructionImage.Image = this.NoConstructionTexture;
                this.ConstructionTurns.Text  = "%EmptyConstructionTitle";
            }
        }
        if (this.PanelSpying.Visible && this.playerControllerRepository != null && agency2 != null)
        {
            float value = this.City.GetPropertyValue(SimulationProperties.CityAntiSpy) * 0.01f;
            this.AntiSpyValue.Text                    = GuiFormater.FormatGui(value, true, true, false, 0);
            this.HeroGroup.Visible                    = false;
            this.SpyingEffectsGroup.Visible           = false;
            this.AssignSpyButton.AgeTransform.Visible = false;
            if (this.City.Empire != this.playerControllerRepository.ActivePlayerController.Empire)
            {
                if (infiltrationState != InfiltrationProcessus.InfiltrationState.None)
                {
                    this.HeroGroup.Visible = true;
                    this.HeroCard.Bind(hero, this.playerControllerRepository.ActivePlayerController.Empire as global::Empire, null);
                    this.HeroCard.RefreshContent(false, false);
                    if (this.HeroCard.GuiHero != null)
                    {
                        AgeTooltip ageTooltip = this.HeroCard.HeroPortrait.AgeTransform.AgeTooltip;
                        if (ageTooltip != null)
                        {
                            ageTooltip.Class      = "Unit";
                            ageTooltip.ClientData = this.HeroCard.GuiHero;
                            ageTooltip.Content    = this.HeroCard.GuiHero.Title;
                        }
                    }
                    if (infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated)
                    {
                        this.InfiltrationTurnSymbol.AgeTransform.Visible = false;
                        this.InfiltrationTurnValue.AgeTransform.Visible  = false;
                        this.HeroCard.AgeTransform.Alpha = 1f;
                        this.SpyingEffectsGroup.Visible  = true;
                    }
                    else
                    {
                        this.HeroCard.AgeTransform.Alpha = 0.75f;
                        this.InfiltrationTurnSymbol.AgeTransform.Visible = true;
                        this.InfiltrationTurnValue.AgeTransform.Visible  = true;
                        int value2 = DepartmentOfIntelligence.InfiltrationRemainingTurns(hero);
                        this.InfiltrationTurnValue.Text = GuiFormater.FormatGui(value2);
                    }
                }
                else if (!flag)
                {
                    this.AssignSpyButton.AgeTransform.Visible = true;
                    float value3 = 0f;
                    this.failures.Clear();
                    bool flag4 = agency2.CanBeInfiltrate(this.City, out value3, this.failures);
                    bool flag5 = agency2.Empire.GetAgency <DepartmentOfEducation>().Heroes.Count < 1;
                    if (flag5)
                    {
                        flag4 = false;
                    }
                    this.AssignSpyButton.AgeTransform.Enable = flag4;
                    global::IGuiService service = Services.GetService <global::IGuiService>();
                    string str = string.Empty;
                    if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable))
                    {
                        str = "#c52222#";
                    }
                    string arg    = str + GuiFormater.FormatGui(value3, false, true, false, 0) + service.FormatSymbol(this.infiltrationCostResourceName);
                    string format = AgeLocalizer.Instance.LocalizeString("%EspionageLabelAssignSpyTitle");
                    this.AssignTitle.Text = string.Format(format, arg);
                    AgeTooltip ageTooltip2 = this.AssignSpyButton.AgeTransform.AgeTooltip;
                    if (ageTooltip2)
                    {
                        if (flag4)
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyDescription";
                        }
                        else if (flag5)
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyNoHeroesDescription";
                        }
                        else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotVisible))
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyNoVisibilityDescription";
                        }
                        else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureSiege))
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyUnderSiegeDescription";
                        }
                        else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable))
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyNotAffordableDescription";
                        }
                        else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureAlreadyInfiltrated))
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyAlreadyInfiltratedDescription";
                        }
                        else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureCityInfected))
                        {
                            ageTooltip2.Content = "%EspionageLabelAssignSpyCityInfectedDescription";
                        }
                    }
                }
            }
        }
        bool         flag6 = false;
        List <Kaiju> list  = new List <Kaiju>();

        foreach (RegionalEffect regionalEffect in this.city.GetRegionalEffects())
        {
            IRegionalEffectsProviderGameEntity regionalEffectsProviderGameEntity = null;
            if (this.regionalEffectsService.TryGetEffectOwner(regionalEffect.GUID, out regionalEffectsProviderGameEntity) && regionalEffectsProviderGameEntity.GetRegionalEffectsProviderContext().SimulationObject.Tags.Contains("ClassKaiju"))
            {
                flag6 = true;
                if (regionalEffectsProviderGameEntity is Kaiju)
                {
                    Kaiju item = regionalEffectsProviderGameEntity as Kaiju;
                    if (!list.Contains(item))
                    {
                        list.Add(item);
                    }
                }
            }
        }
        if (flag6)
        {
            AgeTransform ageTransform = this.KaijuIcon.AgeTransform;
            ageTransform.Visible = true;
            ageTransform.Enable  = true;
            this.PopulationGroup.PercentBottom = 100f - (ageTransform.Height + ageTransform.PixelMarginBottom) / ageTransform.GetParent().Height * 100f;
            KaijuInfluenceInCityTooltipData clientData = new KaijuInfluenceInCityTooltipData(this.City, list);
            this.KaijuIcon.AgeTransform.AgeTooltip.Content    = "%CityKaijuAffectedDescription";
            this.KaijuIcon.AgeTransform.AgeTooltip.Class      = "Kaijus";
            this.KaijuIcon.AgeTransform.AgeTooltip.ClientData = clientData;
            return;
        }
        this.KaijuIcon.AgeTransform.Visible = false;
        this.KaijuIcon.AgeTransform.Enable  = false;
        this.PopulationGroup.PercentBottom  = 100f;
    }
    public override void RefreshContent()
    {
        base.RefreshContent();
        if (base.Empire == null)
        {
            return;
        }
        if (this.diplomaticRelationsViewport != null)
        {
            this.diplomaticRelationsViewport.Refresh();
        }
        float       num         = 0f;
        float       num2        = 1f;
        MajorEmpire majorEmpire = base.Empire as MajorEmpire;

        if (majorEmpire.VictoryConditionStatuses.ContainsKey("Diplomacy") && ELCPUtilities.UseELCPPeacePointRulseset)
        {
            this.DiplomaticScoreContainer.Visible = true;
            num = base.Empire.GetPropertyValue("EmpirePeacePointStock");
            float propertyValue  = base.Empire.GetPropertyValue("PeacePointBucketStock");
            float value          = Mathf.Min(propertyValue, base.Empire.GetPropertyValue("TreatyPeacePointPerTurn"));
            float propertyValue2 = base.Empire.GetPropertyValue("NetEmpirePeacePoint");
            this.DiplomaticScore.Text       = AgeLocalizer.Instance.LocalizeString("%ELCPDiplomacyScreenDiplomaticScoreFormat").Replace("$BucketValue", GuiFormater.FormatGui(propertyValue, false, false, false, 0));
            this.DiplomaticScore.Text       = this.DiplomaticScore.Text.Replace("$BucketNet", GuiFormater.FormatGui(value, false, false, false, 0));
            this.DiplomaticScore.Text       = this.DiplomaticScore.Text.Replace("$PPValue", GuiFormater.FormatGui(num, false, false, false, 0));
            this.DiplomaticScore.Text       = this.DiplomaticScore.Text.Replace("$PPNet", GuiFormater.FormatGui(propertyValue2, false, false, false, 0));
            this.DiplomaticScore.Alignement = AgeTextAnchor.LowerCenter;
            this.victoryService             = base.Game.Services.GetService <IVictoryManagementService>();
            foreach (VictoryCondition victoryCondition in this.victoryService.VictoryConditionsFilteredThisGame)
            {
                if (victoryCondition.Name == "Diplomacy")
                {
                    for (int i = 0; i < victoryCondition.Progression.Vars.Length; i++)
                    {
                        if (victoryCondition.Progression.Vars[i].Name == "TargetValue")
                        {
                            num2 = majorEmpire.VictoryConditionStatuses["Diplomacy"].Variables[i];
                        }
                    }
                    if (this.DiplomaticScoreContainer.AgeTooltip != null)
                    {
                        this.DiplomaticScoreContainer.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%VictoryConditionDiplomacyDescription").Replace("$TargetValue", GuiFormater.FormatGui(num2, false, false, false, 0));
                    }
                }
            }
            this.DiplomaticGauge.Visible             = false;
            this.DiplomaticGauge.GetParent().Visible = false;
            this.DiplomaticGauge.PercentRight        = Mathf.Clamp(100f * (num / num2), 0f, 100f);
            return;
        }
        this.DiplomaticScoreContainer.Visible = false;
    }
Example #26
0
    public void RefreshContent(Player player, Empire playerEmpire, IGuiPanelHelper helper)
    {
        GuiEmpire guiEmpire = new GuiEmpire(player.Empire);

        this.EmpireIcon.Image     = guiEmpire.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, playerEmpire);
        this.EmpireIcon.TintColor = guiEmpire.Color;
        AgeUtils.TruncateString(player.LocalizedName, this.EmpireLeader, out this.temp, '.');
        this.EmpireLeader.Text      = this.temp;
        this.EmpireLeader.TintColor = player.Empire.Color;
        float       value       = 0f;
        MajorEmpire majorEmpire = player.Empire as MajorEmpire;

        if (majorEmpire != null)
        {
            Diagnostics.Assert(majorEmpire.GameScores != null);
            GameScore gameScore = null;
            if (majorEmpire.GameScores.TryGetValue(GameScores.Names.GlobalScore, out gameScore))
            {
                value = gameScore.Value;
            }
        }
        bool            flag    = false;
        ISessionService service = Services.GetService <ISessionService>();

        Diagnostics.Assert(service != null && service.Session != null);
        string lobbyData = service.Session.GetLobbyData <string>(EmpireInfo.EmpireInfoAccessibility, "Default");

        switch ((int)Enum.Parse(typeof(EmpireInfo.Accessibility), lobbyData))
        {
        case 0:
            flag = true;
            break;

        case 1:
            if (player.Empire == playerEmpire)
            {
                flag = true;
            }
            else if (playerEmpire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(player.Empire).State.Name == DiplomaticRelationState.Names.Dead)
            {
                flag = true;
            }
            break;

        case 2:
            if (player.Empire == playerEmpire)
            {
                flag = true;
            }
            else
            {
                DepartmentOfIntelligence agency = playerEmpire.GetAgency <DepartmentOfIntelligence>();
                if (agency != null && agency.IsEmpireInfiltrated(player.Empire))
                {
                    flag = true;
                }
                else if (playerEmpire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(player.Empire).State.Name == DiplomaticRelationState.Names.Dead)
                {
                    flag = true;
                }
            }
            break;

        default:
            flag = true;
            break;
        }
        if (flag || !(playerEmpire is MajorEmpire) || (playerEmpire as MajorEmpire).IsEliminated)
        {
            this.EmpireScore.Text = GuiFormater.FormatGui(value, false, false, false, 1);
        }
        else
        {
            this.EmpireScore.Text = "???";
        }
        this.EmpireScore.TintColor = player.Empire.Color;
        if (player.Empire == playerEmpire)
        {
            this.EmpireDiplomacy.Text      = "-";
            this.EmpireDiplomacy.TintColor = player.Empire.Color;
        }
        else
        {
            DepartmentOfForeignAffairs agency2 = playerEmpire.GetAgency <DepartmentOfForeignAffairs>();
            if (agency2 != null)
            {
                DiplomaticRelation diplomaticRelation = agency2.GetDiplomaticRelation(player.Empire);
                GuiElement         guiElement;
                if (helper.TryGetGuiElement(diplomaticRelation.State.Name, out guiElement))
                {
                    AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(guiElement.Title), this.EmpireDiplomacy, out this.temp, '.');
                    this.EmpireDiplomacy.Text      = this.temp;
                    this.EmpireDiplomacy.TintColor = player.Empire.Color;
                }
                if (player.Empire.IsControlledByAI)
                {
                    if (diplomaticRelation.State.Name == DiplomaticRelationState.Names.Unknown)
                    {
                        AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(guiElement.Title), this.EmpireDiplomacy, out this.temp, '.');
                        this.EmpireLeader.Text = this.temp;
                    }
                    else
                    {
                        AgeUtils.TruncateString(player.Empire.LocalizedName, this.EmpireLeader, out this.temp, '.');
                        this.EmpireLeader.Text = this.temp;
                    }
                }
            }
        }
        string key = string.Empty;

        this.EmpireStatus.Text = string.Empty;
        PlayerHelper.ComputePlayerState(ref player);
        key = string.Format("%PlayerState_{0}", player.State);
        string src = string.Empty;

        if (player.Type == PlayerType.Human && service.Session.SessionMode != SessionMode.Single)
        {
            src = string.Format("{0} ({1:0.}ms)", AgeLocalizer.Instance.LocalizeString(key), player.Latency * 1000.0);
        }
        else
        {
            src = AgeLocalizer.Instance.LocalizeString(key);
        }
        AgeUtils.TruncateString(src, this.EmpireStatus, out this.temp, '.');
        AgePrimitiveLabel empireStatus = this.EmpireStatus;

        empireStatus.Text      = empireStatus.Text + this.temp + "\n";
        this.EmpireStatus.Text = this.EmpireStatus.Text.TrimEnd(new char[]
        {
            '\n'
        });
        this.EmpireStatus.TintColor = player.Empire.Color;
    }
Example #27
0
    public static void GetCostAndTurn(Amplitude.Unity.Gui.IGuiService guiService, DepartmentOfTheTreasury departmentOfTheTreasury, SimulationObjectWrapper context, out string costString, out int turn)
    {
        turn = 0;
        StringBuilder stringBuilder = new StringBuilder();

        if (PanelFeatureCost.costByResource.Count > 0)
        {
            bool flag = false;
            IDatabase <ResourceDefinition> database = Databases.GetDatabase <ResourceDefinition>(false);
            foreach (KeyValuePair <StaticString, PanelFeatureCost.CostResume> keyValuePair in PanelFeatureCost.costByResource)
            {
                if (keyValuePair.Key == SimulationProperties.Population)
                {
                    stringBuilder.Append(GuiFormater.FormatGui(keyValuePair.Value.Cost, false, true, false, 1));
                    stringBuilder.Append(guiService.FormatSymbol(keyValuePair.Key));
                }
                else if (keyValuePair.Key == DepartmentOfTheTreasury.Resources.FreeBorough)
                {
                    stringBuilder.Append(GuiFormater.FormatGui(keyValuePair.Value.Cost, false, true, false, 1));
                    stringBuilder.Append(guiService.FormatSymbol(keyValuePair.Key));
                    float num;
                    if (!departmentOfTheTreasury.TryGetResourceStockValue(context.SimulationObject, DepartmentOfTheTreasury.Resources.QueuedFreeBorough, out num, true))
                    {
                        Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[]
                        {
                            DepartmentOfTheTreasury.Resources.QueuedFreeBorough,
                            context.SimulationObject.Name
                        });
                    }
                    else
                    {
                        stringBuilder.Append(string.Format(AgeLocalizer.Instance.LocalizeString("%CityFreeBoroughsLeft"), num));
                    }
                }
                else
                {
                    float              cost = keyValuePair.Value.Cost;
                    StaticString       key  = keyValuePair.Key;
                    ResourceDefinition resourceDefinition;
                    if (!database.TryGetValue(key, out resourceDefinition))
                    {
                        Diagnostics.LogError("Invalid resource name. The resource {0} does not exist in the resource database.", new object[]
                        {
                            key
                        });
                    }
                    else
                    {
                        string value = guiService.FormatSymbol(resourceDefinition.GetName(departmentOfTheTreasury.Empire));
                        if (!string.IsNullOrEmpty(value))
                        {
                            global::Empire empire = null;
                            if (context is City)
                            {
                                empire = (context as City).Empire;
                            }
                            else if (context is global::Empire)
                            {
                                empire = (context as global::Empire);
                            }
                            if (empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics2) && key == DepartmentOfTheTreasury.Resources.Production)
                            {
                                ResourceDefinition resourceDefinition2;
                                if (!database.TryGetValue(SimulationProperties.CityGrowth, out resourceDefinition2))
                                {
                                    Diagnostics.LogError("Invalid resource name. The resource {0} does not exist in the resource database.", new object[]
                                    {
                                        key
                                    });
                                    continue;
                                }
                                value = guiService.FormatSymbol(resourceDefinition2.GetName(departmentOfTheTreasury.Empire));
                                if (string.IsNullOrEmpty(value))
                                {
                                    continue;
                                }
                            }
                            float num2;
                            if (!departmentOfTheTreasury.TryGetResourceStockValue(context.SimulationObject, key, out num2, true))
                            {
                                num2 = 0f;
                            }
                            if (keyValuePair.Value.Instant && num2 < cost)
                            {
                                AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false);
                                flag = true;
                            }
                            stringBuilder.Append(GuiFormater.FormatGui(cost, false, true, false, 1));
                            stringBuilder.Append(value);
                            if (flag)
                            {
                                stringBuilder.Append("#REVERT#");
                                flag = false;
                            }
                            if (!keyValuePair.Value.Instant)
                            {
                                float num3;
                                if (!departmentOfTheTreasury.TryGetNetResourceValue(context.SimulationObject, key, out num3, true))
                                {
                                    num3 = 0f;
                                }
                                if (cost > num2)
                                {
                                    if (num3 <= 0f)
                                    {
                                        turn = int.MaxValue;
                                    }
                                    else
                                    {
                                        int num4 = Mathf.CeilToInt((cost - num2) / num3);
                                        if (num4 > turn)
                                        {
                                            turn = num4;
                                        }
                                    }
                                }
                            }
                            stringBuilder.Append(" ");
                        }
                    }
                }
            }
        }
        costString = stringBuilder.ToString();
        if (string.IsNullOrEmpty(costString))
        {
            costString = "-";
        }
    }
Example #28
0
    public override void RefreshContent()
    {
        if (this.City == null)
        {
            return;
        }
        base.RefreshContent();
        float            num      = 0f;
        WorkersDragPanel guiPanel = base.GuiService.GetGuiPanel <WorkersDragPanel>();

        for (int i = 0; i < this.workerTypes.Count; i++)
        {
            int num2 = Mathf.FloorToInt(this.City.GetPropertyValue(this.workerTypes[i]));
            if (guiPanel.DragInProgress && guiPanel.DragMoved && this.workerTypes[i] == guiPanel.StartingWorkerType)
            {
                num2 -= guiPanel.NumberOfWorkers;
            }
            if (i < this.WorkersGroups.Length)
            {
                this.WorkersGroups[i].RefreshContent(this.City, num2, this.workerTypes[i], guiPanel);
                this.WorkersGroups[i].GetComponent <AgeTransform>().Enable = (this.interactionsAllowed && !this.IsOtherEmpire);
            }
            int num3 = num2 / this.workersPerLine;
            if (num3 * this.workersPerLine != num2)
            {
                num3++;
            }
            if (num3 < 1)
            {
                num3 = 1;
            }
            if (i < this.WorkersGroups.Length && this.WorkersGroups[i] != null)
            {
                AgeTransform workersTable = this.WorkersGroups[i].WorkersTable;
                float        num4         = workersTable.VerticalMargin + (float)num3 * (this.childHeight + workersTable.VerticalSpacing);
                if (num4 > num)
                {
                    num = num4;
                }
            }
        }
        for (int j = 0; j < this.prodPerPopFIDSTypes.Count; j++)
        {
            float num5 = 0f;
            if (j < this.ProdPerPopFIDSValues.Length)
            {
                float propertyValue = this.City.GetPropertyValue(this.prodPerPopFIDSTypes[j]);
                this.ProdPerPopFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0);
            }
            float propertyValue2 = this.City.GetPropertyValue(this.workedFIDSTypes[j]);
            if (j < this.CityTileFIDSValues.Length)
            {
                float propertyValue3 = this.City.GetPropertyValue(this.cityTileFIDSTypes[j]);
                this.CityTileFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue3, false, false, false, 0);
            }
            if (j < this.TotalFIDSValues.Length)
            {
                num5 = this.City.GetPropertyValue(this.totalFIDSTypes[j]);
                if (this.City.SimulationObject.Tags.Contains(City.MimicsCity) && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData != null && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData is SimulationPropertyTooltipData)
                {
                    SimulationPropertyTooltipData simulationPropertyTooltipData = this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData;
                    if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityProduction)
                    {
                        num5 = 0f;
                    }
                    else if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityGrowth)
                    {
                        num5 = this.City.GetPropertyValue("AlmostNetCityGrowth");
                    }
                }
                this.TotalFIDSValues[j].Text = GuiFormater.FormatGui(num5, false, false, false, 0);
            }
            if (j < this.ModifierFIDSValues.Length)
            {
                float num6 = num5 - propertyValue2;
                if (Mathf.RoundToInt(num6) != 0)
                {
                    this.ModifierFIDSValues[j].Text = GuiFormater.FormatGui(num6, false, false, true, 0);
                }
                else
                {
                    this.ModifierFIDSValues[j].Text = string.Empty;
                }
            }
        }
        this.WorkerGroupsTable.Height = num;
        this.WorkersTitle.Height      = num;
        for (int k = 0; k < this.WorkersGroups.Length; k++)
        {
            this.WorkersGroups[k].WorkersTable.Height    = num;
            this.WorkersGroups[k].ActiveHighlight.Height = num;
            this.WorkersGroups[k].GetComponent <AgeTransform>().Height = num;
        }
        base.AgeTransform.Height = this.TopMargin * AgeUtils.CurrentUpscaleFactor() + num + this.WorkerGroupsTable.PixelMarginBottom;
        bool flag  = DepartmentOfTheInterior.CanBuyoutPopulation(this.City);
        bool flag2 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1);
        bool flag3 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics2);
        int  rowIndex;

        Func <WorkersGroup, bool> < > 9__0;
        int rowIndex2;

        for (rowIndex = 0; rowIndex < this.FoodColumnCells.Length; rowIndex = rowIndex2 + 1)
        {
            bool flag4 = false;
            if (this.IsOtherEmpire)
            {
                IEnumerable <WorkersGroup> workersGroups = this.WorkersGroups;
                Func <WorkersGroup, bool>  predicate;
                if ((predicate = < > 9__0) == null)
                {
                    predicate = (< > 9__0 = ((WorkersGroup cell) => cell.GetComponent <AgeTransform>() == this.FoodColumnCells[rowIndex]));
                }
                flag4 = workersGroups.Any(predicate);
            }
            this.FoodColumnCells[rowIndex].Enable     = (!flag && this.interactionsAllowed && !flag4);
            this.ScienceColumnCells[rowIndex].Enable  = (!flag2 && this.interactionsAllowed && !flag4);
            this.IndustryColumnCells[rowIndex].Enable = (!flag3 && this.interactionsAllowed && !flag4);
            rowIndex2 = rowIndex;
        }
        if (this.BoostersTable == null)
        {
            bool highDefinition = AgeUtils.HighDefinition;
            AgeUtils.HighDefinition              = false;
            this.BoostersTable                   = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable1");
            this.BoostersTable.TableArrangement  = false;
            this.BoostersTable2                  = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable2");
            this.BoostersTable2.TableArrangement = false;
            AgeUtils.HighDefinition              = highDefinition;
        }
        this.stackedBoosters.Clear();
        this.stackedBoosters2.Clear();
        float num7  = 0f;
        bool  flag5 = false;
        bool  flag6 = false;
        bool  flag7 = false;
        bool  flag8 = false;
        float num8  = AgeUtils.HighDefinition ? 3f : 2f;

        if (!this.IsOtherEmpire)
        {
            foreach (string text in new List <string>
            {
                "BoosterFood",
                "BoosterCadavers",
                "BoosterIndustry",
                "FlamesIndustryBooster",
                "BoosterScience"
            })
            {
                BoosterDefinition boosterDefinition2;
                if (this.database.TryGetValue(text, out boosterDefinition2))
                {
                    GuiStackedBooster item = new GuiStackedBooster(boosterDefinition2);
                    this.stackedBoosters.Add(item);
                    if (!this.ParentIsCityListScreen && (text == "BoosterCadavers" || text == "FlamesIndustryBooster"))
                    {
                        this.stackedBoosters2.Add(item);
                    }
                }
            }
            bool flag9 = false;
            this.vaultBoosters = this.departmentOfEducation.GetVaultItems <BoosterDefinition>();
            for (int l = 0; l < this.vaultBoosters.Count; l++)
            {
                BoosterDefinition boosterDefinition = this.vaultBoosters[l].Constructible as BoosterDefinition;
                if (boosterDefinition != null)
                {
                    flag9 = true;
                    if (boosterDefinition.Name == "BoosterFood")
                    {
                        flag5 = true;
                    }
                    else if (boosterDefinition.Name == "BoosterIndustry")
                    {
                        flag6 = true;
                    }
                    else if (boosterDefinition.Name == "BoosterCadavers")
                    {
                        flag7 = true;
                    }
                    else if (boosterDefinition.Name == "FlamesIndustryBooster")
                    {
                        flag8 = true;
                    }
                    this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.RewardType == boosterDefinition.RewardType).AddVaultBooster(this.vaultBoosters[l]);
                }
            }
            if (!flag9)
            {
                this.stackedBoosters.Clear();
                this.stackedBoosters2.Clear();
            }
            else
            {
                num7 = this.FidsGroups[0].Height;
                if (!this.ParentIsCityListScreen)
                {
                    if (!flag6)
                    {
                        GuiStackedBooster item2 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry");
                        this.stackedBoosters.Remove(item2);
                    }
                    else
                    {
                        GuiStackedBooster item3 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster");
                        this.stackedBoosters.Remove(item3);
                    }
                    if (!flag5)
                    {
                        GuiStackedBooster item4 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood");
                        this.stackedBoosters.Remove(item4);
                    }
                    else
                    {
                        GuiStackedBooster item5 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers");
                        this.stackedBoosters.Remove(item5);
                    }
                    if (!flag6 && !flag5)
                    {
                        this.stackedBoosters2.Clear();
                    }
                }
                else
                {
                    if (flag8 && !flag6)
                    {
                        GuiStackedBooster item6 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry");
                        this.stackedBoosters.Remove(item6);
                    }
                    else if (!flag8)
                    {
                        GuiStackedBooster item7 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster");
                        this.stackedBoosters.Remove(item7);
                    }
                    if (!flag5 && flag7)
                    {
                        GuiStackedBooster item8 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood");
                        this.stackedBoosters.Remove(item8);
                    }
                    else if (!flag7)
                    {
                        GuiStackedBooster item9 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers");
                        this.stackedBoosters.Remove(item9);
                    }
                }
            }
        }
        this.BoostersTable2.ReserveChildren(this.stackedBoosters2.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item2");
        this.BoostersTable2.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters2, this.refreshDelegate, true, true);
        this.BoostersTable.ReserveChildren(this.stackedBoosters.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item");
        this.BoostersTable.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters, this.refreshDelegate, true, true);
        this.BoostersTable.PixelMarginTop  = base.AgeTransform.Height;
        this.BoostersTable2.PixelMarginTop = base.AgeTransform.Height + this.FidsGroups[0].Height + num8;
        float num9 = 0f;

        foreach (BoosterStock boosterStock in this.BoostersTable.GetChildren <BoosterStock>(true))
        {
            float num10 = num8;
            if (this.ParentIsCityListScreen && ((flag5 && flag7 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag6 && flag8 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "FlamesIndustryBooster"))))
            {
                boosterStock.AgeTransform.Width = this.FidsGroups[0].Width / 2f - 1f;
                if (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry")
                {
                    num10 = 2f;
                }
            }
            else
            {
                boosterStock.AgeTransform.Width = this.FidsGroups[0].Width;
            }
            if (boosterStock.GuiStackedBooster.Quantity == 0 || (flag && (num9 == 0f || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag2 && boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterScience"))
            {
                boosterStock.AgeTransform.Enable  = false;
                boosterStock.AgeTransform.Visible = false;
            }
            else
            {
                num7 = boosterStock.AgeTransform.Height;
                boosterStock.AgeTransform.Enable  = this.interactionsAllowed;
                boosterStock.AgeTransform.Visible = true;
                boosterStock.QuickActivation      = true;
                boosterStock.Guid = this.City.GUID;
                boosterStock.QuantityLabel.AgeTransform.AttachTop       = true;
                boosterStock.QuantityLabel.AgeTransform.AttachRight     = true;
                boosterStock.QuantityLabel.AgeTransform.PixelMarginLeft = 0f;
                boosterStock.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight;
                if (!this.ParentIsCityListScreen)
                {
                    boosterStock.IconImage.AgeTransform.PixelMarginLeft      = num8 * 2.5f;
                    boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f;
                }
                else
                {
                    boosterStock.IconImage.AgeTransform.PixelMarginLeft      = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f));
                    boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f));
                }
            }
            boosterStock.AgeTransform.X           = num9;
            boosterStock.AgeTransform.AttachRight = false;
            boosterStock.AgeTransform.AttachLeft  = true;
            num9 += boosterStock.AgeTransform.Width + num10;
        }
        if (this.BoostersTable2.GetChildren <BoosterStock>(true).Count > 0)
        {
            bool flag10 = false;
            num9 = 0f;
            foreach (BoosterStock boosterStock2 in this.BoostersTable2.GetChildren <BoosterStock>(true))
            {
                boosterStock2.AgeTransform.Width = this.FidsGroups[0].Width;
                if (boosterStock2.GuiStackedBooster.Quantity == 0 || (num9 == 0f && !flag5) || (num9 > 0f && !flag6) || (flag && num9 == 0f))
                {
                    boosterStock2.AgeTransform.Enable  = false;
                    boosterStock2.AgeTransform.Visible = false;
                }
                else
                {
                    flag10 = true;
                    boosterStock2.AgeTransform.Enable  = this.interactionsAllowed;
                    boosterStock2.AgeTransform.Visible = true;
                    boosterStock2.QuickActivation      = true;
                    boosterStock2.Guid = this.City.GUID;
                    boosterStock2.IconImage.AgeTransform.PixelMarginLeft      = num8 * 2.5f;
                    boosterStock2.QuantityLabel.AgeTransform.AttachTop        = true;
                    boosterStock2.QuantityLabel.AgeTransform.AttachRight      = true;
                    boosterStock2.QuantityLabel.AgeTransform.PixelMarginLeft  = 0f;
                    boosterStock2.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f;
                    boosterStock2.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight;
                }
                boosterStock2.AgeTransform.X           = num9;
                boosterStock2.AgeTransform.AttachRight = false;
                boosterStock2.AgeTransform.AttachLeft  = true;
                num9 += this.FidsGroups[0].Width + this.BoostersTable2.HorizontalSpacing;
            }
            num7 += (flag10 ? (this.FidsGroups[0].Height + num8) : 0f);
        }
        base.AgeTransform.Height          += num7;
        this.AgeModifierPosition.EndHeight = base.AgeTransform.Height;
        foreach (AgeTransform ageTransform in base.AgeTransform.GetChildren())
        {
            if (ageTransform.name.Contains("CityTile") || ageTransform.name.Contains("Total") || ageTransform.name.Contains("Modifiers"))
            {
                ageTransform.PixelMarginBottom = this.OriginalMargins[ageTransform.name] * (AgeUtils.HighDefinition ? 1.5f : 1f) + num7;
            }
        }
    }
Example #29
0
    public void RefreshContent()
    {
        if (this.KaijuGarrison == null)
        {
            return;
        }
        if (this.KaijuGarrison.Owner != null)
        {
            if (this.KaijuGarrison.Kaiju.OnArmyMode())
            {
                this.AgeTransform.Visible = false;
                return;
            }
            this.AgeTransform.Visible             = true;
            this.FactionIcon.AgeTransform.Visible = true;
            this.StatusImage.AgeTransform.Visible = false;
            this.StatusTurns.AgeTransform.Visible = false;
            this.TameCost.AgeTransform.Visible    = false;
            GuiEmpire guiEmpire = new GuiEmpire(this.KaijuGarrison.Owner);
            this.FactionIcon.Image              = guiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, false);
            this.FactionIcon.TintColor          = guiEmpire.Color;
            this.Frame.TintColor                = guiEmpire.Color;
            this.PinLine.TintColor              = guiEmpire.Color;
            this.KaijuIcon.TintColor            = guiEmpire.Color;
            this.StatusPanel.AgeTooltip.Content = string.Empty;
        }
        else
        {
            this.AgeTransform.Visible             = true;
            this.FactionIcon.AgeTransform.Visible = false;
            this.StatusImage.AgeTransform.Visible = true;
            this.StatusTurns.AgeTransform.Visible = true;
            this.Frame.TintColor     = this.KaijuGarrison.Empire.Color;
            this.PinLine.TintColor   = this.KaijuGarrison.Empire.Color;
            this.KaijuIcon.TintColor = this.KaijuGarrison.Empire.Color;
            KaijuCouncil agency = this.KaijuGarrison.KaijuEmpire.GetAgency <KaijuCouncil>();
            if (this.KaijuGarrison.Kaiju.IsWild())
            {
                this.StatusTurns.Text  = agency.RelocationETA.ToString();
                this.StatusImage.Image = AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Icons/kaijuMoveIcon", false);
                this.StatusPanel.AgeTooltip.Content = "%KaijuTurnsToMoveDescription";
            }
            else if (this.KaijuGarrison.Kaiju.IsStunned())
            {
                this.StatusTurns.Text  = this.KaijuGarrison.Kaiju.GetRemainingTurnBeforeStunFinish().ToString();
                this.StatusImage.Image = AgeManager.Instance.FindDynamicTexture("Gui/DynamicBitmaps/Icons/kaijuStunnedIcon", false);
                this.StatusPanel.AgeTooltip.Content = "%KaijuStunnedDescription";
            }
            KaijuTameCost kaijuTameCost = KaijuCouncil.GetKaijuTameCost();
            this.TameCost.AgeTransform.Visible = true;
            this.TameCost.Text = GuiFormater.FormatGui(kaijuTameCost.GetValue(this.empire), false, true, false, 0) + this.GuiService.FormatSymbol((ELCPUtilities.UseELCPSymbiosisBuffs ? agency.ELCPResourceName.ToString() : kaijuTameCost.ResourceName.ToString()) + "Dark");
        }
        if (this.statusPanelTooltip != null)
        {
            this.statusPanelTooltip.Content = "%KaijuSpawnedProperties";
        }
        if (this.panelTooltip != null)
        {
            GuiElement kaijuFactionGuiElement = this.KaijuFactionGuiElement;
            if (kaijuFactionGuiElement != null)
            {
                this.panelTooltip.Content = kaijuFactionGuiElement.Description;
            }
        }
        this.UnitNumber.Text = this.KaijuGarrison.UnitsCount.ToString();
        string text = (this.KaijuGuiUnit == null) ? this.KaijuGarrison.Kaiju.Name.ToString() : GuiUnitDesign.GetTruncatedTitle(this.KaijuGuiUnit.UnitDesign, this.KaijuName);

        this.KaijuName.Text = text;
    }