private Text GetUnusedTextOverlay() { for (int i = 0; i < textOverlayList.Count; i++) { if (textOverlayList[i].text == "") { return(textOverlayList[i]); } } int count = textOverlayList.Count; GameObject obj = UI.Clone(textOverlayList[0].gameObject, "Text " + textOverlayList.Count); textOverlayList.Add(obj.GetComponent <Text>()); textOverlayList[count].text = ""; textOverlayList[count].gameObject.SetActive(false); return(textOverlayList[count]); }
void Start() { instance = this; for (int i = 0; i < 20; i++) { if (i > 0) { GameObject obj = UI.Clone(textOverlayList[0].gameObject, "Text " + i); textOverlayList.Add(obj.GetComponent <Text>()); } textOverlayList[i].text = ""; textOverlayList[i].gameObject.SetActive(false); } durationMultiplier = 1 / textDuration; if (textOverlayList.Count > 0) { defaultColor = textOverlayList[0].color; defaultFontSize = textOverlayList[0].fontSize; } }
public static UIObject Clone(GameObject srcObj, string name = "", Vector3 posOffset = default(Vector3)) { GameObject newObj = UI.Clone(srcObj, name, posOffset); return(new UIObject(newObj)); }
void AddNewUnit(Unit unit) { GameObject obj = UI.Clone(overlayObj.gameObject, "UnitOverlay", Vector3.zero); obj.GetComponent <UIUnitOverlay>().SetUnit(unit); }
public static UIMsgItem Clone(GameObject srcObj, string name = "") { return(new UIMsgItem(UI.Clone(srcObj, name))); }