68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using StardewValley;
|
|
using StardewValley.Menus;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace UIInfoSuite
|
|
{
|
|
static class Tools
|
|
{
|
|
|
|
public static void CreateSafeDelayedDialogue(String dialogue, int timer)
|
|
{
|
|
Task.Factory.StartNew(() =>
|
|
{
|
|
Thread.Sleep(timer);
|
|
|
|
do
|
|
{
|
|
Thread.Sleep(TimeSpan.FromSeconds(1));
|
|
}
|
|
while (Game1.activeClickableMenu is GameMenu);
|
|
Game1.setDialogue(dialogue, true);
|
|
});
|
|
}
|
|
|
|
public static int GetWidthInPlayArea()
|
|
{
|
|
int result = 0;
|
|
|
|
if (Game1.isOutdoorMapSmallerThanViewport())
|
|
{
|
|
int right = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Right;
|
|
int totalWidth = Game1.currentLocation.map.Layers[0].LayerWidth * Game1.tileSize;
|
|
int someOtherWidth = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Right - totalWidth;
|
|
|
|
result = right - someOtherWidth / 2;
|
|
}
|
|
else
|
|
{
|
|
result = Game1.graphics.GraphicsDevice.Viewport.TitleSafeArea.Right;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
public static int GetTruePrice(Item item)
|
|
{
|
|
int truePrice = 0;
|
|
|
|
if (item is StardewValley.Object)
|
|
{
|
|
truePrice = (item as StardewValley.Object).sellToStorePrice() * 2;
|
|
}
|
|
else
|
|
{
|
|
int parentSheetIndex = item.parentSheetIndex;
|
|
//needs more
|
|
}
|
|
|
|
return truePrice;
|
|
}
|
|
}
|
|
}
|