Esempio n. 1
0
    // Called to resolve all combat events.
    public void OnResolveAll()
    {
        Resolver.GenerateAllCombatEvents();

        ScrollRect        scrollRect = CombatLogPanelObj.GetComponent <ScrollRect>();
        RectTransform     content    = scrollRect.content;
        List <GameObject> logs       = new List <GameObject>();
        int childCount = content.childCount;

        for (int i = 0; i < childCount; ++i)
        {
            GameObject childObj = content.GetChild(i).gameObject;
            logs.Add(childObj);
        }
        logs.ForEach(child => Destroy(child));

        foreach (CombatEventLog log in Resolver.CombatEventLog)
        {
            string logFormatText = StringTable.GlobalStringTable.Get(log.Skill.SkillDefinition.LogTextFormat);
            string logText       = StringTable.FormatSubstitute(logFormatText, log.LogValues);

            GameObject textObj = Instantiate(CombatLogTextPrefab);
            textObj.transform.SetParent(content, false);
            Text textComp = textObj.GetComponent <Text>();
            textComp.text = logText;
        }
    }