Example #1
0
            public RecordButton(int pos, bool latest, Record rec)
            {
                _rec = rec;

                if (latest)
                {
                    _flare = new Flare(6, 24);
                    _flare.AngularSpeed = 90;
                    _flare.Color(rec.win ? FlareWin : FlareLose);
                    AddToBack(_flare);
                }

                _position.Text((pos + 1).ToString());
                _position.Measure();

                _desc.Text(rec.info);
                _desc.Measure();

                if (rec.win)
                {
                    _shield.View(ItemSpriteSheet.AMULET, null);
                    _position.Hardlight(TextWin);
                    _desc.Hardlight(TextWin);
                }
                else
                {
                    _position.Hardlight(TextLose);
                    _desc.Hardlight(TextLose);
                }

                _classIcon.Copy(IconsExtensions.Get(rec.heroClass));
            }
Example #2
0
        public WndTitledMessage(Component titlebar, string message)
        {
            titlebar.SetRect(0, 0, WIDTH, 0);
            Add(titlebar);

            var hl = new Highlighter(message);

            normal          = PixelScene.CreateMultiline(hl.Text, 6);
            normal.MaxWidth = WIDTH;
            normal.Measure();
            normal.X = titlebar.Left();
            normal.Y = titlebar.Bottom() + GAP;
            Add(normal);

            if (hl.IsHighlighted)
            {
                normal.Mask = hl.Inverted();

                highlighted          = PixelScene.CreateMultiline(hl.Text, 6);
                highlighted.MaxWidth = normal.MaxWidth;
                highlighted.Measure();
                highlighted.X = normal.X;
                highlighted.Y = normal.Y;
                Add(highlighted);

                highlighted.Mask = hl.Mask;
                highlighted.Hardlight(TitleColor);
            }

            Resize(WIDTH, (int)(normal.Y + normal.Height));
        }
Example #3
0
        protected override void CreateChildren()
        {
            ImIcon = new Image();
            Add(ImIcon);

            TfLabel = PixelScene.CreateMultiline(FontSize);
            TfLabel.Hardlight(Window.TitleColor);
            Add(TfLabel);
        }
Example #4
0
        public void OnSignal(string text)
        {
            var color = CharSprite.Default;

            if (text.StartsWith(GLog.POSITIVE))
            {
                text  = text.Substring(GLog.POSITIVE.Length);
                color = CharSprite.Positive;
            }
            else
            if (text.StartsWith(GLog.NEGATIVE))
            {
                text  = text.Substring(GLog.NEGATIVE.Length);
                color = CharSprite.Negative;
            }
            else
            if (text.StartsWith(GLog.WARNING))
            {
                text  = text.Substring(GLog.WARNING.Length);
                color = CharSprite.Warning;
            }
            else
            if (text.StartsWith(GLog.HIGHLIGHT))
            {
                text  = text.Substring(GLog.HIGHLIGHT.Length);
                color = CharSprite.Neutral;
            }

            text = Utils.Capitalize(text) + (Punctuation.Matcher(text).Matches() ? "" : ".");

            if (_lastEntry != null && color == _lastColor)
            {
                var lastMessage = _lastEntry.Text();
                _lastEntry.Text(lastMessage.Length == 0 ? text : lastMessage + " " + text);
                _lastEntry.Measure();
            }
            else
            {
                _lastEntry          = PixelScene.CreateMultiline(text, 6);
                _lastEntry.MaxWidth = (int)Width;
                _lastEntry.Measure();
                _lastEntry.Hardlight(color);
                _lastColor = color;
                Add(_lastEntry);
            }

            if (Members.Count > MaxMessages)
            {
                Remove(Members[0]);
            }

            Layout();
        }
Example #5
0
 public virtual void Label(string label, int color)
 {
     TfLabel.Text(label);
     TfLabel.Hardlight(color);
 }