Fixes to download script

This commit is contained in:
2025-07-16 21:11:37 -07:00
parent 2c80fbdf2d
commit 2b8e29b101
2 changed files with 9 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
using System;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using TMPro; using TMPro;
using UnityEngine; using UnityEngine;
@@ -16,6 +19,10 @@ public class IconMarketplaceDownloadIcon : MonoBehaviour
void Awake() void Awake()
{ {
backButton.onClick.AddListener(() => marketplaceManager.SwitchPanel(0)); backButton.onClick.AddListener(() => marketplaceManager.SwitchPanel(0));
}
internal void Load()
{
GetIcons(); GetIcons();
} }
@@ -68,6 +75,7 @@ public class IconMarketplaceDownloadIcon : MonoBehaviour
{ {
JObject entry = (JObject)item; JObject entry = (JObject)item;
GameObject newIcon = Instantiate(sample, content.transform); GameObject newIcon = Instantiate(sample, content.transform);
newIcon.name = "Icon_" + Convert.ToBase64String(Encoding.UTF8.GetBytes(entry.ToString(Formatting.None)));
Tools.RenderFromBase64(entry["data"].ToString(), newIcon.transform.GetChild(0).GetChild(0).GetComponent<Image>()); Tools.RenderFromBase64(entry["data"].ToString(), newIcon.transform.GetChild(0).GetChild(0).GetComponent<Image>());
newIcon.transform.GetChild(1).GetComponent<TMP_Text>().text = "Bird Name: " + entry["name"].ToString(); newIcon.transform.GetChild(1).GetComponent<TMP_Text>().text = "Bird Name: " + entry["name"].ToString();

View File

@@ -48,6 +48,7 @@ public class IconMarketplaceManager : MonoBehaviour
uploadPanel.SetActive(false); uploadPanel.SetActive(false);
break; break;
case 1: case 1:
downloadPanelScript.Load();
downloadPanelScript.balanceText.text = "You have " + Tools.FormatWithCommas((BazookaManager.Instance.GetCustomBirdIconData()["totalCoins"] ?? "0").ToString()) + " coins to spend"; downloadPanelScript.balanceText.text = "You have " + Tools.FormatWithCommas((BazookaManager.Instance.GetCustomBirdIconData()["totalCoins"] ?? "0").ToString()) + " coins to spend";
normalPanel.SetActive(false); normalPanel.SetActive(false);
downloadPanel.SetActive(true); downloadPanel.SetActive(true);