diff --git a/src/Loader/Loader.csproj b/src/Loader/Loader.csproj index dc3f3b40..eeb07d6d 100644 --- a/src/Loader/Loader.csproj +++ b/src/Loader/Loader.csproj @@ -33,8 +33,8 @@ DEBUG;TRACE prompt 4 - false - SdkOnly + true + None True false true diff --git a/src/SMAPI.Mods.VirtualKeyboard/KeyButton.cs b/src/SMAPI.Mods.VirtualKeyboard/KeyButton.cs index 7fc1d6bd..3c275c10 100644 --- a/src/SMAPI.Mods.VirtualKeyboard/KeyButton.cs +++ b/src/SMAPI.Mods.VirtualKeyboard/KeyButton.cs @@ -50,7 +50,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard private bool ShouldTrigger(Vector2 screenPixels, SButton button) { - if (this.ButtonRectangle.Contains(screenPixels.X * Game1.options.zoomLevel, screenPixels.Y * Game1.options.zoomLevel) && !this.Hidden && button == SButton.MouseLeft) + if (this.ButtonRectangle.Contains(screenPixels.X, screenPixels.Y) && !this.Hidden && button == SButton.MouseLeft) { if (!this.Hidden) Toolbar.toolbarPressed = true; diff --git a/src/SMAPI.Mods.VirtualKeyboard/ModEntry.cs b/src/SMAPI.Mods.VirtualKeyboard/ModEntry.cs index e9434b36..0f886fd0 100644 --- a/src/SMAPI.Mods.VirtualKeyboard/ModEntry.cs +++ b/src/SMAPI.Mods.VirtualKeyboard/ModEntry.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using StardewModdingAPI; - namespace StardewModdingAPI.Mods.VirtualKeyboard { class ModEntry : Mod { + public static float ZoomScale; public override void Entry(IModHelper helper) { new VirtualToggle(helper, this.Monitor); diff --git a/src/SMAPI.Mods.VirtualKeyboard/VirtualToggle.cs b/src/SMAPI.Mods.VirtualKeyboard/VirtualToggle.cs index b2dac742..b0349a0e 100644 --- a/src/SMAPI.Mods.VirtualKeyboard/VirtualToggle.cs +++ b/src/SMAPI.Mods.VirtualKeyboard/VirtualToggle.cs @@ -40,7 +40,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard this.IsDefault = false; this.AutoHidden = this.ModConfig.vToggle.autoHidden; - this.VirtualToggleButton = new ClickableTextureComponent(new Rectangle(Game1.toolbarPaddingX + 64, 12, 128, 128), this.Texture, new Rectangle(0, 0, 16, 16), 5.75f, false); + this.VirtualToggleButton = new ClickableTextureComponent(new Rectangle(Game1.toolbarPaddingX + 64, 12, 128, 128), this.Texture, new Rectangle(0, 0, 16, 16), 4f, false); helper.WriteConfig(this.ModConfig); this.Helper.Events.Display.Rendered += this.OnRendered; @@ -126,7 +126,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard { return false; } - if (this.VirtualToggleButton.containsPoint((int)(screenPixels.X * Game1.options.zoomLevel), (int)(screenPixels.Y * Game1.options.zoomLevel))) + if (this.VirtualToggleButton.containsPoint((int)screenPixels.X, (int)screenPixels.Y)) { this.LastPressTick = tick; Toolbar.toolbarPressed = true; diff --git a/src/SMAPI/SMainActivity.cs b/src/SMAPI/SMainActivity.cs index ad45af8d..2e59b1ed 100644 --- a/src/SMAPI/SMainActivity.cs +++ b/src/SMAPI/SMainActivity.cs @@ -18,6 +18,7 @@ using File = Java.IO.File; using Newtonsoft.Json; using Java.Lang; using Java.Util; +using StardewModdingAPI.Mobile; using Bundle = Android.OS.Bundle; using Exception = System.Exception; using Thread = System.Threading.Thread; @@ -31,7 +32,7 @@ namespace StardewModdingAPI public static SMainActivity Instance; - private System.Action _callback; + private Action _callback; private static bool ErrorDetected; private static bool Migrating = false; @@ -39,12 +40,14 @@ namespace StardewModdingAPI protected override void OnCreate(Bundle bundle) { MainActivity.instance = this; - base.RequestWindowFeature(WindowFeatures.NoTitle); + this.RequestWindowFeature(WindowFeatures.NoTitle); if (Build.VERSION.SdkInt >= BuildVersionCodes.P) this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges; this.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen); this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); + // FarmMigrationPatch.Apply(); + SMainActivity.Instance = this; try { @@ -101,10 +104,10 @@ namespace StardewModdingAPI if (string.IsNullOrWhiteSpace(modPath)) modPath = "Mods"; - this.core = new SCore(System.IO.Path.Combine(EarlyConstants.StardewValleyBasePath, modPath), false, false); + this.core = new SCore(Path.Combine(EarlyConstants.StardewValleyBasePath, modPath), false, false); this.core.RunInteractively(); - Type.GetType("StardewValley.Mobile.MobileDisplay")?.GetMethod("SetupDisplaySettings", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(null, Array.Empty()); + typeof(MailActivity).Assembly.GetType("StardewValley.Mobile.MobileDisplay")?.GetMethod("SetupDisplaySettings", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(null, Array.Empty()); typeof(MainActivity).GetMethod("SetZoomScaleAndMenuButtonScale", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, Array.Empty()); this.SetPaddingForMenus(); @@ -140,11 +143,11 @@ namespace StardewModdingAPI public bool CheckSMAPIMigration() { string storagePath = this.GetExternalFilesDir(null).AbsolutePath; - if (Migrating) return false; + if (SMainActivity.Migrating) return false; if (Directory.Exists(storagePath + "/smapi-internal")) return true; - Migrating = true; + SMainActivity.Migrating = true; SAlertDialogUtil.AlertMessage($"SMAPI needs to locate StardewValley folder's content to continue", "Confirm", callback: type => { this.ShowMigrationPicker(); }); return false; @@ -155,7 +158,7 @@ namespace StardewModdingAPI base.OnActivityResult(requestCode, resultCode, data); if (requestCode != 1235) return; - this.RunOnUiThread((System.Action)(() => + this.RunOnUiThread((Action)(() => { if (resultCode == Result.Ok) this.CopySMAPIData(data.Data); @@ -173,7 +176,7 @@ namespace StardewModdingAPI Android.Content.Context context = Application.Context; string storagePath = context.GetExternalFilesDir(null).AbsolutePath; this.Window.SetFlags(WindowManagerFlags.NotTouchable, WindowManagerFlags.NotTouchable); - System.Action ContinueGame = () => + Action ContinueGame = () => { this.Window.ClearFlags(WindowManagerFlags.NotTouchable); this.IsDoingStorageMigration = false; @@ -205,7 +208,7 @@ namespace StardewModdingAPI } } } - catch (System.Exception ex) + catch (Exception ex) { string exMessage = ex.Message; } @@ -227,7 +230,7 @@ namespace StardewModdingAPI { string str = Path.Combine(dest, listFile.Name); if (!System.IO.File.Exists(str)) - DirectoryCopy(listFile, str); + SMainActivity.DirectoryCopy(listFile, str); } } else @@ -243,7 +246,7 @@ namespace StardewModdingAPI } } - public new void PromptForPermissionsIfNecessary(System.Action callback = null) + public new void PromptForPermissionsIfNecessary(Action callback = null) { if (this.HasPermissions) {