parent
d9440155ca
commit
4ebf03ee48
|
@ -33,8 +33,8 @@
|
||||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
<AndroidUseSharedRuntime>true</AndroidUseSharedRuntime>
|
||||||
<AndroidLinkMode>SdkOnly</AndroidLinkMode>
|
<AndroidLinkMode>None</AndroidLinkMode>
|
||||||
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
<EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk>
|
||||||
<AndroidManagedSymbols>false</AndroidManagedSymbols>
|
<AndroidManagedSymbols>false</AndroidManagedSymbols>
|
||||||
<AndroidUseAapt2>true</AndroidUseAapt2>
|
<AndroidUseAapt2>true</AndroidUseAapt2>
|
||||||
|
|
|
@ -50,7 +50,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard
|
||||||
|
|
||||||
private bool ShouldTrigger(Vector2 screenPixels, SButton button)
|
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)
|
if (!this.Hidden)
|
||||||
Toolbar.toolbarPressed = true;
|
Toolbar.toolbarPressed = true;
|
||||||
|
|
|
@ -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
|
namespace StardewModdingAPI.Mods.VirtualKeyboard
|
||||||
{
|
{
|
||||||
class ModEntry : Mod
|
class ModEntry : Mod
|
||||||
{
|
{
|
||||||
|
public static float ZoomScale;
|
||||||
public override void Entry(IModHelper helper)
|
public override void Entry(IModHelper helper)
|
||||||
{
|
{
|
||||||
new VirtualToggle(helper, this.Monitor);
|
new VirtualToggle(helper, this.Monitor);
|
||||||
|
|
|
@ -40,7 +40,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard
|
||||||
this.IsDefault = false;
|
this.IsDefault = false;
|
||||||
this.AutoHidden = this.ModConfig.vToggle.autoHidden;
|
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);
|
helper.WriteConfig(this.ModConfig);
|
||||||
|
|
||||||
this.Helper.Events.Display.Rendered += this.OnRendered;
|
this.Helper.Events.Display.Rendered += this.OnRendered;
|
||||||
|
@ -126,7 +126,7 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard
|
||||||
{
|
{
|
||||||
return false;
|
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;
|
this.LastPressTick = tick;
|
||||||
Toolbar.toolbarPressed = true;
|
Toolbar.toolbarPressed = true;
|
||||||
|
|
|
@ -18,6 +18,7 @@ using File = Java.IO.File;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Java.Lang;
|
using Java.Lang;
|
||||||
using Java.Util;
|
using Java.Util;
|
||||||
|
using StardewModdingAPI.Mobile;
|
||||||
using Bundle = Android.OS.Bundle;
|
using Bundle = Android.OS.Bundle;
|
||||||
using Exception = System.Exception;
|
using Exception = System.Exception;
|
||||||
using Thread = System.Threading.Thread;
|
using Thread = System.Threading.Thread;
|
||||||
|
@ -31,7 +32,7 @@ namespace StardewModdingAPI
|
||||||
|
|
||||||
public static SMainActivity Instance;
|
public static SMainActivity Instance;
|
||||||
|
|
||||||
private System.Action _callback;
|
private Action _callback;
|
||||||
|
|
||||||
private static bool ErrorDetected;
|
private static bool ErrorDetected;
|
||||||
private static bool Migrating = false;
|
private static bool Migrating = false;
|
||||||
|
@ -39,12 +40,14 @@ namespace StardewModdingAPI
|
||||||
protected override void OnCreate(Bundle bundle)
|
protected override void OnCreate(Bundle bundle)
|
||||||
{
|
{
|
||||||
MainActivity.instance = this;
|
MainActivity.instance = this;
|
||||||
base.RequestWindowFeature(WindowFeatures.NoTitle);
|
this.RequestWindowFeature(WindowFeatures.NoTitle);
|
||||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.P) this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P) this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.ShortEdges;
|
||||||
|
|
||||||
this.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
|
this.Window.SetFlags(WindowManagerFlags.Fullscreen, WindowManagerFlags.Fullscreen);
|
||||||
this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
|
this.Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);
|
||||||
|
|
||||||
|
// FarmMigrationPatch.Apply();
|
||||||
|
|
||||||
SMainActivity.Instance = this;
|
SMainActivity.Instance = this;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -101,10 +104,10 @@ namespace StardewModdingAPI
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(modPath)) modPath = "Mods";
|
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();
|
this.core.RunInteractively();
|
||||||
|
|
||||||
Type.GetType("StardewValley.Mobile.MobileDisplay")?.GetMethod("SetupDisplaySettings", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(null, Array.Empty<object>());
|
typeof(MailActivity).Assembly.GetType("StardewValley.Mobile.MobileDisplay")?.GetMethod("SetupDisplaySettings", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.Invoke(null, Array.Empty<object>());
|
||||||
typeof(MainActivity).GetMethod("SetZoomScaleAndMenuButtonScale", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, Array.Empty<object>());
|
typeof(MainActivity).GetMethod("SetZoomScaleAndMenuButtonScale", BindingFlags.Instance | BindingFlags.NonPublic)?.Invoke(this, Array.Empty<object>());
|
||||||
this.SetPaddingForMenus();
|
this.SetPaddingForMenus();
|
||||||
|
|
||||||
|
@ -140,11 +143,11 @@ namespace StardewModdingAPI
|
||||||
public bool CheckSMAPIMigration()
|
public bool CheckSMAPIMigration()
|
||||||
{
|
{
|
||||||
string storagePath = this.GetExternalFilesDir(null).AbsolutePath;
|
string storagePath = this.GetExternalFilesDir(null).AbsolutePath;
|
||||||
if (Migrating) return false;
|
if (SMainActivity.Migrating) return false;
|
||||||
|
|
||||||
if (Directory.Exists(storagePath + "/smapi-internal"))
|
if (Directory.Exists(storagePath + "/smapi-internal"))
|
||||||
return true;
|
return true;
|
||||||
Migrating = true;
|
SMainActivity.Migrating = true;
|
||||||
SAlertDialogUtil.AlertMessage($"SMAPI needs to locate StardewValley folder's content to continue", "Confirm",
|
SAlertDialogUtil.AlertMessage($"SMAPI needs to locate StardewValley folder's content to continue", "Confirm",
|
||||||
callback: type => { this.ShowMigrationPicker(); });
|
callback: type => { this.ShowMigrationPicker(); });
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,7 +158,7 @@ namespace StardewModdingAPI
|
||||||
base.OnActivityResult(requestCode, resultCode, data);
|
base.OnActivityResult(requestCode, resultCode, data);
|
||||||
if (requestCode != 1235)
|
if (requestCode != 1235)
|
||||||
return;
|
return;
|
||||||
this.RunOnUiThread((System.Action)(() =>
|
this.RunOnUiThread((Action)(() =>
|
||||||
{
|
{
|
||||||
if (resultCode == Result.Ok)
|
if (resultCode == Result.Ok)
|
||||||
this.CopySMAPIData(data.Data);
|
this.CopySMAPIData(data.Data);
|
||||||
|
@ -173,7 +176,7 @@ namespace StardewModdingAPI
|
||||||
Android.Content.Context context = Application.Context;
|
Android.Content.Context context = Application.Context;
|
||||||
string storagePath = context.GetExternalFilesDir(null).AbsolutePath;
|
string storagePath = context.GetExternalFilesDir(null).AbsolutePath;
|
||||||
this.Window.SetFlags(WindowManagerFlags.NotTouchable, WindowManagerFlags.NotTouchable);
|
this.Window.SetFlags(WindowManagerFlags.NotTouchable, WindowManagerFlags.NotTouchable);
|
||||||
System.Action ContinueGame = () =>
|
Action ContinueGame = () =>
|
||||||
{
|
{
|
||||||
this.Window.ClearFlags(WindowManagerFlags.NotTouchable);
|
this.Window.ClearFlags(WindowManagerFlags.NotTouchable);
|
||||||
this.IsDoingStorageMigration = false;
|
this.IsDoingStorageMigration = false;
|
||||||
|
@ -205,7 +208,7 @@ namespace StardewModdingAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (System.Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
string exMessage = ex.Message;
|
string exMessage = ex.Message;
|
||||||
}
|
}
|
||||||
|
@ -227,7 +230,7 @@ namespace StardewModdingAPI
|
||||||
{
|
{
|
||||||
string str = Path.Combine(dest, listFile.Name);
|
string str = Path.Combine(dest, listFile.Name);
|
||||||
if (!System.IO.File.Exists(str))
|
if (!System.IO.File.Exists(str))
|
||||||
DirectoryCopy(listFile, str);
|
SMainActivity.DirectoryCopy(listFile, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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)
|
if (this.HasPermissions)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue