From 9a32b3afdda54e513cd370a0edfa87febc5cd1f0 Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Tue, 1 Mar 2016 01:35:52 -0500 Subject: trying to get custom content working - do NOT try to implement cc yet --- StardewModdingAPI/Inheritance/Menus/SGameMenu.cs | 60 ++++++++++++++++++++++ .../Inheritance/Menus/SInventoryPage.cs | 26 ++++++++++ 2 files changed, 86 insertions(+) create mode 100644 StardewModdingAPI/Inheritance/Menus/SGameMenu.cs create mode 100644 StardewModdingAPI/Inheritance/Menus/SInventoryPage.cs (limited to 'StardewModdingAPI/Inheritance/Menus') diff --git a/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs b/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs new file mode 100644 index 00000000..8b883fb6 --- /dev/null +++ b/StardewModdingAPI/Inheritance/Menus/SGameMenu.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics.Eventing.Reader; +using System.Linq; +using System.Reflection; +using System.Reflection.Emit; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework.Graphics; +using StardewValley; +using StardewValley.Menus; + +namespace StardewModdingAPI.Inheritance.Menus +{ + public class SGameMenu : StardewValley.Menus.GameMenu + { + public GameMenu BaseGameMenu { get; private set; } + + public List tabs + { + get { return (List)GetBaseFieldInfo("tabs").GetValue(BaseGameMenu); } + set { GetBaseFieldInfo("tabs").SetValue(BaseGameMenu, value); } + } + + public List pages + { + get { return (List)GetBaseFieldInfo("pages").GetValue(BaseGameMenu); } + set { GetBaseFieldInfo("pages").SetValue(BaseGameMenu, value); } + } + + public static SGameMenu ConstructFromBaseClass(GameMenu baseClass) + { + SGameMenu s = new SGameMenu(); + s.BaseGameMenu = baseClass; + return s; + } + + public override void receiveRightClick(int x, int y, bool playSound = true) + { + if (pages[currentTab] is InventoryPage) + { + Program.LogInfo("INV SCREEN"); + } + else + { + } + base.receiveRightClick(x, y, playSound); + } + + public static FieldInfo[] GetPrivateFields() + { + return typeof(GameMenu).GetFields(BindingFlags.Instance | BindingFlags.NonPublic); + } + + public static FieldInfo GetBaseFieldInfo(string name) + { + return typeof(GameMenu).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic); + } + } +} diff --git a/StardewModdingAPI/Inheritance/Menus/SInventoryPage.cs b/StardewModdingAPI/Inheritance/Menus/SInventoryPage.cs new file mode 100644 index 00000000..6bcb7662 --- /dev/null +++ b/StardewModdingAPI/Inheritance/Menus/SInventoryPage.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; +using StardewValley.Menus; + +namespace StardewModdingAPI.Inheritance.Menus +{ + public class SInventoryPage : InventoryPage + { + public InventoryPage BaseInventoryPage { get; private set; } + + public static SInventoryPage ConstructFromBaseClass(InventoryPage baseClass) + { + SInventoryPage s = new SInventoryPage(0,0,0,0); + s.BaseInventoryPage = baseClass; + return s; + } + + public SInventoryPage(int x, int y, int width, int height) : base(x, y, width, height) + { + } + } +} -- cgit