-
Notifications
You must be signed in to change notification settings - Fork 22
Tech Tree #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: EE-Andromeda
Are you sure you want to change the base?
Tech Tree #89
Changes from all commits
03dceac
8bfd4d6
80a8151
5754d70
54fe29e
7318774
460a3aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> | ||
| // SPDX-FileCopyrightText: 2025 Aiden <aiden@djkraz.com> | ||
| // SPDX-FileCopyrightText: 2025 FaDeOkno <143940725+FaDeOkno@users.noreply.github.com> | ||
| // SPDX-FileCopyrightText: 2025 FaDeOkno <logkedr18@gmail.com> | ||
| // SPDX-FileCopyrightText: 2025 coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> | ||
| // SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com> | ||
| // | ||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||
|
|
||
| using System.Linq; | ||
| using Content.Shared._Goobstation.Research; | ||
| using Content.Shared.Research.Components; | ||
| using Content.Shared.Research.Prototypes; | ||
| using JetBrains.Annotations; | ||
| using Robust.Client.UserInterface; | ||
| using Robust.Shared.Prototypes; | ||
|
|
||
| namespace Content.Client._Goobstation.Research.UI; | ||
|
|
||
| [UsedImplicitly] | ||
| public sealed class FancyResearchConsoleBoundUserInterface : BoundUserInterface | ||
| { | ||
| [ViewVariables] | ||
| private FancyResearchConsoleMenu? _consoleMenu; // Goobstation R&D Console rework - ResearchConsoleMenu -> FancyResearchConsoleMenu | ||
|
|
||
| public FancyResearchConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
| { | ||
| } | ||
|
|
||
| protected override void Open() | ||
| { | ||
| base.Open(); | ||
|
|
||
| var owner = Owner; | ||
|
|
||
| _consoleMenu = this.CreateWindow<FancyResearchConsoleMenu>(); // Goobstation R&D Console rework - ResearchConsoleMenu -> FancyResearchConsoleMenu | ||
| _consoleMenu.SetEntity(owner); | ||
| _consoleMenu.OnClose += () => _consoleMenu = null; | ||
|
|
||
| _consoleMenu.OnTechnologyCardPressed += id => | ||
| { | ||
| SendMessage(new ConsoleUnlockTechnologyMessage(id)); | ||
| }; | ||
|
|
||
| _consoleMenu.OnServerButtonPressed += () => | ||
| { | ||
| SendMessage(new ConsoleServerSelectionMessage()); | ||
| }; | ||
| } | ||
|
|
||
| public override void OnProtoReload(PrototypesReloadedEventArgs args) | ||
| { | ||
| base.OnProtoReload(args); | ||
|
|
||
| if (!args.WasModified<TechnologyPrototype>()) | ||
| return; | ||
|
|
||
| if (State is not ResearchConsoleBoundInterfaceState rState) | ||
| return; | ||
|
|
||
| _consoleMenu?.UpdatePanels(rState.Researches); | ||
| _consoleMenu?.UpdateInformationPanel(rState.Points); | ||
| } | ||
|
|
||
| protected override void UpdateState(BoundUserInterfaceState state) | ||
| { | ||
| base.UpdateState(state); | ||
|
|
||
| if (state is not ResearchConsoleBoundInterfaceState castState) | ||
| return; | ||
|
|
||
| // Goobstation checks added | ||
| // Thats for avoiding refresh spam when only points are updated | ||
| if (_consoleMenu == null) | ||
| return; | ||
| if (!_consoleMenu.List.SequenceEqual(castState.Researches)) | ||
| _consoleMenu.UpdatePanels(castState.Researches); | ||
| if (_consoleMenu.Points != castState.Points) | ||
| _consoleMenu.UpdateInformationPanel(castState.Points); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> | ||
| SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com> | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
|
|
||
| <LayoutContainer xmlns="https://spacestation14.io" | ||
| xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
| xmlns:graphics="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
| xmlns:goob="clr-namespace:Content.Client._Goobstation.Research.UI" | ||
| Margin="5" | ||
| HorizontalExpand="False"> | ||
| <BoxContainer Orientation="Vertical" SetSize="80 80"> | ||
| <PanelContainer VerticalExpand="True" | ||
| HorizontalExpand="True" | ||
| Name="Panel"> | ||
| <PanelContainer.PanelOverride> | ||
| <graphics:StyleBoxFlat BackgroundColor="#162031" | ||
| BorderColor="#4972A1" | ||
| BorderThickness="2"/> | ||
| </PanelContainer.PanelOverride> | ||
| <goob:DrawButton Name="Button" | ||
| Access="Public" | ||
| ModulateSelfOverride="#00000000" | ||
| HorizontalExpand="True"/> | ||
| <TextureRect | ||
| Name="ResearchDisplay" | ||
| TextureScale="2 2" | ||
| SetSize="64 64" | ||
| Stretch="KeepAspectCentered"> | ||
| </TextureRect> | ||
| </PanelContainer> | ||
| </BoxContainer> | ||
| </LayoutContainer> |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,94 @@ | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 Aiden <aiden@djkraz.com> | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 FaDeOkno <143940725+FaDeOkno@users.noreply.github.com> | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 FaDeOkno <logkedr18@gmail.com> | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> | ||||||||||||||||||||||||||||
| // SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com> | ||||||||||||||||||||||||||||
| // | ||||||||||||||||||||||||||||
| // SPDX-License-Identifier: AGPL-3.0-or-later | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| using Content.Shared._Goobstation.Research; | ||||||||||||||||||||||||||||
| using Content.Shared.Research.Prototypes; | ||||||||||||||||||||||||||||
| using Robust.Client.AutoGenerated; | ||||||||||||||||||||||||||||
| using Robust.Client.GameObjects; | ||||||||||||||||||||||||||||
| using Robust.Client.Graphics; | ||||||||||||||||||||||||||||
| using Robust.Client.UserInterface.Controls; | ||||||||||||||||||||||||||||
| using Robust.Client.UserInterface.XAML; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| namespace Content.Client._Goobstation.Research.UI; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| [GenerateTypedNameReferences] | ||||||||||||||||||||||||||||
| public sealed partial class FancyResearchConsoleItem : LayoutContainer | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| // Public fields | ||||||||||||||||||||||||||||
| public TechnologyPrototype Prototype; | ||||||||||||||||||||||||||||
| public Action<TechnologyPrototype, ResearchAvailability>? SelectAction; | ||||||||||||||||||||||||||||
| public ResearchAvailability Availability; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| // Some visuals | ||||||||||||||||||||||||||||
| public static readonly Color DefaultColor = Color.FromHex("#141F2F"); | ||||||||||||||||||||||||||||
| public static readonly Color DefaultBorderColor = Color.FromHex("#4972A1"); | ||||||||||||||||||||||||||||
| public static readonly Color DefaultHoveredColor = Color.FromHex("#4972A1"); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public Color Color = DefaultColor; | ||||||||||||||||||||||||||||
| public Color BorderColor = DefaultBorderColor; | ||||||||||||||||||||||||||||
| public Color HoveredColor = DefaultHoveredColor; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public FancyResearchConsoleItem(TechnologyPrototype proto, SpriteSystem sprite, ResearchAvailability availability) | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| RobustXamlLoader.Load(this); | ||||||||||||||||||||||||||||
| IoCManager.InjectDependencies(this); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Availability = availability; | ||||||||||||||||||||||||||||
| Prototype = proto; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| ResearchDisplay.Texture = sprite.Frame0(proto.Icon); | ||||||||||||||||||||||||||||
| Button.OnPressed += Selected; | ||||||||||||||||||||||||||||
| Button.OnDrawModeChanged += UpdateColor; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| (Color, HoveredColor, BorderColor) = availability switch | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| ResearchAvailability.Researched => (Color.DarkOliveGreen, Color.PaleGreen, Color.LimeGreen), | ||||||||||||||||||||||||||||
| ResearchAvailability.Available => (Color.FromHex("#7c7d2a"), Color.FromHex("#ecfa52"), Color.FromHex("#e8fa25")), | ||||||||||||||||||||||||||||
| ResearchAvailability.PrereqsMet => (Color.FromHex("#6b572f"), Color.FromHex("#fad398"), Color.FromHex("#cca031")), | ||||||||||||||||||||||||||||
| ResearchAvailability.Unavailable => (Color.DarkRed, Color.PaleVioletRed, Color.Crimson), | ||||||||||||||||||||||||||||
| _ => (Color.DarkRed, Color.PaleVioletRed, Color.Crimson) | ||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| UpdateColor(); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| private void UpdateColor() | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| var panel = (StyleBoxFlat) Panel.PanelOverride!; | ||||||||||||||||||||||||||||
| panel.BackgroundColor = Button.IsHovered ? HoveredColor : Color; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| panel.BorderColor = BorderColor; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| protected override void ExitedTree() | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| base.ExitedTree(); | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| Button.OnPressed -= Selected; | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
|
Comment on lines
+69
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Cancelar registro do evento
- Button.OnPressed -= Selected;
+ Button.OnPressed -= Selected;
+ Button.OnDrawModeChanged -= UpdateColor;📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
| private void Selected(BaseButton.ButtonEventArgs args) | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| SelectAction?.Invoke(Prototype, Availability); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public sealed class DrawButton : Button | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| public event Action? OnDrawModeChanged; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| public DrawButton() | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| protected override void DrawModeChanged() | ||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||
| OnDrawModeChanged?.Invoke(); | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| <!-- | ||
| SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> | ||
| SPDX-FileCopyrightText: 2025 gluesniffler <159397573+gluesniffler@users.noreply.github.com> | ||
|
|
||
| SPDX-License-Identifier: AGPL-3.0-or-later | ||
| --> | ||
|
|
||
| <controls:FancyWindow xmlns="https://spacestation14.io" | ||
| xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
| xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls;assembly=Content.Client" | ||
| xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls;assembly=Content.Client" | ||
| xmlns:goob="clr-namespace:Content.Client._Goobstation.Research.UI" | ||
| Title="{Loc 'research-console-menu-title'}" | ||
| SetSize="1260 850"> | ||
| <BoxContainer Orientation="Vertical" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True"> | ||
| <BoxContainer Orientation="Horizontal" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="False" | ||
| MinHeight="60" | ||
| Margin="10"> | ||
| <BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True"> | ||
| <RichTextLabel Name="ResearchAmountLabel"/> | ||
| <Control VerticalExpand="True"/> | ||
| <BoxContainer Name="TierDisplayContainer" Orientation="Horizontal" HorizontalExpand="True" VerticalAlignment="Bottom"/> | ||
| <!-- This is where we put all of the little graphics that display discipline tiers!--> | ||
| </BoxContainer> | ||
| <BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalAlignment="Right"> | ||
| <Button Name="ServerButton" Text="{Loc 'research-console-menu-server-selection-button'}" MinHeight="40"/> | ||
| </BoxContainer> | ||
| </BoxContainer> | ||
| <BoxContainer Orientation="Horizontal" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True"> | ||
| <BoxContainer Orientation="Vertical" | ||
| VerticalExpand="True" | ||
| HorizontalExpand="True" | ||
| SizeFlagsStretchRatio="3" | ||
| Margin="0 0 0 10"> | ||
| <PanelContainer Name="ResearchesContainer" VerticalExpand="True" HorizontalExpand="True"> | ||
| <PanelContainer.PanelOverride> | ||
| <gfx:StyleBoxFlat BackgroundColor="#000000FF" /> | ||
| </PanelContainer.PanelOverride> | ||
| <AnimatedTextureRect Name="StaticSprite" | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True"> | ||
| <goob:ResearchesContainerPanel | ||
| HorizontalExpand="True" | ||
| VerticalExpand="True" | ||
| Name="DragContainer" | ||
| MouseFilter="Pass" | ||
| RectClipContent="True"> | ||
| <!-- There lives all of technologies --> | ||
| </goob:ResearchesContainerPanel> | ||
| </AnimatedTextureRect> | ||
| <Button Name="RecenterButton" Text="{Loc 'research-console-menu-recenter-button'}" MinHeight="40" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5 -5"/> | ||
| </PanelContainer> | ||
| </BoxContainer> | ||
| <PanelContainer SizeFlagsStretchRatio="2"> | ||
| <PanelContainer.PanelOverride> | ||
| <gfx:StyleBoxFlat BackgroundColor="#1B1B1E" /> | ||
| </PanelContainer.PanelOverride> | ||
| <BoxContainer Name="InfoContainer" | ||
| Orientation="Vertical" | ||
| VerticalExpand="True" | ||
| HorizontalExpand="True" | ||
| SizeFlagsStretchRatio="1" | ||
| Margin="0"/> | ||
| </PanelContainer> | ||
| </BoxContainer> | ||
| </BoxContainer> | ||
| </controls:FancyWindow> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nome do campo colide com o tipo
Color, causando erro de compilaçãoAo declarar
public Color Color = …, o identificadorColorpassa a se referir ao campo, escondendo o tipoColorno restante da classe. Linhas 50-56 que usamColor.DarkOliveGreen, etc., deixam de compilar.Altere também as demais referências (
BaseColor,BaseBorderColor) dentro da classe.