Пример #1
0
        public override string GetLocalizedTooltip()
        {
            string text = LocaleFormatter.FormatGeneric("AIINFO_WATER_CONSUMPTION", new object[]
            {
                this.GetWaterConsumption() * 16
            }) + Environment.NewLine + LocaleFormatter.FormatGeneric("AIINFO_ELECTRICITY_CONSUMPTION", new object[]
            {
                this.GetElectricityConsumption() * 16
            });

            if (this.m_waterConsumption > 0)
            {
                return(TooltipHelper.Append(base.GetLocalizedTooltip(), TooltipHelper.Format(new string[]
                {
                    LocaleFormatter.Info1,
                    text,
                    LocaleFormatter.Info2,
                    LocaleFormatter.FormatGeneric("AIINFO_WATER_INTAKE", new object[]
                    {
                        this.m_waterConsumption * 16 * m_consumption_multiplier
                    })
                })));
            }
            return(TooltipHelper.Append(base.GetLocalizedTooltip(), TooltipHelper.Format(new string[]
            {
                LocaleFormatter.Info1,
                text,
                LocaleFormatter.Info2,
                LocaleFormatter.FormatGeneric("AIINFO_WATER_OUTLET", new object[]
                {
                    this.m_waterConsumption * 16 * m_consumption_multiplier
                })
            })));
        }
Пример #2
0
 public override string GetLocalizedTooltip()
 {
     return(TooltipHelper.Append(base.GetLocalizedTooltip(), TooltipHelper.Format(new string[]
     {
         LocaleFormatter.Info2,
         LocaleFormatter.FormatGeneric("AIINFO_WATER_OUTLET", new object[]
         {
             0
         })
     })));
 }
Пример #3
0
        public static string GetLocalizedTooltip(Asset asset, PrefabInfo prefab, string title)
        {
            MilestoneInfo unlockMilestone = prefab.GetUnlockMilestone();

            string text = TooltipHelper.Format(new string[]
            {
                LocaleFormatter.Title,
                title,
                LocaleFormatter.Sprite,
                (!string.IsNullOrEmpty(prefab.m_InfoTooltipThumbnail)) ? prefab.m_InfoTooltipThumbnail : prefab.name,
                LocaleFormatter.Text,
                (asset.findIt2Description + Asset.GetLocalizedDescription(prefab)),
                LocaleFormatter.Locked,
                (!ToolsModifierControl.IsUnlocked(unlockMilestone)).ToString()
            });

            ToolsModifierControl.GetUnlockingInfo(unlockMilestone, out string unlockDesc, out string currentValue, out string targetValue, out string progress, out string locked);

            string addTooltip = TooltipHelper.Format(new string[]
            {
                LocaleFormatter.LockedInfo,
                locked,
                LocaleFormatter.UnlockDesc,
                unlockDesc,
                LocaleFormatter.UnlockPopulationProgressText,
                progress,
                LocaleFormatter.UnlockPopulationTarget,
                targetValue,
                LocaleFormatter.UnlockPopulationCurrent,
                currentValue
            });

            text = TooltipHelper.Append(text, addTooltip);
            PrefabAI aI = prefab.GetAI();

            if (aI != null)
            {
                text = TooltipHelper.Append(text, aI.GetLocalizedTooltip());
            }

            if (prefab is PropInfo || prefab is TreeInfo)
            {
                text = TooltipHelper.Append(text, TooltipHelper.Format(new string[]
                {
                    LocaleFormatter.Cost,
                    LocaleFormatter.FormatCost(prefab.GetConstructionCost(), false)
                }));
            }

            return(text);
        }
        private void SpawnEntry(string name, bool enabled, MilestoneInfo info)
        {
            var landscapingInfo = (LandscapingPanel.LandscapingInfo)
                                  typeof(LandscapingPanel).GetProperty("landscapingInfo", BindingFlags.NonPublic | BindingFlags.Instance)
                                  .GetValue(this, null);

            landscapingInfo.m_DirtPrice = Singleton <TerrainManager> .instance.m_properties.m_dirtPrice;
            float  cost = (float)((double)landscapingInfo.m_DirtPrice * 65536.0 / 262144.0 * 512.0 / 100.0);
            string str  = TooltipHelper.Format(LocaleFormatter.Title, Locale.Get("LANDSCAPING_TITLE", name), LocaleFormatter.Sprite, name, LocaleFormatter.Text, Locale.Get("LANDSCAPING_DESC", name), LocaleFormatter.Locked, (!enabled).ToString(), LocaleFormatter.Cost, LocaleFormatter.FormatCubicCost(cost));

            if (Singleton <UnlockManager> .exists)
            {
                string unlockDesc;
                string currentValue;
                string targetValue;
                string progress;
                string locked;
                ToolsModifierControl.GetUnlockingInfo(info, out unlockDesc, out currentValue, out targetValue, out progress, out locked);
                string addTooltip = TooltipHelper.Format(LocaleFormatter.LockedInfo, locked, LocaleFormatter.UnlockDesc, unlockDesc, LocaleFormatter.UnlockPopulationProgressText, progress, LocaleFormatter.UnlockPopulationTarget, targetValue, LocaleFormatter.UnlockPopulationCurrent, currentValue);
                str = TooltipHelper.Append(str, addTooltip);
            }
            //begin mod
            string         buttonName;
            UITextureAtlas buttonAtlas;
            UIComponent    tooltipBox;

            if (name == "Ditch")
            {
                buttonName  = "TerrainDitch";
                buttonAtlas = Util.CreateAtlasFromEmbeddedResources(Assembly.GetExecutingAssembly(), "NaturalResourcesBrush.resources", new List <string> {
                    "TerrainDitch"
                });
                tooltipBox = GeneratedPanel.landscapingTooltipBox;
            }
            else if (name == "Sand")
            {
                buttonName  = "ResourceSand";
                tooltipBox  = GeneratedPanel.tooltipBox;
                buttonAtlas = UIView.GetAView().defaultAtlas;
            }
            else
            {
                buttonName  = "Landscaping" + name;
                buttonAtlas = null;
                tooltipBox  = GeneratedPanel.landscapingTooltipBox;
            }
            var button = (UIButton)this.SpawnEntry(name, str, buttonName, (UITextureAtlas)buttonAtlas, tooltipBox, enabled);

            button.objectUserData = (object)landscapingInfo;
            //end mod
        }