Files
OldThink/Content.Client/CharacterInfo/Components/CharacterInfoComponent.cs

83 lines
2.7 KiB
C#
Raw Normal View History

2021-06-09 22:19:39 +02:00
using Content.Client.CharacterInterface;
using Content.Client.HUD.UI;
using Content.Client.Stylesheets;
2019-07-20 14:06:54 +02:00
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;
2019-07-20 14:06:54 +02:00
2021-06-09 22:19:39 +02:00
namespace Content.Client.CharacterInfo.Components
2019-07-20 14:06:54 +02:00
{
2019-07-31 15:02:36 +02:00
[RegisterComponent]
2021-12-11 15:12:55 -08:00
public sealed class CharacterInfoComponent : Component, ICharacterUI
2019-07-20 14:06:54 +02:00
{
2021-12-11 15:12:55 -08:00
public CharacterInfoControl Control = default!;
2019-07-20 14:06:54 +02:00
2021-12-11 15:12:55 -08:00
public Control Scene { get; set; } = default!;
2019-07-20 14:06:54 +02:00
public UIPriority Priority => UIPriority.Info;
public void Opened()
{
2021-12-11 15:12:55 -08:00
EntitySystem.Get<CharacterInfoSystem>().RequestCharacterInfo(Owner);
}
2021-12-11 15:12:55 -08:00
public sealed class CharacterInfoControl : BoxContainer
2019-07-20 14:06:54 +02:00
{
public SpriteView SpriteView { get; }
public Label NameLabel { get; }
public Label SubText { get; }
public BoxContainer ObjectivesContainer { get; }
2021-12-11 15:12:55 -08:00
public CharacterInfoControl()
2019-07-20 14:06:54 +02:00
{
IoCManager.InjectDependencies(this);
Orientation = LayoutOrientation.Vertical;
AddChild(new BoxContainer
2019-07-20 14:06:54 +02:00
{
Orientation = LayoutOrientation.Horizontal,
2019-07-20 14:06:54 +02:00
Children =
{
(SpriteView = new SpriteView { OverrideDirection = Direction.South, Scale = (2,2)}),
new BoxContainer
2019-07-20 14:06:54 +02:00
{
Orientation = LayoutOrientation.Vertical,
2021-02-21 12:38:56 +01:00
VerticalAlignment = VAlignment.Top,
2019-07-20 14:06:54 +02:00
Children =
{
(NameLabel = new Label()),
(SubText = new Label
{
2021-02-21 12:38:56 +01:00
VerticalAlignment = VAlignment.Top,
2021-12-11 15:12:55 -08:00
StyleClasses = {StyleBase.StyleClassLabelSubText},
2019-07-20 14:06:54 +02:00
})
}
}
}
});
AddChild(new Label
2019-07-20 14:06:54 +02:00
{
Text = Loc.GetString("character-info-objectives-label"),
2021-02-21 12:38:56 +01:00
HorizontalAlignment = HAlignment.Center
2019-07-20 14:06:54 +02:00
});
ObjectivesContainer = new BoxContainer
{
Orientation = LayoutOrientation.Vertical
};
AddChild(ObjectivesContainer);
2019-07-20 14:06:54 +02:00
AddChild(new Placeholder()
2019-07-20 14:06:54 +02:00
{
PlaceholderText = Loc.GetString("character-info-roles-antagonist-text")
2019-07-20 14:06:54 +02:00
});
}
}
}
}