Skip to content

Commit

Permalink
Merge branch 'antag_vizitka_combat' of https://github.com/nekosyndica…
Browse files Browse the repository at this point in the history
…tenihon/space_station_adt into pr/NekoSyndicateNihon/994
  • Loading branch information
Darkiich committed Jan 19, 2025
2 parents e4891d3 + 68e1445 commit c9a5f8e
Show file tree
Hide file tree
Showing 304 changed files with 60,395 additions and 50,116 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/labeler-needsreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions-ecosystem/action-add-labels@v1
with:
labels: "S: Needs Review"
labels: "Status: Needs Review"
- uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "S: Awaiting Changes"
labels: "Status: Awaiting Changes"
44 changes: 44 additions & 0 deletions Content.Client/ADT/Lobby/UI/SpeciesWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
SetSize="800 800"
MinSize="800 128"
Resizable="False">
<BoxContainer Orientation="Horizontal" VerticalExpand="True">
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False" Margin="5">
<PanelContainer VerticalExpand="True" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<BoxContainer Name="SpeciesContainer" VerticalExpand="True" HorizontalExpand="True" Orientation="Vertical"/>
</PanelContainer>
</ScrollContainer>
<BoxContainer Name="InfoContainer" Orientation="Vertical" VerticalExpand="True" Margin="5">
<BoxContainer Name="Showcase" Orientation="Horizontal" VerticalAlignment="Top">
<PanelContainer SetSize="200 200" MaxSize="200 200" VerticalAlignment="Top" Margin="5">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<SpriteView Name="Mob" Scale="4 4"/>
</PanelContainer>
<PanelContainer SetSize="200 200" MaxSize="200 200" VerticalAlignment="Top" Margin="5">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<SpriteView Name="JobLoadout" Scale="4 4"/>
</PanelContainer>
</BoxContainer>
<Button Name="Select" Text="{ Loc 'ui-species-select-button' }" SetWidth="410" MinWidth="410"/>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="False" Margin="5">
<PanelContainer VerticalExpand="True" HorizontalExpand="True">
<PanelContainer.PanelOverride>
<graphics:StyleBoxFlat BackgroundColor="#1B1B1E" />
</PanelContainer.PanelOverride>
<BoxContainer Name="DetailInfoContainer" VerticalExpand="True" MaxWidth="380" Orientation="Vertical">

</BoxContainer>
</PanelContainer>
</ScrollContainer>
</BoxContainer>
</BoxContainer>
</controls:FancyWindow>
273 changes: 273 additions & 0 deletions Content.Client/ADT/Lobby/UI/SpeciesWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,273 @@
using System.Linq;
using Content.Client.Administration.UI.CustomControls;
using Content.Client.Guidebook;
using Content.Client.Lobby;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Preferences;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.ContentPack;
using Robust.Shared.Prototypes;

namespace Content.Client.ADT.Lobby.UI;

[GenerateTypedNameReferences]
public sealed partial class SpeciesWindow : FancyWindow
{
public event Action<ProtoId<SpeciesPrototype>>? ChooseAction;
public ProtoId<SpeciesPrototype> CurrentSpecies;

public HumanoidCharacterProfile Profile;
private readonly IEntityManager _entityManager;
private readonly IPrototypeManager _proto;
private readonly LobbyUIController _uIController;
private readonly IResourceManager _resMan;
[Dependency] private readonly DocumentParsingManager _parsingMan = default!;

public SpeciesWindow(HumanoidCharacterProfile profile,
IPrototypeManager proto,
IEntityManager entMan,
LobbyUIController uIController,
IResourceManager resManager,
DocumentParsingManager parsing)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);

Title = Loc.GetString("species-window-title");

Profile = profile;
_entityManager = entMan;
_proto = proto;
_uIController = uIController;
_resMan = resManager;

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

AddLabel("Классические");
foreach (var item in protoList.Where(x => x.Category == SpeciesCategory.Classic))
{
var button = new SpeciesButton(item)
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Text = Loc.GetString(item.Name),
Margin = new Thickness(5f, 5f),
};
button.OnToggled += args => SelectSpecies(item.ID);
SpeciesContainer.AddChild(button);
}

AddLabel("Нестандартные");
foreach (var item in protoList.Where(x => x.Category == SpeciesCategory.Unusual))
{
var button = new SpeciesButton(item)
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Text = Loc.GetString(item.Name),
Margin = new Thickness(5f, 5f),
};
button.OnToggled += args => SelectSpecies(item.ID);
SpeciesContainer.AddChild(button);
}

