Exemple #1
0
        public void OnShowBriefInfo(EventArgs args)
        {
            if (args is ShowBriefInfoEA sbi)
            {
                string[] messages = sbi.Message.Split('\n');

                foreach (var elem in _elements)
                {
                    elem.RequestTranslation(new Vector2(0, _elementSize.y * messages.Length));
                }

                for (int i = 0; i < messages.Length; ++i)
                {
                    BriefInfoElement bie = Instantiate(_briefInfoElementPrefab, transform);
                    bie.Initialize(messages[i], GetColorOfMessageType(sbi.Type));
                    _elements.Add(bie);
                    bie.DisappearingFinished += OnDisappearingFinished;
                }
            }
            else
            {
                Log.Instance.WriteException(new InvalidEventArgsException());
            }
        }
Exemple #2
0
 private void OnDisappearingFinished(BriefInfoElement bie)
 {
     bie.DisappearingFinished -= OnDisappearingFinished;
     _elements.Remove(bie);
     Destroy(bie.gameObject);
 }