Separate inventory & character UI.
This commit is contained in:
@@ -138,6 +138,7 @@ namespace Content.Client
|
||||
factory.RegisterIgnore("PlayerInputMover");
|
||||
|
||||
factory.Register<ExaminerComponent>();
|
||||
factory.Register<CharacterInfoComponent>();
|
||||
|
||||
IoCManager.Register<IGameHud, GameHud>();
|
||||
IoCManager.Register<IClientNotifyManager, ClientNotifyManager>();
|
||||
|
||||
@@ -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")
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -135,8 +135,8 @@ namespace Content.Client.GameObjects.Components.Actor
|
||||
public enum UIPriority
|
||||
{
|
||||
First = 0,
|
||||
Info = 5,
|
||||
Species = 100,
|
||||
Inventory = 200,
|
||||
Last = 99999
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Content.Client.GameObjects
|
||||
/// <summary>
|
||||
/// A character UI component which shows the current damage state of the mob (living/dead)
|
||||
/// </summary>
|
||||
public class SpeciesUI : SharedSpeciesComponent, ICharacterUI
|
||||
public class SpeciesUI : SharedSpeciesComponent//, ICharacterUI
|
||||
{
|
||||
private StatusEffectsUI _ui;
|
||||
|
||||
|
||||
@@ -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<IResourceCache>();
|
||||
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 []
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
- type: CombatMode
|
||||
- type: Teleportable
|
||||
- type: Examiner
|
||||
- type: CharacterInfo
|
||||
|
||||
- type: entity
|
||||
id: MobObserver
|
||||
|
||||
Reference in New Issue
Block a user