public static Brand MakeBrand(string name, string description = null) { if (LuaPowerData.customEnums[typeof(Brand)].Contains(name)) { MPLog.Log("ERROR: A Brand exists with this name already."); return(Brand.None); } Brand brand = (Brand)(LuaPowerData.customEnums[typeof(Brand)].Count); LuaPowerData.customEnums[typeof(Brand)].Add(name); Array.Resize(ref S.I.deCtrl.brandSprites, Mathf.Max(S.I.deCtrl.brandSprites.Length, (int)brand + 1)); Traverse.Create(S.I.foCtrl).Field("brandTypes").Method("Add", new Type[] { typeof(Brand) }).GetValue(new object[] { brand }); S.I.itemMan.brandTypes.Add(brand); BrandListCard brandListCard = UnityEngine.Object.Instantiate <BrandListCard>(S.I.foCtrl.brandListCardPrefab); brandListCard.transform.SetParent(S.I.foCtrl.focusGrid); brandListCard.foCtrl = S.I.foCtrl; brandListCard.displayButton = false; brandListCard.parentList = S.I.foCtrl.brandListCards; brandListCard.SetBrand(brand); brandListCard.tmpText.text = name; S.I.foCtrl.brandListCards.Add(brandListCard); LuaPowerLang.ImportTerm("BrandNames/" + name, name); if (description != null) { LuaPowerLang.ImportTerm("BrandDescriptions/" + name, description); } return(brand); }
static public void AddUpgrade(string name, string abbreviation, string description, string check, string effect) { if (LuaPowerData.customUpgrades.ContainsKey(name)) { Debug.LogError("'" + name + "' is already an upgrade."); return; } object obj = Traverse.Create(Traverse.Create <EffectActions>().Field("_Instance").GetValue <EffectActions>()).Field("myLuaScript").GetValue <Script>().Globals[check]; if (obj == null) { Debug.LogError("'" + check + "' is not a LUA Function."); return; } object obj2 = Traverse.Create(Traverse.Create <EffectActions>().Field("_Instance").GetValue <EffectActions>()).Field("myLuaScript").GetValue <Script>().Globals[effect]; if (obj2 == null) { Debug.LogError("'" + check + "' is not a LUA Function."); return; } LuaPowerData.customUpgrades.Add(name, new Tuple <string, string, string>(abbreviation, check, effect)); if (!LuaPowerData.customEnums[typeof(Enhancement)].Contains(name)) { LuaPowerData.customEnums[typeof(Enhancement)].Add(name); } LuaPowerLang.ImportTerm("Enhancements/" + name, description); }
public static void AddEffectTooltip(string effect, string name, string tooltip) { Effect effectEnum; if (!string.IsNullOrEmpty(effect) && Enum.TryParse(effect, out effectEnum)) { S.I.deCtrl.effectTooltips.Add((Effect)Enum.Parse(typeof(Effect), effect)); } else { customTooltips.Add(effect); } LuaPowerLang.ImportTerm("MechKeys/" + effect, name); LuaPowerLang.ImportTerm("MechTooltips/" + effect, tooltip); }
public static void AddTriggerTooltip(FTrigger trigger, string name, string tooltip) { S.I.deCtrl.triggerTooltips.Add(trigger); LuaPowerLang.ImportTerm("MechKeys/" + trigger.ToString(), name); LuaPowerLang.ImportTerm("MechTooltips/" + trigger.ToString(), tooltip); }
public static void AddEffectTooltip(Effect effect, string name, string tooltip) { S.I.deCtrl.effectTooltips.Add(effect); LuaPowerLang.ImportTerm("MechKeys/" + effect.ToString(), name); LuaPowerLang.ImportTerm("MechTooltips/" + effect.ToString(), tooltip); }
public static void AddTriggerTooltip(string trigger, string name, string tooltip) { S.I.deCtrl.triggerTooltips.Add((FTrigger)Enum.Parse(typeof(FTrigger), trigger)); LuaPowerLang.ImportTerm("MechKeys/" + trigger.ToString(), name); LuaPowerLang.ImportTerm("MechTooltips/" + trigger.ToString(), tooltip); }