コード例 #1
0
        public void AddNotification(TextNotification notification)
        {
            var notificationWidget = templates[notification.Pool].Clone();

            WidgetUtils.SetupTextNotification(notificationWidget, notification, Bounds.Width, false);

            if (Children.Count == 0)
            {
                notificationWidget.Bounds.Y = Bounds.Bottom - notificationWidget.Bounds.Height - BottomSpacing;
            }
            else
            {
                foreach (var line in Children)
                {
                    line.Bounds.Y -= notificationWidget.Bounds.Height + ItemSpacing;
                }

                var lastLine = Children[Children.Count - 1];
                notificationWidget.Bounds.Y = lastLine.Bounds.Bottom + ItemSpacing;
            }

            AddChild(notificationWidget);
            expirations.Add(Game.LocalTick + RemoveTime);

            while (Children.Count > LogLength)
            {
                RemoveNotification();
            }
        }