public static void Postfix(LanceHeaderWidget __instance, List <MechDef> mechs)
        {
            LanceConfiguratorPanel lanceConfiguratorPanel = (LanceConfiguratorPanel)ReflectionHelper.GetPrivateField(__instance, "LC");

            if (!lanceConfiguratorPanel.IsSimGame)
            {
                return;
            }

            Contract activeContract = (Contract)ReflectionHelper.GetPrivateField(__instance, "activeContract");

            if (activeContract == null)
            {
                return;
            }

            int difficulty   = activeContract.Difficulty;
            int tonnageLimit = 0;

            if (!TonnageLimitByMissionDifficulty.GetTonnageLimit(difficulty, out tonnageLimit))
            {
                return;
            }

            float lanceTonnage = 0;

            foreach (MechDef mech in mechs)
            {
                lanceTonnage += mech.Chassis.Tonnage;
            }

            TextMeshProUGUI tonnageText = (TextMeshProUGUI)ReflectionHelper.GetPrivateField(__instance, "simLanceTonnageText");

            tonnageText.text = string.Format("{0} / {1} TONS", (int)lanceTonnage, tonnageLimit);
        }
        public static void Postfix(LanceConfiguratorPanel __instance, ref bool __result)
        {
            if (!__instance.IsSimGame)
            {
                return;
            }

            if (__instance.activeContract == null)
            {
                return;
            }

            int difficulty   = __instance.activeContract.Difficulty;
            int tonnageLimit = 0;

            if (!TonnageLimitByMissionDifficulty.GetTonnageLimit(difficulty, out tonnageLimit))
            {
                return;
            }

            float          lanceTonnage = 0;
            List <MechDef> mechs        = TonnageLimitByMissionDifficulty.GetMechDefs(__instance);

            foreach (MechDef mech in mechs)
            {
                lanceTonnage += mech.Chassis.Tonnage;
            }

            if (lanceTonnage <= tonnageLimit)
            {
                return;
            }

            __instance.lanceValid = false;

            String errorString = String.Format("Lance exceeds tonnage limit by {0} tons\n", lanceTonnage - tonnageLimit);

            LanceHeaderWidget headerWidget = (LanceHeaderWidget)ReflectionHelper.GetPrivateField(__instance, "headerWidget");

            headerWidget.RefreshLanceInfo(__instance.lanceValid, errorString, mechs);

            ReflectionHelper.SetPrivateField(__instance, "lanceErrorText", errorString);

            __result = __instance.lanceValid;
        }