Ejemplo n.º 1
0
        public override void InitializeSettingsMenu()
        {
            base.InitializeSettingsMenu();

            AllowedStashTabsRoot =
                new CheckboxSettingDrawer(Settings.OnlyAllowedStashTabs, "Allowed Stash Tabs", GetUniqDrawerId());
            SettingsDrawers.Add(AllowedStashTabsRoot); //Adding checkbox to settings menu drawers

            var addTabButton       = new ButtonNode();
            var addTabButtonDrawer = new ButtonSettingDrawer(addTabButton, "Add Stash Tab", GetUniqDrawerId());

            AllowedStashTabsRoot.Children.Add(addTabButtonDrawer);

            addTabButton.OnPressed += delegate
            {
                var newNode = new StashTabNode();
                AddAllowedStashTabNode(newNode);
                Settings.AllowedStashTabs.Add(newNode);
            };

            foreach (var node in Settings.AllowedStashTabs)
            {
                AddAllowedStashTabNode(node);
            }
        }
Ejemplo n.º 2
0
        private List <StashTabNode> StashTabNodes = new List <StashTabNode>(); //This is for hot reload, we will unload it

        private void GenerateStashieSettingsMenu()                             //Separate func cuz we can call it in anu moment to reload all menu
        {
            if (FiltersMenuRootMenu != null)
            {
                SettingsDrawers.Remove(FiltersMenuRootMenu);
            }
            if (RefillMenuRootMenu != null)
            {
                SettingsDrawers.Remove(RefillMenuRootMenu);
            }

            FiltersMenuRootMenu = new BaseSettingsDrawer("Filters", GetUniqDrawerId());
            SettingsDrawers.Add(FiltersMenuRootMenu);

            var submenu = new Dictionary <string, BaseSettingsDrawer>();

            foreach (var customFilter in _customFilters)
            {
                if (!Settings.FilterOptions.TryGetValue(customFilter.Name, out var tabNode))
                {
                    tabNode = new StashTabNode();
                    Settings.FilterOptions.Add(customFilter.Name, tabNode);
                }

                StashTabNodes.Add(tabNode);
                StashTabController.RegisterStashNode(tabNode);

                var filterParent = FiltersMenuRootMenu;
                if (!string.IsNullOrEmpty(customFilter.SubmenuName))
                {
                    if (!submenu.TryGetValue(customFilter.SubmenuName, out filterParent))
                    {
                        filterParent = new BaseSettingsDrawer(customFilter.SubmenuName, GetUniqDrawerId());
                        FiltersMenuRootMenu.Children.Add(filterParent);
                        submenu.Add(customFilter.SubmenuName, filterParent);
                    }
                }

                filterParent.Children.Add(new StashTabNodeSettingDrawer(tabNode, customFilter.Name, GetUniqDrawerId()));
                customFilter.StashIndexNode = tabNode;
            }

            RefillMenuRootMenu =
                new CheckboxSettingDrawer(Settings.RefillCurrency, "Refill Currency", GetUniqDrawerId());
            SettingsDrawers.Add(RefillMenuRootMenu);

            RefillMenuRootMenu.Children.Add(new StashTabNodeSettingDrawer(Settings.CurrencyStashTab, "Currency Tab",
                                                                          GetUniqDrawerId()));
            StashTabController.RegisterStashNode(Settings.CurrencyStashTab);
            RefillMenuRootMenu.Children.Add(new CheckboxSettingDrawer(Settings.AllowHaveMore, "Allow Have More",
                                                                      GetUniqDrawerId()));

            var refillRoot = new BaseSettingsDrawer("Refills:", GetUniqDrawerId());

            RefillMenuRootMenu.Children.Add(refillRoot);

            var addTabButton       = new ButtonNode();
            var addTabButtonDrawer = new ButtonSettingDrawer(addTabButton, "Add Refill", GetUniqDrawerId());

            RefillMenuRootMenu.Children.Add(addTabButtonDrawer);

            addTabButton.OnPressed += delegate
            {
                var newRefill = new RefillProcessor();
                AddRefill(newRefill);
                Settings.Refills.Add(newRefill);
            };

            foreach (var refill in Settings.Refills)
            {
                AddRefill(refill);
            }
        }