public static void FixDefaults(SkirmishMechBayPanel __instance) { try { var mechDefs = __instance.dataManager.MechDefs.Select(pair => pair.Value).ToList(); AutoFixer.Shared.FixMechDef(mechDefs); if (Control.Settings.DEBUG_DumpMechDefs && Directory.Exists(Control.Settings.DEBUG_MechDefsDir)) { foreach (var mechDef in mechDefs) { var str = mechDef.ToJSON(); using (var fs = new FileStream(Path.Combine(Control.Settings.DEBUG_MechDefsDir, $"{mechDef.Description.Id}.json"), FileMode.Create)) { using (var sw = new StreamWriter(fs)) { sw.Write(str); sw.Flush(); } } } } } catch (Exception e) { Control.LogError(e); } }
private static IEnumerator CallBack(SkirmishMechBayPanel panel) { yield return(new WaitForEndOfFrame()); try { if (mechDefsIterator == null) { mechDefsIterator = panel.allMechs.GetEnumerator(); } while (mechDefsIterator.MoveNext()) { var mechDef = mechDefsIterator.Current; var screenshotPath = DebugScreenshotMechsFeature.Shared.ScreenshotPath(mechDef); if (File.Exists(screenshotPath)) { continue; } if (DebugScreenshotMechsFeature.Shared.Settings.OnlyInvalidMechs && MechValidationRules.ValidateMechDef(MechValidationLevel.Full, panel.dataManager, mechDef, null).All(x => !x.Value.Any())) { continue; } panel.SelectMech(mechDef); panel.OnEditMechClicked(); break; } } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Postfix(SkirmishMechBayPanel __instance) { try { __instance.StartCoroutine(CallBack(__instance)); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(SkirmishMechBayPanel __instance) { try { MechDefMods.PostProcessAfterLoading(__instance.dataManager); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(SkirmishMechBayPanel __instance) { try { BattleTechLoadFixFeature.PreloadComponents(__instance.dataManager); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
public static void Prefix(SkirmishMechBayPanel __instance) { try { BTLoadUtils.PreloadComponents(__instance.dataManager); } catch (Exception e) { Control.LogError(e); } }
public static void Prefix(SkirmishMechBayPanel __instance) { try { __instance.dataManager.RequestAllResourcesOfType(BattleTechResourceType.HeatSinkDef); __instance.dataManager.RequestAllResourcesOfType(BattleTechResourceType.UpgradeDef); __instance.dataManager.RequestAllResourcesOfType(BattleTechResourceType.WeaponDef); __instance.dataManager.RequestAllResourcesOfType(BattleTechResourceType.AmmunitionBoxDef); } catch (Exception e) { Control.mod.Logger.LogError(e); } }
internal static void Postfix(SkirmishMechBayPanel __instance) { try { var dm = __instance.dataManager; DataLoadedVerifications.AddedHeatSink(dm); DataLoadedVerifications.ModifiedHeatSink(dm); DataLoadedVerifications.ModifiedCombatGameConstantsViaAdvangedMerge(); DataLoadedVerifications.ModifiedCombatGameConstantsViaNormaldMerge(); DataLoadedVerifications.ModifiedDebugSettings(); DataLoadedVerifications.ModifiedGeneralGameTips(); Control.Logger.Log($"{DataLoadedVerifications.LogPrefix}Done."); } catch (Exception e) { Control.Logger.LogError(DataLoadedVerifications.LogPrefix, e); } }
private static IEnumerator CallBack(SkirmishMechBayPanel panel) { yield return(new WaitForEndOfFrame()); try { if (mechDefsIterator == null) { mechDefsIterator = panel.allMechs.GetEnumerator(); } if (mechDefsIterator.MoveNext()) { panel.SelectMech(mechDefsIterator.Current); panel.OnEditMechClicked(); } } catch (Exception e) { Control.mod.Logger.LogError(e); } }
static void Prefix(SkirmishMechBayPanel __instance, LanceDef lance) { try { if (CustomUnitsAPI.Detected()) { return; } int maxUnits = DropManager.DefaultMechSlots + DropManager.MaxAdditionalMechSlots; if (lance != null) { maxUnits = lance.LanceUnits.Length; } if (__instance.loadoutSlots.Length >= maxUnits) { return; } if (__instance.loadoutSlots.Length < 2) { maxUnits = __instance.loadoutSlots.Length; return; } ; float ydelta = __instance.loadoutSlots[1].GetComponent <RectTransform>().localPosition.y - __instance.loadoutSlots[0].GetComponent <RectTransform>().localPosition.y; int addUnits = maxUnits - __instance.loadoutSlots.Length; GameObject srcLayout = __instance.loadoutSlots[__instance.loadoutSlots.Length - 1].gameObject; List <LanceLoadoutSlot> slots = new List <LanceLoadoutSlot>(); slots.AddRange(__instance.loadoutSlots); for (int t = 0; t < addUnits; ++t) { GameObject nLayout = GameObject.Instantiate(srcLayout, srcLayout.transform.parent); RectTransform rt = nLayout.GetComponent <RectTransform>(); Vector3 pos = rt.localPosition; pos.y = srcLayout.GetComponent <RectTransform>().localPosition.y + (t + 1) * ydelta; rt.localPosition = pos; slots.Add(nLayout.GetComponent <LanceLoadoutSlot>()); } __instance.loadoutSlots = slots.ToArray(); } catch (Exception e) { Logger.M.TWL(0, e.ToString()); } }