Inheritance: OpenRA.Widgets.Widget
Ejemplo n.º 1
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text             = other.Text;
     Align            = other.Align;
     Font             = other.Font;
     TextColor        = other.TextColor;
     Contrast         = other.Contrast;
     ContrastColor    = other.ContrastColor;
     WordWrap         = other.WordWrap;
     GetText          = other.GetText;
     GetColor         = other.GetColor;
     GetContrastColor = other.GetContrastColor;
 }
Ejemplo n.º 2
0
 protected LabelWidget(LabelWidget other)
     : base(other)
 {
     Text                  = other.Text;
     Align                 = other.Align;
     Font                  = other.Font;
     TextColor             = other.TextColor;
     Contrast              = other.Contrast;
     ContrastColorDark     = other.ContrastColorDark;
     ContrastColorLight    = other.ContrastColorLight;
     Shadow                = other.Shadow;
     WordWrap              = other.WordWrap;
     GetText               = other.GetText;
     GetColor              = other.GetColor;
     GetContrastColorDark  = other.GetContrastColorDark;
     GetContrastColorLight = other.GetContrastColorLight;
 }
Ejemplo n.º 3
0
        public static void BindPlayerNameAndStatus(LabelWidget label, Player p)
        {
            var client   = p.World.LobbyInfo.ClientWithIndex(p.ClientIndex);
            var nameFont = Game.Renderer.Fonts[label.Font];
            var name     = new CachedTransform <(string Name, WinState WinState, Session.ClientState ClientState), string>(c =>
            {
                var suffix = c.WinState == WinState.Undefined ? "" : " (" + c.Item2 + ")";
                if (c.ClientState == Session.ClientState.Disconnected)
                {
                    suffix = " (Gone)";
                }

                return(TruncateText(c.Name, label.Bounds.Width - nameFont.Measure(suffix).X, nameFont) + suffix);
            });

            label.GetText = () =>
            {
                var clientState = client != null ? client.State : Session.ClientState.Ready;
                return(name.Update((p.PlayerName, p.WinState, clientState)));
            };
        }