void UpdateEntityTurnList(TurnBase turnBase, TurnBase nextTurnBase) { UICombatMainEntityTurnItem item = GetItem(); item.SetController(turnBase.curController); foreach (CControllerComponent t in turnBase.readyControllerList) { item = GetItem(); item.SetController(t); } turnSplit.SetSiblingIndex(item.transform.GetSiblingIndex()); foreach (CControllerComponent t in nextTurnBase.readyControllerList) { GetItem().SetController(t); } }
UICombatMainEntityTurnItem GetItem() { foreach (UICombatMainEntityTurnItem item in m_Items) { if (!item.gameObject.activeSelf) { return(item); } } GameObject obj = GameObject.Instantiate <GameObject>(prefab.gameObject); obj.transform.parent = transform; UICombatMainEntityTurnItem newItem = obj.GetComponent <UICombatMainEntityTurnItem>(); newItem.Initialize(); newItem.ResetController(); m_Items.Add(newItem); return(newItem); }