// Change this to a foreach, when all are downloaded private void instantiateTexture(Texture2D t, Sticker1 s) { // Instantiate a sticker object and assign it the texture Rect r = new Rect(0, 0, t.width, t.height); Sprite temp = Sprite.Create(t, r, new Vector2()); temp.name = t.name; GameObject stickerButton = Instantiate(Resources.Load("StickerSelector")) as GameObject; stickerButton.transform.SetParent(dlc.transform); stickerButton.transform.position = stickerButton.transform.parent.position; stickerButton.GetComponent <Image>().sprite = temp; stickerButton.name = Path.GetFileNameWithoutExtension(temp.name); // Add Texture to sticker object s.stickerGO = stickerButton; completedDownload++; if (completedDownload == downloadedStickers.Count) { finishedDownload = true; } }
public void GetObjects(Sticker1 s) { string file = s.themeName + "/" + s.stickerName; S3Client.GetObjectAsync(S3BucketName, file, (responseObj) => { var response = responseObj.Response; if (response.ResponseStream != null) { Texture2D t = new Texture2D(4, 4); byte[] imageData = new byte[response.ResponseStream.Length]; response.ResponseStream.Read(imageData, 0, (int)imageData.Length); t.LoadImage(imageData); t.name = s.stickerName; instantiateTexture(t, s); } else { Debug.Log("Nothing found in Bucket"); } }); }
private void addItem(Dictionary <string, AttributeValue> attributeList) { Sticker1 sticker = new Sticker1(); foreach (var kvp in attributeList) { string attributeName = kvp.Key; AttributeValue value = kvp.Value; // Create a new sticker based on each Key/Value pair if (attributeName == "Theme") { sticker.themeName = value.S; } else if (attributeName == "StickerName") { sticker.stickerName = value.S; } else if (attributeName == "Link") { sticker.link = value.S; } } stickers.Add(sticker.stickerName, sticker); }
// Change this to a foreach, when all are downloaded private void instantiateTexture(Texture2D t, Sticker1 s) { // Instantiate a sticker object and assign it the texture Rect r = new Rect(0, 0, t.width, t.height); Sprite temp = Sprite.Create(t, r, new Vector2()); temp.name = t.name; GameObject stickerButton = Instantiate(Resources.Load("StickerSelector")) as GameObject; stickerButton.transform.SetParent(dlc.transform); stickerButton.transform.position = stickerButton.transform.parent.position; stickerButton.GetComponent<Image>().sprite = temp; stickerButton.name = Path.GetFileNameWithoutExtension(temp.name); // Add Texture to sticker object s.stickerGO = stickerButton; completedDownload++; if (completedDownload == downloadedStickers.Count) finishedDownload = true; }
private void addItem(Dictionary<string, AttributeValue> attributeList) { Sticker1 sticker = new Sticker1(); foreach (var kvp in attributeList) { string attributeName = kvp.Key; AttributeValue value = kvp.Value; // Create a new sticker based on each Key/Value pair if (attributeName == "Theme") { sticker.themeName = value.S; } else if (attributeName == "StickerName") { sticker.stickerName = value.S; } else if (attributeName == "Link") { sticker.link = value.S; } } stickers.Add(sticker.stickerName, sticker); }