コード例 #1
0
        static void Postfix(PartyVM __instance)
        {
            if (!PartyManagerSettings.Settings.DisableUpdatedTroopLabel)
            {
                try
                {
                    GenericHelpers.LogDebug("PartyVM RefreshPartyInformation Patch", "Post called");
                    var logic = __instance.GetPartyScreenLogic();

                    if (logic == null)
                    {
                        GenericHelpers.LogDebug("RefreshPartyInformation.Postfix", "Logic null, skipping party label update");
                        return;
                    }

                    if (__instance.MainPartyTroops != null && logic?.RightOwnerParty?.PartySizeLimit != null)
                    {
                        __instance.MainPartyTroopsLbl = GetPMPartyListLabel(__instance.MainPartyTroopsLbl, __instance.MainPartyTroops, logic.RightOwnerParty.PartySizeLimit);
                    }

                    if (__instance.OtherPartyTroops != null && logic?.LeftOwnerParty?.PartySizeLimit != null)
                    {
                        __instance.OtherPartyTroopsLbl = GetPMPartyListLabel(__instance.OtherPartyTroopsLbl, __instance.OtherPartyTroops, logic.LeftOwnerParty.PartySizeLimit);
                    }
                }
                catch (Exception e)
                {
                    GenericHelpers.LogException("updateTroopLabelsPatch", e);
                }
            }
        }
コード例 #2
0
        static bool Prefix(PartyVM __instance)
        {
            if (PartyManagerSettings.Settings.EnableAutoSort)
            {
                GenericHelpers.LogDebug("PartyVM RefreshValues Patch", "Pre Update called");
                PartyController.CurrentInstance.PartyVM = __instance;
                PartyController.CurrentInstance.SortPartyScreen(SortType.Default, true);
            }

            return(true);
        }
        static bool Prefix(PartyVM __instance, SelectorVM <SelectorItemVM> s)
        {
            try
            {
                if (!__instance.CurrentCharacter.IsPrisoner && s.SelectedIndex != (int)__instance.CurrentCharacter.Character.CurrentFormationClass)
                {
                    var newFormation   = (FormationClass)s.SelectedIndex;
                    var name           = __instance.CurrentCharacter.Character.Name.ToString();
                    var savedFormation = new SavedFormation()
                    {
                        TroopName = name, Formation = newFormation
                    };
                    PartyManagerSettings.Settings.SavedFormations[name] = savedFormation;
                    PartyManagerSettings.Settings.SaveSettings();
                    GenericHelpers.LogDebug("PartyVMUpdateCurrentCharacterFormationPatch", $"{name}:{newFormation}");
                }
            }
            catch (Exception e)
            {
                GenericHelpers.LogException("PartyVMUpdateCurrentCharacterFormationPatch", e);
            }

            return(true);
        }