[GenerateTypedNameReferences]
public sealed partial class GuidebookWindow : FancyWindow, ILinkClickHandler
{
- [Dependency] private readonly IConfigurationManager _configuration = default!;
- [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IResourceManager _resourceManager = default!;
[Dependency] private readonly DocumentParsingManager _parsingMan = default!;
};
}
- protected override void Opened()
- {
- base.Opened();
-
- var guideProto = _configuration.GetCVar(CCVars.DefaultGuide);
- if (_prototypeManager.TryIndex<GuideEntryPrototype>(guideProto, out var guideEntry))
- {
- if (Tree.Items.FirstOrDefault(x => x.Metadata is GuideEntry entry && entry.Id == guideProto) is { } item)
- Tree.SetSelectedIndex(item.Index);
- else
- ShowGuide(guideEntry);
- }
- }
-
private void OnSelectionChanged(TreeItem? item)
{
if (item != null && item.Metadata is GuideEntry entry)
using Content.Client.Guidebook;
using Content.Client.Guidebook.Controls;
using Content.Client.Lobby;
+using Content.Client.Players.PlayTimeTracking;
using Content.Client.UserInterface.Controls;
+using Content.Shared.CCVar;
using Content.Shared.Guidebook;
using Content.Shared.Input;
+using Robust.Client.State;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controllers;
+using Robust.Shared.Configuration;
using static Robust.Client.UserInterface.Controls.BaseButton;
using Robust.Shared.Input.Binding;
using Robust.Shared.Prototypes;
{
[UISystemDependency] private readonly GuidebookSystem _guidebookSystem = default!;
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+ [Dependency] private readonly IConfigurationManager _configuration = default!;
+ [Dependency] private readonly JobRequirementsManager _jobRequirements = default!;
+
+ private const int PlaytimeOpenGuidebook = 60;
private GuidebookWindow? _guideWindow;
private MenuButton? GuidebookButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.GuidebookButton;
public void OnStateEntered(LobbyState state)
{
- HandleStateEntered();
+ HandleStateEntered(state);
}
public void OnStateEntered(GameplayState state)
{
- HandleStateEntered();
+ HandleStateEntered(state);
}
- private void HandleStateEntered()
+ private void HandleStateEntered(State state)
{
DebugTools.Assert(_guideWindow == null);
_guideWindow.OnClose += OnWindowClosed;
_guideWindow.OnOpen += OnWindowOpen;
+ if (state is LobbyState &&
+ _jobRequirements.FetchOverallPlaytime() < TimeSpan.FromMinutes(PlaytimeOpenGuidebook))
+ {
+ OpenGuidebook();
+ _guideWindow.RecenterWindow(new(0.5f, 0.5f));
+ _guideWindow.SetPositionFirst();
+ }
+
// setup keybinding
CommandBinds.Builder
.Bind(ContentKeyFunctions.OpenGuidebook,
if (GuidebookButton != null)
GuidebookButton.SetClickPressed(!_guideWindow.IsOpen);
+ selected ??= _configuration.GetCVar(CCVars.DefaultGuide);
+
if (guides == null)
{
guides = _prototypeManager.EnumeratePrototypes<GuideEntryPrototype>()