示例#1
0
        private void TextChanged()
        {
            BodyText = Message;
            if (GlobalSettings.Default.ChatOnlyEmoji)
            {
                BodyText = GameFacade.Emojis.EmojiOnly(BodyText);
            }
            BodyText = ((Offscreen && Message != "") ? "\\[" + Name + "] " : "") + GameFacade.Emojis.EmojiToBB(SanitizeBB(BodyText));

            var textW = Math.Max(130, Message.Length * 2);

            BodyTextLabels = TextRenderer.ComputeText(BodyText, new TextRendererOptions
            {
                BBCode    = true,
                Alignment = TextAlignment.Center,
                MaxWidth  = textW,
                Position  = new Microsoft.Xna.Framework.Vector2(18, 16),
                Scale     = _Scale,
                TextStyle = BodyTextStyle,
                WordWrap  = true,
            }, this);

            BTOffsets = new List <Vector2>();

            foreach (var cmd in BodyTextLabels.DrawingCommands)
            {
                if (cmd is INormalTextCmd)
                {
                    BTOffsets.Add(((INormalTextCmd)cmd).Position);
                }
            }

            DisplayRect.Width  = textW + 18 * 2;
            DisplayRect.Height = BodyTextLabels.BoundingBox.Height + 18 * 3;
        }
示例#2
0
        private void TextChanged()
        {
            BodyText = ((Offscreen && Message != "") ? "[" + Name + "] " : "") + Message;

            var textW = Math.Max(130, Message.Length / 2);

            BodyTextLabels = TextRenderer.ComputeText(BodyText, new TextRendererOptions
            {
                Alignment = TextAlignment.Center,
                MaxWidth  = textW,
                Position  = new Microsoft.Xna.Framework.Vector2(18, 18),
                Scale     = _Scale,
                TextStyle = BodyTextStyle,
                WordWrap  = true,
            }, this);

            BTOffsets = new List <Vector2>();

            foreach (var cmd in BodyTextLabels.DrawingCommands)
            {
                if (cmd is TextDrawCmd_Text)
                {
                    BTOffsets.Add(((TextDrawCmd_Text)cmd).Position);
                }
            }

            DisplayRect.Width  = textW + 18 * 2;
            DisplayRect.Height = BodyTextLabels.BoundingBox.Height + 18 * 3;
        }
示例#3
0
        protected override void CalculateMatrix()
        {
            base.CalculateMatrix();

            if (Type == PrimBoxType.Primitive)
            {
                BodyTextLabels = TextRenderer.ComputeText(BodyText, new TextRendererOptions
                {
                    Alignment = TextAlignment.Center,
                    MaxWidth  = 300,
                    Position  = new Vector2(0, 24),
                    Scale     = _Scale,
                    TextStyle = BodyTextStyle,
                    WordWrap  = true,
                }, this);

                var shift = (Width - 300) / 2;
                foreach (var cmd in BodyTextLabels.DrawingCommands)
                {
                    if (cmd is TextDrawCmd_Text)
                    {
                        ((TextDrawCmd_Text)cmd).Position += new Vector2(shift, 0);
                    }
                }
            }
        }
示例#4
0
        private void ComputeText()
        {
            var msg = m_Options.Message;

            if (m_Options.AllowEmojis)
            {
                msg = GameFacade.Emojis.EmojiToBB(BBCodeParser.SanitizeBB(msg));
            }
            else if (m_Options.AllowBB)
            {
                msg = GameFacade.Emojis.EmojiToBB(msg);
            }
            m_MessageText = TextRenderer.ComputeText(msg, new TextRendererOptions
            {
                Alignment        = m_Options.Alignment,
                MaxWidth         = m_Options.Width - 64,
                Position         = new Microsoft.Xna.Framework.Vector2(32, 38),
                Scale            = _Scale,
                TextStyle        = m_TextStyle,
                WordWrap         = true,
                TopLeftIconSpace = IconSpace,
                BBCode           = m_Options.AllowEmojis || m_Options.AllowBB
            }, this);

            m_TextDirty = false;
        }
