Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChatBubble"/> class.
        /// </summary>
        /// <param name="parent">The parent <see cref="Control"/>.</param>
        /// <param name="owner">The <see cref="Entity"/> that this <see cref="ChatBubble"/> is for.</param>
        /// <param name="text">The text to display.</param>
        /// <exception cref="ArgumentNullException"><paramref name="owner" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="text" /> is <c>null</c>.</exception>
        public ChatBubble(Control parent, Entity owner, string text) : base(parent, Vector2.Zero, Vector2.Zero)
        {
            if (owner == null)
                throw new ArgumentNullException("owner");
            if (string.IsNullOrEmpty(text))
                throw new ArgumentNullException("text");

            _owner = owner;
            _deathTime = (TickCount)(TickCount.Now + Lifespan);
            _textControl = new ChatBubbleText(this, text) { Font = Font };

            _owner.Disposed += ChatBubble_Owner_Disposed;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ChatBubble"/> class.
        /// </summary>
        /// <param name="parent">The parent <see cref="Control"/>.</param>
        /// <param name="owner">The <see cref="Entity"/> that this <see cref="ChatBubble"/> is for.</param>
        /// <param name="text">The text to display.</param>
        /// <exception cref="ArgumentNullException"><paramref name="owner" /> is <c>null</c>.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="text" /> is <c>null</c>.</exception>
        public ChatBubble(Control parent, Entity owner, string text) : base(parent, Vector2.Zero, Vector2.Zero)
        {
            if (owner == null)
            {
                throw new ArgumentNullException("owner");
            }
            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentNullException("text");
            }

            _owner       = owner;
            _deathTime   = (TickCount)(TickCount.Now + Lifespan);
            _textControl = new ChatBubbleText(this, text)
            {
                Font = Font
            };

            _owner.Disposed += ChatBubble_Owner_Disposed;
        }