Fix lobby container
This commit is contained in:
@@ -1,101 +0,0 @@
|
|||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
@@ -8,26 +9,27 @@ namespace Content.Client.Info
|
|||||||
{
|
{
|
||||||
private IGameController _gameController;
|
private IGameController _gameController;
|
||||||
private List<Button> _connectButtons = new();
|
private List<Button> _connectButtons = new();
|
||||||
|
private IUriOpener _uriOpener;
|
||||||
|
|
||||||
public ServerListBox()
|
public ServerListBox()
|
||||||
{
|
{
|
||||||
_gameController = IoCManager.Resolve<IGameController>();
|
_gameController = IoCManager.Resolve<IGameController>();
|
||||||
|
_uriOpener = IoCManager.Resolve<IUriOpener>();
|
||||||
Orientation = LayoutOrientation.Vertical;
|
Orientation = LayoutOrientation.Vertical;
|
||||||
AddServers();
|
AddServers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddServers()
|
private void AddServers()
|
||||||
{
|
{
|
||||||
AddServerInfo("Грид", "Сервер с постоянным безумием");
|
AddServerInfo("Grid", "Сервер с постоянным безумием", "ss14://s0.ss14.su:3333", null);
|
||||||
AddServerInfo("Мэйд", "Сервер с лучшим сервисом");
|
AddServerInfo("Maid", "Сервер с лучшим сервисом", "ss14://s5.ss14.su:6666", null);
|
||||||
AddServerInfo("Енги", "Сервер с расслабленным геймплеем");
|
AddServerInfo("Engi", "Сервер с расслабленным геймплеем", "ss14://s5.ss14.su:7777", null);
|
||||||
AddServerInfo("Амур", "Сервер для любителей ЕРП");
|
AddServerInfo("Amour", "Сервер для любителей ЕРП", "ss14://s0.ss14.su:8888", "https://discord.gg/vxHPsZ3Qyr");
|
||||||
AddServerInfo("Инфинити️", "Сервер без правил");
|
AddServerInfo("Glasio", "Сервер с лучшим отыгрышем", "ss14://s0.ss14.su:4444", "https://discord.gg/TGzZep96cR");
|
||||||
AddServerInfo("Гласио", "Сервер с лучшим отыгрышем");
|
AddServerInfo("Ataraxia", "Для любителей ролевой игры", "ss14://s0.ss14.su:10101", "https://discord.gg/BCPkP3TcDT");
|
||||||
AddServerInfo("Атараксия", "Для любителей ролевой игры");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddServerInfo(string serverName, string description)
|
private void AddServerInfo(string serverName, string description, string serverUrl, string ?discord)
|
||||||
{
|
{
|
||||||
var serverBox = new BoxContainer
|
var serverBox = new BoxContainer
|
||||||
{
|
{
|
||||||
@@ -53,21 +55,36 @@ namespace Content.Client.Info
|
|||||||
|
|
||||||
var buttonBox = new BoxContainer
|
var buttonBox = new BoxContainer
|
||||||
{
|
{
|
||||||
Orientation = LayoutOrientation.Vertical,
|
Orientation = LayoutOrientation.Horizontal,
|
||||||
HorizontalExpand = true,
|
HorizontalExpand = true,
|
||||||
HorizontalAlignment = HAlignment.Right
|
HorizontalAlignment = HAlignment.Right
|
||||||
};
|
};
|
||||||
|
|
||||||
var connectButton = new Button
|
var connectButton = new Button
|
||||||
{
|
{
|
||||||
Text = "Connect"
|
Text = "Подключиться"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (discord != null)
|
||||||
|
{
|
||||||
|
var discordButton = new Button
|
||||||
|
{
|
||||||
|
Text = "Discord"
|
||||||
|
};
|
||||||
|
|
||||||
|
discordButton.OnPressed += _ =>
|
||||||
|
{
|
||||||
|
_uriOpener.OpenUri(discord);
|
||||||
|
};
|
||||||
|
|
||||||
|
buttonBox.AddChild(discordButton);
|
||||||
|
}
|
||||||
|
|
||||||
_connectButtons.Add(connectButton);
|
_connectButtons.Add(connectButton);
|
||||||
|
|
||||||
connectButton.OnPressed += _ =>
|
connectButton.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
ConnectToServer(serverName);
|
_gameController.Redial(serverUrl, "Connecting to another server...");
|
||||||
|
|
||||||
foreach (var connectButton in _connectButtons)
|
foreach (var connectButton in _connectButtons)
|
||||||
{
|
{
|
||||||
@@ -85,36 +102,5 @@ namespace Content.Client.Info
|
|||||||
|
|
||||||
AddChild(serverBox);
|
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...");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,14 +45,6 @@
|
|||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
|
|
||||||
<BoxContainer Orientation="Horizontal" HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
<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">
|
<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"/>
|
<info:ServerListBox Name="ServerListBox" Access="Public" MinSize="0 30" VerticalExpand="True" HorizontalExpand="True" Margin="3 3 3 3" HorizontalAlignment="Stretch"/>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
|
|||||||
Reference in New Issue
Block a user