Modify some ui position for Android

This commit is contained in:
yangzhi 2020-02-20 11:39:13 +08:00
parent 03314b2ea8
commit 583fb44f4c
7 changed files with 92 additions and 0 deletions

View File

@ -519,6 +519,15 @@ namespace UIInfoSuite.UIElements
{
float leftSide = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Left;
if(Constants.TargetPlatform == GamePlatform.Android)
{
if (this._helper.Reflection.GetField<bool>(Game1.options, "verticalToolbar", true).GetValue())
{
Toolbar toolbar = this._helper.Reflection.GetField<Toolbar>(typeof(Game1), "toolbar", true).GetValue();
leftSide += this._helper.Reflection.GetField<int>(typeof(Game1), "toolbarPaddingX", true).GetValue() + this._helper.Reflection.GetProperty<int>(toolbar, "itemSlotSize", true).GetValue();
}
}
if (Game1.isOutdoorMapSmallerThanViewport())
{
int num3 = Game1.currentLocation.map.Layers[0].LayerWidth * Game1.tileSize;

View File

@ -1,4 +1,5 @@
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using System;
using System.Collections.Generic;
@ -24,6 +25,18 @@ namespace UIInfoSuite.UIElements
{
_position.Y -= 0.5f;
--_alpha;
if(Constants.TargetPlatform == GamePlatform.Android)
{
Game1.drawWithBorder(
"Exp " + _experiencePoints,
Color.DarkSlateGray * ((float)_alpha / 100f),
Color.PaleTurquoise * ((float)_alpha / 100f),
new Vector2(_position.X - 28, _position.Y - 130) * Game1.options.zoomLevel,
0.0f,
0.8f,
0.0f);
return;
}
Game1.drawWithBorder(
"Exp " + _experiencePoints,
Color.DarkSlateGray * ((float)_alpha / 100f),

View File

@ -85,6 +85,12 @@ namespace UIInfoSuite.UIElements
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
// draw hover text
if (Constants.TargetPlatform == GamePlatform.Android)
{
if (_icon.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)))
IClickableMenu.drawHoverText(Game1.spriteBatch, _hoverText, Game1.dialogueFont);
return;
}
if (_icon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
IClickableMenu.drawHoverText(Game1.spriteBatch, _hoverText, Game1.dialogueFont);
}

View File

@ -5,6 +5,7 @@ using StardewModdingAPI.Events;
using StardewValley;
using StardewValley.Menus;
using System;
using StardewModdingAPI;
namespace UIInfoSuite.UIElements
{
@ -137,6 +138,20 @@ namespace UIInfoSuite.UIElements
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
// draw hover text
if (Constants.TargetPlatform == GamePlatform.Android)
{
if (_birthdayNPC != null &&
(_birthdayIcon?.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)) ?? false))
{
String hoverText = String.Format("{0}'s Birthday", _birthdayNPC.Name);
IClickableMenu.drawHoverText(
Game1.spriteBatch,
hoverText,
Game1.dialogueFont);
}
return;
}
if (_birthdayNPC != null &&
(_birthdayIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
{

View File

@ -192,6 +192,17 @@ namespace UIInfoSuite.UIElements
texture.draw(Game1.spriteBatch);
if(Constants.TargetPlatform == GamePlatform.Android)
{
if (texture.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)))
{
IClickableMenu.drawHoverText(
Game1.spriteBatch,
"Gus is selling " + Game1.dishOfTheDay.DisplayName + " recipe today!",
Game1.dialogueFont);
}
return;
}
if (texture.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{
IClickableMenu.drawHoverText(
@ -209,6 +220,19 @@ namespace UIInfoSuite.UIElements
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
// draw hover text
if (Constants.TargetPlatform == GamePlatform.Android)
{
if (_drawQueenOfSauceIcon &&
_queenOfSauceIcon.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)))
{
IClickableMenu.drawHoverText(
Game1.spriteBatch,
_helper.SafeGetString(
LanguageKeys.TodaysRecipe) + _todaysRecipe,
Game1.dialogueFont);
}
return;
}
if (_drawQueenOfSauceIcon &&
_queenOfSauceIcon.containsPoint(Game1.getMouseX(), Game1.getMouseY()))
{

View File

@ -139,6 +139,18 @@ namespace UIInfoSuite.UIElements
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
// draw hover text
if (Constants.TargetPlatform == GamePlatform.Android)
{
if (_toolBeingUpgraded != null &&
(_toolUpgradeIcon?.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)) ?? false))
{
IClickableMenu.drawHoverText(
Game1.spriteBatch,
_hoverText, Game1.dialogueFont);
}
return;
}
if (_toolBeingUpgraded != null &&
(_toolUpgradeIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
{

View File

@ -79,6 +79,19 @@ namespace UIInfoSuite.UIElements
private void OnRenderedHud(object sender, RenderedHudEventArgs e)
{
// draw hover text
if (Constants.TargetPlatform == GamePlatform.Android)
{
if (_travelingMerchantIsHere && (_travelingMerchantIcon?.containsPoint((int)(Game1.getMouseX() * Game1.options.zoomLevel), (int)(Game1.getMouseY() * Game1.options.zoomLevel)) ?? false))
{
string hoverText = _helper.SafeGetString(
LanguageKeys.TravelingMerchantIsInTown);
IClickableMenu.drawHoverText(
Game1.spriteBatch,
hoverText, Game1.dialogueFont);
}
return;
}
if (_travelingMerchantIsHere && (_travelingMerchantIcon?.containsPoint(Game1.getMouseX(), Game1.getMouseY()) ?? false))
{
string hoverText = _helper.SafeGetString(