New custom icon system (not fully done yet)
This commit is contained in:
@@ -8,38 +8,17 @@ public static class Tools
|
||||
{
|
||||
public static Sprite GetIconForUser(BigInteger user)
|
||||
{
|
||||
if (user == 1)
|
||||
{
|
||||
return Resources.Load<Sprite>("Icons/Icons/bird_-1");
|
||||
}
|
||||
else if (user == 2)
|
||||
{
|
||||
return Resources.Load<Sprite>("Icons/Icons/bird_-2");
|
||||
}
|
||||
else if (user == 4)
|
||||
{
|
||||
return Resources.Load<Sprite>("Icons/Icons/bird_-3");
|
||||
}
|
||||
else if (user == 3)
|
||||
{
|
||||
return Resources.Load<Sprite>("Icons/Icons/bird_-4");
|
||||
}
|
||||
else
|
||||
{
|
||||
return Resources.Load<Sprite>("Icons/Icons/bird_1");
|
||||
}
|
||||
if (user == 1) return Resources.Load<Sprite>("Icons/Icons/bird_-1");
|
||||
else if (user == 2) return Resources.Load<Sprite>("Icons/Icons/bird_-2");
|
||||
else if (user == 4) return Resources.Load<Sprite>("Icons/Icons/bird_-3");
|
||||
else if (user == 3) return Resources.Load<Sprite>("Icons/Icons/bird_-4");
|
||||
else return Resources.Load<Sprite>("Icons/Icons/bird_1");
|
||||
}
|
||||
|
||||
public static string FormatWithCommas(string number)
|
||||
{
|
||||
try
|
||||
{
|
||||
return FormatWithCommas(BigInteger.Parse(number));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return number;
|
||||
}
|
||||
try { return FormatWithCommas(BigInteger.Parse(number)); }
|
||||
catch { return number; }
|
||||
}
|
||||
|
||||
public static string FormatWithCommas(BigInteger number)
|
||||
@@ -84,4 +63,29 @@ public static class Tools
|
||||
foreach (Transform child in root.transform) RefreshHierarchy(child.gameObject);
|
||||
if (root.TryGetComponent<RectTransform>(out var rect)) LayoutRebuilder.ForceRebuildLayoutImmediate(rect);
|
||||
}
|
||||
|
||||
public static (string, string) FixIconData(string i)
|
||||
{
|
||||
int t = i.Length;
|
||||
int h = 128;
|
||||
int d = t - h;
|
||||
int a = d / 4;
|
||||
int b = h / 4;
|
||||
|
||||
string D = string.Concat(
|
||||
i.Substring(0, a),
|
||||
i.Substring(a + b, a),
|
||||
i.Substring(a * 2 + b * 2, a),
|
||||
i.Substring(a * 3 + b * 3, d - a * 3)
|
||||
);
|
||||
|
||||
string H = string.Concat(
|
||||
i.Substring(a, b),
|
||||
i.Substring(a * 2 + b, b),
|
||||
i.Substring(a * 3 + b * 2, b),
|
||||
i.Substring(a * 4 + b * 3, b)
|
||||
);
|
||||
|
||||
return (D, H);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user