Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Content.Client/Research/UI/MiniTechnologyCardControl.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Control xmlns="https://spacestation14.io">
<Control xmlns="https://spacestation14.io">
<BoxContainer Orientation="Horizontal">
<PanelContainer Name="Background"
Access="Public"
Expand All @@ -19,7 +19,7 @@
HorizontalExpand="False"
VerticalExpand="False"
Margin="1"
TextureScale="0.5 0.5"/>
TextureScale="1 1" /> <!-- Tech Tree Change -->
<Control MinWidth="5"/>
<RichTextLabel Name="NameLabel" StyleClasses="LabelSubText" VerticalAlignment="Center"/>
</BoxContainer>
Expand Down
5 changes: 0 additions & 5 deletions Content.Client/Research/UI/ResearchConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
("name", disciplineText), ("color", disciplineColor)));
MainDisciplineLabel.SetMessage(msg);

var softcapMsg = new FormattedMessage();
softcapMsg.AddMarkup(Loc.GetString("research-console-menu-softcap-amount-text",
("softcap", state.SoftCapMultiplier.ToString("#.##"))));
SoftcapAmountLabel.SetMessage(softcapMsg);

TierDisplayContainer.Children.Clear();
foreach (var disciplineId in database.SupportedDisciplines)
{
Expand Down
2 changes: 1 addition & 1 deletion Content.Client/Research/UI/TechnologyCardControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Research.Components;
using Content.Shared.Research.Components;
using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// 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.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,34 @@
<!--
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"
Stretch="KeepAspectCentered">
</TextureRect>
</PanelContainer>
</BoxContainer>
</LayoutContainer>
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// 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 GoobBot <uristmchands@proton.me>
// SPDX-FileCopyrightText: 2025 SX-7 <sn1.test.preria.2002@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.Numerics;
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;
}

private void Selected(BaseButton.ButtonEventArgs args)
{
SelectAction?.Invoke(Prototype, Availability);
}

public void SetScale(float scale)
{
var box = (BoxContainer) GetChild(0)!;
box.SetSize = new Vector2(80 * scale, 80 * scale);
}
}

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>
Loading