This repository has been archived by the owner on Dec 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
16 changed files
with
1,118 additions
and
0 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
Content.Client/SimpleStation14/Skills/SkillsBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
16
Content.Client/SimpleStation14/Skills/SkillsUIContainer.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
32
Content.Client/SimpleStation14/Skills/SkillsUIContainer.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |
Oops, something went wrong.