Exemplo n.º 1
0
 public static void InitializeLegacyLocalization()
 {
     FillNameCacheArray <PrefixID, int>("Prefix", prefix);
     for (int i = 0; i < gen.Length; i++)
     {
         gen[i] = Language.GetText("LegacyWorldGen." + i);
     }
     for (int j = 0; j < menu.Length; j++)
     {
         menu[j] = Language.GetText("LegacyMenu." + j);
     }
     for (int k = 0; k < inter.Length; k++)
     {
         inter[k] = Language.GetText("LegacyInterface." + k);
     }
     for (int l = 0; l < misc.Length; l++)
     {
         misc[l] = Language.GetText("LegacyMisc." + l);
     }
     for (int m = 0; m < mp.Length; m++)
     {
         mp[m] = Language.GetText("LegacyMultiplayer." + m);
     }
     for (int n = 0; n < tip.Length; n++)
     {
         tip[n] = Language.GetText("LegacyTooltip." + n);
     }
     for (int num = 0; num < chestType.Length; num++)
     {
         chestType[num] = Language.GetText("LegacyChestType." + num);
     }
     for (int num2 = 0; num2 < chestType2.Length; num2++)
     {
         chestType2[num2] = Language.GetText("LegacyChestType2." + num2);
     }
     for (int num3 = 0; num3 < dresserType.Length; num3++)
     {
         dresserType[num3] = Language.GetText("LegacyDresserType." + num3);
     }
     FillNameCacheArray <ItemID, short>("ItemName", _itemNameCache);
     FillNameCacheArray <ProjectileID, short>("ProjectileName", _projectileNameCache);
     FillNameCacheArray <NPCID, short>("NPCName", _npcNameCache);
     FillNameCacheArray <BuffID, int>("BuffName", _buffNameCache);
     FillNameCacheArray <BuffID, int>("BuffDescription", _buffDescriptionCache);
     FillNameCacheArray <EmoteID, int>("EmojiName", _emojiNameCache, leaveMissingEntriesBlank: true);
     for (int num4 = -65; num4 < 0; num4++)
     {
         _negativeNpcNameCache[-num4 - 1] = _npcNameCache[NPCID.FromNetId(num4)];
     }
     _negativeNpcNameCache[0]  = Language.GetText("NPCName.Slimeling");
     _negativeNpcNameCache[1]  = Language.GetText("NPCName.Slimer2");
     _negativeNpcNameCache[2]  = Language.GetText("NPCName.GreenSlime");
     _negativeNpcNameCache[3]  = Language.GetText("NPCName.Pinky");
     _negativeNpcNameCache[4]  = Language.GetText("NPCName.BabySlime");
     _negativeNpcNameCache[5]  = Language.GetText("NPCName.BlackSlime");
     _negativeNpcNameCache[6]  = Language.GetText("NPCName.PurpleSlime");
     _negativeNpcNameCache[7]  = Language.GetText("NPCName.RedSlime");
     _negativeNpcNameCache[8]  = Language.GetText("NPCName.YellowSlime");
     _negativeNpcNameCache[9]  = Language.GetText("NPCName.JungleSlime");
     _negativeNpcNameCache[53] = Language.GetText("NPCName.SmallRainZombie");
     _negativeNpcNameCache[54] = Language.GetText("NPCName.BigRainZombie");
     ItemTooltip.AddGlobalProcessor(delegate(string tooltip)
     {
         if (tooltip.Contains("<right>"))
         {
             InputMode inputMode = InputMode.XBoxGamepad;
             if (PlayerInput.UsingGamepad)
             {
                 inputMode = InputMode.XBoxGamepadUI;
             }
             if (inputMode == InputMode.XBoxGamepadUI)
             {
                 KeyConfiguration keyConfiguration = PlayerInput.CurrentProfile.InputModes[inputMode];
                 string text = PlayerInput.BuildCommand("", true, keyConfiguration.KeyStatus["MouseRight"]);
                 text        = text.Replace(": ", "");
                 tooltip     = tooltip.Replace("<right>", text);
             }
             else
             {
                 tooltip = tooltip.Replace("<right>", Language.GetTextValue("Controls.RightClick"));
             }
         }
         if (tooltip.Contains("<left>"))
         {
             InputMode inputMode2 = InputMode.XBoxGamepad;
             if (PlayerInput.UsingGamepad)
             {
                 inputMode2 = InputMode.XBoxGamepadUI;
             }
             if (inputMode2 == InputMode.XBoxGamepadUI)
             {
                 KeyConfiguration keyConfiguration2 = PlayerInput.CurrentProfile.InputModes[inputMode2];
                 string text2 = PlayerInput.BuildCommand("", true, keyConfiguration2.KeyStatus["MouseLeft"]);
                 text2        = text2.Replace(": ", "");
                 tooltip      = tooltip.Replace("<left>", text2);
             }
             else
             {
                 tooltip = tooltip.Replace("<left>", Language.GetTextValue("Controls.LeftClick"));
             }
         }
         return(tooltip);
     });
     for (int num5 = 0; num5 < _itemTooltipCache.Length; num5++)
     {
         _itemTooltipCache[num5] = ItemTooltip.None;
     }
     (from f in typeof(ItemID).GetFields(BindingFlags.Static | BindingFlags.Public)
      where f.FieldType == typeof(short)
      select f).ToList().ForEach(delegate(FieldInfo field)
     {
         short num6 = (short)field.GetValue(null);
         if (num6 > 0 && num6 < _itemTooltipCache.Length)
         {
             _itemTooltipCache[num6] = ItemTooltip.FromLanguageKey("ItemTooltip." + field.Name);
         }
     });
 }
Exemplo n.º 2
0
 public static void InitializeLegacyLocalization()
 {
     Lang.FillNameCacheArray <PrefixID, int>("Prefix", Lang.prefix, false);
     for (int index = 0; index < Lang.gen.Length; ++index)
     {
         Lang.gen[index] = Language.GetText("LegacyWorldGen." + (object)index);
     }
     for (int index = 0; index < Lang.menu.Length; ++index)
     {
         Lang.menu[index] = Language.GetText("LegacyMenu." + (object)index);
     }
     for (int index = 0; index < Lang.inter.Length; ++index)
     {
         Lang.inter[index] = Language.GetText("LegacyInterface." + (object)index);
     }
     for (int index = 0; index < Lang.misc.Length; ++index)
     {
         Lang.misc[index] = Language.GetText("LegacyMisc." + (object)index);
     }
     for (int index = 0; index < Lang.mp.Length; ++index)
     {
         Lang.mp[index] = Language.GetText("LegacyMultiplayer." + (object)index);
     }
     for (int index = 0; index < Lang.tip.Length; ++index)
     {
         Lang.tip[index] = Language.GetText("LegacyTooltip." + (object)index);
     }
     for (int index = 0; index < Lang.chestType.Length; ++index)
     {
         Lang.chestType[index] = Language.GetText("LegacyChestType." + (object)index);
     }
     for (int index = 0; index < Lang.chestType2.Length; ++index)
     {
         Lang.chestType2[index] = Language.GetText("LegacyChestType2." + (object)index);
     }
     for (int index = 0; index < Lang.dresserType.Length; ++index)
     {
         Lang.dresserType[index] = Language.GetText("LegacyDresserType." + (object)index);
     }
     Lang.FillNameCacheArray <ItemID, short>("ItemName", Lang._itemNameCache, false);
     Lang.FillNameCacheArray <ProjectileID, short>("ProjectileName", Lang._projectileNameCache, false);
     Lang.FillNameCacheArray <NPCID, short>("NPCName", Lang._npcNameCache, false);
     Lang.FillNameCacheArray <BuffID, int>("BuffName", Lang._buffNameCache, false);
     Lang.FillNameCacheArray <BuffID, int>("BuffDescription", Lang._buffDescriptionCache, false);
     for (int id = -65; id < 0; ++id)
     {
         Lang._negativeNpcNameCache[-id - 1] = Lang._npcNameCache[NPCID.FromNetId(id)];
     }
     Lang._negativeNpcNameCache[0]  = Language.GetText("NPCName.Slimeling");
     Lang._negativeNpcNameCache[1]  = Language.GetText("NPCName.Slimer2");
     Lang._negativeNpcNameCache[2]  = Language.GetText("NPCName.GreenSlime");
     Lang._negativeNpcNameCache[3]  = Language.GetText("NPCName.Pinky");
     Lang._negativeNpcNameCache[4]  = Language.GetText("NPCName.BabySlime");
     Lang._negativeNpcNameCache[5]  = Language.GetText("NPCName.BlackSlime");
     Lang._negativeNpcNameCache[6]  = Language.GetText("NPCName.PurpleSlime");
     Lang._negativeNpcNameCache[7]  = Language.GetText("NPCName.RedSlime");
     Lang._negativeNpcNameCache[8]  = Language.GetText("NPCName.YellowSlime");
     Lang._negativeNpcNameCache[9]  = Language.GetText("NPCName.JungleSlime");
     Lang._negativeNpcNameCache[53] = Language.GetText("NPCName.SmallRainZombie");
     Lang._negativeNpcNameCache[54] = Language.GetText("NPCName.BigRainZombie");
     ItemTooltip.AddGlobalProcessor((TooltipProcessor)(tooltip =>
     {
         if (tooltip.Contains("<right>"))
         {
             InputMode index = InputMode.XBoxGamepad;
             if (PlayerInput.UsingGamepad)
             {
                 index = InputMode.XBoxGamepadUI;
             }
             if (index == InputMode.XBoxGamepadUI)
             {
                 string newValue = PlayerInput.BuildCommand("", true, PlayerInput.CurrentProfile.InputModes[index].KeyStatus["MouseRight"]).Replace(": ", "");
                 tooltip = tooltip.Replace("<right>", newValue);
             }
             else
             {
                 tooltip = tooltip.Replace("<right>", Language.GetTextValue("Controls.RightClick"));
             }
         }
         return(tooltip);
     }));
     for (int index = 0; index < Lang._itemTooltipCache.Length; ++index)
     {
         Lang._itemTooltipCache[index] = ItemTooltip.None;
     }
     ((IEnumerable <FieldInfo>) typeof(ItemID).GetFields(BindingFlags.Static | BindingFlags.Public)).Where <FieldInfo>((Func <FieldInfo, bool>)(f => f.FieldType == typeof(short))).ToList <FieldInfo>().ForEach((Action <FieldInfo>)(field =>
     {
         short num = (short)field.GetValue((object)null);
         if ((int)num <= 0 || (int)num >= Lang._itemTooltipCache.Length)
         {
             return;
         }
         Lang._itemTooltipCache[(int)num] = ItemTooltip.FromLanguageKey("ItemTooltip." + field.Name);
     }));
 }
