public PlayerListItemElement(string username, int?ping) { AddChild(new GuiTextElement() { Text = username.Replace("\n", "").Trim(), Margin = new Thickness(2), Anchor = Alignment.TopLeft, //Enabled = false, Padding = new Thickness(5, 5) }); if (ping.HasValue) { AddChild(_pingElement = new GuiConnectionPingIcon { Anchor = Alignment.MiddleRight, ShowPlayerCount = false, Margin = new Thickness(0, 0, 8, 0) }); _ping = ping.Value; } AutoSizeMode = AutoSizeMode.GrowOnly; }
private GuiServerListEntryElement(IServerQueryProvider queryProvider, string serverName, string serverAddress) { QueryProvider = queryProvider; SetFixedSize(355, 36); ServerName = serverName; ServerAddress = serverAddress; Margin = new Thickness(5, 5, 5, 5); Padding = Thickness.One; Anchor = Alignment.TopFill; AddChild(_serverIcon = new GuiTextureElement() { Width = ServerIconSize, Height = ServerIconSize, Anchor = Alignment.TopLeft, Background = GuiTextures.DefaultServerIcon, }); AddChild(_pingStatus = new GuiConnectionPingIcon() { Anchor = Alignment.TopRight, }); AddChild(_textWrapper = new GuiStackContainer() { ChildAnchor = Alignment.TopFill, Anchor = Alignment.TopLeft }); _textWrapper.Padding = new Thickness(0, 0); _textWrapper.Margin = new Thickness(ServerIconSize + 5, 0, 0, 0); _textWrapper.AddChild(_serverName = new GuiTextElement() { Text = ServerName, Margin = Thickness.Zero }); _textWrapper.AddChild(_serverMotd = new GuiTextElement() { TranslationKey = "multiplayer.status.pinging", Margin = new Thickness(0, 0, 5, 0), //Anchor = center }); }