static FolderType() { Type.Define(NameAttribute); Type.Define(ItemChild); Type.SetIdAttribute(NameAttribute); ItemChild.AddRule(new ChildCountRule(0, int.MaxValue)); }
public Item(int id, ItemChild typedChild, ItemChild untypedChild) { _id = id; _typedChild = typedChild; _untypedChild = untypedChild; }
// Start is called before the first frame update void Start() { ItemChildAR = Overview.child; GameObjectList = new List <GameObject>(); StartCoroutine(LoadAssets(ItemChildAR)); }
private IEnumerator downloadTexture(Asset asset) { S($"Inside downloadTextture: Adding assets {asset.name}"); Texture2D texture = new Texture2D(512, 512); S($"Created Texture"); //var handler = UnityWebRequestTexture.GetTexture(asset.images[0]).downloadHandler; UnityWebRequest www = UnityWebRequestTexture.GetTexture(asset.images[0]); // yield return new WaitUntil(() => handler.isDone); yield return(www.SendWebRequest()); S($"Done with Handler in downloadTexture"); if (www.isNetworkError || www.isHttpError) { S($"Something went wrong : {www.error}"); } else { texture = ((DownloadHandlerTexture)www.downloadHandler).texture; // ---------------------- or ------------------------- // texture = DownloadHandlerTexture.GetContent(www); S($"Texture is got"); } // byte[] image = handler.data; // S($"Got the byte image"); // texture.LoadRawTextureData(image); //S($"texture.LoadRawTextureData called"); ItemChild itemChild = new ItemChild(texture, asset.name, asset.label, asset.description, asset.images[0], asset.id, asset); S($"downloadtexture : Adding Item {itemChild.name}"); // TODO: check if the itemchild is contain in the Itemchildren. use a method to loop through the itemchildren and check if (!CheckIfItemContain(itemChildren, itemChild)) { S($"Adding Item {itemChild.name}"); itemChildren.Add(itemChild); S($"downloadtexture : Added Item {itemChild.name}"); RefreshList(); } }
private IEnumerator LoadAssets(ItemChild itemChild) { var loading = LoadAssetFromRemote.GetAsset(itemChild.label, GameObjectList); yield return(new WaitUntil(() => loading.IsCompleted)); asset = GameObjectList[0]; }
public void Setup(ItemChild child, ContentScrollist content) { contentscript = content; childitem = child; image.texture = child.texture; name.text = child.name; label.text = child.label; describe.text = child.description; }
public void ChildrenClickEvent(ItemChild child) { ItemChildtransfer = child; SceneManager.LoadScene(PathString.Preview); //TODO: this will load a new scene and will transfer data to static Itemchild to be reference from the other scene //TODO: The EventHandler in ChildItem script will call this method }
public void OnPointerClick(PointerEventData eventData) { if (ItemChild == null) { OnSlotClick.Invoke(null); } else { OnSlotClick.Invoke(ItemChild.GetComponent <FragmentItem>()); } }
public void AddFragmentItem(FragmentName _name, GameObject ItemPrefab, Sprite _sprite) { if (ItemChild == null) { ItemChild = Instantiate(ItemPrefab, transform).transform; } ItemChild.GetComponent <Image>().sprite = _sprite; ItemChild.GetComponent <FragmentItem>().ItemFragment = FragmentFactory.GetFragment(_name); isEmpty = false; ItemChild.localPosition = Vector3.zero; }
private bool CheckIfItemContain(List <ItemChild> items, ItemChild child) { bool check = false; foreach (var item in items) { if (item.id.Equals(child.id)) { check = true; break; } } return(check); }
// Start is called before the first frame update void Start() { isObjectContainList = new List <string>(); previewItems = new List <PreviewItem>(); isPreviewInList = new List <string>(); objectPooler = ObjectPooler.instance; // get the Itemchild from the content controller of Assetlist child = ContentScrollist.ItemChildtransfer; // get the list of images and spawn them images = child.asset.images; AddImagePreviews(images); // fill the text ui element name.text = child.name; label.text = child.label; description.text = child.description; overpreview.texture = child.texture; }
public Item(int id, string name, ItemChild child) { this.id = id; this.name = name; this.child = child; }