Merge branch 'android' of https://github.com/MartyrPher/SMAPI.git into android

# Conflicts:
#	src/SMAPI/Metadata/CoreAssetPropagator.cs
This commit is contained in:
yangzhi 2020-02-05 10:37:00 +08:00
commit dff5cbcae0
7 changed files with 41 additions and 27 deletions

View File

@ -5,7 +5,6 @@ using StardewValley;
using StardewValley.Menus;
using static StardewModdingAPI.Mods.VirtualKeyboard.ModConfig;
using System.Reflection;
using Microsoft.Xna.Framework.Input;
namespace StardewModdingAPI.Mods.VirtualKeyboard
{
@ -17,13 +16,9 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard
private object buttonPressed;
private object buttonReleased;
private object legacyButtonPressed;
private object legacyButtonReleased;
private readonly MethodBase RaiseButtonPressed;
private readonly MethodBase RaiseButtonReleased;
private readonly MethodBase Legacy_KeyPressed;
private readonly MethodBase Legacy_KeyReleased;
private readonly SButton buttonKey;
private readonly float transparency;
@ -70,7 +65,8 @@ namespace StardewModdingAPI.Mods.VirtualKeyboard
{
if (this.buttonRectangle.Contains(screenPixels.X * Game1.options.zoomLevel, screenPixels.Y * Game1.options.zoomLevel))
{
Toolbar.toolbarPressed = true;
if (!this.hidden)
Toolbar.toolbarPressed = true;
return true;
}
return false;

View File

@ -20,10 +20,7 @@ namespace StardewModdingAPI
** Public
****/
/// <summary>SMAPI's current semantic version.</summary>
public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.2.0");
/// <summary>Android SMAPI's current semantic version.</summary>
public static ISemanticVersion AndroidApiVersion { get; } = new Toolkit.SemanticVersion("3.1.0-experimental");
public static ISemanticVersion ApiVersion { get; } = new Toolkit.SemanticVersion("3.2.0.1", allowNonStandard: true);
/// <summary>The minimum supported version of Stardew Valley.</summary>
public static ISemanticVersion MinimumGameVersion { get; } = new GameVersion("1.4.1");
@ -98,7 +95,7 @@ namespace StardewModdingAPI
internal static string ModsPath { get; set; }
/// <summary>The game's current semantic version.</summary>
internal static ISemanticVersion GameVersion { get; } = new GameVersion("1.3.36");
internal static ISemanticVersion GameVersion { get; } = new GameVersion("1.4.4.122");
/// <summary>The target game platform.</summary>
internal static Platform Platform { get; } = Platform.Android;

View File

@ -14,30 +14,41 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
drawHoverText(b, text, font, xOffset, yOffset, moneyAmounttoDisplayAtBottom, boldTitleText, healAmountToDisplay, buffIconsToDsiplay, hoveredItem, currencySymbol, extraItemToShowIndex, extraItemToShowAmount, overideX, overrideY, alpha, craftingIngrediants, -1, 80, -1, additional_craft_materials);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, 1, true, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color, float scale)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, scale, true, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new void drawTextureBox(SpriteBatch b, Texture2D texture, Microsoft.Xna.Framework.Rectangle sourceRect, int x, int y, int width, int height, Color color, float scale, bool drawShadow)
{
drawTextureBox(b, texture, sourceRect, x, y, width, height, color, scale, drawShadow, false);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawHorizontalPartition(SpriteBatch b, int yPosition, bool small = false, int red = -1, int green = -1, int blue = -1)
{
this.drawMobileHorizontalPartition(b, 0, yPosition, 64, small);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawVerticalUpperIntersectingPartition(SpriteBatch b, int xPosition, int partitionHeight, int red = -1, int green = -1, int blue = -1)
{
this.drawVerticalUpperIntersectingPartition(b, xPosition, partitionHeight);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public new void drawVerticalIntersectingPartition(SpriteBatch b, int xPosition, int yPosition, int red = -1, int green = -1, int blue = -1)
{
this.drawVerticalIntersectingPartition(b, xPosition, yPosition);
}
}
}

View File

@ -16,5 +16,11 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
return getTrashReclamationPrice(item, player, -1);
}
[SuppressMessage("ReSharper", "CS0109", Justification = "The 'new' modifier applies when compiled on Windows.")]
public static new int getRandomItemFromSeason(string season, int randomSeedAddition, bool forQuest, bool changeDaily = true)
{
return getRandomItemFromSeason(season, randomSeedAddition, forQuest);
}
}
}

View File

