IEnumerator AddItemAsync(TerminalItem obj) { //inst var instance = Instantiate(ItemPrototype.gameObject); var script = instance.GetComponent <TerminalItemView>(); script.Label.text = obj.Text; script.Label.color = obj.Color; script.Model = obj; //parent instance.transform.SetParent(ItemLayout); instance.SetActive(true); //wtf instance.transform.localScale = new Vector3(1, 1, 1); TextItems.Add(script); yield return(1); if (ItemScrollBar) { ItemScrollBar.value = 0; } }
void Items_OnRemove(TerminalItem obj) { var item = TextItems.FirstOrDefault(o => o.Model.Equals(obj)); if (item != null) { TextItems.Remove(item); Destroy(item.gameObject); } }
IEnumerator AddItemAsync(TerminalItem obj) { //inst var instance = (GameObject)Instantiate(ItemPrototype.gameObject); var script = instance.GetComponent <TerminalViewItem>(); script.Label.text = obj.Text; script.Label.color = obj.Color; script.Model = obj; //parent instance.transform.SetParent(ItemLayout.transform); instance.SetActive(true); TextItems.Add(script); yield return(1); ItemScrollBar.value = 0; yield return(1); ItemScrollBar.value = 0; }
void Items_OnAdd(TerminalItem obj) { StartCoroutine(AddItemAsync(obj)); }
IEnumerator AddItemAsync(TerminalItem obj) { //inst var instance = (GameObject)Instantiate(ItemPrototype.gameObject); var script = instance.GetComponent<TerminalViewItem>(); script.Label.text = obj.Text; script.Label.color = obj.Color; script.Model = obj; //parent instance.transform.SetParent(ItemLayout.transform); instance.SetActive(true); TextItems.Add(script); yield return 1; ItemScrollBar.value = 0; yield return 1; ItemScrollBar.value = 0; }
void Items_OnAdd(TerminalItem obj) { StartCoroutine(AddItemAsync(obj)); }
void Items_OnRemove(TerminalItem obj) { var item = TextItems.FirstOrDefault(o => o.Model.Equals(obj)); if (item != null) { TextItems.Remove(item); Destroy(item.gameObject); } }
IEnumerator AddItemAsync(TerminalItem obj) { //inst var instance = Instantiate(ItemPrototype.gameObject); var script = instance.GetComponent<TerminalItemView>(); script.Label.text = obj.Text; script.Label.color = obj.Color; script.Model = obj; //parent instance.transform.SetParent(ItemLayout); instance.SetActive(true); //wtf instance.transform.localScale = new Vector3(1, 1, 1); TextItems.Add(script); yield return 1; if (ItemScrollBar) ItemScrollBar.value = 0; }