Lobby Containers (#320)
This commit is contained in:
101
Content.Client/Info/DiscordListBox.cs
Normal file
101
Content.Client/Info/DiscordListBox.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using Robust.Client.UserInterface;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Client.Info
|
||||||
|
{
|
||||||
|
public sealed class DiscordListBox : BoxContainer
|
||||||
|
{
|
||||||
|
|
||||||
|
private IUriOpener _uriOpener;
|
||||||
|
|
||||||
|
public DiscordListBox()
|
||||||
|
{
|
||||||
|
_uriOpener = IoCManager.Resolve<IUriOpener>();
|
||||||
|
Orientation = LayoutOrientation.Vertical;
|
||||||
|
AddDiscordServers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddDiscordServers()
|
||||||
|
{
|
||||||
|
AddDiscordServerInfo("Атараксия", "Проект для заинтересованных в отыгрыше.");
|
||||||
|
AddDiscordServerInfo("Гласио", "Ролевой сервер для разумных эскапистов.");
|
||||||
|
AddDiscordServerInfo("Амур", "Проект с ЕРП направленностью.");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddDiscordServerInfo(string serverName, string description)
|
||||||
|
{
|
||||||
|
var serverBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Horizontal,
|
||||||
|
};
|
||||||
|
|
||||||
|
var nameAndDescriptionBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Vertical,
|
||||||
|
};
|
||||||
|
|
||||||
|
var serverNameLabel = new Label
|
||||||
|
{
|
||||||
|
Text = serverName,
|
||||||
|
MinWidth = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
var descriptionLabel = new RichTextLabel
|
||||||
|
{
|
||||||
|
MaxWidth = 500
|
||||||
|
};
|
||||||
|
descriptionLabel.SetMessage(FormattedMessage.FromMarkup(description));
|
||||||
|
|
||||||
|
var buttonBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Vertical,
|
||||||
|
HorizontalExpand = true,
|
||||||
|
HorizontalAlignment = HAlignment.Right
|
||||||
|
};
|
||||||
|
|
||||||
|
var connectButton = new Button
|
||||||
|
{
|
||||||
|
Text = "Discord"
|
||||||
|
};
|
||||||
|
|
||||||
|
connectButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
OpenUrl(serverName, connectButton);
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonBox.AddChild(connectButton);
|
||||||
|
|
||||||
|
nameAndDescriptionBox.AddChild(serverNameLabel);
|
||||||
|
nameAndDescriptionBox.AddChild(descriptionLabel);
|
||||||
|
|
||||||
|
serverBox.AddChild(nameAndDescriptionBox);
|
||||||
|
serverBox.AddChild(buttonBox);
|
||||||
|
|
||||||
|
AddChild(serverBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OpenUrl(string serverName, Button button)
|
||||||
|
{
|
||||||
|
button.Disabled = true;
|
||||||
|
|
||||||
|
var url = "";
|
||||||
|
|
||||||
|
switch (serverName)
|
||||||
|
{
|
||||||
|
case "Атараксия":
|
||||||
|
url = "https://discord.gg/BCPkP3TcDT";
|
||||||
|
break;
|
||||||
|
case "Гласио":
|
||||||
|
url = "https://discord.gg/TGzZep96cR";
|
||||||
|
break;
|
||||||
|
case "Амур":
|
||||||
|
url = "https://discord.gg/vxHPsZ3Qyr";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_uriOpener.OpenUri(url);
|
||||||
|
|
||||||
|
button.Disabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
120
Content.Client/Info/ServerListBox.cs
Normal file
120
Content.Client/Info/ServerListBox.cs
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
using Robust.Client;
|
||||||
|
using Robust.Client.UserInterface.Controls;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Client.Info
|
||||||
|
{
|
||||||
|
public sealed class ServerListBox : BoxContainer
|
||||||
|
{
|
||||||
|
private IGameController _gameController;
|
||||||
|
private List<Button> _connectButtons = new();
|
||||||
|
|
||||||
|
public ServerListBox()
|
||||||
|
{
|
||||||
|
_gameController = IoCManager.Resolve<IGameController>();
|
||||||
|
Orientation = LayoutOrientation.Vertical;
|
||||||
|
AddServers();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddServers()
|
||||||
|
{
|
||||||
|
AddServerInfo("Грид", "Сервер с постоянным безумием");
|
||||||
|
AddServerInfo("Мэйд", "Сервер с лучшим сервисом");
|
||||||
|
AddServerInfo("Енги", "Сервер с расслабленным геймплеем");
|
||||||
|
AddServerInfo("Амур", "Сервер для любителей ЕРП");
|
||||||
|
AddServerInfo("Инфинити️", "Сервер без правил");
|
||||||
|
AddServerInfo("Гласио", "Вайтлистовый сервер");
|
||||||
|
AddServerInfo("Атараксия", "Для любителей ролевой игры");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddServerInfo(string serverName, string description)
|
||||||
|
{
|
||||||
|
var serverBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Horizontal,
|
||||||
|
};
|
||||||
|
|
||||||
|
var nameAndDescriptionBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Vertical,
|
||||||
|
};
|
||||||
|
|
||||||
|
var serverNameLabel = new Label
|
||||||
|
{
|
||||||
|
Text = serverName,
|
||||||
|
MinWidth = 200
|
||||||
|
};
|
||||||
|
|
||||||
|
var descriptionLabel = new RichTextLabel
|
||||||
|
{
|
||||||
|
MaxWidth = 500
|
||||||
|
};
|
||||||
|
descriptionLabel.SetMessage(FormattedMessage.FromMarkup(description));
|
||||||
|
|
||||||
|
var buttonBox = new BoxContainer
|
||||||
|
{
|
||||||
|
Orientation = LayoutOrientation.Vertical,
|
||||||
|
HorizontalExpand = true,
|
||||||
|
HorizontalAlignment = HAlignment.Right
|
||||||
|
};
|
||||||
|
|
||||||
|
var connectButton = new Button
|
||||||
|
{
|
||||||
|
Text = "Connect"
|
||||||
|
};
|
||||||
|
|
||||||
|
_connectButtons.Add(connectButton);
|
||||||
|
|
||||||
|
connectButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
ConnectToServer(serverName);
|
||||||
|
|
||||||
|
foreach (var connectButton in _connectButtons)
|
||||||
|
{
|
||||||
|
connectButton.Disabled = true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonBox.AddChild(connectButton);
|
||||||
|
|
||||||
|
nameAndDescriptionBox.AddChild(serverNameLabel);
|
||||||
|
nameAndDescriptionBox.AddChild(descriptionLabel);
|
||||||
|
|
||||||
|
serverBox.AddChild(nameAndDescriptionBox);
|
||||||
|
serverBox.AddChild(buttonBox);
|
||||||
|
|
||||||
|
AddChild(serverBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ConnectToServer(string serverName)
|
||||||
|
{
|
||||||
|
var url = "";
|
||||||
|
|
||||||
|
switch (serverName)
|
||||||
|
{
|
||||||
|
case "Грид":
|
||||||
|
url = "ss14://s0.ss14.su:3333";
|
||||||
|
break;
|
||||||
|
case "Мэйд":
|
||||||
|
url = "ss14://s5.ss14.su:6666";
|
||||||
|
break;
|
||||||
|
case "Енги":
|
||||||
|
url = "ss14://s5.ss14.su:7777";
|
||||||
|
break;
|
||||||
|
case "Амур":
|
||||||
|
url = "ss14://s0.ss14.su:8888";
|
||||||
|
break;
|
||||||
|
case "Инфинити️":
|
||||||
|
url = "ss14://s0.ss14.su:5555";
|
||||||
|
break;
|
||||||
|
case "Гласио":
|
||||||
|
url = "ss14://s0.ss14.su:4444";
|
||||||
|
break;
|
||||||
|
case "Атараксия":
|
||||||
|
url = "ss14://s0.ss14.su:10101";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_gameController.Redial(url, "Connecting to another server...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -43,6 +43,22 @@
|
|||||||
</controls:StripeBack>
|
</controls:StripeBack>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
|
|
||||||
|
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
||||||
|
<PanelContainer Name="TopLeftContainer" MinHeight="350" MinWidth="469" StyleClasses="LobbyGayBackground">
|
||||||
|
<info:DiscordListBox Name="DiscordListBox" Access="Public" MinSize="0 30" VerticalExpand="True" HorizontalExpand="True" Margin="3 3 3 3" HorizontalAlignment="Stretch"/>
|
||||||
|
</PanelContainer>
|
||||||
|
|
||||||
|
<BoxContainer HorizontalAlignment="Stretch" HorizontalExpand="True">
|
||||||
|
<!-- Empty container to create spacing -->
|
||||||
|
</BoxContainer>
|
||||||
|
|
||||||
|
<PanelContainer Name="TopRightContainer" MinHeight="350" MinWidth="469" StyleClasses="LobbyGayBackground">
|
||||||
|
<info:ServerListBox Name="ServerListBox" Access="Public" MinSize="0 30" VerticalExpand="True" HorizontalExpand="True" Margin="3 3 3 3" HorizontalAlignment="Stretch"/>
|
||||||
|
</PanelContainer>
|
||||||
|
</BoxContainer>
|
||||||
|
|
||||||
|
|
||||||
<!-- Voting Popups -->
|
<!-- Voting Popups -->
|
||||||
<BoxContainer Orientation="Vertical" SeparationOverride="4" Name="VoteContainer"
|
<BoxContainer Orientation="Vertical" SeparationOverride="4" Name="VoteContainer"
|
||||||
Access="Public" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8" />
|
Access="Public" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8" />
|
||||||
|
|||||||
Reference in New Issue
Block a user