forked from aly/qstbak
85 lines
2.6 KiB
C#
85 lines
2.6 KiB
C#
using System.Numerics;
|
|
using System.Runtime.CompilerServices;
|
|
using Dalamud.Bindings.ImGui;
|
|
using Dalamud.Interface.Windowing;
|
|
using Dalamud.Plugin;
|
|
using LLib.ImGui;
|
|
using Questionable.Model.Questing;
|
|
using Questionable.Windows.QuestComponents;
|
|
|
|
namespace Questionable.Windows;
|
|
|
|
internal sealed class QuestSequenceWindow : ThemedWindow, IPersistableWindowConfig
|
|
{
|
|
private readonly IDalamudPluginInterface _pluginInterface;
|
|
|
|
private readonly Configuration _configuration;
|
|
|
|
private readonly QuestSequenceComponent _questSequenceComponent;
|
|
|
|
private bool _selectLookupTabNextFrame;
|
|
|
|
private int _selectedTab;
|
|
|
|
public WindowConfig WindowConfig => _configuration.QuestSequenceWindowConfig;
|
|
|
|
public QuestSequenceWindow(IDalamudPluginInterface pluginInterface, Configuration configuration, QuestSequenceComponent questSequenceComponent)
|
|
: base("Quest Sequence Viewer###QuestionableQuestSequenceViewer", ImGuiWindowFlags.NoTitleBar)
|
|
{
|
|
_pluginInterface = pluginInterface;
|
|
_configuration = configuration;
|
|
_questSequenceComponent = questSequenceComponent;
|
|
base.Size = new Vector2(950f, 700f);
|
|
base.SizeCondition = ImGuiCond.FirstUseEver;
|
|
base.SizeConstraints = new WindowSizeConstraints
|
|
{
|
|
MinimumSize = new Vector2(750f, 550f),
|
|
MaximumSize = new Vector2(float.MaxValue, float.MaxValue)
|
|
};
|
|
}
|
|
|
|
public void SaveWindowConfig()
|
|
{
|
|
_pluginInterface.SavePluginConfig(_configuration);
|
|
}
|
|
|
|
public void OpenForQuest(ElementId questId)
|
|
{
|
|
_questSequenceComponent.SetLookedUpQuest(questId);
|
|
_selectLookupTabNextFrame = true;
|
|
base.IsOpenAndUncollapsed = true;
|
|
}
|
|
|
|
public override void DrawContent()
|
|
{
|
|
bool isOpen = true;
|
|
QuestSequenceComponent.DrawCustomHeader(ref isOpen);
|
|
if (!isOpen)
|
|
{
|
|
RequestClose();
|
|
}
|
|
ImGui.Spacing();
|
|
ImGui.Spacing();
|
|
if (_selectLookupTabNextFrame)
|
|
{
|
|
_selectedTab = 1;
|
|
_selectLookupTabNextFrame = false;
|
|
}
|
|
InlineArray2<string> buffer = default(InlineArray2<string>);
|
|
global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<InlineArray2<string>, string>(ref buffer, 0) = "Current Quest";
|
|
global::_003CPrivateImplementationDetails_003E.InlineArrayElementRef<InlineArray2<string>, string>(ref buffer, 1) = "Quest Lookup";
|
|
_selectedTab = UiThemeUtils.DrawTabBar(global::_003CPrivateImplementationDetails_003E.InlineArrayAsReadOnlySpan<InlineArray2<string>, string>(in buffer, 2), _selectedTab);
|
|
switch (_selectedTab)
|
|
{
|
|
case 0:
|
|
ImGui.Spacing();
|
|
_questSequenceComponent.DrawCurrentQuestTab();
|
|
break;
|
|
case 1:
|
|
ImGui.Spacing();
|
|
_questSequenceComponent.DrawQuestLookupTab();
|
|
break;
|
|
}
|
|
QuestSequenceComponent.DrawWindowBorder();
|
|
}
|
|
}
|