public void WriteSystemMessage(string newMessage) { //float scrollBarValue = systemScrollBar.value; //GameObject go = Instantiate(textPrefab, systemContentArea.transform); //systemMessageList.Add(go); TextLogController textLogController = GetTextLogController(ref systemLogControllers, ref usedSystemLogControllers); textLogController.InitializeTextLogController(newMessage); LayoutRebuilder.ForceRebuildLayoutImmediate(systemRectTransform); }
public void WriteCombatMessage(string newMessage) { //Debug.Log("CombatLogUI.WriteCombatMessage(" + newMessage + ")"); //float scrollBarValue = combatScrollBar.value; //Debug.Log("CombatLogUI.WriteCombatMessage(" + newMessage + "): scrollbarValue: " + combatScrollBar.value); //GameObject go = Instantiate(textPrefab, combatContentArea.transform); //combatMessageList.Add(go); TextLogController textLogController = GetTextLogController(ref combatLogControllers, ref usedCombatLogControllers); textLogController.InitializeTextLogController(newMessage); LayoutRebuilder.ForceRebuildLayoutImmediate(combatRectTransform); }
public TextLogController GetTextLogController(ref List <TextLogController> freeTextLogControllers, ref List <TextLogController> usedTextLogControllers) { TextLogController returnValue = null; if (freeTextLogControllers.Count > 0) { // we are getting an unused one returnValue = freeTextLogControllers[0]; usedTextLogControllers.Add(freeTextLogControllers[0]); freeTextLogControllers.RemoveAt(0); } else { // we are recycling a used one if (usedTextLogControllers.Count > 0) { returnValue = usedTextLogControllers[0]; usedTextLogControllers.RemoveAt(0); usedTextLogControllers.Add(returnValue); } } return(returnValue); }