-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
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
95 changes: 95 additions & 0 deletions
95
Content.Client/GameObjects/Components/Actor/CharacterInfoComponent.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,95 @@ | ||
using Content.Client.GameObjects.Components.Mobs; | ||
using Content.Client.UserInterface; | ||
using Robust.Client.Interfaces.GameObjects.Components; | ||
using Robust.Client.Interfaces.ResourceManagement; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Shared.GameObjects; | ||
using Robust.Shared.IoC; | ||
using Robust.Shared.Localization; | ||
using Robust.Shared.Maths; | ||
|
||
namespace Content.Client.GameObjects.Components.Actor | ||
{ | ||
public sealed class CharacterInfoComponent : Component, ICharacterUI | ||
{ | ||
private CharacterInfoControl _control; | ||
|
||
#pragma warning disable 649 | ||
[Dependency] private readonly ILocalizationManager _loc; | ||
[Dependency] private readonly IResourceCache _resourceCache; | ||
#pragma warning restore 649 | ||
|
||
public override string Name => "CharacterInfo"; | ||
|
||
public Control Scene { get; private set; } | ||
public UIPriority Priority => UIPriority.Info; | ||
|
||
public override void OnAdd() | ||
{ | ||
base.OnAdd(); | ||
|
||
Scene = _control = new CharacterInfoControl(_resourceCache, _loc); | ||
} | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
if (Owner.TryGetComponent(out ISpriteComponent spriteComponent)) | ||
{ | ||
_control.SpriteView.Sprite = spriteComponent; | ||
} | ||
|
||
_control.NameLabel.Text = Owner.Name; | ||
// ReSharper disable once StringLiteralTypo | ||
_control.SubText.Text = _loc.GetString("Professional Greyshirt"); | ||
} | ||
|
||
private sealed class CharacterInfoControl : VBoxContainer | ||
{ | ||
public SpriteView SpriteView { get; } | ||
public Label NameLabel { get; } | ||
public Label SubText { get; } | ||
|
||
public CharacterInfoControl(IResourceCache resourceCache, ILocalizationManager loc) | ||
{ | ||
AddChild(new HBoxContainer | ||
{ | ||
Children = | ||
{ | ||
(SpriteView = new SpriteView()), | ||
new VBoxContainer | ||
{ | ||
SizeFlagsVertical = SizeFlags.None, | ||
Children = | ||
{ | ||
(NameLabel = new Label()), | ||
(SubText = new Label | ||
{ | ||
SizeFlagsVertical = SizeFlags.None, | ||
StyleClasses = {NanoStyle.StyleClassLabelSubText} | ||
}) | ||
} | ||
} | ||
} | ||
}); | ||
|
||
AddChild(new Placeholder(resourceCache) | ||
{ | ||
PlaceholderText = loc.GetString("Health & status effects") | ||
}); | ||
|
||
AddChild(new Placeholder(resourceCache) | ||
{ | ||
PlaceholderText = loc.GetString("Objectives") | ||
}); | ||
|
||
AddChild(new Placeholder(resourceCache) | ||
{ | ||
PlaceholderText = loc.GetString("Antagonist Roles") | ||
}); | ||
} | ||
} | ||
} | ||
} |
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
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
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
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
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