Skip to content

Commit

Permalink
дэржи жъжьжь
Browse files Browse the repository at this point in the history
  • Loading branch information
FaDeOkno committed Dec 19, 2024
1 parent 6d62222 commit edf55c9
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 10 deletions.
23 changes: 23 additions & 0 deletions Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Control xmlns="https://spacestation14.io">
<BoxContainer Orientation="Horizontal">
<PanelContainer Name="Background"
Access="Public"
StyleClasses="PdaBackground"
VerticalExpand="False"
HorizontalExpand="False"
MaxWidth="10"
Margin="0 0 -5 0"/>
<Button Name="Main"
Disabled="True"
HorizontalExpand="True"
VerticalExpand="False"
StyleClasses="ButtonSquare"
Margin="0"
ToolTip="foobar">
<BoxContainer Orientation="Horizontal" Margin="0">
<Control MinWidth="5"/>
<RichTextLabel Name="NameLabel" StyleClasses="LabelSubText" VerticalAlignment="Center"/>
</BoxContainer>
</Button>
</BoxContainer>
</Control>
28 changes: 28 additions & 0 deletions Content.Client/ADT/Research/UI/MiniRecipeCardControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Content.Shared.Research.Prototypes;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;

namespace Content.Client.ADT.Research.UI;

[GenerateTypedNameReferences]
public sealed partial class MiniRecipeCardControl : Control
{
public MiniRecipeCardControl(TechnologyPrototype technology, string name, IPrototypeManager prototypeManager)
{
RobustXamlLoader.Load(this);

var discipline = prototypeManager.Index(technology.Discipline);
Background.ModulateSelfOverride = discipline.Color;
NameLabel.SetMessage(Loc.GetString(technology.Name));

// var tooltip = new Tooltip();
// tooltip.SetMessage(description);
// Main.TooltipSupplier = _ => tooltip;
// Technology = technology;
}
}
12 changes: 11 additions & 1 deletion Content.Client/ADT/Research/UI/ResearchConsoleItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ public ResearchConsoleItem(TechnologyPrototype proto, SpriteSystem sprite)
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
Prototype = proto;
Buy.OnPressed += _ => BuyAction?.Invoke(Prototype);
Buy.OnPressed += Selected;
ResearchDisplay.Texture = sprite.Frame0(proto.Icon);
}

protected override void Dispose(bool disposing)
{
Buy.OnPressed -= Selected;
base.Dispose(disposing);
}

private void Selected(BaseButton.ButtonEventArgs args)
{
BuyAction?.Invoke(Prototype);
}
}
18 changes: 11 additions & 7 deletions Content.Client/ADT/Research/UI/ResearchConsoleMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public void SetEntity(EntityUid entity)

public void UpdatePanels(ResearchConsoleBoundInterfaceState state)
{
DragContainer.Children.Clear();
DisciplinesContainer.Children.Clear();
DragContainer.DisposeAllChildren();
DisciplinesContainer.DisposeAllChildren();
List = state.AllowedPrototypes;

foreach (var proto in _prototype.EnumeratePrototypes<TechDisciplinePrototype>())
Expand Down Expand Up @@ -141,7 +141,7 @@ public void UpdateInformationPanel(ResearchConsoleBoundInterfaceState state)
("name", disciplineText), ("color", disciplineColor)));
MainDisciplineLabel.SetMessage(msg);

TierDisplayContainer.Children.Clear();
TierDisplayContainer.DisposeAllChildren();
foreach (var disciplineId in database.SupportedDisciplines)
{
var discipline = _prototype.Index<TechDisciplinePrototype>(disciplineId);
Expand Down Expand Up @@ -217,7 +217,7 @@ protected override DragMode GetDragModeFor(Vector2 relativeMousePos)

public void Select(TechnologyPrototype proto)
{
InfoContainer.Children.Clear();
InfoContainer.DisposeAllChildren();
if (!_player.LocalEntity.HasValue)
return;

Expand All @@ -238,10 +238,14 @@ public void Recenter()

public override void Close()
{
DragContainer.Children.Clear();
InfoContainer.Children.Clear();
DisciplinesContainer.Children.Clear();
base.Close();
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);


}
}

1 change: 0 additions & 1 deletion Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Margin="5"
Orientation="Vertical"
VerticalExpand="True">
<BoxContainer
Name="InfoContainer"
Expand Down
18 changes: 17 additions & 1 deletion Content.Client/ADT/Research/UI/TechnologyInfoPanel.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,27 @@ public TechnologyInfoPanel(TechnologyPrototype proto, SpriteSystem sprite, int p
DisciplineTexture.Texture = sprite.Frame0(_proto.Index<TechDisciplinePrototype>(proto.Discipline).Icon);
TechnologyTexture.Texture = sprite.Frame0(proto.Icon);

UnlocksContainer.DisposeAllChildren();
foreach (var item in proto.RecipeUnlocks)
{
var control = new MiniRecipeCardControl(proto, Loc.GetString(proto.Name), _proto);
UnlocksContainer.AddChild(control);
}
if (!hasAccess)
ResearchButton.ToolTip = Loc.GetString("research-console-no-access-popup");

ResearchButton.Disabled = points < proto.Cost || !hasAccess;
ResearchButton.OnPressed += _ => BuyAction?.Invoke(Prototype);
ResearchButton.OnPressed += Bought;
}

protected override void Dispose(bool disposing)
{
ResearchButton.OnPressed -= Bought;
base.Dispose(disposing);
}
private void Bought(BaseButton.ButtonEventArgs args)
{
BuyAction?.Invoke(Prototype);
}

}

0 comments on commit edf55c9

Please sign in to comment.