Exemplo n.º 3
0
 public static void InitializeLegacyLocalization()
 {
     FillNameCacheArray <PrefixID, int>("Prefix", prefix);
     for (int i = 0; i < gen.Length; i++)
     {
         gen[i] = Language.GetText("LegacyWorldGen." + i);
     }
     for (int j = 0; j < menu.Length; j++)
     {
         menu[j] = Language.GetText("LegacyMenu." + j);
     }
     for (int k = 0; k < inter.Length; k++)
     {
         inter[k] = Language.GetText("LegacyInterface." + k);
     }
     for (int l = 0; l < misc.Length; l++)
     {
         misc[l] = Language.GetText("LegacyMisc." + l);
     }
     for (int m = 0; m < mp.Length; m++)
     {
         mp[m] = Language.GetText("LegacyMultiplayer." + m);
     }
     for (int n = 0; n < tip.Length; n++)
     {
         tip[n] = Language.GetText("LegacyTooltip." + n);
     }
     for (int num = 0; num < chestType.Length; num++)
     {
         chestType[num] = Language.GetText("LegacyChestType." + num);
     }
     for (int num2 = 0; num2 < dresserType.Length; num2++)
     {
         dresserType[num2] = Language.GetText("LegacyDresserType." + num2);
     }
     FillNameCacheArray <ItemID, short>("ItemName", _itemNameCache);
     FillNameCacheArray <MobileLangID, short>("Mobile", mobile);
     for (int num3 = 0; num3 < _negativeItemNameCache.Length; num3++)
     {
         _negativeItemNameCache[num3] = LocalizedText.Empty;
     }
     _negativeItemNameCache[23] = Language.GetText("ItemName.YellowPhasesaber");
     _negativeItemNameCache[22] = Language.GetText("ItemName.WhitePhasesaber");
     _negativeItemNameCache[21] = Language.GetText("ItemName.PurplePhasesaber");
     _negativeItemNameCache[20] = Language.GetText("ItemName.GreenPhasesaber");
     _negativeItemNameCache[19] = Language.GetText("ItemName.RedPhasesaber");
     _negativeItemNameCache[18] = Language.GetText("ItemName.BluePhasesaber");
     FillNameCacheArray <ProjectileID, short>("ProjectileName", _projectileNameCache);
     FillNameCacheArray <NPCID, short>("NPCName", _npcNameCache);
     FillNameCacheArray <BuffID, int>("BuffName", _buffNameCache);
     FillNameCacheArray <BuffID, int>("BuffDescription", _buffDescriptionCache);
     for (int num4 = -65; num4 < 0; num4++)
     {
         _negativeNpcNameCache[-num4 - 1] = _npcNameCache[NPCID.FromNetId(num4)];
     }
     _negativeNpcNameCache[0]  = Language.GetText("NPCName.Slimeling");
     _negativeNpcNameCache[1]  = Language.GetText("NPCName.Slimer2");
     _negativeNpcNameCache[2]  = Language.GetText("NPCName.GreenSlime");
     _negativeNpcNameCache[3]  = Language.GetText("NPCName.Pinky");
     _negativeNpcNameCache[4]  = Language.GetText("NPCName.BabySlime");
     _negativeNpcNameCache[5]  = Language.GetText("NPCName.BlackSlime");
     _negativeNpcNameCache[6]  = Language.GetText("NPCName.PurpleSlime");
     _negativeNpcNameCache[7]  = Language.GetText("NPCName.RedSlime");
     _negativeNpcNameCache[8]  = Language.GetText("NPCName.YellowSlime");
     _negativeNpcNameCache[9]  = Language.GetText("NPCName.JungleSlime");
     _negativeNpcNameCache[53] = Language.GetText("NPCName.SmallRainZombie");
     _negativeNpcNameCache[54] = Language.GetText("NPCName.BigRainZombie");
     ItemTooltip.AddGlobalProcessor(delegate(string tooltip)
     {
         if (tooltip.Contains("<right>"))
         {
             tooltip = tooltip.Replace("<right>", Language.GetTextValue("Controls.RightClick"));
         }
         return(tooltip);
     });
     for (int num5 = 0; num5 < _itemTooltipCache.Length; num5++)
     {
         _itemTooltipCache[num5] = ItemTooltip.None;
     }
     for (int num6 = 0; num6 < _negativeItemTooltipCache.Length; num6++)
     {
         _negativeItemTooltipCache[num6] = ItemTooltip.None;
     }
     (from f in typeof(ItemID).GetFields(BindingFlags.Static | BindingFlags.Public)
      where f.FieldType == typeof(short)
      select f).ToList().ForEach(delegate(FieldInfo field)
     {
         short num8 = (short)field.GetValue(null);
         if (num8 > 0 && num8 < _itemTooltipCache.Length)
         {
             _itemTooltipCache[num8] = ItemTooltip.FromLanguageKey("ItemTooltip." + field.Name);
         }
     });
     _negativeItemTooltipCache[23] = ItemTooltip.FromLanguageKey("ItemTooltip.YellowPhasesaber");
     _negativeItemTooltipCache[22] = ItemTooltip.FromLanguageKey("ItemTooltip.WhitePhasesaber");
     _negativeItemTooltipCache[21] = ItemTooltip.FromLanguageKey("ItemTooltip.PurplePhasesaber");
     _negativeItemTooltipCache[20] = ItemTooltip.FromLanguageKey("ItemTooltip.GreenPhasesaber");
     _negativeItemTooltipCache[19] = ItemTooltip.FromLanguageKey("ItemTooltip.RedPhasesaber");
     _negativeItemTooltipCache[18] = ItemTooltip.FromLanguageKey("ItemTooltip.BluePhasesaber");
     for (int num7 = 0; num7 < Recipe.numRecipes; num7++)
     {
         Main.recipe[num7].createItem.RebuildTooltip();
     }
 }