AddLabel("Особые");
foreach (var item in protoList.Where(x => x.Category == SpeciesCategory.Special))
{
var button = new SpeciesButton(item)
{
HorizontalExpand = true,
ToggleMode = true,
Pressed = Profile.Species == item.ID,
Text = Loc.GetString(item.Name),
Margin = new Thickness(5f, 5f),
};
button.OnToggled += args => SelectSpecies(item.ID);
SpeciesContainer.AddChild(button);
}

CurrentSpecies = Profile.Species;
SelectSpecies(Profile.Species);
}
private void AddLabel(string text)
{
var container = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
Margin = new Thickness(5f, 5f),
};
var label = new Label()
{
Text = text,
StyleClasses = { StyleBase.ClassLowDivider },
Margin = new(2f, 2f),
};
var separator = new HSeparator()
{
Margin = new(2f, 2f, 2f, 4f),
};
container.AddChild(label);
container.AddChild(separator);

SpeciesContainer.AddChild(container);
}

public void SelectSpecies(ProtoId<SpeciesPrototype> protoId)
{
DetailInfoContainer.DisposeAllChildren();

foreach (var item in SpeciesContainer.Children)
{
if (item is not SpeciesButton button)
continue;
button.Pressed = protoId == button.Proto;
}

var proto = _proto.Index(protoId);
var job = Profile.JobPriorities.Where(x => x.Value == JobPriority.High).First().Key;
CurrentSpecies = protoId;

var previewProfile = Profile;
previewProfile = previewProfile.WithSpecies(protoId);

var skin = proto.SkinColoration;
switch (skin)
{
case HumanoidSkinColor.HumanToned:
{
var tone = SkinColor.HumanSkinToneFromColor(Profile.Appearance.SkinColor);
var color = SkinColor.HumanSkinTone((int)tone);

previewProfile = previewProfile.WithCharacterAppearance(previewProfile.Appearance.WithSkinColor(color));//
break;
}
case HumanoidSkinColor.Hues:
{
break;
}
case HumanoidSkinColor.TintedHues:
{
var color = SkinColor.TintedHues(Profile.Appearance.SkinColor);

previewProfile = previewProfile.WithCharacterAppearance(previewProfile.Appearance.WithSkinColor(color));
break;
}
case HumanoidSkinColor.VoxFeathers:
{
var color = SkinColor.ClosestVoxColor(Profile.Appearance.SkinColor);

previewProfile = previewProfile.WithCharacterAppearance(previewProfile.Appearance.WithSkinColor(color));
break;
}
}

var mob = _uIController.LoadProfileEntity(previewProfile, _proto.Index(job), false); // Раздетый моб
Mob.SetEntity(mob);

var loadoutMob = _uIController.LoadProfileEntity(previewProfile, _proto.Index(job), true); // Моб в одежде должности
JobLoadout.SetEntity(loadoutMob);

Select.Disabled = Profile.Species == protoId;
Select.OnPressed += args => ChooseAction?.Invoke(protoId);

// Тут у нас идёт штука для создание контейнера плюсов и минусов. Я не уверен, зачем я впихнул это сюда, но мне уже лень переделывать
var prosConsContainer = new BoxContainer()
{
Orientation = BoxContainer.LayoutOrientation.Vertical,
Margin = new Thickness(5f, 5f),
MaxWidth = 380f,
};
var prosConsLabel = new RichTextLabel()
{
Text = Loc.GetString("ui-species-pros-cons"),
StyleClasses = { StyleBase.ClassLowDivider },
Margin = new(2f, 2f),
};
var separator = new HSeparator()
{
Margin = new(2f, 2f, 2f, 4f),
};
prosConsContainer.AddChild(prosConsLabel);
prosConsContainer.AddChild(separator);
DetailInfoContainer.AddChild(prosConsContainer);

if (proto.Pros.Count <= 0 && proto.Special.Count <= 0 && proto.Cons.Count <= 0)
{
var noProsConsLabel = new RichTextLabel()
{
Text = Loc.GetString("ui-species-no-pros-cons"),
Margin = new(4f),
};
DetailInfoContainer.AddChild(noProsConsLabel);
}
else
{
if (proto.Pros.Count > 0)
{
foreach (var item in proto.Pros)
{
var label = new RichTextLabel()
{
Text = "[color=#13f244]- " + Loc.GetString(item) + "[/color]",
StyleClasses = { StyleBase.ClassLowDivider },
Margin = new(4f, 2f),
};
prosConsContainer.AddChild(label);
}
prosConsContainer.AddChild(new Control() { MinHeight = 8f });
}

if (proto.Special.Count > 0)
{
foreach (var item in proto.Special)
{
var label = new RichTextLabel()
{
Text = "- " + Loc.GetString(item),
StyleClasses = { StyleBase.ClassLowDivider },
Margin = new(4f, 2f),
};
prosConsContainer.AddChild(label);
}
prosConsContainer.AddChild(new Control() { MinHeight = 8f });
}

if (proto.Cons.Count > 0)
{
foreach (var item in proto.Cons)
{
var label = new RichTextLabel()
{
Text = "[color=#d63636]- " + Loc.GetString(item) + "[/color]",
StyleClasses = { StyleBase.ClassLowDivider },
Margin = new(4f, 2f),
};
prosConsContainer.AddChild(label);
}
prosConsContainer.AddChild(new Control() { MinHeight = 8f });
}
}

if (!proto.Description.HasValue)
return;

// Описания рас берут текст из .xml файлов, поэтому нам нужно найти и использовать контент из указанного файла.
// По сути, всё работает так же, как и в гайдбуке (и да, сюда можно вставлять изображения)
using var file = _resMan.ContentFileReadText(proto.Description.Value);
_parsingMan.TryAddMarkup(DetailInfoContainer, file.ReadToEnd());
}

