punish v6.8.18.0
This commit is contained in:
commit
e786325cda
322 changed files with 554232 additions and 0 deletions
191
Questionable/Questionable.Windows/QuestWindow.cs
Normal file
191
Questionable/Questionable.Windows/QuestWindow.cs
Normal file
|
@ -0,0 +1,191 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface;
|
||||
using Dalamud.Interface.Colors;
|
||||
using Dalamud.Interface.Windowing;
|
||||
using Dalamud.Plugin;
|
||||
using Dalamud.Plugin.Services;
|
||||
using LLib.ImGui;
|
||||
using Questionable.Controller;
|
||||
using Questionable.Controller.GameUi;
|
||||
using Questionable.Data;
|
||||
using Questionable.Windows.QuestComponents;
|
||||
|
||||
namespace Questionable.Windows;
|
||||
|
||||
internal sealed class QuestWindow : LWindow, IPersistableWindowConfig
|
||||
{
|
||||
private static readonly Version PluginVersion = typeof(QuestionablePlugin).Assembly.GetName().Version;
|
||||
|
||||
private readonly IDalamudPluginInterface _pluginInterface;
|
||||
|
||||
private readonly QuestController _questController;
|
||||
|
||||
private readonly IClientState _clientState;
|
||||
|
||||
private readonly Configuration _configuration;
|
||||
|
||||
private readonly TerritoryData _territoryData;
|
||||
|
||||
private readonly ActiveQuestComponent _activeQuestComponent;
|
||||
|
||||
private readonly ARealmRebornComponent _aRealmRebornComponent;
|
||||
|
||||
private readonly CreationUtilsComponent _creationUtilsComponent;
|
||||
|
||||
private readonly EventInfoComponent _eventInfoComponent;
|
||||
|
||||
private readonly QuickAccessButtonsComponent _quickAccessButtonsComponent;
|
||||
|
||||
private readonly RemainingTasksComponent _remainingTasksComponent;
|
||||
|
||||
private readonly IFramework _framework;
|
||||
|
||||
private readonly InteractionUiController _interactionUiController;
|
||||
|
||||
private readonly TitleBarButton _minimizeButton;
|
||||
|
||||
public WindowConfig WindowConfig => _configuration.DebugWindowConfig;
|
||||
|
||||
public bool IsMinimized { get; set; }
|
||||
|
||||
public QuestWindow(IDalamudPluginInterface pluginInterface, QuestController questController, IClientState clientState, Configuration configuration, TerritoryData territoryData, ActiveQuestComponent activeQuestComponent, ARealmRebornComponent aRealmRebornComponent, EventInfoComponent eventInfoComponent, CreationUtilsComponent creationUtilsComponent, QuickAccessButtonsComponent quickAccessButtonsComponent, RemainingTasksComponent remainingTasksComponent, IFramework framework, InteractionUiController interactionUiController, ConfigWindow configWindow)
|
||||
: base("Questionable v" + PluginVersion.ToString(4) + "###Questionable", ImGuiWindowFlags.AlwaysAutoResize)
|
||||
{
|
||||
QuestWindow questWindow = this;
|
||||
_pluginInterface = pluginInterface;
|
||||
_questController = questController;
|
||||
_clientState = clientState;
|
||||
_configuration = configuration;
|
||||
_territoryData = territoryData;
|
||||
_activeQuestComponent = activeQuestComponent;
|
||||
_aRealmRebornComponent = aRealmRebornComponent;
|
||||
_eventInfoComponent = eventInfoComponent;
|
||||
_creationUtilsComponent = creationUtilsComponent;
|
||||
_quickAccessButtonsComponent = quickAccessButtonsComponent;
|
||||
_remainingTasksComponent = remainingTasksComponent;
|
||||
_framework = framework;
|
||||
_interactionUiController = interactionUiController;
|
||||
base.SizeConstraints = new WindowSizeConstraints
|
||||
{
|
||||
MinimumSize = new Vector2(240f, 30f),
|
||||
MaximumSize = default(Vector2)
|
||||
};
|
||||
base.RespectCloseHotkey = false;
|
||||
base.AllowClickthrough = false;
|
||||
_minimizeButton = new TitleBarButton
|
||||
{
|
||||
Icon = FontAwesomeIcon.Minus,
|
||||
Priority = int.MinValue,
|
||||
IconOffset = new Vector2(1.5f, 1f),
|
||||
Click = delegate
|
||||
{
|
||||
questWindow.IsMinimized = !questWindow.IsMinimized;
|
||||
questWindow._minimizeButton.Icon = (questWindow.IsMinimized ? FontAwesomeIcon.WindowMaximize : FontAwesomeIcon.Minus);
|
||||
},
|
||||
AvailableClickthrough = true
|
||||
};
|
||||
base.TitleBarButtons.Insert(0, _minimizeButton);
|
||||
base.TitleBarButtons.Add(new TitleBarButton
|
||||
{
|
||||
Icon = FontAwesomeIcon.Cog,
|
||||
IconOffset = new Vector2(1.5f, 1f),
|
||||
Click = delegate
|
||||
{
|
||||
configWindow.IsOpenAndUncollapsed = true;
|
||||
},
|
||||
Priority = int.MinValue,
|
||||
ShowTooltip = delegate
|
||||
{
|
||||
ImGui.BeginTooltip();
|
||||
ImGui.Text("Open Configuration");
|
||||
ImGui.EndTooltip();
|
||||
}
|
||||
});
|
||||
_activeQuestComponent.Reload += OnReload;
|
||||
_quickAccessButtonsComponent.Reload += OnReload;
|
||||
_questController.IsQuestWindowOpenFunction = () => questWindow.IsOpen;
|
||||
}
|
||||
|
||||
public void SaveWindowConfig()
|
||||
{
|
||||
_pluginInterface.SavePluginConfig(_configuration);
|
||||
}
|
||||
|
||||
public override void PreOpenCheck()
|
||||
{
|
||||
if (_questController.IsRunning)
|
||||
{
|
||||
base.IsOpen = true;
|
||||
base.Flags |= ImGuiWindowFlags.NoCollapse;
|
||||
base.ShowCloseButton = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
base.Flags &= ~ImGuiWindowFlags.NoCollapse;
|
||||
base.ShowCloseButton = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool DrawConditions()
|
||||
{
|
||||
if (!_configuration.IsPluginSetupComplete())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!_clientState.IsLoggedIn || _clientState.LocalPlayer == null || _clientState.IsPvPExcludingDen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (_configuration.General.HideInAllInstances && _territoryData.IsDutyInstance(_clientState.TerritoryType))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DrawContent()
|
||||
{
|
||||
try
|
||||
{
|
||||
_activeQuestComponent.Draw(IsMinimized);
|
||||
if (!IsMinimized)
|
||||
{
|
||||
ImGui.Separator();
|
||||
if (_aRealmRebornComponent.ShouldDraw)
|
||||
{
|
||||
_aRealmRebornComponent.Draw();
|
||||
ImGui.Separator();
|
||||
}
|
||||
if (_eventInfoComponent.ShouldDraw)
|
||||
{
|
||||
_eventInfoComponent.Draw();
|
||||
ImGui.Separator();
|
||||
}
|
||||
_creationUtilsComponent.Draw();
|
||||
ImGui.Separator();
|
||||
_quickAccessButtonsComponent.Draw();
|
||||
_remainingTasksComponent.Draw();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void OnReload(object? sender, EventArgs e)
|
||||
{
|
||||
Reload();
|
||||
}
|
||||
|
||||
internal void Reload()
|
||||
{
|
||||
_questController.Reload();
|
||||
_framework.RunOnTick(delegate
|
||||
{
|
||||
_interactionUiController.HandleCurrentDialogueChoices();
|
||||
}, TimeSpan.FromMilliseconds(200L, 0L));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue