diff --git a/Content.Client/EntryPoint.cs b/Content.Client/EntryPoint.cs index 0fab1ae930..9c902e3f1a 100644 --- a/Content.Client/EntryPoint.cs +++ b/Content.Client/EntryPoint.cs @@ -138,6 +138,7 @@ namespace Content.Client factory.RegisterIgnore("PlayerInputMover"); factory.Register(); + factory.Register(); IoCManager.Register(); IoCManager.Register(); diff --git a/Content.Client/GameObjects/Components/Actor/CharacterInfoComponent.cs b/Content.Client/GameObjects/Components/Actor/CharacterInfoComponent.cs new file mode 100644 index 0000000000..59059ba7d0 --- /dev/null +++ b/Content.Client/GameObjects/Components/Actor/CharacterInfoComponent.cs @@ -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") + }); + } + } + } +} diff --git a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs index 280f0e557e..fe2d2a5063 100644 --- a/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs +++ b/Content.Client/GameObjects/Components/Actor/CharacterInterface.cs @@ -135,8 +135,8 @@ namespace Content.Client.GameObjects.Components.Actor public enum UIPriority { First = 0, + Info = 5, Species = 100, - Inventory = 200, Last = 99999 } } diff --git a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs index cc82853dfb..1d33c759cb 100644 --- a/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs +++ b/Content.Client/GameObjects/Components/HUD/Inventory/ClientInventoryComponent.cs @@ -51,10 +51,6 @@ namespace Content.Client.GameObjects private ISpriteComponent _sprite; - //Relevant interface implementation for the character UI controller - public Control Scene => _window; - public UIPriority Priority => UIPriority.Inventory; - public override void OnRemove() { base.OnRemove(); diff --git a/Content.Client/GameObjects/Components/Mobs/SpeciesUI.cs b/Content.Client/GameObjects/Components/Mobs/SpeciesUI.cs index 7f999bad9c..c590245f90 100644 --- a/Content.Client/GameObjects/Components/Mobs/SpeciesUI.cs +++ b/Content.Client/GameObjects/Components/Mobs/SpeciesUI.cs @@ -26,12 +26,12 @@ namespace Content.Client.GameObjects /// /// A character UI component which shows the current damage state of the mob (living/dead) /// - public class SpeciesUI : SharedSpeciesComponent, ICharacterUI + public class SpeciesUI : SharedSpeciesComponent//, ICharacterUI { private StatusEffectsUI _ui; /// - /// Holds the godot control for the species window + /// Holds the godot control for the species window /// private SpeciesWindow _window; diff --git a/Content.Client/UserInterface/NanoStyle.cs b/Content.Client/UserInterface/NanoStyle.cs index 92bcc9b1fb..8ccab3bb5a 100644 --- a/Content.Client/UserInterface/NanoStyle.cs +++ b/Content.Client/UserInterface/NanoStyle.cs @@ -13,6 +13,7 @@ namespace Content.Client.UserInterface public sealed class NanoStyle { public const string StyleClassLabelHeading = "LabelHeading"; + public const string StyleClassLabelSubText = "LabelSubText"; public const string StyleClassButtonBig = "ButtonBig"; private static readonly Color NanoGold = Color.FromHex("#A88B5E"); @@ -26,6 +27,7 @@ namespace Content.Client.UserInterface public NanoStyle() { var resCache = IoCManager.Resolve(); + var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSansDisplayBold14 = resCache.GetFont("/Fonts/NotoSansDisplay/NotoSansDisplay-Bold.ttf", 14); var notoSans16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 16); @@ -421,6 +423,13 @@ namespace Content.Client.UserInterface new StyleProperty(Label.StylePropertyFontColor, NanoGold), } ), + // Small Label + new StyleRule(new SelectorElement(typeof(Label), new []{StyleClassLabelSubText}, null, null), new [] + { + new StyleProperty(Label.StylePropertyFont, notoSans10), + new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray), + } ), + // Big Button new StyleRule(new SelectorElement(typeof(Button), new []{StyleClassButtonBig}, null, null), new [] { diff --git a/Resources/Prototypes/Entities/Mobs.yml b/Resources/Prototypes/Entities/Mobs.yml index a22cd6381a..806d91d7d0 100644 --- a/Resources/Prototypes/Entities/Mobs.yml +++ b/Resources/Prototypes/Entities/Mobs.yml @@ -67,6 +67,7 @@ - type: CombatMode - type: Teleportable - type: Examiner + - type: CharacterInfo - type: entity id: MobObserver