Adapt to SMAPI for Android
This commit is contained in:
parent
a972062f5e
commit
f3dfcc64ae
|
@ -31,7 +31,7 @@ namespace UIInfoSuite
|
|||
int xPosition = (int)Tools.GetWidthInPlayArea() - 70 - 48 * _amountOfVisibleIcons;
|
||||
if (Game1.player.questLog.Any())
|
||||
{
|
||||
x -= 65;
|
||||
xPosition -= 65;
|
||||
}
|
||||
++_amountOfVisibleIcons;
|
||||
return new Point(xPosition, yPos);
|
||||
|
|
|
@ -90,15 +90,17 @@ namespace UIInfoSuite
|
|||
public static Item GetHoveredItem()
|
||||
{
|
||||
Item hoverItem = null;
|
||||
|
||||
for (int i = 0; i < Game1.onScreenMenus.Count; ++i)
|
||||
if (Game1.onScreenMenus != null)
|
||||
{
|
||||
Toolbar onScreenMenu = Game1.onScreenMenus[i] as Toolbar;
|
||||
if (onScreenMenu != null)
|
||||
for (int i = 0; i < Game1.onScreenMenus.Count; ++i)
|
||||
{
|
||||
FieldInfo hoverItemField = typeof(Toolbar).GetField("hoverItem", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
hoverItem = hoverItemField.GetValue(onScreenMenu) as Item;
|
||||
//hoverItemField.SetValue(onScreenMenu, null);
|
||||
Toolbar onScreenMenu = Game1.onScreenMenus[i] as Toolbar;
|
||||
if (onScreenMenu != null)
|
||||
{
|
||||
FieldInfo hoverItemField = typeof(Toolbar).GetField("hoverItem", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
hoverItem = hoverItemField.GetValue(onScreenMenu) as Item;
|
||||
//hoverItemField.SetValue(onScreenMenu, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ using StardewValley.Tools;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Media;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
@ -46,7 +45,7 @@ namespace UIInfoSuite.UIElements
|
|||
private bool _showLevelUpAnimation = true;
|
||||
private bool _showExperienceBar = true;
|
||||
private readonly IModHelper _helper;
|
||||
private SoundPlayer _player;
|
||||
private object _player;
|
||||
|
||||
private LevelExtenderInterface _levelExtenderAPI;
|
||||
|
||||
|
@ -62,7 +61,7 @@ namespace UIInfoSuite.UIElements
|
|||
try
|
||||
{
|
||||
path = Path.Combine(_helper.DirectoryPath, "LevelUp.wav");
|
||||
_player = new SoundPlayer(path);
|
||||
_player = Type.GetType("System.Media.SoundPlayer")?.GetConstructor(new Type[] { }).Invoke(new object[] { });
|
||||
//path = path.Replace(Environment.CurrentDirectory, "");
|
||||
//path = path.TrimStart(Path.DirectorySeparatorChar);
|
||||
//_soundEffect = SoundEffect.FromStream(TitleContainer.OpenStream(path)).CreateInstance();
|
||||
|
@ -209,7 +208,7 @@ namespace UIInfoSuite.UIElements
|
|||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
_player.Play();
|
||||
Type.GetType("System.Media.SoundPlayer")?.GetMethod("Play").Invoke(this._player, new object[] { });
|
||||
});
|
||||
|
||||
Task.Factory.StartNew(() =>
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace UIInfoSuite.UIElements
|
|||
{
|
||||
if (Game1.activeClickableMenu is GameMenu gameMenu)
|
||||
{
|
||||
if (gameMenu.currentTab == 3)
|
||||
if (gameMenu.currentTab == (Constants.TargetPlatform == GamePlatform.Android ? 4 : 3))
|
||||
{
|
||||
List<String> namesToShow = new List<string>();
|
||||
foreach (var character in _townsfolk)
|
||||
|
|
|
@ -42,7 +42,8 @@ namespace UIInfoSuite.UIElements
|
|||
// draw shop harvest prices
|
||||
if (Game1.activeClickableMenu is ShopMenu menu)
|
||||
{
|
||||
if (menu.hoveredItem is Item hoverItem)
|
||||
object item = _helper.Reflection.GetField<object>(menu, "hoveredItem").GetValue();
|
||||
if (item is Item hoverItem)
|
||||
{
|
||||
String text = string.Empty;
|
||||
bool itemHasPriceInfo = Tools.GetTruePrice(hoverItem) > 0;
|
||||
|
@ -67,7 +68,8 @@ namespace UIInfoSuite.UIElements
|
|||
text = " " + temp.Price;
|
||||
}
|
||||
|
||||
var heldItem = menu.heldItem as Item;
|
||||
item = _helper.Reflection.GetField<object>(menu, "heldItem").GetValue();
|
||||
var heldItem = item as Item;
|
||||
if (heldItem == null)
|
||||
{
|
||||
int value = 0;
|
||||
|
@ -162,7 +164,7 @@ namespace UIInfoSuite.UIElements
|
|||
getHoveredItemExtraItemIndex.Invoke<int>(new object[0]),
|
||||
getHoveredItemExtraItemAmount.Invoke<int>(new object[0]),
|
||||
null,
|
||||
menu.hoverPrice);
|
||||
_helper.Reflection.GetField<Int32>(menu, "hoverPrice").GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ namespace UIInfoSuite.UIElements
|
|||
}
|
||||
}
|
||||
|
||||
String hoverText = gameMenu.hoverText;
|
||||
String hoverText = (string)gameMenu.GetType().GetField("hoverText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)?.GetValue(gameMenu);
|
||||
IClickableMenu.drawHoverText(
|
||||
Game1.spriteBatch,
|
||||
hoverText,
|
||||
|
|
Loading…
Reference in New Issue