示例#5
0
        public void UpdateDisplay()
        {
            Descriptor.Operand = Operand;
            Style = PGroupStyles.ByType[Descriptor.Group];

            TitleText = Descriptor.GetTitle(Master.Scope);
            var titleWidth = Title.CaptionStyle.MeasureString(TitleText).X;

            Title.Caption            = TitleText;
            Title.CaptionStyle.Color = Style.Title;
            Index.Caption            = InstPtr.ToString();
            Index.CaptionStyle.Color = Style.Title;

            BodyText            = Descriptor.GetBody(Master.Scope);
            BodyTextStyle.Color = Style.Body;

            BodyTextLabels = TextRenderer.ComputeText(BodyText, new TextRendererOptions
            {
                Alignment = TextAlignment.Center,
                MaxWidth  = 300,
                Position  = new Microsoft.Xna.Framework.Vector2(0, 24),
                Scale     = _Scale,
                TextStyle = BodyTextStyle,
                WordWrap  = true,
            }, this);

            RecenterSize(Math.Max((int)titleWidth, BodyTextLabels.MaxWidth) + 10, BodyTextLabels.BoundingBox.Height + 43);
            Title.Size = new Vector2(Width, 24);
            Index.Size = new Vector2(Width - 4, 20);

            var shift = (Width - 300) / 2;

            foreach (var cmd in BodyTextLabels.DrawingCommands)
            {
                if (cmd is TextDrawCmd_Text)
                {
                    ((TextDrawCmd_Text)cmd).Position += new Vector2(shift, 0);
                }
            }

            if (Descriptor.Returns == PrimitiveReturnTypes.TrueFalse)
            {
                Nodes[0].Visible = true;
                Nodes[1].Type    = NodeType.True;
            }
            else
            {
                Nodes[0].Visible = false;
                Nodes[1].Type    = NodeType.Done;
            }

            if (CommentNode != null)
            {
                CommentNode.X = Width + 3;
            }
        }
示例#6
0
        private void ComputeText()
        {
            m_MessageText = TextRenderer.ComputeText(m_Options.Message, new TextRendererOptions
            {
                Alignment = TextAlignment.Center,
                MaxWidth  = m_Options.Width - 64,
                Position  = new Microsoft.Xna.Framework.Vector2(32, 38),
                Scale     = _Scale,
                TextStyle = m_TextStyle,
                WordWrap  = true
            }, this);

            m_TextDirty = false;
        }
示例#7
0
        private void ComputeText()
        {
            var margin = (IconSpace.X > 0) ? 50 : 80;

            m_MessageText = TextRenderer.ComputeText(m_Options.Message, new TextRendererOptions
            {
                Alignment        = TextAlignment.Left | TextAlignment.Top,
                MaxWidth         = Width - margin * 2,
                Position         = new Microsoft.Xna.Framework.Vector2(margin, 105),
                Scale            = _Scale,
                TextStyle        = m_TextStyle,
                WordWrap         = true,
                TopLeftIconSpace = IconSpace
            }, this);

            m_TextDirty = false;
        }
示例#8
0
        private void ComputeText(UIHint hint)
        {
            var msg = hint.Body;

            msg           = GameFacade.Emojis.EmojiToBB(msg);
            m_MessageText = TextRenderer.ComputeText(msg, new TextRendererOptions
            {
                Alignment        = TextAlignment.Left | TextAlignment.Top,
                MaxWidth         = 492,
                Position         = new Vector2(290, 65),
                Scale            = _Scale,
                TextStyle        = TextStyle.DefaultLabel,
                WordWrap         = true,
                TopLeftIconSpace = IconSpace,
                BBCode           = true
            }, this);
            ActiveHint  = hint;
            m_TextDirty = false;
        }