@ -183,8 +183,7 @@ namespace StardewModdingAPI.Framework
this.ConsoleManager.OnMessageIntercepted += message => this.HandleConsoleMessage(this.MonitorForGame, message);
// init logging
//this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {Constants.Platform} ({EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)})", LogLevel.Info);
this.Monitor.Log($"MartyrPher's Android SMAPI Loader: {Constants.AndroidApiVersion} on Android: {Android.OS.Build.VERSION.Sdk}", LogLevel.Info);
this.Monitor.Log($"SMAPI {Constants.ApiVersion} with Stardew Valley {Constants.GameVersion} on {Constants.Platform}", LogLevel.Info); //({EnvironmentUtility.GetFriendlyPlatformName(Constants.Platform)})", LogLevel.Info);
this.Monitor.Log($"Mods go here: {modsPath}");
if (modsPath != Constants.DefaultModsPath)
this.Monitor.Log("(Using custom --mods-path argument.)", LogLevel.Trace);
@ -267,7 +266,7 @@ namespace StardewModdingAPI.Framework
// apply game patches
new GamePatcher(this.Monitor).Apply(
new EventErrorPatch(this.MonitorForGame),
//new DialogueErrorPatch(this.MonitorForGame, this.Reflection),
new DialogueErrorPatch(this.MonitorForGame, this.Reflection),
new ObjectErrorPatch(),
new LoadContextPatch(this.Reflection, this.GameInstance.OnLoadStageChanged),
new LoadErrorPatch(this.Monitor, this.GameInstance.OnSaveContentRemoved),
@ -340,8 +339,8 @@ namespace StardewModdingAPI.Framework
this.Monitor.Log($"You have SMAPI for developers, so the console will be much more verbose. You can disable developer mode by installing the non-developer version of SMAPI, or by editing {Constants.ApiConfigPath}.", LogLevel.Info);
if (!this.Settings.CheckForUpdates)
this.Monitor.Log($"You configured SMAPI to not check for updates. Running an old version of SMAPI is not recommended. You can enable update checks by reinstalling SMAPI or editing {Constants.ApiConfigPath}.", LogLevel.Warn);
if (!this.Monitor.WriteToConsole)
this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
//if (!this.Monitor.WriteToConsole)
//this.Monitor.Log("Writing to the terminal is disabled because the --no-terminal argument was received. This usually means launching the terminal failed.", LogLevel.Warn);
this.Monitor.VerboseLog("Verbose logging enabled.");
// update window titles
@ -469,7 +468,7 @@ namespace StardewModdingAPI.Framework
// load mods
resolver.ValidateManifests(mods, Constants.ApiVersion, toolkit.GetUpdateUrl);
//mods = resolver.ProcessDependencies(mods, modDatabase).ToArray();
mods = resolver.ProcessDependencies(mods, modDatabase).ToArray();
this.LoadMods(mods, this.Toolkit.JsonHelper, this.ContentCore, modDatabase);
// check for updates

View File

@ -353,11 +353,12 @@ namespace StardewModdingAPI.Metadata
case "loosesprites\\cursors": // Game1.LoadContent
Game1.mouseCursors = content.Load<Texture2D>(key);
foreach (DayTimeMoneyBox menu in Game1.onScreenMenus.OfType<DayTimeMoneyBox>())
{
foreach (ClickableTextureComponent button in new[] { menu.questButton, menu.zoomInButton, menu.zoomOutButton })
button.texture = Game1.mouseCursors;
}
//Game1.onScreenMenus is a List<T> instead of an IList<T>
//foreach (DayTimeMoneyBox menu in Game1.onScreenMenus)
//{
// foreach (ClickableTextureComponent button in new[] { menu.questButton, menu.zoomInButton, menu.zoomOutButton })
// button.texture = Game1.mouseCursors;
//}
return true;
case "loosesprites\\cursors2": // Game1.LoadContent
@ -921,7 +922,7 @@ namespace StardewModdingAPI.Metadata
if (lastScheduleTime != 0)
{
//villager.scheduleTimeToTry = NPC.NO_TRY; // use time that's passed in to checkSchedule
this.Reflection.GetField<int>(villager, "scheduleTimeToTry").SetValue(0x98967f);
this.Reflection.GetField<int>(villager, "scheduleTimeToTry").SetValue(9999999);
villager.checkSchedule(lastScheduleTime);
}
}

View File

@ -26,6 +26,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -34,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>8.0</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
@ -62,6 +64,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\..\..\..\SteamLibrary\steamapps\common\Stardew Valley\smapi-internal\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="SMAPI.Toolkit">
<HintPath>..\SMAPI.Toolkit\bin\Debug\net4.5\SMAPI.Toolkit.dll</HintPath>
</Reference>
<Reference Include="StardewValley">
<HintPath>..\..\..\..\..\Downloads\StardewValleyAndroidStuff\base_1.4.4.118\assemblies\StardewValley.dll</HintPath>
</Reference>
@ -72,6 +77,9 @@
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Xml" />
<Reference Include="TMXTile">
<HintPath>..\..\..\..\..\..\..\SteamLibrary\steamapps\common\Stardew Valley\smapi-internal\TMXTile.dll</HintPath>
</Reference>
<Reference Include="xTile">
<HintPath>..\..\..\..\..\AndroidStudioProjects\SMAPI Android Installer\app\src\main\assets\Stardew\xTile.dll</HintPath>
</Reference>
@ -389,10 +397,6 @@
<Project>{ed8e41fa-ddfa-4a77-932e-9853d279a129}</Project>
<Name>SMAPI.Toolkit.CoreInterfaces</Name>
</ProjectReference>
<ProjectReference Include="..\SMAPI.Toolkit\SMAPI.Toolkit.csproj">
<Project>{08184f74-60ad-4eee-a78c-f4a35ade6246}</Project>
<Name>SMAPI.Toolkit</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\SMAPI.Internal\SMAPI.Internal.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />