Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions Content.Client/ADT/Lobby/UI/SpeciesWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public sealed partial class SpeciesWindow : FancyWindow
private readonly LobbyUIController _uIController;
private readonly IResourceManager _resMan;
[Dependency] private readonly DocumentParsingManager _parsingMan = default!;
[Dependency] private readonly Content.Client.ADT.Sponsors.SponsorManager _adtSponsors = default!;
[Dependency] private readonly Robust.Client.Player.IPlayerManager _players = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly ILocalizationManager _loc = default!;

Expand All @@ -51,6 +53,34 @@ public SpeciesWindow(HumanoidCharacterProfile profile,
_uIController = uIController;
_resMan = resManager;

CurrentSpecies = Profile.Species;

BuildSpeciesList();
SelectSpecies(Profile.Species);

_adtSponsors.Updated += OnSponsorsUpdated;
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (disposing)
_adtSponsors.Updated -= OnSponsorsUpdated;
}

private void OnSponsorsUpdated()
{
if (Disposed)
return;

BuildSpeciesList();
}

private void BuildSpeciesList()
{
SpeciesContainer.RemoveAllChildren();

var protoList = _proto.EnumeratePrototypes<SpeciesPrototype>().Where(x => x.RoundStart).ToList();
protoList.Sort((x, y) => LocOrLiteral(x.Name)[0].CompareTo(LocOrLiteral(y.Name)[0]));

Expand All @@ -61,7 +91,7 @@ public SpeciesWindow(HumanoidCharacterProfile profile,
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Pressed = CurrentSpecies == item.ID,
Text = LocOrLiteral(item.Name),
Margin = new Thickness(5f, 5f),
};
Expand All @@ -76,7 +106,7 @@ public SpeciesWindow(HumanoidCharacterProfile profile,
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Pressed = CurrentSpecies == item.ID,
Text = LocOrLiteral(item.Name),
Margin = new Thickness(5f, 5f),
};
Expand All @@ -91,34 +121,36 @@ public SpeciesWindow(HumanoidCharacterProfile profile,
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Pressed = CurrentSpecies == item.ID,
Text = LocOrLiteral(item.Name),
Margin = new Thickness(5f, 5f),
};
button.OnToggled += args => SelectSpecies(item.ID);
SpeciesContainer.AddChild(button);
}

if (IoCManager.Resolve<SponsorsManager>().TryGetInfo(out var sponsor))
var localSession = _players.LocalSession;

if (IoCManager.Resolve<SponsorsManager>().TryGetInfo(out var sponsor) || _adtSponsors.Data.HasAnyBenefit)
{
AddLabel("Спонсорские");
Comment thread
Inconnu1337 marked this conversation as resolved.
foreach (var item in protoList.Where(x => x.Category == SpeciesCategory.Sponsor))
{
if (item.SponsorOnly && !_adtSponsors.IsSpeciesAllowed(localSession, item.ID) && sponsor == null)
continue;

var button = new SpeciesButton(item)
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Pressed = CurrentSpecies == item.ID,
Text = LocOrLiteral(item.Name),
Margin = new Thickness(5f, 5f),
};
button.OnToggled += args => SelectSpecies(item.ID);
SpeciesContainer.AddChild(button);
}
}

CurrentSpecies = Profile.Species;
SelectSpecies(Profile.Species);
}

private string LocOrLiteral(string id)
Expand Down
55 changes: 37 additions & 18 deletions Content.Client/ADT/Lobby/UI/SponsorInfoWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,43 @@
x:Class="Content.Client.Lobby.UI.SponsorInfoWindow"
xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Content.Client.UserInterface.Controls;assembly=Content.Client"
Title="{Loc 'ui-lobby-sponsor-status'}"
MinWidth="490"
MinHeight="250"
MaxHeight="300"
Resizable="False">

<BoxContainer Orientation="Vertical" SeparationOverride="8" Margin="10">
<!-- Инфо о спонсоре -->
<RichTextLabel Name="SponsorLabel"
HorizontalExpand="True"
VerticalExpand="True" />

<!-- Кнопка перехода на Boosty -->
<Button Name="ButtonSiteBoosty"
Text="{Loc 'ui-lobby-sponsor-get-sponsor'}"
HorizontalAlignment="Center"
Margin="0,10,0,0"
StyleClasses="ButtonBig" />
MinWidth="600"
MinHeight="480"
Resizable="True">
<BoxContainer Orientation="Vertical" SeparationOverride="6" Margin="8">
<PanelContainer StyleClasses="BackgroundPanel">
<BoxContainer Orientation="Vertical" SeparationOverride="4" Margin="12 10">
<BoxContainer Orientation="Horizontal" SeparationOverride="8">
<Label Name="PlayerNameLabel"
StyleClasses="LabelHeading"
HorizontalExpand="True" />
<PanelContainer Name="StatusBadgePanel" VerticalAlignment="Center">
<Label Name="StatusBadgeLabel" Margin="8 2" />
</PanelContainer>
</BoxContainer>
<BoxContainer Name="TiersContainer" Orientation="Vertical" SeparationOverride="2" />
</BoxContainer>
</PanelContainer>
<ScrollContainer HorizontalExpand="True"
VerticalExpand="True"
HScrollEnabled="False">
<BoxContainer Name="BenefitsContainer"
Orientation="Vertical"
SeparationOverride="0"
Margin="2 2 8 2" />
</ScrollContainer>
<PanelContainer StyleClasses="LowDivider" SetHeight="2" />
<BoxContainer Orientation="Horizontal"
SeparationOverride="6"
HorizontalAlignment="Center"
Margin="0 4 0 0">
<Button Name="ButtonSponsorColors"
Text="{Loc 'adt-sponsor-colors-open'}"
Visible="False" />
<Button Name="ButtonSiteBoosty"
Text="{Loc 'ui-lobby-sponsor-get-sponsor'}"
StyleClasses="ButtonBig" />
</BoxContainer>
</BoxContainer>
</DefaultWindow>
Loading
Loading