update deprecated reflection API

This commit is contained in:
Jesse Plamondon-Willard 2018-01-11 00:50:16 -05:00
parent 402c27b29c
commit c4e92f5cf3
6 changed files with 9 additions and 9 deletions

View File

@ -17,7 +17,7 @@ namespace Omegasis.MuseumRearranger.Framework
private bool ShowInventory = true;
/// <summary>A reference to a private <see cref="MuseumMenu"/> field for use in the overridden draw code.</summary>
private readonly IPrivateField<bool> HoldingMuseumPiece;
private readonly IReflectedField<bool> HoldingMuseumPiece;
/*********
@ -27,7 +27,7 @@ namespace Omegasis.MuseumRearranger.Framework
/// <param name="reflection">Simplifies access to private game code.</param>
public NewMuseumMenu(IReflectionHelper reflection)
{
this.HoldingMuseumPiece = reflection.GetPrivateField<bool>(this, "holdingMuseumPiece");
this.HoldingMuseumPiece = reflection.GetField<bool>(this, "holdingMuseumPiece");
}
/// <summary>Toggle the inventory box.</summary>

View File

@ -5,6 +5,6 @@
"Description": "Lets you rearrange the museum without needing to donate something.",
"UniqueID": "Omegasis.MuseumRearranger",
"EntryDll": "MuseumRearranger.dll",
"MinimumApiVersion": "2.0",
"MinimumApiVersion": "2.3",
"UpdateKeys": [ "Nexus:428" ]
}

View File

@ -215,7 +215,7 @@ namespace Omegasis.SaveAnywhere
int endFacingDir = Convert.ToInt32(fields[4]);
schedulePathDescription = this.Helper.Reflection
.GetPrivateMethod(npc, "pathfindToNextScheduleLocation")
.GetMethod(npc, "pathfindToNextScheduleLocation")
.Invoke<SchedulePathDescription>(npc.currentLocation.name, npc.getTileX(), npc.getTileY(), endMap, x, y, endFacingDir, null, null);
index++;
}
@ -274,14 +274,14 @@ namespace Omegasis.SaveAnywhere
if ((npc.name.Equals("Penny") && (dayName.Equals("Tue") || dayName.Equals("Wed") || dayName.Equals("Fri"))) || (npc.name.Equals("Maru") && (dayName.Equals("Tue") || dayName.Equals("Thu"))) || (npc.name.Equals("Harvey") && (dayName.Equals("Tue") || dayName.Equals("Thu"))))
{
this.Helper.Reflection
.GetPrivateField<string>(npc, "nameofTodaysSchedule")
.GetField<string>(npc, "nameofTodaysSchedule")
.SetValue("marriageJob");
return "marriageJob";
}
if (!Game1.isRaining && schedule.ContainsKey("marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth)))
{
this.Helper.Reflection
.GetPrivateField<string>(npc, "nameofTodaysSchedule")
.GetField<string>(npc, "nameofTodaysSchedule")
.SetValue("marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth));
return "marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth);
}

View File

@ -5,6 +5,6 @@
"Description": "Lets you save almost anywhere.",
"UniqueID": "Omegasis.SaveAnywhere",
"EntryDll": "SaveAnywhere.dll",
"MinimumApiVersion": "2.0",
"MinimumApiVersion": "2.3",
"UpdateKeys": [ "Nexus:444" ]
}

View File

@ -55,7 +55,7 @@ namespace StardustCore.ModInfo
{
// if (Game1.activeClickableMenu.allClickableComponents == null) return;
try {
List<IClickableMenu> pages = ModCore.ModHelper.Reflection.GetPrivateValue<List<IClickableMenu>>(Game1.activeClickableMenu, "pages");
List<IClickableMenu> pages = ModCore.ModHelper.Reflection.GetField<List<IClickableMenu>>(Game1.activeClickableMenu, "pages").GetValue();
if (Game1.activeClickableMenu is GameMenu)
{
StardewValley.Menus.IClickableMenu s = pages[(Game1.activeClickableMenu as GameMenu).currentTab];

View File

@ -5,6 +5,6 @@
"Description": "A core mod that allows for other mods to be run.",
"UniqueID": "Omegasis.StardustCore",
"EntryDll": "StardustCore.dll",
"MinimumApiVersion": "2.0",
"MinimumApiVersion": "2.3",
"UpdateKeys": []
}