public static DM_StatusEffect ParseStatusEffect(StatusEffect status)
        {
            var preset = status.GetComponent <EffectPreset>();

            At.Invoke(status, "OnAwake");

            var template = (DM_StatusEffect)Activator.CreateInstance(Serializer.GetBestDMType(status.GetType()));

            template.SerializeStatusEffect(status, preset);

            return(template);
        }
Exemplo n.º 2
0
            public static bool Prefix(QuickSlotPanel __instance, ref bool ___m_hideWanted, ref Character ___m_lastCharacter,
                                      ref bool ___m_initialized, QuickSlotDisplay[] ___m_quickSlotDisplays, bool ___m_active)
            {
                var self = __instance;

                if (___m_hideWanted && self.IsDisplayed)
                {
                    At.Invoke(self, "OnHide");
                }

                // check init
                if ((self.LocalCharacter == null || ___m_lastCharacter != self.LocalCharacter) && ___m_initialized)
                {
                    At.SetField(self, "m_initialized", false);
                }

                // normal update when initialized
                if (___m_initialized)
                {
                    if (self.UpdateInputVisibility)
                    {
                        for (int i = 0; i < ___m_quickSlotDisplays.Count(); i++)
                        {
                            At.Invoke(___m_quickSlotDisplays[i], "SetInputTargetAlpha", new object[] { (!___m_active) ? 0f : 1f });
                        }
                    }
                }

                // custom initialize setup
                else if (self.LocalCharacter != null)
                {
                    ___m_lastCharacter = self.LocalCharacter;
                    ___m_initialized   = true;

                    // set quickslot display refs (orig function)
                    for (int j = 0; j < ___m_quickSlotDisplays.Length; j++)
                    {
                        int refSlotID = ___m_quickSlotDisplays[j].RefSlotID;
                        ___m_quickSlotDisplays[j].SetQuickSlot(self.LocalCharacter.QuickSlotMngr.GetQuickSlot(refSlotID));
                    }

                    // if its a keyboard quickslot, set up the custom display stuff
                    if (self.name == "Keyboard" && self.transform.parent.name == "QuickSlot")
                    {
                        SetupKeyboardQuickslotDisplay(self, ___m_quickSlotDisplays);
                    }
                }

                return(false);
            }