Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.5 Compatibility for Split Screen #61

Merged
merged 19 commits into from Jan 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 2 additions & 6 deletions SDVModTest/Extensions/CollectionExtensions.cs
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.Generic;

namespace UIInfoSuite.Extensions
{
Expand All @@ -11,7 +7,7 @@ static class CollectionExtensions

public static TValue SafeGet<Tkey, TValue>(this IDictionary<Tkey, TValue> dictionary, Tkey key, TValue defaultValue = default(TValue))
{
TValue value = defaultValue;
var value = defaultValue;

if (dictionary != null)
{
Expand Down
11 changes: 5 additions & 6 deletions SDVModTest/Extensions/ObjectExtensions.cs
@@ -1,15 +1,14 @@
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using System;
using System.Collections.Generic;

namespace UIInfoSuite.Extensions
{
public static class ObjectExtensions
{
#region Memebers
private static readonly Dictionary<String, int> _npcHeadShotSize = new Dictionary<string, int>()
private static readonly Dictionary<string, int> _npcHeadShotSize = new Dictionary<string, int>()
{
{ "Piere", 9 },
{ "Sebastian", 7 },
Expand Down Expand Up @@ -55,17 +54,17 @@ public static Rectangle GetHeadShot(this NPC npc)
if (!_npcHeadShotSize.TryGetValue(npc.Name, out size))
size = 4;

Rectangle mugShotSourceRect = npc.getMugShotSourceRect();
var mugShotSourceRect = npc.getMugShotSourceRect();
mugShotSourceRect.Height -= size / 2;
mugShotSourceRect.Y -= size / 2;
return mugShotSourceRect;
}

public static String SafeGetString(this IModHelper helper, String key)
public static string SafeGetString(this IModHelper helper, string key)
{
String result = string.Empty;
var result = string.Empty;

if (!String.IsNullOrEmpty(key) &&
if (!string.IsNullOrEmpty(key) &&
helper != null)
{
result = helper.Translation.Get(key);
Expand Down
32 changes: 13 additions & 19 deletions SDVModTest/Extensions/StringExtensions.cs
@@ -1,44 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIInfoSuite.Extensions
namespace UIInfoSuite.Extensions
{
static class StringExtensions
{


public static Int32 SafeParseInt32(this String s)
public static int SafeParseInt32(this string s)
{
Int32 result = 0;
var result = 0;

if (!String.IsNullOrWhiteSpace(s))
if (!string.IsNullOrWhiteSpace(s))
{
Int32.TryParse(s, out result);
int.TryParse(s, out result);
}

return result;
}

public static Int64 SafeParseInt64(this String s)
public static long SafeParseInt64(this string s)
{
Int64 result = 0;
long result = 0;

if (!String.IsNullOrWhiteSpace(s))
Int64.TryParse(s, out result);
if (!string.IsNullOrWhiteSpace(s))
long.TryParse(s, out result);

return result;
}

public static bool SafeParseBool(this String s)
public static bool SafeParseBool(this string s)
{
bool result = false;
var result = false;

if (!String.IsNullOrWhiteSpace(s))
if (!string.IsNullOrWhiteSpace(s))
{
Boolean.TryParse(s, out result);
bool.TryParse(s, out result);
}

return result;
Expand Down
17 changes: 7 additions & 10 deletions SDVModTest/IconHandler.cs
@@ -1,14 +1,11 @@
using Microsoft.Xna.Framework;
using StardewValley;
using StardewModdingAPI.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIInfoSuite
{
class IconHandler
internal class IconHandler
{
public static IconHandler Handler { get; private set; }

Expand All @@ -18,7 +15,7 @@ static IconHandler()
Handler = new IconHandler();
}

private int _amountOfVisibleIcons;
private readonly PerScreen<int> _amountOfVisibleIcons = new PerScreen<int>();

private IconHandler()
{
Expand All @@ -27,19 +24,19 @@ private IconHandler()

public Point GetNewIconPosition()
{
int yPos = Game1.options.zoomButtons ? 290 : 260;
int xPosition = (int)Tools.GetWidthInPlayArea() - 70 - 48 * _amountOfVisibleIcons;
var yPos = Game1.options.zoomButtons ? 290 : 260;
var xPosition = Tools.GetWidthInPlayArea() - 70 - 48 * _amountOfVisibleIcons.Value;
if (Game1.player.questLog.Any())
{
xPosition -= 65;
}
++_amountOfVisibleIcons;
++_amountOfVisibleIcons.Value;
return new Point(xPosition, yPos);
}

public void Reset(object sender, EventArgs e)
{
_amountOfVisibleIcons = 0;
_amountOfVisibleIcons.Value = 0;
}


Expand Down
10 changes: 3 additions & 7 deletions SDVModTest/LEEvents.cs
@@ -1,14 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIInfoSuite
{
public interface LEEvents
public interface ILeEvents
{
event EventHandler OnXPChanged;
void raiseEvent();
event EventHandler OnXpChanged;
void RaiseEvent();
}
}
10 changes: 2 additions & 8 deletions SDVModTest/LanguageKeys.cs
@@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIInfoSuite
namespace UIInfoSuite
{
static class LanguageKeys
internal static class LanguageKeys
{
public const string Days = "Days";
public const string DaysToMature = "DaysToMature";
Expand Down
14 changes: 4 additions & 10 deletions SDVModTest/LevelExtenderInterface.cs
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UIInfoSuite
namespace UIInfoSuite
{
public interface LevelExtenderInterface
public interface ILevelExtenderInterface
{
int[] currentXP();
int[] requiredXP();
int[] CurrentXp();
int[] RequiredXp();
}
}
131 changes: 62 additions & 69 deletions SDVModTest/ModConfig.cs
@@ -1,83 +1,76 @@
using StardewModdingAPI;

namespace UIInfoSuite
namespace UIInfoSuite
{
class ModConfig
internal class ModConfig
{

public int[][] Sprinkler { get; set; } = new int[][]
{
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
public int[][] Sprinkler { get; set; } = {
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

public int[][] QualitySprinkler { get; set; } = new int[][]
{
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
public int[][] QualitySprinkler { get; set; } = {
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

public int[][] IridiumSprinkler { get; set; } = new int[][]
{
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
public int[][] IridiumSprinkler { get; set; } = {
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

public int[][] PrismaticSprinkler { get; set; } = new int[][]
{
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
public int[][] PrismaticSprinkler { get; set; } = {
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

public int[][] Beehouse { get; set; } = new int[][]
{
new int[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
new int[] { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 },
new int[] { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
new int[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new int[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new int[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }
public int[][] Beehouse { get; set; } = {
new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
new[] { 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0 },
new[] { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 },
new[] { 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0 },
new[] { 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0 },
new[] { 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0 },
new[] { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 }
};
}
}