Ejemplo n.º 1
0
        public GeodeMenu(GeodeInfoMenuMod mod, GeodeInfoMenuConfig config, IList <Tuple <int[], bool[]> > items, GeodeMenuStateInfo savedState = null, bool forceReloadState = false)
            : base(Game1.viewport.Width / 2 - (800 + IClickableMenu.borderWidth * 2) / 2, Game1.viewport.Height / 2 - (600 + IClickableMenu.borderWidth * 2) / 2, 800 + IClickableMenu.borderWidth * 2, 600 + IClickableMenu.borderWidth * 2, true)
        {
            this.config   = config;
            this.modEntry = mod;
            this.wasSearchTextBoxSelectedWhenPageLeft = false;

            this.tabs.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen + IClickableMenu.tabYPositionRelativeToMenuY + Game1.tileSize, Game1.tileSize, Game1.tileSize), "search", "Search for Drops")
            {
                myID            = 15960,
                downNeighborID  = 0,
                rightNeighborID = 15961,
                tryDefaultIfNoDownNeighborExists = true,
                fullyImmutable = true
            });
            this.pages.Add((IClickableMenu) new SearchTab(mod, config, this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height));
            this.tabs.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 2, this.yPositionOnScreen + IClickableMenu.tabYPositionRelativeToMenuY + Game1.tileSize, Game1.tileSize, Game1.tileSize), "normal", "Geode")
            {
                myID            = 15961,
                downNeighborID  = 1,
                rightNeighborID = 15962,
                leftNeighborID  = 15960,
                tryDefaultIfNoDownNeighborExists = true,
                fullyImmutable = true
            });
            this.pages.Add((IClickableMenu) new GeodeTab("geode", items[0], this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height));
            this.tabs.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 3, this.yPositionOnScreen + IClickableMenu.tabYPositionRelativeToMenuY + Game1.tileSize, Game1.tileSize, Game1.tileSize), "frozen", "Frozen Geode")
            {
                myID            = 15962,
                downNeighborID  = 2,
                rightNeighborID = 15963,
                leftNeighborID  = 15961,
                tryDefaultIfNoDownNeighborExists = true,
                fullyImmutable = true
            });
            this.pages.Add((IClickableMenu) new GeodeTab("frozen geode", items[1], this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height));
            this.tabs.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 4, this.yPositionOnScreen + IClickableMenu.tabYPositionRelativeToMenuY + Game1.tileSize, Game1.tileSize, Game1.tileSize), "magma", "Magma Geode")
            {
                myID            = 15963,
                downNeighborID  = 3,
                rightNeighborID = 15964,
                leftNeighborID  = 15962,
                tryDefaultIfNoDownNeighborExists = true,
                fullyImmutable = true
            });
            this.pages.Add((IClickableMenu) new GeodeTab("magma geode", items[2], this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height));
            this.tabs.Add(new ClickableComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize * 5, this.yPositionOnScreen + IClickableMenu.tabYPositionRelativeToMenuY + Game1.tileSize, Game1.tileSize, Game1.tileSize), "omni", "Omni Geode")
            {
                myID           = 15964,
                downNeighborID = 4,
                leftNeighborID = 15963,
                tryDefaultIfNoDownNeighborExists = true,
                fullyImmutable = true
            });
            this.pages.Add((IClickableMenu) new GeodeTab("omni geode", items[3], this.xPositionOnScreen, this.yPositionOnScreen, this.width, this.height));

            if (Game1.activeClickableMenu == null)
            {
                Game1.playSound("bigSelect");
            }

            GeodeMenu.forcePreventClose = false;

            if (savedState != null)
            {
                (this.pages[0] as SearchTab).SetSearchBoxText(savedState.searchText);
                if (config.IfRememberingMenuStateAlsoRememberScrollBarPositions || forceReloadState)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        (this.pages[i] as IScrollableMenu).SetCurrentIndex(savedState.scrollBarIndicies[i]);
                    }
                }
            }

            if (Game1.options.SnappyMenus)
            {
                this.pages[this.currentTab].populateClickableComponentList();
                this.pages[this.currentTab].allClickableComponents.AddRange((IEnumerable <ClickableComponent>) this.tabs);
                this.snapToDefaultClickableComponent();
            }


            if (savedState != null)
            {
                this.ChangeTab(savedState.currentTab);
            }
        }
Ejemplo n.º 2
0
 public GeodeMenu(int startingTab, GeodeInfoMenuMod entry, GeodeInfoMenuConfig config, IList <Tuple <int[], bool[]> > items) : this(entry, config, items)
 {
     this.ChangeTab(startingTab);
 }