+using Content.Client.Guidebook.Components;
using Content.Shared.Chemistry;
using Content.Shared.Containers.ItemSlots;
using JetBrains.Annotations;
_window = new()
{
Title = EntMan.GetComponent<MetaDataComponent>(Owner).EntityName,
+ HelpGuidebookIds = EntMan.GetComponent<GuideHelpComponent>(Owner).Guides
};
_window.OpenCentered();
});
}
+ public void OpenHelp(List<string> guides)
+ {
+ OnGuidebookOpen?.Invoke(guides, null, null, true, guides[0]);
+ }
+
private void OnInteract(EntityUid uid, GuideHelpComponent component, ActivateInWorldEvent args)
{
if (!_timing.IsFirstTimePredicted)
using System.Numerics;
using Content.Client.Resources;
+using Content.Client.UserInterface.Controls;
using Robust.Client.Graphics;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
Element<PanelContainer>().Class("WindowHeadingBackgroundLight")
.Prop("panel", new StyleBoxTexture(BaseButtonOpenLeft) { Padding = default }),
+ // Window Header Help Button
+ Element<TextureButton>().Class(FancyWindow.StyleClassWindowHelpButton)
+ .Prop(TextureButton.StylePropertyTexture, resCache.GetTexture("/Textures/Interface/Nano/help.png"))
+ .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#4B596A")),
+
+ Element<TextureButton>().Class(FancyWindow.StyleClassWindowHelpButton).Pseudo(ContainerButton.StylePseudoClassHover)
+ .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#7F3636")),
+
+ Element<TextureButton>().Class(FancyWindow.StyleClassWindowHelpButton).Pseudo(ContainerButton.StylePseudoClassPressed)
+ .Prop(Control.StylePropertyModulateSelf, Color.FromHex("#753131")),
+
//The lengths you have to go through to change a background color smh
Element<PanelContainer>().Class("PanelBackgroundBaseDark")
.Prop("panel", new StyleBoxTexture(BaseButtonOpenBoth) { Padding = default })
<BoxContainer Margin="4 2 8 0" Orientation="Horizontal">
<Label Name="WindowTitle"
HorizontalExpand="True" VAlign="Center" StyleClasses="FancyWindowTitle" />
+ <TextureButton Name="HelpButton" StyleClasses="windowHelpButton" VerticalAlignment="Center" Disabled="True" Visible="False" Access="Public" />
<TextureButton Name="CloseButton" StyleClasses="windowCloseButton"
VerticalAlignment="Center" />
</BoxContainer>
using System.Numerics;
+using Content.Client.Guidebook;
+using Content.Client.Guidebook.Components;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
+using Robust.Shared.Prototypes;
namespace Content.Client.UserInterface.Controls
{
[Virtual]
public partial class FancyWindow : BaseWindow
{
+ [Dependency] private readonly IEntitySystemManager _sysMan = default!;
+ private GuidebookSystem? _guidebookSystem;
private const int DRAG_MARGIN_SIZE = 7;
+ public const string StyleClassWindowHelpButton = "windowHelpButton";
public FancyWindow()
{
RobustXamlLoader.Load(this);
CloseButton.OnPressed += _ => Close();
+ HelpButton.OnPressed += _ => Help();
XamlChildren = ContentsContainer.Children;
}
set => WindowTitle.Text = value;
}
+ private List<string>? _helpGuidebookIds;
+ public List<string>? HelpGuidebookIds
+ {
+ get => _helpGuidebookIds;
+ set
+ {
+ _helpGuidebookIds = value;
+ HelpButton.Disabled = _helpGuidebookIds == null;
+ HelpButton.Visible = !HelpButton.Disabled;
+ }
+ }
+
+ public void Help()
+ {
+ if (HelpGuidebookIds is null)
+ return;
+ _guidebookSystem ??= _sysMan.GetEntitySystem<GuidebookSystem>();
+ _guidebookSystem.OpenHelp(HelpGuidebookIds);
+ }
+
protected override DragMode GetDragModeFor(Vector2 relativeMousePos)
{
var mode = DragMode.Move;