Beispiel #1
0
 static RecyclingData()
 {
     LanguageWrapper.SetDefault(recycleTextID, recycleText);
     LanguageWrapper.SetDefault(recycleTooltipID, recycleTooltip);
     LanguageWrapper.SetDefault(nonRecyclableTextID, nonRecyclableText);
     LanguageWrapper.SetDefault(nonRecyclableTooltipID, nonRecyclableTooltip);
 }
Beispiel #2
0
            private static void LoadRecyclingTooltip(TechType recyclingTech)
            {
                TooltipFactoryWrapper.RegisterTech(recyclingTech);
                var lang = Language.main;

                if (lang == null)
                {
                    return;
                }

                if (IsBlackListed(recyclingTech))
                {
                    var errorText = lang.Get(nonRecyclableTooltipID);
                    LanguageWrapper.SetDefault("Tooltip_" + recyclingTech.AsString(), errorText);
                    return;
                }

                var data = CraftData.Get(recyclingTech);

                if (data == null)
                {
                    return;
                }
                var ings = new Dictionary <TechType, int>();

                for (var i = 0; i < data.linkedItemCount; i++)
                {
                    var item = data.GetLinkedItem(i);
                    ings[item] = ings.ContainsKey(item) ? (ings[item] + 1) : 1;
                }

                var builder = new System.Text.StringBuilder();

                foreach (var ing in ings)
                {
                    builder.Append(lang.Get(ing.Key.AsString()));
                    if (ing.Value > 1)
                    {
                        builder.Append(" (x");
                        builder.Append(ing.Value);
                        builder.Append(')');
                    }
                    builder.Append(", ");
                }
                if (builder.Length >= 2)
                {
                    builder.Length -= 2;
                }
                var ingList = builder.ToString();

                var tooltip  = lang.Get(recycleTooltipID);
                var formated = StringUtil.FormatWithFallback(tooltip, recycleTooltip, ingList);

                LanguageWrapper.SetDefault("Tooltip_" + recyclingTech.AsString(), formated);
            }
Beispiel #3
0
            private static void LoadRecyclingText(TechType originTech, TechType recyclingTech)
            {
                var lang = Language.main;

                if (lang == null)
                {
                    return;
                }

                if (IsBlackListed(recyclingTech))
                {
                    var translation1 = lang.Get(nonRecyclableTextID);
                    LanguageWrapper.SetDefault(recyclingTech.AsString(), translation1);
                    return;
                }

                var techName    = lang.Get(originTech.AsString());
                var translation = lang.Get(recycleTextID);
                var formated    = StringUtil.FormatWithFallback(translation, recycleText, techName);

                LanguageWrapper.SetDefault(recyclingTech.AsString(), formated);
            }