2016-03-23 08:36:04 +08:00
|
|
|
|
using System.Collections.Generic;
|
2016-03-01 14:35:52 +08:00
|
|
|
|
using System.Reflection;
|
|
|
|
|
using StardewValley.Menus;
|
|
|
|
|
|
|
|
|
|
namespace StardewModdingAPI.Inheritance.Menus
|
|
|
|
|
{
|
2016-03-23 08:36:04 +08:00
|
|
|
|
public class SGameMenu : GameMenu
|
2016-03-01 14:35:52 +08:00
|
|
|
|
{
|
|
|
|
|
public GameMenu BaseGameMenu { get; private set; }
|
|
|
|
|
|
|
|
|
|
public List<ClickableComponent> tabs
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
get { return (List<ClickableComponent>) GetBaseFieldInfo("tabs").GetValue(BaseGameMenu); }
|
2016-03-01 14:35:52 +08:00
|
|
|
|
set { GetBaseFieldInfo("tabs").SetValue(BaseGameMenu, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<IClickableMenu> pages
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
get { return (List<IClickableMenu>) GetBaseFieldInfo("pages").GetValue(BaseGameMenu); }
|
2016-03-01 14:35:52 +08:00
|
|
|
|
set { GetBaseFieldInfo("pages").SetValue(BaseGameMenu, value); }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static SGameMenu ConstructFromBaseClass(GameMenu baseClass)
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
var s = new SGameMenu();
|
2016-03-01 14:35:52 +08:00
|
|
|
|
s.BaseGameMenu = baseClass;
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void receiveRightClick(int x, int y, bool playSound = true)
|
|
|
|
|
{
|
|
|
|
|
if (pages[currentTab] is InventoryPage)
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
Log.AsyncY("INV SCREEN");
|
2016-03-01 14:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
base.receiveRightClick(x, y, playSound);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static FieldInfo[] GetPrivateFields()
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
return typeof (GameMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic);
|
2016-03-01 14:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static FieldInfo GetBaseFieldInfo(string name)
|
|
|
|
|
{
|
2016-03-27 13:09:09 +08:00
|
|
|
|
return typeof (GameMenu).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic);
|
2016-03-01 14:35:52 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-03-27 13:09:09 +08:00
|
|
|
|
}
|