2018-08-23 16:23:42 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
using Microsoft.Xna.Framework.Input;
|
|
|
|
using StardewModdingAPI;
|
|
|
|
using StardewValley;
|
|
|
|
using StardewValley.Menus;
|
|
|
|
using StardustCore.UIUtilities;
|
|
|
|
using StardustCore.UIUtilities.MenuComponents;
|
2019-07-25 05:16:04 +08:00
|
|
|
using StardustCore.UIUtilities.MenuComponents.ComponentsV1;
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
namespace StardustCore.Menus
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
// TODO: make buttons to cycle through page
|
|
|
|
public class ModularGameMenu : IClickableMenuExtended
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
public static SortedDictionary<string, List<KeyValuePair<Button, IClickableMenuExtended>>> StaticMenuTabsAndPages = new SortedDictionary<string, List<KeyValuePair<Button, IClickableMenuExtended>>>();
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
public string hoverText = "";
|
|
|
|
public string descriptionText = "";
|
2018-12-30 18:00:05 +08:00
|
|
|
public Dictionary<Button, IClickableMenuExtended> menuTabsAndPages;
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
public Button currentButton;
|
|
|
|
public IClickableMenuExtended currentMenu;
|
|
|
|
|
|
|
|
public bool invisible;
|
|
|
|
public static bool forcePreventClose;
|
|
|
|
|
|
|
|
public const int tabsPerPage = 12;
|
|
|
|
|
2018-08-24 00:42:54 +08:00
|
|
|
public int currentPageIndex;
|
|
|
|
|
2018-08-23 16:23:42 +08:00
|
|
|
public ModularGameMenu()
|
|
|
|
: 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)
|
|
|
|
{
|
2018-09-19 09:04:38 +08:00
|
|
|
//ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
2018-08-23 16:23:42 +08:00
|
|
|
if (Game1.activeClickableMenu == null)
|
|
|
|
Game1.playSound("bigSelect");
|
|
|
|
GameMenu.forcePreventClose = false;
|
|
|
|
|
|
|
|
this.menuTabsAndPages = new Dictionary<Button, IClickableMenuExtended>();
|
2018-09-19 09:04:38 +08:00
|
|
|
//ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
2018-08-23 16:23:42 +08:00
|
|
|
foreach (var v in StaticMenuTabsAndPages)
|
|
|
|
{
|
2018-09-19 09:04:38 +08:00
|
|
|
//ModCore.ModMonitor.Log("LIST A GO GO", LogLevel.Alert);
|
2018-08-23 16:23:42 +08:00
|
|
|
foreach (var pair in v.Value)
|
|
|
|
{
|
|
|
|
this.AddMenuTab(pair.Key, pair.Value.clone());
|
2018-09-19 09:04:38 +08:00
|
|
|
//ModCore.ModMonitor.Log("ADD IN A PART", LogLevel.Alert);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
//this.menuTabsAndPages.Add(v.Key,v.Value.clone());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static void AddTabsForMod(IManifest modManifest, List<KeyValuePair<Button, IClickableMenuExtended>> menuComponents)
|
|
|
|
{
|
|
|
|
StaticMenuTabsAndPages.Add(modManifest.UniqueID, menuComponents);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddMenuTab(Button b, IClickableMenuExtended menu)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
int count = this.menuTabsAndPages.Count % tabsPerPage;
|
2018-08-23 16:23:42 +08:00
|
|
|
int xPos = this.xPositionOnScreen + count * 64;
|
|
|
|
int yPos = this.yPositionOnScreen;
|
|
|
|
|
|
|
|
b.bounds = new Rectangle(xPos, yPos, b.bounds.Width, b.bounds.Height);
|
|
|
|
|
|
|
|
if (b.extraTextures == null)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
this.menuTabsAndPages.Add(b, menu);
|
2018-08-23 16:23:42 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < b.extraTextures.Count; i++)
|
|
|
|
{
|
|
|
|
ClickableTextureComponent text = b.extraTextures.ElementAt(i).Key;
|
|
|
|
Rectangle bounds = new Rectangle(b.bounds.X + text.bounds.X, b.bounds.Y + text.bounds.Y, text.bounds.Width, text.bounds.Height);
|
|
|
|
text.bounds = bounds;
|
2018-12-30 18:00:05 +08:00
|
|
|
b.extraTextures[i] = new KeyValuePair<ClickableTextureComponent, ExtraTextureDrawOrder>(text, b.extraTextures.ElementAt(i).Value);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
this.menuTabsAndPages.Add(b, menu);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Get how many pages there should be for the modular menu.</summary>
|
2018-08-23 16:23:42 +08:00
|
|
|
public int getNumberOfPages()
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
int count = (this.menuTabsAndPages.Count / tabsPerPage);
|
2018-08-23 16:23:42 +08:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Takes in the static declared tabs and tries to set the menu tabs to that.</summary>
|
|
|
|
public ModularGameMenu(int startingTab)
|
|
|
|
: 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)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
|
|
|
ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
|
|
|
if (Game1.activeClickableMenu == null)
|
|
|
|
Game1.playSound("bigSelect");
|
|
|
|
GameMenu.forcePreventClose = false;
|
|
|
|
|
|
|
|
this.menuTabsAndPages = new Dictionary<Button, IClickableMenuExtended>();
|
|
|
|
ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
|
|
|
foreach (var v in StaticMenuTabsAndPages)
|
|
|
|
{
|
|
|
|
ModCore.ModMonitor.Log("LIST A GO GO", LogLevel.Alert);
|
|
|
|
foreach (var pair in v.Value)
|
|
|
|
{
|
|
|
|
this.AddMenuTab(pair.Key, pair.Value.clone());
|
|
|
|
ModCore.ModMonitor.Log("ADD IN A PART", LogLevel.Alert);
|
|
|
|
}
|
|
|
|
//this.menuTabsAndPages.Add(v.Key,v.Value.clone());
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentPageIndex = startingTab % tabsPerPage;
|
|
|
|
this.changeTab(startingTab);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>Takes in the static declared tabs and tries to set the menu tabs to that.</summary>
|
|
|
|
public ModularGameMenu(string startingTab)
|
|
|
|
: 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)
|
2018-08-24 00:42:54 +08:00
|
|
|
{
|
|
|
|
ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
|
|
|
if (Game1.activeClickableMenu == null)
|
|
|
|
Game1.playSound("bigSelect");
|
|
|
|
GameMenu.forcePreventClose = false;
|
|
|
|
|
|
|
|
this.menuTabsAndPages = new Dictionary<Button, IClickableMenuExtended>();
|
|
|
|
ModCore.ModMonitor.Log("INITIALIZE MENU: ", LogLevel.Alert);
|
|
|
|
foreach (var v in StaticMenuTabsAndPages)
|
|
|
|
{
|
|
|
|
ModCore.ModMonitor.Log("LIST A GO GO", LogLevel.Alert);
|
|
|
|
foreach (var pair in v.Value)
|
|
|
|
{
|
|
|
|
this.AddMenuTab(pair.Key, pair.Value.clone());
|
|
|
|
ModCore.ModMonitor.Log("ADD IN A PART", LogLevel.Alert);
|
|
|
|
}
|
|
|
|
//this.menuTabsAndPages.Add(v.Key,v.Value.clone());
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
this.changeTab(this.getTabIndexFromName(startingTab));
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>More modular menu to only have a subset of buttons and pages.</summary>
|
|
|
|
public ModularGameMenu(int startingTab, Dictionary<Button, IClickableMenuExtended> tabsAndPages) : 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)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
|
|
|
foreach (var v in tabsAndPages)
|
|
|
|
{
|
|
|
|
this.AddMenuTab(v.Key, v.Value.clone());
|
|
|
|
}
|
|
|
|
this.changeTab(startingTab);
|
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
/// <summary>More modular menu to only have a subset of buttons and pages.</summary>
|
|
|
|
public ModularGameMenu(string startingTab, Dictionary<Button, IClickableMenuExtended> tabsAndPages)
|
|
|
|
: 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)
|
2018-08-24 00:42:54 +08:00
|
|
|
{
|
|
|
|
foreach (var v in tabsAndPages)
|
|
|
|
{
|
|
|
|
this.AddMenuTab(v.Key, v.Value.clone());
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
this.changeTab(this.getTabIndexFromName(startingTab));
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int getTabIndexFromName(string tabLabel)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
for (int i = 0; i < this.menuTabsAndPages.Count; i++)
|
2018-08-24 00:42:54 +08:00
|
|
|
{
|
|
|
|
var ok = this.menuTabsAndPages.ElementAt(i);
|
|
|
|
if (ok.Key.label == tabLabel)
|
|
|
|
{
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0; //If I can't find it just do a default.
|
|
|
|
}
|
|
|
|
|
2018-08-23 16:23:42 +08:00
|
|
|
public override void snapToDefaultClickableComponent()
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
if (this.currentTab < this.pages.Count)
|
|
|
|
this.pages[this.currentTab].snapToDefaultClickableComponent();
|
|
|
|
if (this.junimoNoteIcon == null || this.currentTab >= this.pages.Count || this.pages[this.currentTab].allClickableComponents.Contains((ClickableComponent)this.junimoNoteIcon))
|
|
|
|
return;
|
|
|
|
this.pages[this.currentTab].allClickableComponents.Add((ClickableComponent)this.junimoNoteIcon);
|
|
|
|
*/
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.snapToDefaultClickableComponent();
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void receiveGamePadButton(Buttons b)
|
|
|
|
{
|
|
|
|
base.receiveGamePadButton(b);
|
|
|
|
/*
|
|
|
|
switch (b)
|
|
|
|
{
|
|
|
|
case Buttons.Back:
|
|
|
|
if (this.currentTab != 0)
|
|
|
|
break;
|
|
|
|
this.pages[this.currentTab].receiveGamePadButton(b);
|
|
|
|
break;
|
|
|
|
case Buttons.RightTrigger:
|
|
|
|
if (this.currentTab == 3)
|
|
|
|
{
|
|
|
|
Game1.activeClickableMenu = (IClickableMenu)new GameMenu(4, -1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (this.currentTab >= 7 || !this.pages[this.currentTab].readyToClose())
|
|
|
|
break;
|
|
|
|
this.changeTab(this.currentTab + 1);
|
|
|
|
break;
|
|
|
|
case Buttons.LeftTrigger:
|
|
|
|
if (this.currentTab == 3)
|
|
|
|
{
|
|
|
|
Game1.activeClickableMenu = (IClickableMenu)new GameMenu(2, -1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (this.currentTab <= 0 || !this.pages[this.currentTab].readyToClose())
|
|
|
|
break;
|
|
|
|
this.changeTab(this.currentTab - 1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
*/
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.receiveGamePadButton(b);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void receiveLeftClick(int x, int y, bool playSound = true)
|
|
|
|
{
|
|
|
|
base.receiveLeftClick(x, y, playSound);
|
|
|
|
//click the menu and stuff here I guess.
|
2018-08-24 00:42:54 +08:00
|
|
|
Dictionary<Button, IClickableMenuExtended> subTabs = new Dictionary<Button, IClickableMenuExtended>();
|
2018-12-30 18:00:05 +08:00
|
|
|
for (int i = this.currentPageIndex * tabsPerPage; i < (this.currentPageIndex + 1) * tabsPerPage; i++)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (i >= this.menuTabsAndPages.Count)
|
|
|
|
break;
|
|
|
|
|
|
|
|
var pair = this.menuTabsAndPages.ElementAt(i);
|
|
|
|
subTabs.Add(pair.Key, pair.Value);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
2018-08-24 00:42:54 +08:00
|
|
|
|
|
|
|
foreach (var tab in subTabs)
|
|
|
|
{
|
|
|
|
if (tab.Key.containsPoint(x, y))
|
|
|
|
{
|
|
|
|
ModCore.ModMonitor.Log(tab.Key.label);
|
|
|
|
//this.hoverText = tab.Key.label;
|
2018-12-30 18:00:05 +08:00
|
|
|
this.changeTab(tab.Key, tab.Value);
|
2018-08-24 00:42:54 +08:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-08-23 16:23:42 +08:00
|
|
|
//Check for submenu leftclick
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.receiveLeftClick(x, y, playSound);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void receiveRightClick(int x, int y, bool playSound = true)
|
|
|
|
{
|
|
|
|
//base.receiveLeftClick(x, y, playSound);
|
|
|
|
//click the menu and stuff here I guess.
|
2018-08-24 00:42:54 +08:00
|
|
|
|
2018-08-23 16:23:42 +08:00
|
|
|
//Check for submenu right
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.receiveRightClick(x, y);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void receiveScrollWheelAction(int direction)
|
|
|
|
{
|
|
|
|
base.receiveScrollWheelAction(direction);
|
|
|
|
//this.pages[this.currentTab].receiveScrollWheelAction(direction);
|
|
|
|
//check for submenu scroll action.
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.receiveScrollWheelAction(direction);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void performHoverAction(int x, int y)
|
|
|
|
{
|
|
|
|
base.performHoverAction(x, y);
|
|
|
|
this.hoverText = "";
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.performHoverAction(x, y);
|
2018-08-23 16:23:42 +08:00
|
|
|
//this.pages[this.currentTab].performHoverAction(x, y);
|
2018-08-24 00:42:54 +08:00
|
|
|
|
|
|
|
Dictionary<Button, IClickableMenuExtended> subTabs = new Dictionary<Button, IClickableMenuExtended>();
|
2018-12-30 18:00:05 +08:00
|
|
|
for (int i = this.currentPageIndex * tabsPerPage; i < (this.currentPageIndex + 1) * tabsPerPage; i++)
|
2018-08-24 00:42:54 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (i >= this.menuTabsAndPages.Count)
|
|
|
|
break;
|
|
|
|
|
|
|
|
var pair = this.menuTabsAndPages.ElementAt(i);
|
|
|
|
subTabs.Add(pair.Key, pair.Value);
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var tab in subTabs)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
|
|
|
if (tab.Key.containsPoint(x, y))
|
|
|
|
{
|
|
|
|
this.hoverText = tab.Key.label;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void releaseLeftClick(int x, int y)
|
|
|
|
{
|
|
|
|
base.releaseLeftClick(x, y);
|
|
|
|
//this.pages[this.currentTab].releaseLeftClick(x, y);
|
2018-08-24 00:42:54 +08:00
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.releaseLeftClick(x, y);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
2018-08-24 00:42:54 +08:00
|
|
|
public void pageBack()
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (this.currentPageIndex != 0)
|
|
|
|
this.currentPageIndex--;
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public void pageForward()
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (this.currentPageIndex < this.getNumberOfPages())
|
|
|
|
this.currentPageIndex++;
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
2018-08-23 16:23:42 +08:00
|
|
|
public override void leftClickHeld(int x, int y)
|
|
|
|
{
|
|
|
|
base.leftClickHeld(x, y);
|
|
|
|
//this.pages[this.currentTab].leftClickHeld(x, y);
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.leftClickHeld(x, y);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override bool readyToClose()
|
|
|
|
{
|
|
|
|
if (!GameMenu.forcePreventClose)
|
2018-12-30 18:00:05 +08:00
|
|
|
return this.currentMenu.readyToClose();
|
2018-08-23 16:23:42 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void changeTab(int which)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentPageIndex = which % tabsPerPage;
|
|
|
|
this.currentButton = this.menuTabsAndPages.ElementAt(which).Key;
|
|
|
|
this.currentMenu = this.menuTabsAndPages.ElementAt(which).Value;
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
2018-08-24 00:42:54 +08:00
|
|
|
public void changeTab(Button b, IClickableMenuExtended menu)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentButton = b;
|
|
|
|
this.currentMenu = menu;
|
2018-08-24 00:42:54 +08:00
|
|
|
}
|
|
|
|
|
2018-12-30 18:00:05 +08:00
|
|
|
public void setTabNeighborsForCurrentPage() { }
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
public override void draw(SpriteBatch b)
|
|
|
|
{
|
|
|
|
if (!this.invisible)
|
|
|
|
{
|
|
|
|
if (!Game1.options.showMenuBackground)
|
|
|
|
b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.4f);
|
|
|
|
//Game1.drawDialogueBox(this.xPositionOnScreen, this.yPositionOnScreen, currentMenu.width, currentMenu.height, false, true, (string)null, false);
|
|
|
|
//this.pages[this.currentTab].draw(b);
|
2018-12-30 18:00:05 +08:00
|
|
|
this.drawDialogueBoxBackground();
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
b.End();
|
|
|
|
b.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied, SamplerState.PointClamp, (DepthStencilState)null, (RasterizerState)null);
|
|
|
|
Dictionary<Button, IClickableMenuExtended> subTabs = new Dictionary<Button, IClickableMenuExtended>();
|
2018-12-30 18:00:05 +08:00
|
|
|
for (int i = this.currentPageIndex * tabsPerPage; i < (this.currentPageIndex + 1) * tabsPerPage; i++)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (i >= this.menuTabsAndPages.Count)
|
|
|
|
break;
|
|
|
|
|
|
|
|
var pair = this.menuTabsAndPages.ElementAt(i);
|
|
|
|
subTabs.Add(pair.Key, pair.Value);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
foreach (var tab in subTabs)
|
|
|
|
{
|
|
|
|
if (tab.Key.visible)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (tab.Key == this.currentButton)
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
tab.Key.draw(b, Color.White, new Vector2(0, 0));
|
2018-08-23 16:23:42 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
tab.Key.draw(b);
|
|
|
|
}
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.draw(b);
|
2018-08-23 16:23:42 +08:00
|
|
|
|
|
|
|
if (Game1.options.hardwareCursor)
|
|
|
|
return;
|
|
|
|
b.Draw(Game1.mouseCursors, new Vector2((float)Game1.getOldMouseX(), (float)Game1.getOldMouseY()), new Rectangle?(Game1.getSourceRectForStandardTileSheet(Game1.mouseCursors, Game1.options.gamepadControls ? 44 : 0, 16, 16)), Color.White, 0.0f, Vector2.Zero, (float)(4.0 + (double)Game1.dialogueButtonScale / 150.0), SpriteEffects.None, 1f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public override bool areGamePadControlsImplemented()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override void receiveKeyPress(Keys key)
|
|
|
|
{
|
2018-12-30 18:00:05 +08:00
|
|
|
if (Game1.options.menuButton.Contains(new InputButton(key)) && this.readyToClose())
|
2018-08-23 16:23:42 +08:00
|
|
|
{
|
|
|
|
Game1.exitActiveMenu();
|
|
|
|
Game1.playSound("bigDeSelect");
|
|
|
|
}
|
|
|
|
//this.pages[this.currentTab].receiveKeyPress(key);
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.receiveKeyPress(key);
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public override void emergencyShutDown()
|
|
|
|
{
|
|
|
|
base.emergencyShutDown();
|
2018-12-30 18:00:05 +08:00
|
|
|
this.currentMenu.emergencyShutDown();
|
2018-08-23 16:23:42 +08:00
|
|
|
}
|
|
|
|
}
|
2018-12-30 18:00:05 +08:00
|
|
|
}
|