From 9efc727fe17ec4fd969e488cc1efabc013006d2d Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Mon, 15 May 2023 16:17:30 -0400 Subject: [PATCH] RND Rework [Death to Techweb] (#16370) * Techweb rework * more ui work * finishing ui * Finish all the C# logic * the techs + lathes * remove old-tech * mirror-review --- .../UI/MiniTechnologyCardControl.xaml | 29 + .../UI/MiniTechnologyCardControl.xaml.cs | 24 + .../UI/ResearchConsoleBoundUserInterface.cs | 112 ++- .../Research/UI/ResearchConsoleMenu.xaml | 152 ++-- .../Research/UI/ResearchConsoleMenu.xaml.cs | 276 ++++---- .../Research/UI/TechnologyCardControl.xaml | 42 ++ .../Research/UI/TechnologyCardControl.xaml.cs | 36 + Content.Client/Stylesheets/StyleNano.cs | 4 + .../Tests/ResearchTest.cs | 40 +- Content.Server/Lathe/LatheSystem.cs | 2 +- .../Research/Disk/ResearchDiskSystem.cs | 4 +- .../Research/Systems/ResearchSystem.Client.cs | 9 +- .../Systems/ResearchSystem.Console.cs | 9 +- .../Research/Systems/ResearchSystem.Server.cs | 14 +- .../Systems/ResearchSystem.Technology.cs | 111 +-- .../Research/Systems/ResearchSystem.cs | 4 +- .../Systems/DiskConsoleSystem.cs | 2 +- .../Systems/TechnologyDiskSystem.cs | 9 +- .../Systems/ArtifactAnalyzerSystem.cs | 2 +- .../Components/ResearchServerComponent.cs | 111 ++- .../SharedResearchConsoleComponent.cs | 4 +- .../Components/TechnologyDatabaseComponent.cs | 80 ++- .../Prototypes/TechDisciplinePrototype.cs | 48 ++ .../Prototypes/TechnologyPrototype.cs | 136 ++-- .../Research/Systems/SharedResearchSystem.cs | 165 ++++- .../catalog/research/technologies.ftl | 105 --- .../components/research-console-component.ftl | 19 +- .../Locale/en-US/research/technologies.ftl | 51 ++ .../Catalog/Research/technologies.yml | 655 ------------------ .../Entities/Structures/Machines/lathe.yml | 95 ++- .../Entities/Structures/Machines/research.yml | 5 + .../Prototypes/Recipes/Lathes/devices.yml | 29 +- .../Prototypes/Recipes/Lathes/janitorial.yml | 16 + Resources/Prototypes/Research/biochemical.yml | 117 ++++ .../Prototypes/Research/civilianservices.yml | 153 ++++ Resources/Prototypes/Research/disciplines.yml | 47 ++ .../Prototypes/Research/experimental.yml | 162 +++++ Resources/Prototypes/Research/industrial.yml | 177 +++++ .../research_disciplines.rsi/biochemical.png | Bin 0 -> 144 bytes .../civilianservices.png | Bin 0 -> 546 bytes .../research_disciplines.rsi/experimental.png | Bin 0 -> 177 bytes .../research_disciplines.rsi/industrial.png | Bin 0 -> 160 bytes .../Misc/research_disciplines.rsi/meta.json | 23 + .../artifact_analyzer.rsi/display.png | Bin 0 -> 390 bytes .../Machines/artifact_analyzer.rsi/meta.json | 3 + .../Machines/fat_sucker.rsi/display.png | Bin 0 -> 943 bytes .../Machines/fat_sucker.rsi/meta.json | 3 + .../tech_disk_printer.rsi/display.png | Bin 0 -> 785 bytes .../Machines/tech_disk_printer.rsi/meta.json | 3 + .../traversal_distorter.rsi/display.png | Bin 0 -> 735 bytes .../traversal_distorter.rsi/meta.json | 3 + 51 files changed, 1711 insertions(+), 1380 deletions(-) create mode 100644 Content.Client/Research/UI/MiniTechnologyCardControl.xaml create mode 100644 Content.Client/Research/UI/MiniTechnologyCardControl.xaml.cs create mode 100644 Content.Client/Research/UI/TechnologyCardControl.xaml create mode 100644 Content.Client/Research/UI/TechnologyCardControl.xaml.cs create mode 100644 Content.Shared/Research/Prototypes/TechDisciplinePrototype.cs delete mode 100644 Resources/Locale/en-US/prototypes/catalog/research/technologies.ftl create mode 100644 Resources/Locale/en-US/research/technologies.ftl delete mode 100644 Resources/Prototypes/Catalog/Research/technologies.yml create mode 100644 Resources/Prototypes/Research/biochemical.yml create mode 100644 Resources/Prototypes/Research/civilianservices.yml create mode 100644 Resources/Prototypes/Research/disciplines.yml create mode 100644 Resources/Prototypes/Research/experimental.yml create mode 100644 Resources/Prototypes/Research/industrial.yml create mode 100644 Resources/Textures/Interface/Misc/research_disciplines.rsi/biochemical.png create mode 100644 Resources/Textures/Interface/Misc/research_disciplines.rsi/civilianservices.png create mode 100644 Resources/Textures/Interface/Misc/research_disciplines.rsi/experimental.png create mode 100644 Resources/Textures/Interface/Misc/research_disciplines.rsi/industrial.png create mode 100644 Resources/Textures/Interface/Misc/research_disciplines.rsi/meta.json create mode 100644 Resources/Textures/Structures/Machines/artifact_analyzer.rsi/display.png create mode 100644 Resources/Textures/Structures/Machines/fat_sucker.rsi/display.png create mode 100644 Resources/Textures/Structures/Machines/tech_disk_printer.rsi/display.png create mode 100644 Resources/Textures/Structures/Machines/traversal_distorter.rsi/display.png diff --git a/Content.Client/Research/UI/MiniTechnologyCardControl.xaml b/Content.Client/Research/UI/MiniTechnologyCardControl.xaml new file mode 100644 index 0000000000..2808995524 --- /dev/null +++ b/Content.Client/Research/UI/MiniTechnologyCardControl.xaml @@ -0,0 +1,29 @@ + + + + + + diff --git a/Content.Client/Research/UI/MiniTechnologyCardControl.xaml.cs b/Content.Client/Research/UI/MiniTechnologyCardControl.xaml.cs new file mode 100644 index 0000000000..8b1a583c24 --- /dev/null +++ b/Content.Client/Research/UI/MiniTechnologyCardControl.xaml.cs @@ -0,0 +1,24 @@ +using Content.Shared.Research.Prototypes; +using Robust.Client.AutoGenerated; +using Robust.Client.GameObjects; +using Robust.Client.UserInterface; +using Robust.Client.UserInterface.XAML; +using Robust.Shared.Prototypes; +using Robust.Shared.Utility; + +namespace Content.Client.Research.UI; + +[GenerateTypedNameReferences] +public sealed partial class MiniTechnologyCardControl : Control +{ + public MiniTechnologyCardControl(TechnologyPrototype technology, IPrototypeManager prototypeManager, SpriteSystem spriteSys, FormattedMessage description) + { + RobustXamlLoader.Load(this); + + var discipline = prototypeManager.Index(technology.Discipline); + Background.ModulateSelfOverride = discipline.Color; + Texture.Texture = spriteSys.Frame0(technology.Icon); + NameLabel.SetMessage(Loc.GetString(technology.Name)); + Main.ToolTip = description.ToString(); + } +} diff --git a/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs b/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs index c9a3fb4379..97556c931d 100644 --- a/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs +++ b/Content.Client/Research/UI/ResearchConsoleBoundUserInterface.cs @@ -4,91 +4,63 @@ using Content.Shared.Research.Systems; using JetBrains.Annotations; using Robust.Client.GameObjects; -namespace Content.Client.Research.UI -{ - [UsedImplicitly] - public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface - { - public int Points { get; private set; } - public int PointsPerSecond { get; private set; } - private ResearchConsoleMenu? _consoleMenu; - private TechnologyDatabaseComponent? _technologyDatabase; - private readonly IEntityManager _entityManager; - private readonly SharedResearchSystem _research; - - public ResearchConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) - { - SendMessage(new ConsoleServerSyncMessage()); - _entityManager = IoCManager.Resolve(); - _research = _entityManager.System(); - } - - protected override void Open() - { - base.Open(); +namespace Content.Client.Research.UI; - if (!_entityManager.TryGetComponent(Owner.Owner, out _technologyDatabase)) - return; +[UsedImplicitly] +public sealed class ResearchConsoleBoundUserInterface : BoundUserInterface +{ - _consoleMenu = new ResearchConsoleMenu(this); + private ResearchConsoleMenu? _consoleMenu; - _consoleMenu.OnClose += Close; - _consoleMenu.ServerSyncButton.OnPressed += (_) => - { - SendMessage(new ConsoleServerSyncMessage()); - }; + public ResearchConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) + { + SendMessage(new ConsoleServerSyncMessage()); + } - _consoleMenu.ServerSelectionButton.OnPressed += (_) => - { - SendMessage(new ConsoleServerSelectionMessage()); - }; + protected override void Open() + { + base.Open(); - _consoleMenu.UnlockButton.OnPressed += (_) => - { - if (_consoleMenu.TechnologySelected != null) - { - SendMessage(new ConsoleUnlockTechnologyMessage(_consoleMenu.TechnologySelected.ID)); - } - }; + var owner = Owner.Owner; - _consoleMenu.OpenCentered(); - } + _consoleMenu = new ResearchConsoleMenu(owner); - public bool IsTechnologyUnlocked(TechnologyPrototype technology) + _consoleMenu.OnTechnologyCardPressed += id => { - if (_technologyDatabase == null) - return false; + SendMessage(new ConsoleUnlockTechnologyMessage(id)); + }; - return _research.IsTechnologyUnlocked(_technologyDatabase.Owner, technology, _technologyDatabase); - } + _consoleMenu.OnServerButtonPressed += () => + { + SendMessage(new ConsoleServerSelectionMessage()); + }; - public bool CanUnlockTechnology(TechnologyPrototype technology) + _consoleMenu.OnSyncButtonPressed += () => { - if (_technologyDatabase == null) - return false; + SendMessage(new ConsoleServerSyncMessage()); + }; - return _research.ArePrerequesitesUnlocked(_technologyDatabase.Owner, technology, _technologyDatabase); - } + _consoleMenu.OnClose += Close; - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); + _consoleMenu.OpenCentered(); + } - var castState = (ResearchConsoleBoundInterfaceState)state; - Points = castState.Points; - PointsPerSecond = castState.PointsPerSecond; - // We update the user interface here. - _consoleMenu?.PopulatePoints(); - _consoleMenu?.Populate(); - } + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - if (!disposing) - return; - _consoleMenu?.Dispose(); - } + if (state is not ResearchConsoleBoundInterfaceState castState) + return; + _consoleMenu?.UpdatePanels(castState); + _consoleMenu?.UpdateInformationPanel(castState); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; + _consoleMenu?.Dispose(); } } diff --git a/Content.Client/Research/UI/ResearchConsoleMenu.xaml b/Content.Client/Research/UI/ResearchConsoleMenu.xaml index df892b8820..a332458de3 100644 --- a/Content.Client/Research/UI/ResearchConsoleMenu.xaml +++ b/Content.Client/Research/UI/ResearchConsoleMenu.xaml @@ -1,87 +1,101 @@ - + - - - -