Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
Like, a prototype I guess?
Browse files Browse the repository at this point in the history
Some odd stuff here.
  • Loading branch information
Pspritechologist committed Mar 24, 2024
1 parent 4b65cdf commit 66175f0
Show file tree
Hide file tree
Showing 16 changed files with 1,118 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Content.Client/SimpleStation14/Skills/SkillsBoundUserInterface.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using JetBrains.Annotations;
using Content.Shared.Borgs;
using Robust.Client.GameObjects;
using Content.Shared.SimpleStation14.Skills.Systems;

namespace Content.Client.SimpleStation14.Skills;

[UsedImplicitly]
public sealed class SkillsBoundUserInterface : BoundUserInterface
{
private SkillsMenu? _skillsMenu;

public SkillsBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
{
}

protected override void Open()
{
base.Open();

_skillsMenu = new SkillsMenu(this, EntMan.System<SharedSkillsSystem>());

_skillsMenu.OnClose += Close;

_skillsMenu.OpenCentered();
}

protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing) return;
_skillsMenu?.Dispose();
}
}
29 changes: 29 additions & 0 deletions Content.Client/SimpleStation14/Skills/SkillsMenu.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<ui:FancyWindow xmlns="https://spacestation14.io"
xmlns:ui="clr-namespace:Content.Client.UserInterface.Controls"
Title="{Loc 'skills-window-title'}"
MinSize="400 300"
SetSize="500 500"
Resizable="true">
<BoxContainer Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True">
<BoxContainer Orientation="Horizontal"
HorizontalExpand="True"
VerticalExpand="True"
SizeFlagsStretchRatio="2"
SeparationOverride="10">
<ScrollContainer
HScrollEnabled="False"
HorizontalExpand="True"
VerticalExpand="True">
<BoxContainer Name="Skills"
Orientation="Vertical"
HorizontalExpand="True"
VerticalExpand="True"
Margin="0 0 0 12">
<Label Text="{Loc 'skills-label'}" />
</BoxContainer>
</ScrollContainer>
</BoxContainer>
</BoxContainer>
</ui:FancyWindow>
60 changes: 60 additions & 0 deletions Content.Client/SimpleStation14/Skills/SkillsMenu.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using Content.Client.UserInterface.Controls;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.XAML;
using Content.Shared.SimpleStation14.Skills.Components;
using Content.Shared.SimpleStation14.Skills.Systems;

namespace Content.Client.SimpleStation14.Skills;

[GenerateTypedNameReferences]
public sealed partial class SkillsMenu : FancyWindow
{
[Dependency] private readonly IEntityManager _entityManager = default!;

private readonly SharedSkillsSystem _skills = default!;

private readonly SkillsBoundUserInterface _owner;

public SkillsMenu(SkillsBoundUserInterface owner, SharedSkillsSystem skillsSystem)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
_skills = skillsSystem;

_owner = owner;

UpdateSkills();
}

public void UpdateSkills()
{
var skills = _skills.GetAllSkillsCategorized();

Skills.DisposeAllChildren();

foreach (var category in skills.Keys)
{
var categoryLabel = new SkillsUIContainer();
categoryLabel.SetHeading(category.Name);
categoryLabel.SetDescription(category.Description);
Skills.AddChild(categoryLabel);

foreach (var subCategory in skills[category].Keys)
{
var subCategoryLabel = new SkillsUIContainer();
subCategoryLabel.SetHeading(subCategory.Name);
subCategoryLabel.SetDescription(subCategory.Description);
subCategoryLabel.SetColor(subCategory.SubCategoryColor);
Skills.AddChild(subCategoryLabel);

foreach (var skill in skills[category][subCategory])
{
var newLabel = new SkillsUIContainer();
newLabel.SetHeading(skill.Name);
newLabel.SetDescription(skill.Description);
Skills.AddChild(newLabel);
}
}
}
}
}
16 changes: 16 additions & 0 deletions Content.Client/SimpleStation14/Skills/SkillsUIContainer.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<PanelContainer
xmlns="https://spacestation14.io"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Content.Client.ContextMenu.UI"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Margin="12 12 12 0"
StyleClasses="PanelBackgroundAngledDark"
VerticalExpand="True">

<BoxContainer Orientation="Vertical"
HorizontalExpand="True">
<controls:NanoHeading Name="Title"/>
<RichTextLabel Name="Description" Margin="12 6 6 6" />
</BoxContainer>
</PanelContainer>
32 changes: 32 additions & 0 deletions Content.Client/SimpleStation14/Skills/SkillsUIContainer.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
using Robust.Shared.Utility;

namespace Content.Client.SimpleStation14.Skills;

[GenerateTypedNameReferences]
public sealed partial class SkillsUIContainer : PanelContainer
{
public SkillsUIContainer()
{
RobustXamlLoader.Load(this);
}

public void SetHeading(string desc)
{
Title.Text = desc;
}

public void SetDescription(string desc)
{
Description.SetMessage(desc);
}

public void SetColor(Color color)
{
Modulate = color;
}
}
Loading

0 comments on commit 66175f0

Please sign in to comment.