コード例 #1
0
        static bool Prefix(WorkOrderEntry_ReadyMech order, SimGameState __instance)
        {
            Logger.Debug("ML_ReadyMech Patch Installed");
            if (order.IsMechLabComplete)
            {
                return(false);
            }

            var index = __instance.ReadyingMechs.First(item => item.Value == order.Mech).Key;

            __instance.ReadyingMechs.Remove(index);
            __instance.ActiveMechs[index] = order.Mech;
            order.Mech.RefreshBattleValue();
            order.SetMechLabComplete(true);
            SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
            return(false);
        }
コード例 #2
0
        static bool Prefix(WorkOrderEntry_ReadyMech order, SimGameState __instance)
        {
            Logger.Debug("ML_Cancel_ReadyMech Patch Installed");
            if (order.IsMechLabComplete)
            {
                Logger.Debug("wtf is happening how");
                return(false);
            }

            var item  = __instance.ReadyingMechs.First(readying => readying.Value == order.Mech);
            var index = item.Key;

            Logger.Debug($"cancel index: {index}\nmech? {item.Value.GUID} : {order.Mech.GUID} : {order.Mech.Chassis.VariantName}");
            __instance.UnreadyMech(index, order.Mech);
            __instance.ReadyingMechs.Remove(index);
            SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
            return(false);
        }
コード例 #3
0
        static bool Prefix(int idx, MechDef mech, bool active, bool forcePlacement, bool displayMechPopup,
                           string mechAddedHeader, SimGameState __instance)
        {
            Logger.Debug("AddMech Prefix Patch Installed");
            if (displayMechPopup)
            {
                if (string.IsNullOrEmpty(mech.GUID))
                {
                    mech.SetGuid(__instance.GenerateSimGameUID());
                }

                var companyStats = Traverse.Create(__instance).Field("companyStats").GetValue <StatCollection>();
                companyStats.ModifyStat <int>("Mission", 0, "COMPANY_MechsAdded", StatCollection.StatOperation.Int_Add, 1, -1, true);
                if (string.IsNullOrEmpty(mechAddedHeader))
                {
                    mechAddedHeader = "'Mech Chassis Complete";
                    int num = (int)WwiseManager.PostEvent <AudioEventList_ui>(AudioEventList_ui.ui_sim_popup_newChassis, WwiseManager.GlobalAudioObject, (AkCallbackManager.EventCallback)null, (object)null);
                }

                mechAddedHeader += ": {0}";

                __instance.GetInterruptQueue().QueuePauseNotification(
                    string.Format(mechAddedHeader, (object)mech.Description.UIName), mech.Chassis.YangsThoughts,
                    __instance.GetCrewPortrait(SimGameCrew.Crew_Yang), "notification_mechreadycomplete", (Action)(() =>
                {
                    int firstFreeMechBay = __instance.GetFirstFreeMechBay();
                    if (firstFreeMechBay >= 0)
                    {
                        __instance.ActiveMechs[firstFreeMechBay] = mech;
                        SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs,
                                         __instance.ReadyingMechs);
                    }
                    else
                    {
                        __instance.CreateMechPlacementPopup(mech);
                    }
                }), "Continue", (Action)null, (string)null);
                return(false);
            }

            return(true);
        }
コード例 #4
0
 static void Postfix(int baySlot, MechDef def, SimGameState __instance)
 {
     Logger.Debug("UnreadyMech Patch Installed");
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }
コード例 #5
0
 static void Postfix(string id, bool pay, SimGameState __instance)
 {
     Logger.Debug("ScrapInactiveMech Patch Installed");
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }
コード例 #6
0
 static void Postfix(int idx, MechDef mech, bool active, SimGameState __instance)
 {
     Logger.Debug("RemoveMech Patch Installed");
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }
コード例 #7
0
 static void Postfix(int baySlot, string id, SimGameState __instance)
 {
     Logger.Debug("ReadyMech Postfix Patch Installed");
     EnableSort();
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }
コード例 #8
0
 static void Postfix(int idx, MechDef mech, bool active, bool forcePlacement, bool displayMechPopup,
                     string mechAddedHeader, SimGameState __instance)
 {
     Logger.Debug("AddMech Postfix Patch Installed");
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }
コード例 #9
0
 static void Postfix(SimGameState __instance)
 {
     Logger.Debug("_OnDefsLoadComplete Postfix Patch Installed");
     EnableSort();
     SortMechLabMechs(__instance.GetMaxActiveMechs(), __instance.ActiveMechs, __instance.ReadyingMechs);
 }