Make marketplace icons show up in game
This commit is contained in:
@@ -47,30 +47,89 @@ public class GamePlayer : MonoBehaviour
|
|||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
var customIconData = BazookaManager.Instance.GetCustomBirdIconData();
|
||||||
var birdColor = BazookaManager.Instance.GetColorSettingIcon();
|
SpriteRenderer component = bird.GetComponent<SpriteRenderer>();
|
||||||
var overlayColor = BazookaManager.Instance.GetColorSettingOverlay();
|
if (customIconData.Selected == null)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
Camera.main.backgroundColor = new Color(
|
var backgroundColor = BazookaManager.Instance.GetColorSettingBackground();
|
||||||
int.Parse(backgroundColor[0].ToString()) / 255f,
|
var birdColor = BazookaManager.Instance.GetColorSettingIcon();
|
||||||
int.Parse(backgroundColor[1].ToString()) / 255f,
|
var overlayColor = BazookaManager.Instance.GetColorSettingOverlay();
|
||||||
int.Parse(backgroundColor[2].ToString()) / 255f
|
try
|
||||||
);
|
{
|
||||||
bird.GetComponent<SpriteRenderer>().color = new Color(
|
Camera.main.backgroundColor = new Color(
|
||||||
int.Parse(birdColor[0].ToString()) / 255f,
|
int.Parse(backgroundColor[0].ToString()) / 255f,
|
||||||
int.Parse(birdColor[1].ToString()) / 255f,
|
int.Parse(backgroundColor[1].ToString()) / 255f,
|
||||||
int.Parse(birdColor[2].ToString()) / 255f
|
int.Parse(backgroundColor[2].ToString()) / 255f
|
||||||
);
|
);
|
||||||
bird.transform.GetChild(0).GetComponent<SpriteRenderer>().color = new Color(
|
bird.GetComponent<SpriteRenderer>().color = new Color(
|
||||||
int.Parse(overlayColor[0].ToString()) / 255f,
|
int.Parse(birdColor[0].ToString()) / 255f,
|
||||||
int.Parse(overlayColor[1].ToString()) / 255f,
|
int.Parse(birdColor[1].ToString()) / 255f,
|
||||||
int.Parse(overlayColor[2].ToString()) / 255f
|
int.Parse(birdColor[2].ToString()) / 255f
|
||||||
);
|
);
|
||||||
|
bird.transform.GetChild(0).GetComponent<SpriteRenderer>().color = new Color(
|
||||||
|
int.Parse(overlayColor[0].ToString()) / 255f,
|
||||||
|
int.Parse(overlayColor[1].ToString()) / 255f,
|
||||||
|
int.Parse(overlayColor[2].ToString()) / 255f
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.LogError("Invalid BackgroundColor format");
|
||||||
|
}
|
||||||
|
|
||||||
|
int num = BazookaManager.Instance.GetBirdIcon();
|
||||||
|
int num2 = BazookaManager.Instance.GetBirdOverlay();
|
||||||
|
if (num == 1)
|
||||||
|
{
|
||||||
|
component.sprite = Tools.GetIconForUser(BazookaManager.Instance.GetAccountID() ?? 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
component.sprite = Resources.Load<Sprite>("Icons/Icons/bird_" + num);
|
||||||
|
}
|
||||||
|
if (num2 == 8)
|
||||||
|
{
|
||||||
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
||||||
|
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.37f, 0.32f, 0f);
|
||||||
|
}
|
||||||
|
else if (num2 == 11)
|
||||||
|
{
|
||||||
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
||||||
|
overlayRender.transform.localScale = new UnityEngine.Vector3(1.1f, 1.1f, 1.1f); //yea i didnt feel like doing it for all lmao
|
||||||
|
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.3141809f, 0.4324968f, 0f);
|
||||||
|
}
|
||||||
|
else if (num2 == 13)
|
||||||
|
{
|
||||||
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
||||||
|
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.3559977f, 0.3179995f, 0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
||||||
|
}
|
||||||
|
if (component.sprite == null)
|
||||||
|
{
|
||||||
|
component.sprite = Resources.Load<Sprite>("Icons/Icons/bird_1");
|
||||||
|
BazookaManager.Instance.SetBirdIcon(1);
|
||||||
|
}
|
||||||
|
if (overlayRender.sprite == null && num2 != 0)
|
||||||
|
{
|
||||||
|
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_1");
|
||||||
|
BazookaManager.Instance.SetBirdOverlay(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
else
|
||||||
{
|
{
|
||||||
Debug.LogError("Invalid BackgroundColor format");
|
if (customIconData.Selected != null)
|
||||||
|
{
|
||||||
|
foreach (var icon in customIconData.Data)
|
||||||
|
{
|
||||||
|
if (icon.UUID == customIconData.Selected)
|
||||||
|
{
|
||||||
|
Tools.RenderFromBase64(icon.Data, component);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastMoveTime = Time.time;
|
lastMoveTime = Time.time;
|
||||||
@@ -88,47 +147,6 @@ public class GamePlayer : MonoBehaviour
|
|||||||
|
|
||||||
Cursor.visible = false;
|
Cursor.visible = false;
|
||||||
Cursor.lockState = CursorLockMode.Locked;
|
Cursor.lockState = CursorLockMode.Locked;
|
||||||
SpriteRenderer component = bird.GetComponent<SpriteRenderer>();
|
|
||||||
int num = BazookaManager.Instance.GetBirdIcon();
|
|
||||||
int num2 = BazookaManager.Instance.GetBirdOverlay();
|
|
||||||
if (num == 1)
|
|
||||||
{
|
|
||||||
component.sprite = Tools.GetIconForUser(BazookaManager.Instance.GetAccountID() ?? 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
component.sprite = Resources.Load<Sprite>("Icons/Icons/bird_" + num);
|
|
||||||
}
|
|
||||||
if (num2 == 8)
|
|
||||||
{
|
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
|
||||||
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.37f, 0.32f, 0f);
|
|
||||||
}
|
|
||||||
else if (num2 == 11)
|
|
||||||
{
|
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
|
||||||
overlayRender.transform.localScale = new UnityEngine.Vector3(1.1f, 1.1f, 1.1f); //yea i didnt feel like doing it for all lmao
|
|
||||||
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.3141809f, 0.4324968f, 0f);
|
|
||||||
}
|
|
||||||
else if (num2 == 13)
|
|
||||||
{
|
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
|
||||||
overlayRender.transform.localPosition = new UnityEngine.Vector3(-0.3559977f, 0.3179995f, 0f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_" + num2);
|
|
||||||
}
|
|
||||||
if (component.sprite == null)
|
|
||||||
{
|
|
||||||
component.sprite = Resources.Load<Sprite>("Icons/Icons/bird_1");
|
|
||||||
BazookaManager.Instance.SetBirdIcon(1);
|
|
||||||
}
|
|
||||||
if (overlayRender.sprite == null && num2 != 0)
|
|
||||||
{
|
|
||||||
overlayRender.sprite = Resources.Load<Sprite>("Icons/Overlays/overlay_1");
|
|
||||||
BazookaManager.Instance.SetBirdOverlay(1);
|
|
||||||
}
|
|
||||||
backgroundMusic.volume = BazookaManager.Instance.GetSettingMusicVolume();
|
backgroundMusic.volume = BazookaManager.Instance.GetSettingMusicVolume();
|
||||||
screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect;
|
screenWidth = Camera.main.orthographicSize * 2f * Camera.main.aspect;
|
||||||
if (Application.isMobilePlatform)
|
if (Application.isMobilePlatform)
|
||||||
|
|||||||
Reference in New Issue
Block a user