Compatibility fix for mods with input box

This commit is contained in:
ZaneYork 2020-03-19 18:20:40 +08:00
parent 9de08f81b1
commit 7472853d6b
1 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using StardewValley;
using StardewValley.Menus;
#pragma warning disable 1591 // missing documentation
@ -9,10 +8,20 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
public class TextBoxMethods : TextBox
{
public static void SelectedSetter(TextBox textBox, bool value)
{
if(!textBox.Selected && value)
{
typeof(TextBox).GetMethod("ShowAndroidKeyboard", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(textBox, new object[] { });
textBox.Selected = value;
}
else
textBox.Selected = value;
}
public TextBoxMethods(Texture2D textboxTexture, Texture2D caretTexture, SpriteFont font, Color textColor)
: base(textboxTexture, caretTexture, font, textColor, true, false)
{
}
}
}