Провиль и привязка через лобби.
This commit is contained in:
parent
ee3d2ff398
commit
839257dba8
13 changed files with 280 additions and 64 deletions
|
|
@ -57,14 +57,6 @@ namespace Content.Client.Info
|
|||
// Sunrise-Start
|
||||
roadmapButton.OnPressed += _ => UserInterfaceManager.GetUIController<RoadmapUIController>().ToggleRoadmap();
|
||||
buttons.AddChild(roadmapButton);
|
||||
|
||||
var donateButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("server-info-donate-button"),
|
||||
Disabled = true,
|
||||
};
|
||||
//donateButton.OnPressed += args =>
|
||||
buttons.AddChild(donateButton);
|
||||
// Sunrise-End
|
||||
|
||||
void AddInfoButton(string loc, CVarDef<string> cVar)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@
|
|||
xmlns:info="clr-namespace:Content.Client.Info"
|
||||
xmlns:widgets="clr-namespace:Content.Client.UserInterface.Systems.Chat.Widgets"
|
||||
xmlns:serversHub="clr-namespace:Content.Client._Sunrise.ServersHub"
|
||||
xmlns:changelog="clr-namespace:Content.Client.Changelog">
|
||||
xmlns:changelog="clr-namespace:Content.Client.Changelog"
|
||||
xmlns:userProfile="clr-namespace:Content.Client._Sunrise.UserProfile">
|
||||
<!-- Background -->
|
||||
<TextureRect Access="Public" VerticalExpand="True" HorizontalExpand="True" Name="Background" Stretch="KeepAspectCovered" />
|
||||
<BoxContainer Name="MainContainer" VerticalExpand="True" HorizontalExpand="True" Orientation="Horizontal"
|
||||
|
|
@ -63,14 +64,37 @@
|
|||
<BoxContainer Orientation="Vertical" SeparationOverride="4" Name="VoteContainer"
|
||||
Access="Public" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0 8" />
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Left">
|
||||
<PanelContainer Name="LeftBottomPanel" StyleClasses="AngleRect" VerticalExpand="True" MinWidth="550"
|
||||
VerticalAlignment="Bottom" HorizontalExpand="True">
|
||||
<BoxContainer Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Top"
|
||||
HorizontalExpand="True" VerticalExpand="True">
|
||||
<BoxContainer Orientation="Vertical" HorizontalAlignment="Left" VerticalExpand="True"
|
||||
SeparationOverride="2" VerticalAlignment="Stretch" HorizontalExpand="True" >
|
||||
<BoxContainer Orientation="Vertical" HorizontalAlignment="Left" MinWidth="600"
|
||||
VerticalAlignment="Bottom" VerticalExpand="True">
|
||||
<PanelContainer Name="LeftBottomPanel" SizeFlagsStretchRatio="3"
|
||||
StyleClasses="AngleRect" VerticalExpand="True"
|
||||
VerticalAlignment="Bottom" HorizontalAlignment="Stretch" HorizontalExpand="True">
|
||||
<BoxContainer Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
|
||||
HorizontalExpand="True" VerticalExpand="True" SeparationOverride="3">
|
||||
<BoxContainer Orientation="Vertical" Name="UserProfileBox" VerticalExpand="True"
|
||||
VerticalAlignment="Stretch" Access="Public" SizeFlagsStretchRatio="4">
|
||||
<controls:StripeBack>
|
||||
<BoxContainer Orientation="Horizontal" Name="UserProfileHeader" >
|
||||
<Label HorizontalExpand="True" Name="UserProfileHeaderLabel" Access="Public"
|
||||
Text="Профиль" VAlign="Center" StyleClasses="LabelHeading"
|
||||
Align="Center"/>
|
||||
<TextureRect Name="UserProfileHider" VerticalAlignment="Center" SetSize="25 25"
|
||||
Stretch="KeepAspectCentered" Margin="5 1" MouseFilter="Pass"
|
||||
HorizontalAlignment="Right" Access="Public">
|
||||
</TextureRect>
|
||||
</BoxContainer>
|
||||
</controls:StripeBack>
|
||||
<BoxContainer Orientation="Vertical" Name="UserProfileContent" HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||
<userProfile:UserProfile Name="UserProfileBody" Access="Public" HorizontalExpand="True"
|
||||
VerticalExpand="True" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" Name="ServersHubBox" VerticalExpand="True"
|
||||
VerticalAlignment="Bottom" Access="Public">
|
||||
VerticalAlignment="Bottom" Access="Public" SizeFlagsStretchRatio="2">
|
||||
<controls:StripeBack>
|
||||
<BoxContainer Orientation="Horizontal" Name="ServersHubHeader" >
|
||||
<Label HorizontalExpand="True" Name="ServersHubHeaderLabel" Access="Public"
|
||||
|
|
@ -84,13 +108,15 @@
|
|||
</controls:StripeBack>
|
||||
<BoxContainer Orientation="Vertical" Name="ServersHubContent" HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Top" MinHeight="150">
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Top">
|
||||
<serversHub:ServersHub Name="ServersHubBody" Access="Public" HorizontalExpand="True"
|
||||
VerticalExpand="True" />
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" Name="ChangelogBox" VerticalExpand="True" HorizontalAlignment="Stretch"
|
||||
MaxWidth="530" VerticalAlignment="Bottom">
|
||||
<BoxContainer Orientation="Vertical" Name="ChangelogBox" VerticalExpand="True"
|
||||
MaxWidth="580"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Bottom"
|
||||
SizeFlagsStretchRatio="5">
|
||||
<BoxContainer Orientation="Vertical" VerticalExpand="True" VerticalAlignment="Stretch">
|
||||
<controls:StripeBack VerticalAlignment="Top">
|
||||
<BoxContainer Orientation="Horizontal" Name="ChangelogHeader">
|
||||
|
|
@ -102,12 +128,11 @@
|
|||
</TextureRect>
|
||||
</BoxContainer>
|
||||
</controls:StripeBack>
|
||||
<BoxContainer Orientation="Vertical" MinHeight="200" MaxHeight="250" Name="ChangelogContent" VerticalExpand="True"
|
||||
<BoxContainer Orientation="Vertical" MinHeight="250" MaxHeight="250" Name="ChangelogContent" VerticalExpand="True"
|
||||
HorizontalAlignment="Stretch" VerticalAlignment="Top" >
|
||||
<changelog:ChangelogTab Name="LocalChangelogBody"
|
||||
RectClipContent="True" Access="Public"
|
||||
VerticalExpand="True" VerticalAlignment="Stretch"
|
||||
MinHeight="200" MaxHeight="250"/>
|
||||
VerticalExpand="True" VerticalAlignment="Stretch"/>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
|
|
@ -119,6 +144,7 @@
|
|||
VerticalExpand="True" HorizontalExpand="True"/>
|
||||
</PanelContainer>
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" HorizontalAlignment="Right">
|
||||
<PanelContainer Name="RightPanel" MinWidth="500" StyleClasses="AngleRect" VerticalExpand="True"
|
||||
VerticalAlignment="Stretch" HorizontalExpand="True">
|
||||
|
|
|
|||
|
|
@ -80,6 +80,15 @@ namespace Content.Client.Lobby.UI
|
|||
CharacterInfoHider.Texture = CharacterInfoContent.Visible ? IconExpanded : IconCollapsed;
|
||||
};
|
||||
|
||||
UserProfileHider.OnKeyBindUp += args =>
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.Use)
|
||||
return;
|
||||
|
||||
UserProfileContent.Visible = !UserProfileContent.Visible;
|
||||
UserProfileHider.Texture = UserProfileContent.Visible ? IconExpanded : IconCollapsed;
|
||||
};
|
||||
|
||||
ServersHubHider.OnKeyBindUp += args =>
|
||||
{
|
||||
if (args.Function != EngineKeyFunctions.Use)
|
||||
|
|
@ -152,11 +161,13 @@ namespace Content.Client.Lobby.UI
|
|||
ServerInfoHider.Texture = ServerInfoContent.Visible ? IconExpanded : IconCollapsed;
|
||||
CharacterInfoHider.Texture = CharacterInfoContent.Visible ? IconExpanded : IconCollapsed;
|
||||
ChatHider.Texture = ChatContent.Visible ? IconExpanded : IconCollapsed;
|
||||
UserProfileHider.Texture = CharacterInfoContent.Visible ? IconExpanded : IconCollapsed;
|
||||
ServersHubHider.Modulate = StyleNano.NanoGold;
|
||||
ChangelogHider.Modulate = StyleNano.NanoGold;
|
||||
ServerInfoHider.Modulate = StyleNano.NanoGold;
|
||||
CharacterInfoHider.Modulate = StyleNano.NanoGold;
|
||||
ChatHider.Modulate = StyleNano.NanoGold;
|
||||
UserProfileHider.Modulate = StyleNano.NanoGold;
|
||||
}
|
||||
|
||||
private void OnServersHubEnableChanged(bool enable)
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
<ui:VoteCallMenuButton />
|
||||
<!-- Sunrise-Sponsor-Start -->
|
||||
<Button Access="Public" Name="DonateButton" Text="{Loc 'ui-escape-donate'}" />
|
||||
<Button Access="Public" Name="ForumButton" Text="{Loc 'ui-escape-forum'}" />
|
||||
<!-- Sunrise-Sponsor-End -->
|
||||
<Button Access="Public" Name="OptionsButton" Text="{Loc 'ui-escape-options'}" />
|
||||
<Button Access="Public" Name="RulesButton" Text="{Loc 'ui-escape-rules'}" />
|
||||
|
|
|
|||
|
|
@ -106,6 +106,11 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||
{
|
||||
_uri.OpenUri(_cfg.GetCVar(SunriseCCVars.InfoLinksDonate));
|
||||
};
|
||||
|
||||
_escapeWindow.ForumButton.OnPressed += _ =>
|
||||
{
|
||||
_uri.OpenUri(_cfg.GetCVar(CCVars.InfoLinksForum));
|
||||
};
|
||||
// Sunrise-end
|
||||
|
||||
_escapeWindow.WikiButton.OnPressed += _ =>
|
||||
|
|
|
|||
51
Content.Client/_Sunrise/UserProfile/UserProfile.xaml
Normal file
51
Content.Client/_Sunrise/UserProfile/UserProfile.xaml
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<Control xmlns="https://spacestation14.io"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
|
||||
MinSize="100 100">
|
||||
<BoxContainer Orientation="Vertical" >
|
||||
<customControls:HSeparator/>
|
||||
<BoxContainer Orientation="Horizontal" SeparationOverride="2" HorizontalExpand="True">
|
||||
<customControls:VSeparator/>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'Спонсорство'}" StyleClasses="LabelHeadingBigger" HorizontalAlignment="Center"/>
|
||||
<GridContainer Columns="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalExpand="True"
|
||||
VerticalAlignment="Top"
|
||||
Margin="5 5 5 5">
|
||||
<Label Text="{Loc 'Уровень: '}" StyleClasses="LabelKeyText"/>
|
||||
<Label Name="SponsorTierName" />
|
||||
</GridContainer>
|
||||
<GridContainer Columns="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalExpand="True"
|
||||
VerticalAlignment="Top">
|
||||
<Button Name="InfoSponsorButton" Text="Информация" Disabled="True" />
|
||||
<Button Name="BuySponsorButton" Text="Приобрести" />
|
||||
</GridContainer>
|
||||
</BoxContainer>
|
||||
<customControls:VSeparator/>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'Соц.сети'}" StyleClasses="LabelHeadingBigger" HorizontalAlignment="Center"/>
|
||||
<GridContainer Columns="2"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalExpand="True"
|
||||
VerticalAlignment="Top"
|
||||
Margin="5 5 5 5">
|
||||
<Label Text="{Loc 'Discord:'}" StyleClasses="LabelKeyText"/>
|
||||
<BoxContainer Orientation="Horizontal">
|
||||
<Label Name="LinkedDiscordName" />
|
||||
<Button Name="LinkDiscordButton" Text="Подвязать"/>
|
||||
</BoxContainer>
|
||||
<Label Text="{Loc 'Telegram:'}" StyleClasses="LabelKeyText"/>
|
||||
<BoxContainer Orientation="Horizontal" >
|
||||
<Label Name="LinkedTelegramName" />
|
||||
<Button Name="LinkTelegramButton" Text="Подвязать"/>
|
||||
</BoxContainer>
|
||||
</GridContainer>
|
||||
</BoxContainer>
|
||||
<customControls:VSeparator/>
|
||||
</BoxContainer>
|
||||
<customControls:HSeparator/>
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
105
Content.Client/_Sunrise/UserProfile/UserProfile.xaml.cs
Normal file
105
Content.Client/_Sunrise/UserProfile/UserProfile.xaml.cs
Normal file
|
|
@ -0,0 +1,105 @@
|
|||
using Content.Shared._Sunrise.SunriseCCVars;
|
||||
using Content.Sunrise.Interfaces.Client;
|
||||
using Content.Sunrise.Interfaces.Shared;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client._Sunrise.UserProfile;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class UserProfile : Control
|
||||
{
|
||||
[Dependency] private readonly ISharedPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IUriOpener _uri = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
private readonly IClientServiceAuthManager? _serviceAuthManager;
|
||||
private readonly ISharedSponsorsManager? _sponsorsManager;
|
||||
|
||||
public UserProfile()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
IoCManager.Instance!.TryResolveType(out _sponsorsManager);
|
||||
IoCManager.Instance!.TryResolveType(out _serviceAuthManager);
|
||||
|
||||
BuySponsorButton.Disabled = _cfg.GetCVar(SunriseCCVars.InfoLinksDonate) == "";
|
||||
|
||||
if (_serviceAuthManager == null || _sponsorsManager == null)
|
||||
return;
|
||||
|
||||
BuySponsorButton.OnPressed += BuySponsorPressed;
|
||||
LinkTelegramButton.OnPressed += LinkTelegramPressed;
|
||||
LinkDiscordButton.OnPressed += LinkDiscordPressed;
|
||||
InfoSponsorButton.OnPressed += InfoSponsorPressed;
|
||||
|
||||
_serviceAuthManager.LoadedServiceLinkedServices += RefreshServiceLinkedServices;
|
||||
_sponsorsManager.LoadedSponsorData += RefreshSponsorData;
|
||||
}
|
||||
|
||||
private void RefreshSponsorData()
|
||||
{
|
||||
if (_sponsorsManager == null)
|
||||
return;
|
||||
|
||||
if (_playerManager.LocalSession != null)
|
||||
{
|
||||
if (!_sponsorsManager.ClientIsSponsor())
|
||||
return;
|
||||
|
||||
_sponsorsManager.TryGetOocTitle(_playerManager.LocalSession.UserId, out var sponsorTitle);
|
||||
SponsorTierName.Text = sponsorTitle;
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshServiceLinkedServices(List<LinkedServiceData> linkedServices)
|
||||
{
|
||||
if (_serviceAuthManager == null)
|
||||
return;
|
||||
|
||||
foreach (var serviceAuthData in _serviceAuthManager.ServiceLinkedServices)
|
||||
{
|
||||
switch (serviceAuthData.ServiceType)
|
||||
{
|
||||
case ServiceType.Discord:
|
||||
LinkDiscordButton.Visible = false;
|
||||
LinkedDiscordName.Text = serviceAuthData.Username;
|
||||
break;
|
||||
case ServiceType.Telegram:
|
||||
LinkTelegramButton.Visible = false;
|
||||
LinkedTelegramName.Text = serviceAuthData.Username;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BuySponsorPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
_uri.OpenUri(_cfg.GetCVar(SunriseCCVars.InfoLinksDonate));
|
||||
}
|
||||
|
||||
private void LinkTelegramPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_serviceAuthManager == null)
|
||||
return;
|
||||
|
||||
_serviceAuthManager.ToggleWindow(ServiceType.Telegram);
|
||||
}
|
||||
|
||||
private void LinkDiscordPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
if (_serviceAuthManager == null)
|
||||
return;
|
||||
|
||||
_serviceAuthManager.ToggleWindow(ServiceType.Discord);
|
||||
}
|
||||
|
||||
private void InfoSponsorPressed(BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,11 @@
|
|||
service-check-member-title = Проверка членства в Discord
|
||||
service-check-member-info = Для доступа на сервер вам необходимо быть участником нашего Discord сервера.
|
||||
service-check-member-discord-title = Проверка членства в Discord
|
||||
service-check-member-telegram-title = Проверка членства в Telegram
|
||||
service-check-member-discord-info = Для доступа на сервер вам необходимо быть участником нашего Discord сервера.
|
||||
service-check-member-telegram-info = Для доступа на сервер вам необходимо быть участником нашего Telegram канала.
|
||||
service-check-member-warn = Учтите что зайти на сервер нужно с того аккаунта на который вы делали подвязку.
|
||||
service-check-member-username = Ваш подвязаный аккаунт:
|
||||
service-check-member-browser-btn = Открыть в браузере
|
||||
service-check-member-quit-btn = Выйти
|
||||
service-check-member-qrcode = QrCode для сканирования на телефоне.
|
||||
service-check-member-check-btn = Проверить
|
||||
service-check-member-check-btn-wait = Ожидайте: { TOSTRING($time, "G3") }
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
using Content.Sunrise.Interfaces.Shared;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
namespace Content.Sunrise.Interfaces.Client;
|
||||
|
||||
public interface IClientServiceAuthManager : ISharedServiceAuthManager
|
||||
{
|
||||
public string ServiceJoinUrl { get; }
|
||||
public Texture? ServiceJoinQrcode { get; }
|
||||
public string ServiceUsername { get; }
|
||||
public List<ServiceAuthData> ServiceAuthDatas { get; set; }
|
||||
public List<ServiceAuthData> ServiceAuthDataList { get; set; }
|
||||
public List<LinkedServiceData> ServiceLinkedServices { get; set; }
|
||||
public event Action<List<LinkedServiceData>>? LoadedServiceLinkedServices;
|
||||
public event Action<ServiceAuthData>? LoadedAuthData;
|
||||
public void ToggleWindow(ServiceType serviceType);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
using Content.Sunrise.Interfaces.Shared;
|
||||
using Robust.Client.Graphics;
|
||||
|
||||
namespace Content.Sunrise.Interfaces.Client;
|
||||
|
||||
public interface IClientServiceCheckMemberManager : ISharedServiceAuthManager
|
||||
{
|
||||
public string ServiceJoinUrl { get; }
|
||||
public Texture? ServiceJoinQrcode { get; }
|
||||
public string ServiceUsername { get; }
|
||||
public ServiceType SelectedService { get; }
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ public interface IServerServiceAuthManager : ISharedServiceAuthManager
|
|||
public event EventHandler<ICommonSession>? PlayerVerified;
|
||||
public Task<ServiceAuthDataResponse> GenerateDiscordAuthData(NetUserId userId, CancellationToken cancel);
|
||||
public Task<ServiceAuthDataResponse> GenerateTelegramAuthData(NetUserId userId, CancellationToken cancel);
|
||||
public Task<List<ServiceType>> CheckLinkedServices(NetUserId userId, string username, CancellationToken cancel);
|
||||
public Task<List<LinkedServiceData>> CheckLinkedServices(NetUserId userId, string username, CancellationToken cancel);
|
||||
public Task<string?> GetDiscordUserId(NetUserId? userId, CancellationToken cancel = default);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -20,3 +20,9 @@ public sealed class ServiceAuthData(string url, byte[] qrcode, ServiceType servi
|
|||
public byte[] QrCode { get; set; } = qrcode;
|
||||
public ServiceType ServiceType { get; set; } = serviceType;
|
||||
}
|
||||
|
||||
public sealed class LinkedServiceData(string username, ServiceType serviceType)
|
||||
{
|
||||
public string Username { get; set; } = username;
|
||||
public ServiceType ServiceType { get; set; } = serviceType;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,10 +9,14 @@ public interface ISharedSponsorsManager
|
|||
{
|
||||
public void Initialize();
|
||||
|
||||
public event Action? LoadedSponsorData;
|
||||
|
||||
// Client
|
||||
public List<string> GetClientPrototypes();
|
||||
public bool ClientAllowedRespawn();
|
||||
|
||||
public bool ClientIsSponsor();
|
||||
|
||||
// Server
|
||||
public bool TryGetPrototypes(NetUserId userId, [NotNullWhen(true)] out List<string>? prototypes);
|
||||
public bool TryGetOocTitle(NetUserId userId, [NotNullWhen(true)] out string? title);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue