feat: add a tutorial for profiles

This commit is contained in:
goat 2023-06-26 10:30:56 +02:00
parent e8c411bd72
commit 1443c751f5
No known key found for this signature in database
GPG key ID: 49E2AA8C6A76498B
2 changed files with 100 additions and 2 deletions

View file

@ -287,6 +287,11 @@ internal sealed class DalamudConfiguration : IServiceType
/// </summary>
public bool ProfilesEnabled { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether or not the user has seen the profiles tutorial.
/// </summary>
public bool ProfilesHasSeenTutorial { get; set; } = false;
/// <summary>
/// Gets or sets a value indicating whether or not Dalamud RMT filtering should be disabled.
/// </summary>

View file

@ -4,6 +4,7 @@ using System.Numerics;
using System.Threading.Tasks;
using CheapLoc;
using Dalamud.Configuration.Internal;
using Dalamud.Interface.Colors;
using Dalamud.Interface.Components;
using Dalamud.Interface.Internal.Notifications;
@ -48,10 +49,14 @@ internal class ProfileManagerWidget
/// </summary>
public void Draw()
{
var tutorialTitle = Locs.TutorialTitle + "###collectionsTutorWindow";
var tutorialId = ImGui.GetID(tutorialTitle);
this.DrawTutorial(tutorialTitle);
switch (this.mode)
{
case Mode.Overview:
this.DrawOverview();
this.DrawOverview(tutorialId);
break;
case Mode.EditSingleProfile:
@ -70,7 +75,51 @@ internal class ProfileManagerWidget
this.pickerSearch = string.Empty;
}
private void DrawOverview()
private void DrawTutorial(string modalTitle)
{
var _ = true;
ImGui.SetNextWindowSize(new Vector2(450, 350), ImGuiCond.Appearing);
using (var popup = ImRaii.PopupModal(modalTitle, ref _))
{
if (popup)
{
using var scrolling = ImRaii.Child("###scrolling", new Vector2(-1, -1));
if (scrolling)
{
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphOne);
ImGuiHelpers.ScaledDummy(3);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphTwo);
ImGuiHelpers.ScaledDummy(3);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphThree);
ImGuiHelpers.ScaledDummy(3);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialParagraphFour);
ImGuiHelpers.ScaledDummy(3);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommands);
ImGui.BulletText(Locs.TutorialCommandsEnable);
ImGui.BulletText(Locs.TutorialCommandsDisable);
ImGui.BulletText(Locs.TutorialCommandsToggle);
ImGuiHelpers.SafeTextWrapped(Locs.TutorialCommandsEnd);
var buttonWidth = 120f;
ImGui.SetCursorPosX((ImGui.GetWindowWidth() - buttonWidth) / 2);
if (ImGui.Button("OK", new Vector2(buttonWidth, 40)))
{
ImGui.CloseCurrentPopup();
}
}
}
}
var config = Service<DalamudConfiguration>.Get();
if (!config.ProfilesHasSeenTutorial)
{
ImGui.OpenPopup(modalTitle);
config.ProfilesHasSeenTutorial = true;
config.QueueSave();
}
}
private void DrawOverview(uint tutorialId)
{
var didAny = false;
var profman = Service<ProfileManager>.Get();
@ -101,6 +150,16 @@ internal class ProfileManagerWidget
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Locs.ImportProfileHint);
ImGui.SameLine();
ImGuiHelpers.ScaledDummy(5);
ImGui.SameLine();
if (ImGuiComponents.IconButton(FontAwesomeIcon.Question))
ImGui.OpenPopup(tutorialId);
if (ImGui.IsItemHovered())
ImGui.SetTooltip(Locs.TutorialHint);
ImGui.Separator();
ImGuiHelpers.ScaledDummy(5);
@ -488,6 +547,9 @@ internal class ProfileManagerWidget
public static string ImportProfileHint =>
Loc.Localize("ProfileManagerImportProfile", "Import a shared collection from your clipboard");
public static string TutorialHint =>
Loc.Localize("ProfileManagerTutorialHint", "Learn more about collections");
public static string AddProfile => Loc.Localize("ProfileManagerAddProfile", "Add a new collection");
public static string NotificationImportSuccess =>
@ -504,5 +566,36 @@ internal class ProfileManagerWidget
public static string NotInstalled(string name) =>
Loc.Localize("ProfileManagerNotInstalled", "{0} (Not Installed)").Format(name);
public static string TutorialTitle =>
Loc.Localize("ProfileManagerTutorial", "About Collections");
public static string TutorialParagraphOne =>
Loc.Localize("ProfileManagerTutorialParagraphOne", "Collections are shareable lists of plugins that can be enabled or disabled in the plugin installer or via chat commands.\nWhen a plugin is part of a collection, it will be enabled if the collection is enabled. If a plugin is part of multiple collections, it will be enabled if one or more collections it is a part of are enabled.");
public static string TutorialParagraphTwo =>
Loc.Localize("ProfileManagerTutorialParagraphTwo", "You can add plugins to collections by clicking the plus button when editing a collection on this screen, or by using the button with the toolbox icon on the \"Installed Plugins\" screen.");
public static string TutorialParagraphThree =>
Loc.Localize("ProfileManagerTutorialParagraphThree", "If a collection's \"Start on boot\" checkbox is ticked, the collection and the plugins within will be enabled every time the game starts up, even if it has been manually disabled in a prior session.");
public static string TutorialParagraphFour =>
Loc.Localize("ProfileManagerTutorialParagraphFour", "Individual plugins inside a collection also have a checkbox next to them. This indicates if a plugin is active within that collection - if the checkbox is not ticked, the plugin will not be enabled if that collection is active. Mind that it will still be enabled if the plugin is an active part of any other collection.");
public static string TutorialCommands =>
Loc.Localize("ProfileManagerTutorialCommands", "You can use the following commands in chat or in macros to manage active collections:");
public static string TutorialCommandsEnable =>
Loc.Localize("ProfileManagerTutorialCommandsEnable", "/xlenableprofile \"Collection Name\" - Enable a collection");
public static string TutorialCommandsDisable =>
Loc.Localize("ProfileManagerTutorialCommandsDisable", "/xldisableprofile \"Collection Name\" - Disable a collection");
public static string TutorialCommandsToggle =>
Loc.Localize("ProfileManagerTutorialCommandsToggle", "/xltoggleprofile \"Collection Name\" - Toggle a collection's state");
public static string TutorialCommandsEnd =>
Loc.Localize("ProfileManagerTutorialCommandsEnd", "If you run multiple of these commands, they will be executed in order.");
}
}