mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Make popups not appear when the player is busy.
This commit is contained in:
parent
b7cd6dfe2d
commit
53b9aa9387
1 changed files with 22 additions and 4 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
using System.Numerics;
|
using System.Numerics;
|
||||||
|
using Dalamud.Game.ClientState.Conditions;
|
||||||
using Dalamud.Interface.Utility;
|
using Dalamud.Interface.Utility;
|
||||||
using Dalamud.Interface.Windowing;
|
using Dalamud.Interface.Windowing;
|
||||||
|
using Dalamud.Plugin.Services;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
using OtterGui;
|
using OtterGui;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
|
|
@ -10,9 +12,11 @@ namespace Glamourer.Gui;
|
||||||
public class GenericPopupWindow : Window
|
public class GenericPopupWindow : Window
|
||||||
{
|
{
|
||||||
private readonly Configuration _config;
|
private readonly Configuration _config;
|
||||||
|
private readonly ICondition _condition;
|
||||||
|
private readonly IClientState _state;
|
||||||
public bool OpenFestivalPopup { get; internal set; } = false;
|
public bool OpenFestivalPopup { get; internal set; } = false;
|
||||||
|
|
||||||
public GenericPopupWindow(Configuration config)
|
public GenericPopupWindow(Configuration config, IClientState state, ICondition condition)
|
||||||
: base("Glamourer Popups",
|
: base("Glamourer Popups",
|
||||||
ImGuiWindowFlags.NoBringToFrontOnFocus
|
ImGuiWindowFlags.NoBringToFrontOnFocus
|
||||||
| ImGuiWindowFlags.NoDecoration
|
| ImGuiWindowFlags.NoDecoration
|
||||||
|
|
@ -23,14 +27,16 @@ public class GenericPopupWindow : Window
|
||||||
| ImGuiWindowFlags.NoNav
|
| ImGuiWindowFlags.NoNav
|
||||||
| ImGuiWindowFlags.NoTitleBar, true)
|
| ImGuiWindowFlags.NoTitleBar, true)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
_state = state;
|
||||||
|
_condition = condition;
|
||||||
DisableWindowSounds = true;
|
DisableWindowSounds = true;
|
||||||
IsOpen = true;
|
IsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw()
|
public override void Draw()
|
||||||
{
|
{
|
||||||
if (OpenFestivalPopup)
|
if (OpenFestivalPopup && CheckFestivalPopupConditions())
|
||||||
{
|
{
|
||||||
ImGui.OpenPopup("FestivalPopup");
|
ImGui.OpenPopup("FestivalPopup");
|
||||||
OpenFestivalPopup = false;
|
OpenFestivalPopup = false;
|
||||||
|
|
@ -39,6 +45,18 @@ public class GenericPopupWindow : Window
|
||||||
DrawFestivalPopup();
|
DrawFestivalPopup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool CheckFestivalPopupConditions()
|
||||||
|
=> !_state.IsPvPExcludingDen
|
||||||
|
&& !_condition[ConditionFlag.InCombat]
|
||||||
|
&& !_condition[ConditionFlag.BoundByDuty]
|
||||||
|
&& !_condition[ConditionFlag.WatchingCutscene]
|
||||||
|
&& !_condition[ConditionFlag.WatchingCutscene78]
|
||||||
|
&& !_condition[ConditionFlag.BoundByDuty95]
|
||||||
|
&& !_condition[ConditionFlag.BoundByDuty56]
|
||||||
|
&& !_condition[ConditionFlag.InDeepDungeon]
|
||||||
|
&& !_condition[ConditionFlag.PlayingLordOfVerminion]
|
||||||
|
&& !_condition[ConditionFlag.ChocoboRacing];
|
||||||
|
|
||||||
|
|
||||||
private void DrawFestivalPopup()
|
private void DrawFestivalPopup()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue