New custom icon system (not fully done yet)
This commit is contained in:
@@ -56,11 +56,11 @@ public class ProfileMenu : MonoBehaviour
|
||||
string coins,
|
||||
string playerName,
|
||||
BigInteger playerID,
|
||||
int playerIcon,
|
||||
int playerOverlay,
|
||||
string customIcon,
|
||||
int? playerIcon,
|
||||
int? playerOverlay,
|
||||
Color playerIconColor,
|
||||
Color playerOverlayColor
|
||||
Color playerOverlayColor,
|
||||
string customIcon
|
||||
)
|
||||
{
|
||||
normalBerryStat.text = normalBerries;
|
||||
@@ -77,34 +77,20 @@ public class ProfileMenu : MonoBehaviour
|
||||
if (customIcon == null)
|
||||
{
|
||||
playerIconImage.sprite = Resources.Load<Sprite>("Icons/Icons/bird_" + playerIcon);
|
||||
if (playerIcon == 1)
|
||||
{
|
||||
playerIconImage.sprite = Tools.GetIconForUser(playerID);
|
||||
}
|
||||
if (playerIcon == 1) playerIconImage.sprite = Tools.GetIconForUser(playerID);
|
||||
playerOverlayImage.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + playerOverlay);
|
||||
if (playerOverlay == 0)
|
||||
{
|
||||
playerOverlayImage.gameObject.SetActive(false);
|
||||
}
|
||||
else if (playerOverlay == 8)
|
||||
{
|
||||
playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-16.56f, 14.81f);
|
||||
}
|
||||
else if (playerOverlay == 11)
|
||||
{
|
||||
playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-14.74451f, 20.39122f);
|
||||
}
|
||||
else if (playerOverlay == 13)
|
||||
{
|
||||
playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-16.54019f, 14.70365f);
|
||||
}
|
||||
if (playerOverlay != 0) playerOverlayImage.gameObject.SetActive(true);
|
||||
if (playerOverlay == 8) playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-16.56f, 14.81f);
|
||||
else if (playerOverlay == 11) playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-14.74451f, 20.39122f);
|
||||
else if (playerOverlay == 13) playerOverlayImage.transform.localPosition = new UnityEngine.Vector2(-16.54019f, 14.70365f);
|
||||
playerIconImage.color = playerIconColor;
|
||||
playerOverlayImage.color = playerOverlayColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
Tools.RenderFromBase64(customIcon, playerIconImage);
|
||||
playerOverlayImage.gameObject.SetActive(false);
|
||||
var waitingForCustomIcon = playerIconImage.gameObject.AddComponent<WaitingForCustomIcon>();
|
||||
waitingForCustomIcon.ID = customIcon;
|
||||
CustomIconLoader.Init(new[] { waitingForCustomIcon });
|
||||
}
|
||||
if (BazookaManager.Instance.GetAccountID() == playerID)
|
||||
{
|
||||
@@ -139,8 +125,8 @@ public class ProfileMenu : MonoBehaviour
|
||||
var jsonResponse = JObject.Parse(response);
|
||||
if ((bool)jsonResponse["success"])
|
||||
{
|
||||
var iconColorArray = JArray.Parse(jsonResponse["data"]["iconColor"].Type == JTokenType.Null ? "[255,255,255]" : jsonResponse["data"]["iconColor"].ToString());
|
||||
var overlayColorArray = JArray.Parse(jsonResponse["data"]["overlayColor"].Type == JTokenType.Null ? "[255,255,255]" : jsonResponse["data"]["overlayColor"].ToString());
|
||||
var iconColorArray = jsonResponse["data"]["iconColor"].Type == JTokenType.Null ? new JArray(255, 255, 255) : (JArray)jsonResponse["data"]["iconColor"];
|
||||
var overlayColorArray = jsonResponse["data"]["overlayColor"].Type == JTokenType.Null ? new JArray(255, 255, 255) : (JArray)jsonResponse["data"]["overlayColor"];
|
||||
var iconColor = new Color((int)iconColorArray[0] / 255f, (int)iconColorArray[1] / 255f, (int)iconColorArray[2] / 255f);
|
||||
var overlayColor = new Color((int)overlayColorArray[0] / 255f, (int)overlayColorArray[1] / 255f, (int)overlayColorArray[2] / 255f);
|
||||
await Init(
|
||||
@@ -157,9 +143,9 @@ public class ProfileMenu : MonoBehaviour
|
||||
playerID,
|
||||
int.Parse(jsonResponse["data"]["icon"].Type == JTokenType.Null ? "1" : jsonResponse["data"]["icon"].ToString()),
|
||||
int.Parse(jsonResponse["data"]["overlay"].Type == JTokenType.Null ? "0" : jsonResponse["data"]["overlay"].ToString()),
|
||||
(string)jsonResponse["data"]["customIcon"],
|
||||
iconColor,
|
||||
overlayColor
|
||||
overlayColor,
|
||||
(string)jsonResponse["data"]["customIcon"]
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -176,19 +162,8 @@ public class ProfileMenu : MonoBehaviour
|
||||
public async Task Init()
|
||||
{
|
||||
var customIconData = BazookaManager.Instance.GetCustomBirdIconData();
|
||||
string customIcon = null;
|
||||
if (customIconData.Selected != null)
|
||||
{
|
||||
foreach (var icon in customIconData.Data)
|
||||
{
|
||||
if (icon.UUID == customIconData.Selected)
|
||||
{
|
||||
customIcon = icon.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
var iconColor = BazookaManager.Instance.GetColorSettingIcon();
|
||||
var overlayColor = BazookaManager.Instance.GetColorSettingOverlay();
|
||||
var iconColor = customIconData.Selected == null ? BazookaManager.Instance.GetColorSettingIcon() : null;
|
||||
var overlayColor = customIconData.Selected == null ? BazookaManager.Instance.GetColorSettingOverlay() : null;
|
||||
await Init(
|
||||
BazookaManager.Instance.GetGameStoreTotalNormalBerries().ToString(),
|
||||
BazookaManager.Instance.GetGameStoreTotalPoisonBerries().ToString(),
|
||||
@@ -201,11 +176,11 @@ public class ProfileMenu : MonoBehaviour
|
||||
customIconData.Balance.ToString(),
|
||||
BazookaManager.Instance.GetAccountName().ToString(),
|
||||
BazookaManager.Instance.GetAccountID() ?? 0,
|
||||
BazookaManager.Instance.GetBirdIcon(),
|
||||
BazookaManager.Instance.GetBirdOverlay(),
|
||||
customIcon,
|
||||
new Color((int)iconColor[0] / 255f, (int)iconColor[1] / 255f, (int)iconColor[2] / 255f),
|
||||
new Color((int)overlayColor[0] / 255f, (int)overlayColor[1] / 255f, (int)overlayColor[2] / 255f)
|
||||
customIconData.Selected == null ? BazookaManager.Instance.GetBirdIcon() : null,
|
||||
customIconData.Selected == null ? BazookaManager.Instance.GetBirdOverlay() : null,
|
||||
customIconData.Selected == null ? new Color((int)iconColor[0] / 255f, (int)iconColor[1] / 255f, (int)iconColor[2] / 255f) : Color.white,
|
||||
customIconData.Selected == null ? new Color((int)overlayColor[0] / 255f, (int)overlayColor[1] / 255f, (int)overlayColor[2] / 255f) : Color.white,
|
||||
customIconData.Selected
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user