Fix the marketplace not working in the game player
This took me 3 weeks to figure out, I hate everything
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
@@ -72,17 +72,16 @@ public class IconMarketplaceDownloadIcon : MonoBehaviour
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
ShowStatus(null);
|
ShowStatus(null);
|
||||||
var jsonResponse = JArray.Parse(response);
|
var icons = JsonConvert.DeserializeObject<MarketplaceIconType[]>(response);
|
||||||
foreach (var item in jsonResponse)
|
foreach (var entry in icons)
|
||||||
{
|
{
|
||||||
MarketplaceIconType entry = ((JObject)item).ToObject<MarketplaceIconType>();
|
|
||||||
GameObject newIcon = Instantiate(sample, content.transform);
|
GameObject newIcon = Instantiate(sample, content.transform);
|
||||||
newIcon.name = "IconEntry";
|
newIcon.name = "IconEntry";
|
||||||
|
|
||||||
Tools.RenderFromBase64(entry.Data, newIcon.transform.GetChild(0).GetChild(0).GetComponent<Image>());
|
Tools.RenderFromBase64(entry.Data, newIcon.transform.GetChild(0).GetChild(0).GetComponent<Image>());
|
||||||
newIcon.transform.GetChild(1).GetComponent<TMP_Text>().text = "Bird Name: " + entry.Name;
|
newIcon.transform.GetChild(1).GetComponent<TMP_Text>().text = "Bird Name: " + entry.Name;
|
||||||
newIcon.transform.GetChild(2).GetComponent<TMP_Text>().text = "Price " + entry.Price + " coin";
|
newIcon.transform.GetChild(2).GetComponent<TMP_Text>().text = "Price " + entry.Price + " coin";
|
||||||
newIcon.transform.GetChild(3).GetComponent<TMP_Text>().text = "Designer Name: " + ((JObject)item)["username"].ToString();
|
newIcon.transform.GetChild(3).GetComponent<TMP_Text>().text = "Designer Name: " + entry.CreatorUsername;
|
||||||
|
|
||||||
var btn = newIcon.transform.GetChild(4).GetComponent<Button>();
|
var btn = newIcon.transform.GetChild(4).GetComponent<Button>();
|
||||||
var btnText = btn.transform.GetChild(0).GetComponent<TMP_Text>();
|
var btnText = btn.transform.GetChild(0).GetComponent<TMP_Text>();
|
||||||
@@ -122,8 +121,6 @@ public class IconMarketplaceDownloadIcon : MonoBehaviour
|
|||||||
BazookaManager.Instance.SetCustomBirdIconData(marketplaceIconStorage);
|
BazookaManager.Instance.SetCustomBirdIconData(marketplaceIconStorage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ShowStatus(string content)
|
void ShowStatus(string content)
|
||||||
{
|
{
|
||||||
if (content == null)
|
if (content == null)
|
||||||
|
|||||||
@@ -1,13 +1,30 @@
|
|||||||
using System.Numerics;
|
using UnityEngine.Scripting;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
public class MarketplaceIconType {
|
public class MarketplaceIconType {
|
||||||
|
[Preserve]
|
||||||
|
[JsonProperty("username")]
|
||||||
|
public string CreatorUsername { get; set; }
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
|
[JsonProperty("userid")]
|
||||||
|
public BigInteger CreatorUserID { get; set; }
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
[JsonProperty("data")]
|
[JsonProperty("data")]
|
||||||
public string Data { get; set; }
|
public string Data { get; set; }
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
[JsonProperty("uuid")]
|
[JsonProperty("uuid")]
|
||||||
public string UUID { get; set; }
|
public string UUID { get; set; }
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
[JsonProperty("price")]
|
[JsonProperty("price")]
|
||||||
public BigInteger Price { get; set; }
|
public BigInteger Price { get; set; }
|
||||||
|
|
||||||
|
[Preserve]
|
||||||
[JsonProperty("name")]
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user