Пример #1
0
        internal void OnDisable()
        {
            ModComponentMenu.SetPagesVisible(false);

            previousMod = modSelector?.value;
            foreach (ModTab tab in modTabs.Values)
            {
                tab.requiresConfirmation = false;
            }
            SetConfirmButtonVisible(false);
        }
Пример #2
0
        internal void OnEnable()
        {
            ModComponentMenu.SetPagesVisible(true);

            if (modSelector.items.Count > 0)
            {
                modSelector.items.Sort();

                string modToSelect = modSelector.items.Contains(previousMod) ? previousMod : modSelector.items[0];
                modSelector.value = modToSelect;
                SelectMod(modToSelect);
            }
        }
            internal static void Postfix()
            {
                DateTime tStart = DateTime.UtcNow;

                try
                {
                    Logger.Log("Building ModComponent Menu GUI");
                    ModComponentMenu.BuildGUI();
                }
                catch (Exception e)
                {
                    Logger.LogError("Exception while building ModComponent Menu GUI\n" + e.ToString());
                    return;
                }

                long timeMillis = (long)(DateTime.UtcNow - tStart).TotalMilliseconds;

                Logger.Log("Done! Took " + timeMillis + " ms");
            }
            internal static void Postfix(Panel_OptionsMenu __instance)
            {
                if (!ModComponentMenu.HasVisiblePages())
                {
                    return;
                }

                BasicMenu basicMenu = __instance.m_BasicMenu;

                if (basicMenu is null)
                {
                    return;
                }

                //AddAnotherMenuItem(basicMenu); // We need one more than they have...
                BasicMenu.BasicMenuItemModel firstItem = basicMenu.m_ItemModelList[0];
                int itemIndex = basicMenu.GetItemCount();

                basicMenu.AddItem("ModComponent", MODCOMPONENT_ID, itemIndex, "ModComponent", "View information about ModComponent and your installed item packs.", null,
                                  new Action(() => ShowModComponentMenu(__instance)), firstItem.m_NormalTint, firstItem.m_HighlightTint);
            }