From b56448c3b634fb45dc030cb40f65dde26a2e712d Mon Sep 17 00:00:00 2001 From: Vigers Ray <60344369+VigersRay@users.noreply.github.com> Date: Mon, 23 Dec 2024 20:45:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D0=BF=D0=BE=D0=BD=D1=81=D0=BE=D1=80?= =?UTF-8?q?=D1=81=D0=BA=D0=BE=D0=B9=20=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC?= =?UTF-8?q?=D1=8B=20(#905)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Апдейт спонсорки * Доработка апдейта * упс --- .../Humanoid/HumanoidAppearanceSystem.cs | 3 +- .../GhostThemeBoundUserInterface.cs | 51 ++ .../_Sunrise/GhostTheme/GhostThemeMenu.xaml | 11 + .../GhostTheme/GhostThemeMenu.xaml.cs | 76 +++ .../_Sunrise/GhostTheme/GhostThemeSystem.cs | 24 +- .../_Sunrise/Roadmap/RoadmapUIController.cs | 2 +- .../SponsorTiers/SponsorTierEntry.xaml | 134 +++++ .../SponsorTiers/SponsorTierEntry.xaml.cs | 543 ++++++++++++++++++ .../_Sunrise/SponsorTiers/SponsorTiers.xaml | 7 + .../SponsorTiers/SponsorTiers.xaml.cs | 66 +++ .../SponsorTiers/SponsorTiersUIController.cs | 53 ++ .../_Sunrise/SponsorTiers/SponsorTiersUi.xaml | 9 + .../SponsorTiers/SponsorTiersUi.xaml.cs | 27 + .../_Sunrise/UserProfile/UserProfile.xaml | 2 +- .../_Sunrise/UserProfile/UserProfile.xaml.cs | 13 +- Content.Server/Ghost/GhostSystem.cs | 3 + .../_Sunrise/GhostTheme/GhostThemeSystem.cs | 87 ++- Content.Shared/Ghost/GhostComponent.cs | 8 + .../Humanoid/Prototypes/SpeciesPrototype.cs | 5 + Content.Shared/Roles/AntagPrototype.cs | 4 + Content.Shared/Roles/JobPrototype.cs | 4 + .../GhostTheme/GhostThemeComponent.cs | 32 ++ .../GhostTheme/GhostThemePrototype.cs | 17 +- .../_Sunrise/SunriseCCVars/SunriseCCVars.cs | 3 + .../entities/clothing/pants/pants.ftl | 4 +- .../entities/markers/spawners/ghost_roles.ftl | 16 +- .../_strings/_sunrise/ghost/ghost-themes.ftl | 26 + .../sponsor-tiers-info/sponsor-tiers-gui.ftl | 32 ++ .../_sunrise/tts/tts-voices-sunrise.ftl | 92 +-- .../Entities/Markers/Spawners/ghost_roles.yml | 41 +- .../Mobs/Customization/Markings/cat_parts.yml | 2 - .../Entities/Mobs/Player/admin_ghost.yml | 5 + .../Entities/Mobs/Player/observer.yml | 7 + .../Prototypes/Roles/Antags/changeling.yml | 6 +- Resources/Prototypes/Roles/Antags/nukeops.yml | 12 + .../Prototypes/Roles/Antags/revolutionary.yml | 4 + Resources/Prototypes/Roles/Antags/thief.yml | 4 + Resources/Prototypes/Roles/Antags/traitor.yml | 4 + Resources/Prototypes/Roles/Antags/vampire.yml | 6 +- Resources/Prototypes/Roles/Antags/zombie.yml | 4 + .../_Sunrise/Actions/ghost_actions.yml | 14 + .../Entities/Mobs/Player/ghost_themes.yml | 304 +++++----- .../Entities/Mobs/Species/predator.yml | 3 + .../Mobs/Species/Human/parts.rsi/full.png | Bin 486 -> 2700 bytes .../Mobs/Species/Human/parts.rsi/meta.json | 3 +- .../Misc/antag_preview.rsi/ChangelingG.png | Bin 0 -> 19579 bytes .../Misc/antag_preview.rsi/blood_cultist.png | Bin 0 -> 1281 bytes .../Misc/antag_preview.rsi/changeling.png | Bin 0 -> 1099 bytes .../Misc/antag_preview.rsi/flesh_cultist.png | Bin 0 -> 1741 bytes .../Misc/antag_preview.rsi/head_rev.png | Bin 0 -> 1104 bytes .../antag_preview.rsi/initial_infected.png | Bin 0 -> 3785 bytes .../Misc/antag_preview.rsi/meta.json | 50 ++ .../Misc/antag_preview.rsi/nuke_commander.png | Bin 0 -> 1186 bytes .../Misc/antag_preview.rsi/nuke_medic.png | Bin 0 -> 1216 bytes .../Misc/antag_preview.rsi/nuke_operative.png | Bin 0 -> 1189 bytes .../Misc/antag_preview.rsi/pirate.png | Bin 0 -> 1115 bytes .../Misc/antag_preview.rsi/prisoner.png | Bin 0 -> 828 bytes .../Misc/antag_preview.rsi/space_ninja.png | Bin 0 -> 964 bytes .../Interface/Misc/antag_preview.rsi/test.png | Bin 0 -> 309 bytes .../Misc/antag_preview.rsi/thief.png | Bin 0 -> 1059 bytes .../Misc/antag_preview.rsi/traitor.png | Bin 0 -> 1484 bytes .../Misc/antag_preview.rsi/vampire.png | Bin 0 -> 3646 bytes .../Interface/Misc/job_preview.rsi/meta.json | 14 + .../Interface/Misc/job_preview.rsi/test.png | Bin 0 -> 309 bytes .../_Sunrise/Mobs/Ghosts/asuka.rsi/icon.png | Bin 0 -> 4672 bytes .../_Sunrise/Mobs/Ghosts/asuka.rsi/meta.json | 15 + .../Mobs/Ghosts/blue_archive.rsi/hibiki.png | Bin 0 -> 1952 bytes .../Mobs/Ghosts/blue_archive.rsi/meta.json | 20 + .../Mobs/Ghosts/blue_archive.rsi/rio.png | Bin 0 -> 1459 bytes .../Mobs/Ghosts/blue_archive.rsi/yuuka.png | Bin 0 -> 1482 bytes .../Mobs/Ghosts/vigers_ray.rsi/icon.png | Bin 0 -> 438350 bytes .../Mobs/Ghosts/vigers_ray.rsi/meta.json | 15 + .../Mobs/Ghosts/wizden_block.rsi/icon.png | Bin 0 -> 1255 bytes .../Mobs/Ghosts/wizden_block.rsi/meta.json | 15 + Resources/Textures/_Sunrise/test.png | Bin 317 -> 309 bytes .../ISharedSponsorsManager.cs | 70 ++- 76 files changed, 1703 insertions(+), 269 deletions(-) create mode 100644 Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs create mode 100644 Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml create mode 100644 Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml.cs create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml.cs create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml.cs create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTiersUIController.cs create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml create mode 100644 Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml.cs create mode 100644 Resources/Locale/ru-RU/_strings/_sunrise/ghost/ghost-themes.ftl create mode 100644 Resources/Locale/ru-RU/_strings/_sunrise/sponsor-tiers-info/sponsor-tiers-gui.ftl create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/ChangelingG.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/blood_cultist.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/changeling.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/flesh_cultist.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/head_rev.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/initial_infected.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/meta.json create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/nuke_commander.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/nuke_medic.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/nuke_operative.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/pirate.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/prisoner.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/space_ninja.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/test.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/thief.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/traitor.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/antag_preview.rsi/vampire.png create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/job_preview.rsi/meta.json create mode 100644 Resources/Textures/_Sunrise/Interface/Misc/job_preview.rsi/test.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/asuka.rsi/icon.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/asuka.rsi/meta.json create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/blue_archive.rsi/hibiki.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/blue_archive.rsi/meta.json create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/blue_archive.rsi/rio.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/blue_archive.rsi/yuuka.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/vigers_ray.rsi/icon.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/vigers_ray.rsi/meta.json create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/wizden_block.rsi/icon.png create mode 100644 Resources/Textures/_Sunrise/Mobs/Ghosts/wizden_block.rsi/meta.json diff --git a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs index 6eb5dd9ec98..262bedc5237 100644 --- a/Content.Client/Humanoid/HumanoidAppearanceSystem.cs +++ b/Content.Client/Humanoid/HumanoidAppearanceSystem.cs @@ -264,7 +264,8 @@ private void RemoveMarking(Marking marking, SpriteComponent spriteComp) spriteComp.RemoveLayer(index); } } - private void ApplyMarking(MarkingPrototype markingPrototype, + // Sunrsie-Edit + public void ApplyMarking(MarkingPrototype markingPrototype, IReadOnlyList? colors, bool visible, HumanoidAppearanceComponent humanoid, diff --git a/Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs b/Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs new file mode 100644 index 00000000000..954bc600a0c --- /dev/null +++ b/Content.Client/_Sunrise/GhostTheme/GhostThemeBoundUserInterface.cs @@ -0,0 +1,51 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using Content.Shared._Sunrise.GhostTheme; +using JetBrains.Annotations; + +namespace Content.Client._Sunrise.GhostTheme; + +[UsedImplicitly] +public sealed class GhostThemeBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private GhostThemeMenu? _menu; + + public GhostThemeBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + } + + protected override void Open() + { + base.Open(); + + _menu = new GhostThemeMenu(); + _menu.OnClose += Close; + _menu.OnIdSelected += OnIdSelected; + _menu.OpenCentered(); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + if (state is not GhostThemeBoundUserInterfaceState st) + return; + + _menu?.UpdateState(st.GhostThemes); + } + + private void OnIdSelected(string selectedId) + { + SendMessage(new GhostThemePrototypeSelectedMessage(selectedId)); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + { + _menu?.Close(); + _menu = null; + } + } +} diff --git a/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml b/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml new file mode 100644 index 00000000000..651d18a81cc --- /dev/null +++ b/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml @@ -0,0 +1,11 @@ + + + + + + + + diff --git a/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml.cs b/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml.cs new file mode 100644 index 00000000000..958d0212cee --- /dev/null +++ b/Content.Client/_Sunrise/GhostTheme/GhostThemeMenu.xaml.cs @@ -0,0 +1,76 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using System.Numerics; +using Content.Client.Stylesheets; +using Content.Shared._Sunrise.GhostTheme; +using Content.Shared._Sunrise.SunriseCCVars; +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.CustomControls; +using Robust.Client.UserInterface.XAML; +using Robust.Client.Utility; +using Robust.Shared.Configuration; +using Robust.Shared.Prototypes; + +namespace Content.Client._Sunrise.GhostTheme; + +[GenerateTypedNameReferences] +public sealed partial class GhostThemeMenu : DefaultWindow +{ + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IConfigurationManager _cfg = default!; + + public event Action? OnIdSelected; + + private List _availableGhostThemes = []; + + public GhostThemeMenu() + { + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + } + + public void UpdateState(List ghostThemes) + { + _availableGhostThemes = ghostThemes; + UpdateGrid(); + } + + private void UpdateGrid() + { + ClearGrid(); + + foreach (var ghostTheme in _availableGhostThemes) + { + if (!_prototypeManager.TryIndex(ghostTheme, out GhostThemePrototype? ghostThemePrototype)) + continue; + + var button = new Button + { + SetSize = new Vector2(128, 128), + HorizontalExpand = true, + ToggleMode = false, + StyleClasses = {StyleBase.ButtonSquare}, + }; + button.OnPressed += _ => + { + OnIdSelected?.Invoke(ghostTheme); + _cfg.SetCVar(SunriseCCVars.SponsorGhostTheme, ghostTheme); + _cfg.SaveToFile(); + }; + Grid.AddChild(button); + + var ghost = new TextureRect() + { + Texture = ghostThemePrototype.Sprite.Frame0(), + Stretch = TextureRect.StretchMode.KeepAspectCentered, + }; + + button.AddChild(ghost); + } + } + + private void ClearGrid() + { + Grid.RemoveAllChildren(); + } +} diff --git a/Content.Client/_Sunrise/GhostTheme/GhostThemeSystem.cs b/Content.Client/_Sunrise/GhostTheme/GhostThemeSystem.cs index 0bc9a59d4d4..d3eca172f39 100644 --- a/Content.Client/_Sunrise/GhostTheme/GhostThemeSystem.cs +++ b/Content.Client/_Sunrise/GhostTheme/GhostThemeSystem.cs @@ -1,4 +1,6 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt using Content.Shared._Sunrise.GhostTheme; +using Content.Shared.Weapons.Ranged.Systems; using Robust.Client.GameObjects; using Robust.Shared.Prototypes; @@ -7,6 +9,7 @@ namespace Content.Client._Sunrise.GhostTheme; public sealed class GhostThemeSystem: EntitySystem { [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + public override void Initialize() { base.Initialize(); @@ -17,16 +20,21 @@ private void OnInit(EntityUid uid, GhostThemeComponent component, ref AfterAutoH { if (component.GhostTheme == null || !_prototypeManager.TryIndex(component.GhostTheme, out var ghostThemePrototype)) - { return; - } - foreach (var entry in ghostThemePrototype.Components.Values) + + if (!EntityManager.TryGetComponent(uid, out var sprite)) + return; + + if (!sprite.LayerMapTryGet(EffectLayers.Unshaded, out var layer)) { - if (entry.Component is not SpriteComponent spriteComponent || - !EntityManager.TryGetComponent(uid, out var targetsprite)) - continue; - targetsprite.CopyFrom(spriteComponent); - targetsprite.LayerSetShader(0, "unshaded"); + sprite.LayerSetSprite(layer, ghostThemePrototype.Sprite); + sprite.LayerSetShader(layer, "unshaded"); + sprite.LayerSetColor(layer, ghostThemePrototype.SpriteColor); + sprite.LayerSetScale(layer, ghostThemePrototype.Scale); } + + sprite.DrawDepth = DrawDepth.Default + 11; + sprite.OverrideContainerOcclusion = true; + sprite.NoRotation = true; } } diff --git a/Content.Client/_Sunrise/Roadmap/RoadmapUIController.cs b/Content.Client/_Sunrise/Roadmap/RoadmapUIController.cs index 00da29091cc..c142fbb44ea 100644 --- a/Content.Client/_Sunrise/Roadmap/RoadmapUIController.cs +++ b/Content.Client/_Sunrise/Roadmap/RoadmapUIController.cs @@ -13,7 +13,7 @@ public void OnStateEntered(LobbyState state) if (_shown || _window != null) return; - ToggleRoadmap(); + //ToggleRoadmap(); } public void ToggleRoadmap() diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml b/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml new file mode 100644 index 00000000000..8c63b67df02 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml @@ -0,0 +1,134 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml.cs b/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml.cs new file mode 100644 index 00000000000..fcaec06e08b --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTierEntry.xaml.cs @@ -0,0 +1,543 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using System.Numerics; +using Content.Client._Sunrise.TTS; +using Content.Client.Humanoid; +using Content.Client.Lobby; +using Content.Client.Resources; +using Content.Client.Stylesheets; +using Content.Shared._Sunrise.GhostTheme; +using Content.Shared._Sunrise.TTS; +using Content.Shared.Clothing; +using Content.Shared.Humanoid; +using Content.Shared.Humanoid.Markings; +using Content.Shared.Humanoid.Prototypes; +using Content.Shared.Preferences; +using Content.Shared.Preferences.Loadouts; +using Content.Shared.Roles; +using Content.Sunrise.Interfaces.Shared; +using Robust.Client.AutoGenerated; +using Robust.Client.GameObjects; +using Robust.Client.Graphics; +using Robust.Client.Player; +using Robust.Client.ResourceManagement; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; +using Robust.Client.Utility; +using Robust.Shared.Map; +using Robust.Shared.Prototypes; +using Robust.Shared.Timing; +using Robust.Shared.Utility; + +namespace Content.Client._Sunrise.SponsorTiers; + +[GenerateTypedNameReferences] +public sealed partial class SponsorTierEntry : Control +{ + [Dependency] private readonly IPrototypeManager _prototypeManager = default!; + [Dependency] private readonly IEntityManager _entityManager = default!; + [Dependency] private readonly IResourceCache _resourceCache = default!; + [Dependency] private readonly IClientPreferencesManager _preferencesManager = default!; + [Dependency] private readonly IPlayerManager _playerManager = default!; + + private readonly LobbyUIController _lobbyUIController; + private ISharedSponsorsManager? _sponsorsManager; // Sunrise-Sponsors + + private float AccumulatedTime; + private List SpriteViews = new(); + private SponsorInfo SponsorInfoTier; + + public int Index { get; } + + public SponsorTierEntry(SponsorInfo sponsorTier, int index) + { + IoCManager.InjectDependencies(this); + RobustXamlLoader.Load(this); + IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Sunrise-Sponsors + _lobbyUIController = UserInterfaceManager.GetUIController(); + _preferencesManager.OnServerDataLoaded += PreferencesDataLoaded; + + Index = index; + SponsorInfoTier = sponsorTier; + + LoadTierInfo(sponsorTier.Tier, sponsorTier.OOCColor, sponsorTier.ExtraSlots, sponsorTier.HavePriorityJoin, sponsorTier.AllowedRespawn); + LoadOpenAntags(sponsorTier.OpenAntags); + LoadPriorityAntags(sponsorTier.PriorityAntags); + LoadAllowedMarkings(sponsorTier.AllowedMarkings); + LoadAllowedSpecies(sponsorTier.AllowedSpecies); + LoadGhostThemes(sponsorTier.GhostThemes); + LoadPriorityGhostRoles(sponsorTier.PriorityGhostRoles); + LoadOpenGhostRoles(sponsorTier.OpenGhostRoles); + LoadAllowedVoices(sponsorTier.AllowedVoices); + LoadAllowedLoadouts(sponsorTier.AllowedLoadouts); + } + + private void PreferencesDataLoaded() + { + LoadOpenRoles(SponsorInfoTier.OpenRoles); + LoadPriorityRoles(SponsorInfoTier.PriorityRoles); + LoadBypassRoles(SponsorInfoTier.BypassRoles); + } + + protected override void FrameUpdate(FrameEventArgs args) + { + base.FrameUpdate(args); + + AccumulatedTime += args.DeltaSeconds; + foreach (var spriteView in SpriteViews) + { + spriteView.OverrideDirection = (Direction) ((int) AccumulatedTime % 4 * 2); + } + } + + private void LoadTierInfo(int tier, string? oocColor, int extraSlots, bool priorityJoin, bool allowedRespawn) + { + TierLabel.Text = $"{tier}"; + if (!string.IsNullOrEmpty(oocColor)) + { + OocColorLabel.Text = "цвет"; + OocColorLabel.FontColorOverride = Color.FromHex(oocColor); + } + ExtraSlotsLabel.Text = $"{extraSlots}"; + PriorityJoinLabel.Text = priorityJoin ? "Да" : "Нет"; + AllowedRespawnLabel.Text = allowedRespawn ? "Да" : "Нет"; + } + + private void LoadOpenGhostRoles(string[] openGhostRoles) + { + foreach (var openGhostRole in openGhostRoles) + { + if (!_prototypeManager.TryIndex(openGhostRole, out EntityPrototype? ghostRolePrototype)) + continue; + + var dummyEnt = _entityManager.SpawnEntity(openGhostRole, MapCoordinates.Nullspace); + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4) + }; + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon($"ent-{openGhostRole}", view); + + OpenGhostRolesGrid.AddChild(panel); + } + } + + private void LoadPriorityGhostRoles(string[] priorityGhostRoles) + { + foreach (var priorityGhostRole in priorityGhostRoles) + { + if (!_prototypeManager.TryIndex(priorityGhostRole, out EntityPrototype? ghostRolePrototype)) + continue; + + var dummyEnt = _entityManager.SpawnEntity(priorityGhostRole, MapCoordinates.Nullspace); + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4) + }; + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon($"ent-{priorityGhostRole}", view); + + PriorityGhostRolesGrid.AddChild(panel); + } + } + + private void LoadAllowedVoices(string[] allowedVoices) + { + foreach (var allowedVoice in allowedVoices) + { + if (!_prototypeManager.TryIndex(allowedVoice, out TTSVoicePrototype? voicePrototype)) + continue; + + var button = new Button() + { + HorizontalAlignment = HAlignment.Center, + Text = Loc.GetString(voicePrototype.Name), + StyleClasses = { "LabelKeyText" }, + SetSize = new Vector2(315,30), + }; + + button.OnPressed += _ => + { + _entityManager.System().RequestPreviewTts(allowedVoice); + }; + + TTSVoicesGrid.AddChild(button); + } + } + + private void LoadAllowedLoadouts(string[] allowedLoadouts) + { + foreach (var allowedLoadout in allowedLoadouts) + { + if (!_prototypeManager.TryIndex(allowedLoadout, out LoadoutPrototype? loadoutPrototype)) + continue; + + var entProtoId = _entityManager.System().GetFirstOrNull(loadoutPrototype); + var name = _entityManager.System().GetName(loadoutPrototype); + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(6, 6) + }; + SpriteViews.Add(view); + + if (entProtoId != null) + { + var dummyEnt = _entityManager.SpawnEntity(entProtoId, MapCoordinates.Nullspace); + view.SetEntity(dummyEnt); + } + + var panel = CreateEntityIcon(name, view); + + AllowedLoadoutsGrid.AddChild(panel); + } + } + + private void LoadGhostThemes(string[] ghostThemes) + { + foreach (var ghostTheme in ghostThemes) + { + if (!_prototypeManager.TryIndex(ghostTheme, out GhostThemePrototype? ghostThemePrototype)) + continue; + + var panel = CreateIcon(ghostThemePrototype.Name, ghostThemePrototype.Sprite); + + GhostThemesGrid.AddChild(panel); + } + } + + private void LoadBypassRoles(string[] bypassRoles) + { + foreach (var bypassRole in bypassRoles) + { + if (!_prototypeManager.TryIndex(bypassRole, out JobPrototype? roleProto)) + continue; + + var sponsorPrototypes = _sponsorsManager?.GetClientPrototypes().ToArray() ?? []; + + var humanoid = (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter; + if (humanoid == null) + continue; + + var previewEntity = roleProto.JobPreviewEntity ?? (EntProtoId?)roleProto.JobEntity; + + EntityUid dummyEnt; + + if (previewEntity == null) + { + var dummy = _prototypeManager.Index(humanoid.Species).DollPrototype; + dummyEnt = _entityManager.SpawnEntity(dummy, MapCoordinates.Nullspace); + + _entityManager.System().LoadProfile(dummyEnt, humanoid); + _lobbyUIController.GiveDummyJobClothes(dummyEnt, humanoid, roleProto); + + if (_prototypeManager.HasIndex(LoadoutSystem.GetJobPrototype(roleProto.ID))) + { + var loadout = humanoid.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(roleProto.ID), _playerManager.LocalSession, humanoid.Species, _entityManager, _prototypeManager, sponsorPrototypes); + _lobbyUIController.GiveDummyLoadout(dummyEnt, loadout, true); + } + } + else + { + dummyEnt = _entityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace); + } + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4) + }; + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon(roleProto.Name, view); + + BypassRolesGrid.AddChild(panel); + } + } + + private void LoadAllowedSpecies(string[] speciesList) + { + foreach (var species in speciesList) + { + if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesPrototype)) + continue; + + var dummyEnt = _entityManager.SpawnEntity(speciesPrototype.DollPrototype, MapCoordinates.Nullspace); + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4), + }; + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon(speciesPrototype.Name, view); + + AllowedSpeciesGrid.AddChild(panel); + } + } + + private void LoadAllowedMarkings(string[] markings) + { + foreach (var marking in markings) + { + if (!_prototypeManager.TryIndex(marking, out MarkingPrototype? markingProto)) + continue; + + var species = markingProto.SpeciesRestrictions is { Count: > 0 } + ? markingProto.SpeciesRestrictions[0] + : SharedHumanoidAppearanceSystem.DefaultSpecies; + + if (!_prototypeManager.TryIndex(species, out SpeciesPrototype? speciesProto)) + continue; + + var dummyEnt = _entityManager.SpawnEntity(speciesProto.DollPrototype, MapCoordinates.Nullspace); + + var humanoidAppearance = _entityManager.EnsureComponent(dummyEnt); + var spriteComponent = _entityManager.EnsureComponent(dummyEnt); + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4), + }; + + _entityManager.System().ApplyMarking(markingProto, null, true, humanoidAppearance, spriteComponent); + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon($"marking-{markingProto.ID}", view); + + AllowedMarkingsGrid.AddChild(panel); + } + } + + private void LoadPriorityAntags(string[] priorityAntags) + { + foreach (var priorityAntag in priorityAntags) + { + if (!_prototypeManager.TryIndex(priorityAntag, out AntagPrototype? antagProto)) + continue; + + var panel = CreateIcon(antagProto.Name, antagProto.PreviewIcon); + + PriorityAntagGrid.AddChild(panel); + } + } + + private void LoadOpenAntags(string[] openAntags) + { + foreach (var openAntag in openAntags) + { + if (!_prototypeManager.TryIndex(openAntag, out AntagPrototype? antagProto)) + continue; + + var panel = CreateIcon(antagProto.Name, antagProto.PreviewIcon); + + OpenAntagGrid.AddChild(panel); + } + } + + private void LoadPriorityRoles(string[] priorityRoles) + { + foreach (var priorityRole in priorityRoles) + { + if (!_prototypeManager.TryIndex(priorityRole, out JobPrototype? roleProto)) + continue; + + var sponsorPrototypes = _sponsorsManager?.GetClientPrototypes().ToArray() ?? []; + + var humanoid = (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter; + if (humanoid == null) + continue; + + var previewEntity = roleProto.JobPreviewEntity ?? (EntProtoId?)roleProto.JobEntity; + + EntityUid dummyEnt; + + if (previewEntity == null) + { + var dummy = _prototypeManager.Index(humanoid.Species).DollPrototype; + dummyEnt = _entityManager.SpawnEntity(dummy, MapCoordinates.Nullspace); + + _entityManager.System().LoadProfile(dummyEnt, humanoid); + _lobbyUIController.GiveDummyJobClothes(dummyEnt, humanoid, roleProto); + + if (_prototypeManager.HasIndex(LoadoutSystem.GetJobPrototype(roleProto.ID))) + { + var loadout = humanoid.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(roleProto.ID), _playerManager.LocalSession, humanoid.Species, _entityManager, _prototypeManager, sponsorPrototypes); + _lobbyUIController.GiveDummyLoadout(dummyEnt, loadout, true); + } + } + else + { + dummyEnt = _entityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace); + } + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4) + }; + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon(roleProto.Name, view); + + PriorityRolesGrid.AddChild(panel); + } + } + + private void LoadOpenRoles(string[] openRoles) + { + foreach (var openRole in openRoles) + { + if (!_prototypeManager.TryIndex(openRole, out JobPrototype? roleProto)) + continue; + + var sponsorPrototypes = _sponsorsManager?.GetClientPrototypes().ToArray() ?? []; + + var humanoid = (HumanoidCharacterProfile?)_preferencesManager.Preferences?.SelectedCharacter; + if (humanoid == null) + continue; + + var previewEntity = roleProto.JobPreviewEntity ?? (EntProtoId?)roleProto.JobEntity; + + EntityUid dummyEnt; + + if (previewEntity == null) + { + var dummy = _prototypeManager.Index(humanoid.Species).DollPrototype; + dummyEnt = _entityManager.SpawnEntity(dummy, MapCoordinates.Nullspace); + + _entityManager.System().LoadProfile(dummyEnt, humanoid); + _lobbyUIController.GiveDummyJobClothes(dummyEnt, humanoid, roleProto); + + if (_prototypeManager.HasIndex(LoadoutSystem.GetJobPrototype(roleProto.ID))) + { + var loadout = humanoid.GetLoadoutOrDefault(LoadoutSystem.GetJobPrototype(roleProto.ID), _playerManager.LocalSession, humanoid.Species, _entityManager, _prototypeManager, sponsorPrototypes); + _lobbyUIController.GiveDummyLoadout(dummyEnt, loadout, true); + } + } + else + { + dummyEnt = _entityManager.SpawnEntity(previewEntity, MapCoordinates.Nullspace); + } + + var view = new SpriteView + { + SetSize = new Vector2(128, 128), + Scale = new Vector2(4, 4) + }; + + view.SetEntity(dummyEnt); + SpriteViews.Add(view); + + var panel = CreateEntityIcon(roleProto.Name, view); + + OpenRolesGrid.AddChild(panel); + } + } + + private PanelContainer CreateEntityIcon(string name, SpriteView spriteView) + { + var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/light_panel_background_bordered.png"); + var back = new StyleBoxTexture + { + Texture = panelTex, + }; + back.SetPatchMargin(StyleBox.Margin.All, 10); + + var panel = new PanelContainer() + { + SetSize = new Vector2(200, 200), + Margin = new Thickness(5, 5, 5, 5), + StyleClasses = { StyleBase.ButtonSquare }, + }; + + var box = new BoxContainer() + { + Orientation = BoxContainer.LayoutOrientation.Vertical, + Margin = new Thickness(5, 5, 5, 5), + StyleClasses = { StyleBase.ButtonSquare }, + Align = BoxContainer.AlignMode.Center + }; + + panel.AddChild(box); + panel.PanelOverride = back; + + var title = new RichTextLabel() + { + HorizontalAlignment = HAlignment.Center, + Text = Loc.GetString(name), + StyleClasses = { "LabelKeyText" } + }; + + box.AddChild(spriteView); + box.AddChild(title); + + return panel; + } + + private PanelContainer CreateIcon(string name, SpriteSpecifier spriteSpecifier) + { + var panelTex = _resourceCache.GetTexture("/Textures/Interface/Nano/light_panel_background_bordered.png"); + var back = new StyleBoxTexture + { + Texture = panelTex, + }; + back.SetPatchMargin(StyleBox.Margin.All, 10); + + var panel = new PanelContainer() + { + SetSize = new Vector2(200, 200), + Margin = new Thickness(5, 5, 5, 5), + StyleClasses = { StyleBase.ButtonSquare }, + }; + + var box = new BoxContainer() + { + Orientation = BoxContainer.LayoutOrientation.Vertical, + Margin = new Thickness(5, 5, 5, 5), + StyleClasses = { StyleBase.ButtonSquare }, + }; + + panel.AddChild(box); + panel.PanelOverride = back; + + var icon = new TextureRect() + { + SetSize = new Vector2(128, 128), + Texture = spriteSpecifier.Frame0(), + Stretch = TextureRect.StretchMode.KeepAspectCentered, + }; + + var title = new RichTextLabel() + { + HorizontalAlignment = HAlignment.Center, + Text = Loc.GetString(name), + StyleClasses = { "LabelKeyText" } + }; + + box.AddChild(icon); + box.AddChild(title); + + return panel; + } +} diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml b/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml new file mode 100644 index 00000000000..191942c6528 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml.cs b/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml.cs new file mode 100644 index 00000000000..53a40e75d51 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTiers.xaml.cs @@ -0,0 +1,66 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using System.Linq; +using Content.Client.Resources; +using Content.Client.Stylesheets; +using Content.Sunrise.Interfaces.Shared; +using Robust.Client.AutoGenerated; +using Robust.Client.ResourceManagement; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; +using static Robust.Client.UserInterface.StylesheetHelpers; + +namespace Content.Client._Sunrise.SponsorTiers; + +[GenerateTypedNameReferences] +public sealed partial class SponsorTiers : Control +{ + [Dependency] private readonly IResourceCache _resourceCache = default!; + + private readonly ISharedSponsorsManager? _sponsorsManager; + + public SponsorTiers() + { + IoCManager.InjectDependencies(this); + RobustXamlLoader.Load(this); + + IoCManager.Instance!.TryResolveType(out _sponsorsManager); + if (_sponsorsManager == null) + return; + + _sponsorsManager.LoadedSponsorTiers += ReloadSponsorTiers; + + ReloadSponsorTiers(_sponsorsManager.GetSponsorTiers()); + } + + private void ReloadSponsorTiers(List sponsorTiers) + { + SponsorTiersContainer.RemoveAllChildren(); + for (var i = 0; i < sponsorTiers.Count; i++) + { + var sponsorTier = sponsorTiers[i]; + var entry = new SponsorTierEntry(sponsorTier, i); + SponsorTiersContainer.AddChild(entry); + SponsorTiersContainer.SetTabTitle(i, sponsorTier.Title ?? "No Title"); + var stylesheet = IoCManager.Resolve().SheetNano; + var notoSans20 = _resourceCache.GetFont( + [ + "/Fonts/NotoSans/NotoSans-Regular.ttf", + "/Fonts/NotoSans/NotoSansSymbols-Regular.ttf", + "/Fonts/NotoSans/NotoSansSymbols2-Regular.ttf", + ], + 20 + ); + var rules = stylesheet.Rules.ToList(); + var tabContainerFontRule = new StyleRule( + Element(), + new[] { new StyleProperty("font", notoSans20) } + ); + + rules.Add(tabContainerFontRule); + + stylesheet = new Stylesheet(rules.ToArray()); + SponsorTiersContainer.Stylesheet = stylesheet; + } + } +} diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUIController.cs b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUIController.cs new file mode 100644 index 00000000000..351baccc919 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUIController.cs @@ -0,0 +1,53 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using Content.Client.Lobby; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.Controllers; + +namespace Content.Client._Sunrise.SponsorTiers; + +public partial class SponsorTiersUIController : UIController, IOnStateEntered +{ + [Dependency] private readonly IUserInterfaceManager _uiManager = default!; + + private SponsorTiersUi _sponsorTiersUi = default!; + private bool _shown; + + public void OnStateEntered(LobbyState state) + { + if (_shown) + return; + + ToggleWindow(); + _shown = true; + } + + public void OpenWindow() + { + EnsureWindow(); + + _sponsorTiersUi.OpenCentered(); + _sponsorTiersUi.MoveToFront(); + } + + private void EnsureWindow() + { + if (_sponsorTiersUi is { Disposed: false }) + return; + + _sponsorTiersUi = _uiManager.CreateWindow(); + } + + public void ToggleWindow() + { + EnsureWindow(); + + if (_sponsorTiersUi.IsOpen) + { + _sponsorTiersUi.Close(); + } + else + { + OpenWindow(); + } + } +} diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml new file mode 100644 index 00000000000..69dcc1dc773 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml.cs b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml.cs new file mode 100644 index 00000000000..201249ebda4 --- /dev/null +++ b/Content.Client/_Sunrise/SponsorTiers/SponsorTiersUi.xaml.cs @@ -0,0 +1,27 @@ +// © SUNRISE, An EULA/CLA with a hosting restriction, full text: https://github.com/space-sunrise/space-station-14/blob/master/CLA.txt +using Content.Client._Sunrise.ServersHub; +using Content.Shared._Sunrise.ServersHub; +using Robust.Client.AutoGenerated; +using Robust.Client.UserInterface.CustomControls; +using Robust.Client.UserInterface.XAML; + +namespace Content.Client._Sunrise.SponsorTiers; + +[GenerateTypedNameReferences] +public sealed partial class SponsorTiersUi : DefaultWindow +{ + [Dependency] private readonly ServersHubManager _serversHubManager = default!; + + public SponsorTiersUi() + { + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + + _serversHubManager.ServersDataListChanged += RefreshServersHubHeader; + } + + private void RefreshServersHubHeader(List servers) + { + + } +} diff --git a/Content.Client/_Sunrise/UserProfile/UserProfile.xaml b/Content.Client/_Sunrise/UserProfile/UserProfile.xaml index f077e1d4abb..863dc2b9796 100644 --- a/Content.Client/_Sunrise/UserProfile/UserProfile.xaml +++ b/Content.Client/_Sunrise/UserProfile/UserProfile.xaml @@ -20,7 +20,7 @@ HorizontalAlignment="Center" VerticalExpand="True" VerticalAlignment="Top"> -