private sealed partial class SpeciesButton(ProtoId<SpeciesPrototype> proto) : Button
{
public ProtoId<SpeciesPrototype> Proto = proto;
}
}
4 changes: 3 additions & 1 deletion Content.Client/Corvax/JoinQueue/QueueState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
using Robust.Client.GameObjects;
using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Shared.Audio;
using Robust.Client.Audio;
using Robust.Shared.Audio.Systems;
using Robust.Shared.Player;

Expand All @@ -12,7 +14,7 @@ public sealed class QueueState : State
{
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly AudioSystem _audio = default!;

private const string JoinSoundPath = "/Audio/Effects/voteding.ogg";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Content.Client.Lobby;
using Content.Shared.Access.Systems;
using Content.Shared.CriminalRecords;
using Content.Shared.CriminalRecords.Components;
Expand All @@ -14,6 +15,7 @@ public sealed class CriminalRecordsConsoleBoundUserInterface : BoundUserInterfac
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly IRobustRandom _random = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
[Dependency] private readonly IEntityManager _ent = default!;
private readonly AccessReaderSystem _accessReader;

private CriminalRecordsConsoleWindow? _window;
Expand All @@ -30,7 +32,7 @@ protected override void Open()

var comp = EntMan.GetComponent<CriminalRecordsConsoleComponent>(Owner);

_window = new(Owner, comp.MaxStringLength, _playerManager, _proto, _random, _accessReader);
_window = new(Owner, comp.MaxStringLength, _playerManager, _proto, _random, _accessReader, _ent); // ADT Station Records Showcase Tweaked
_window.OnKeySelected += key =>
SendMessage(new SelectStationRecord(key));
_window.OnFiltersChanged += (type, filterValue) =>
Expand Down
14 changes: 13 additions & 1 deletion Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,19 @@
<Label Name="RecordUnselected" Text="{Loc 'criminal-records-console-select-record-info'}" HorizontalExpand="True" Align="Center" FontColorOverride="DarkGray"/>
<!-- Selected record info -->
<BoxContainer Name="PersonContainer" Orientation="Vertical" Margin="5" Visible="False">
<Label Name="PersonName" StyleClasses="LabelBig"/>
<!-- ADT Station Records Showcase Start -->
<BoxContainer Name="ShowcaseContainer" Orientation="Horizontal" Margin="5">
<SpriteView Name="Showcase"
SetSize="96 96"
OverrideDirection="South"
Margin="5"
Stretch="Fill"/>
<BoxContainer Orientation="Vertical" Margin="5">
<RichTextLabel Name="PersonName"/>
<RichTextLabel Name="PersonJob"/>
</BoxContainer>
</BoxContainer>
<!-- ADT Station Records Showcase End -->
<Label Name="PersonPrints"/>
<Label Name="PersonDna"/>
<PanelContainer StyleClasses="LowDivider" Margin="0 5 0 5" />
Expand Down
Loading

0 comments on commit c9a5f8e

Please sign in to comment.