Fix icon position for Android
This commit is contained in:
parent
134eb34c0a
commit
03314b2ea8
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI.Events;
|
using StardewModdingAPI.Events;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
|
@ -64,6 +65,8 @@ namespace UIInfoSuite.UIElements
|
||||||
.GetValue(_socialPage);
|
.GetValue(_socialPage);
|
||||||
int yOffset = 0;
|
int yOffset = 0;
|
||||||
|
|
||||||
|
if (Constants.TargetPlatform != GamePlatform.Android)
|
||||||
|
{
|
||||||
for (int i = slotPosition; i < slotPosition + 5 && i < _friendNames.Length; ++i)
|
for (int i = slotPosition; i < slotPosition + 5 && i < _friendNames.Length; ++i)
|
||||||
{
|
{
|
||||||
int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset;
|
int yPosition = Game1.activeClickableMenu.yPositionOnScreen + 130 + yOffset;
|
||||||
|
@ -102,7 +105,55 @@ namespace UIInfoSuite.UIElements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List<ClickableTextureComponent> sprites = (List<ClickableTextureComponent>)_socialPage.GetType().GetField("sprites", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(_socialPage);
|
||||||
|
for (int i = 0; i < _friendNames.Length; ++i)
|
||||||
|
{
|
||||||
|
if(sprites[i].bounds.Y < 40)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(sprites[i].bounds.Y > _socialPage.height)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Friendship friendshipValues;
|
||||||
|
String nextName = _friendNames[i];
|
||||||
|
if (Game1.player.friendshipData.TryGetValue(nextName, out friendshipValues))
|
||||||
|
{
|
||||||
|
int friendshipRawValue = friendshipValues.Points;
|
||||||
|
|
||||||
|
if (friendshipRawValue > 0)
|
||||||
|
{
|
||||||
|
int pointsToNextHeart = friendshipRawValue % 250;
|
||||||
|
int numHearts = friendshipRawValue / 250;
|
||||||
|
|
||||||
|
if (friendshipRawValue < 3000 &&
|
||||||
|
_friendNames[i] == Game1.player.spouse ||
|
||||||
|
friendshipRawValue < 2500)
|
||||||
|
{
|
||||||
|
DrawEachIndividualSquare(numHearts, pointsToNextHeart, sprites[i].bounds.Y + 40);
|
||||||
|
//if (!Game1.options.hardwareCursor)
|
||||||
|
// Game1.spriteBatch.Draw(
|
||||||
|
// Game1.mouseCursors,
|
||||||
|
// new Vector2(Game1.getMouseX(), Game1.getMouseY()),
|
||||||
|
// Game1.getSourceRectForStandardTileSheet(
|
||||||
|
// Game1.mouseCursors, Game1.mouseCursor,
|
||||||
|
// 16,
|
||||||
|
// 16),
|
||||||
|
// Color.White,
|
||||||
|
// 0.0f,
|
||||||
|
// Vector2.Zero,
|
||||||
|
// Game1.pixelZoom + (float)(Game1.dialogueButtonScale / 150.0),
|
||||||
|
// SpriteEffects.None,
|
||||||
|
// 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
String hoverText = gameMenu.hoverText;
|
String hoverText = gameMenu.hoverText;
|
||||||
IClickableMenu.drawHoverText(
|
IClickableMenu.drawHoverText(
|
||||||
Game1.spriteBatch,
|
Game1.spriteBatch,
|
||||||
|
@ -163,6 +214,8 @@ namespace UIInfoSuite.UIElements
|
||||||
for (int j = 0; j < 5 && numberOfPointsToDraw > 0; ++j, --numberOfPointsToDraw)
|
for (int j = 0; j < 5 && numberOfPointsToDraw > 0; ++j, --numberOfPointsToDraw)
|
||||||
{
|
{
|
||||||
if (_numArray[i][j] == 1)
|
if (_numArray[i][j] == 1)
|
||||||
|
{
|
||||||
|
if(Constants.TargetPlatform != GamePlatform.Android)
|
||||||
{
|
{
|
||||||
Game1.spriteBatch.Draw(
|
Game1.spriteBatch.Draw(
|
||||||
Game1.staminaRect,
|
Game1.staminaRect,
|
||||||
|
@ -173,6 +226,20 @@ namespace UIInfoSuite.UIElements
|
||||||
4),
|
4),
|
||||||
Color.Crimson);
|
Color.Crimson);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int heartsX = (int)_socialPage.GetType().GetField("heartsX", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_socialPage);
|
||||||
|
float widthMod = (float)_socialPage.GetType().GetField("widthMod", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(_socialPage);
|
||||||
|
Game1.spriteBatch.Draw(
|
||||||
|
Game1.staminaRect,
|
||||||
|
new Rectangle(
|
||||||
|
Game1.activeClickableMenu.xPositionOnScreen + heartsX + (int)(num2 * widthMod) + 24 + j * 4,
|
||||||
|
yPosition + i * 4,
|
||||||
|
4,
|
||||||
|
4),
|
||||||
|
Color.Crimson);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,6 +221,11 @@ namespace UIInfoSuite.UIElements
|
||||||
|
|
||||||
private Vector2 GetPetPositionAboveAnimal(Character animal)
|
private Vector2 GetPetPositionAboveAnimal(Character animal)
|
||||||
{
|
{
|
||||||
|
if(Constants.TargetPlatform == GamePlatform.Android)
|
||||||
|
{
|
||||||
|
return new Vector2(Game1.viewport.Width <= Game1.currentLocation.map.DisplayWidth ? (animal.position.X - Game1.viewport.X + 16) * Game1.options.zoomLevel : (animal.position.X + ((Game1.viewport.Width - Game1.currentLocation.map.DisplayWidth) / 2 + 18)) * Game1.options.zoomLevel,
|
||||||
|
Game1.viewport.Height <= Game1.currentLocation.map.DisplayHeight ? (animal.position.Y - Game1.viewport.Y - 34) * Game1.options.zoomLevel : (animal.position.Y + ((Game1.viewport.Height - Game1.currentLocation.map.DisplayHeight) / 2 - 50)) * Game1.options.zoomLevel);
|
||||||
|
}
|
||||||
return new Vector2(Game1.viewport.Width <= Game1.currentLocation.map.DisplayWidth ? animal.position.X - Game1.viewport.X + 16 : animal.position.X + ((Game1.viewport.Width - Game1.currentLocation.map.DisplayWidth) / 2 + 18),
|
return new Vector2(Game1.viewport.Width <= Game1.currentLocation.map.DisplayWidth ? animal.position.X - Game1.viewport.X + 16 : animal.position.X + ((Game1.viewport.Width - Game1.currentLocation.map.DisplayWidth) / 2 + 18),
|
||||||
Game1.viewport.Height <= Game1.currentLocation.map.DisplayHeight ? animal.position.Y - Game1.viewport.Y - 34 : animal.position.Y + ((Game1.viewport.Height - Game1.currentLocation.map.DisplayHeight) / 2 - 50));
|
Game1.viewport.Height <= Game1.currentLocation.map.DisplayHeight ? animal.position.Y - Game1.viewport.Y - 34 : animal.position.Y + ((Game1.viewport.Height - Game1.currentLocation.map.DisplayHeight) / 2 - 50));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue