private static string NftToString(Nft nft) { return("Item #: " + nft.Item + "\n" + "URL: " + nft.Url + "\n" + "Image: " + nft.Img + "\n" + "Type: " + nft.Type + "\n" + "Source: " + nft.Source + "\n" + "Source Data: " + nft.SourceData + "\n" + "Timestamp: " + nft.Timestamp + "\n" + "Mint: " + nft.Mint + "\n" + "Name (English): " + nft.NameEnglish + "\n" + "Make: " + nft.Make + "\n" + "Model: " + nft.Model + "\n" + "Part: " + nft.Part + "\n" + "Material: " + nft.Material + "\n" + "ImageUrl: " + nft.ImageUrl + "\n" + "Description (English): " + nft.DescriptionEnglish + "\n" + "Display Type (English): " + nft.DisplayTypeEnglish + "\n" + "ItemDefId: " + nft.ItemDefId + "\n" + "Season: " + nft.Season + "\n" + "Rarity: " + nft.Rarity + "\n" + "BodyPart: " + nft.BodyPart + "\n" + "ModelAsset: " + nft.ModelAsset + "\n" + "Type: " + nft.Type + "\n" + "Parent Types: " + nft.ParentTypes + "\n" + "Series: " + nft.Series + "\n" + "Extra: " + nft.Extra + "\n" + "Color: " + nft.Color + "\n" + "Finish: " + nft.Finish + "\n" + "MintLimit: " + nft.MintLimit); }
public static IEnumerator DownloadImage(Nft nft) { // Trying to avoid downloading same image multiple times. if (CheckIfImageLoaded(nft.Img)) { yield break; } var texture = Cache.GetTexture("ttrs-image-" + nft.Item, 0); if (texture != null) { var image = new Image(); image.Url = nft.Img; image.Texture = texture; lock (Images) { if (!CheckIfImageLoaded(image.Url)) { Images.Add(image.Url, image); } } yield break; } while (imagesLoadedSimultaneously > 5) { yield return(null); // Trying to avoid downloading same image multiple times. if (CheckIfImageLoaded(nft.Img)) { yield break; } } imagesLoadedSimultaneously++; UnityWebRequest request = UnityWebRequestTexture.GetTexture(nft.Img); yield return(request.SendWebRequest()); if (request.isNetworkError || request.isHttpError) { Log.Write(request.error); } else { var image = new Image(); image.Url = nft.Img; image.Texture = ((DownloadHandlerTexture)request.downloadHandler).texture; lock (Images) { if (!CheckIfImageLoaded(image.Url)) { Images.Add(image.Url, image); } } Cache.AddTexture("ttrs-image-" + nft.Item, image.Texture); } imagesLoadedSimultaneously--; }