예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }