feat: add IsDebugging prop to PluginInterface

This commit is contained in:
goat 2021-01-14 22:10:59 +01:00
parent 0288db5220
commit 744c777a6d
2 changed files with 20 additions and 5 deletions

View file

@ -229,6 +229,12 @@ namespace Dalamud {
private bool isImguiDrawDevMenu = false; private bool isImguiDrawDevMenu = false;
#endif #endif
public bool IsDevMenu
{
get => this.isImguiDrawDevMenu;
set => this.isImguiDrawDevMenu = value;
}
private bool isImguiDrawLogWindow = false; private bool isImguiDrawLogWindow = false;
private bool isImguiDrawDataWindow = false; private bool isImguiDrawDataWindow = false;
private bool isImguiDrawPluginWindow = false; private bool isImguiDrawPluginWindow = false;
@ -247,7 +253,7 @@ namespace Dalamud {
private void BuildDalamudUi() private void BuildDalamudUi()
{ {
if (!this.isImguiDrawDevMenu && !ClientState.Condition.Any()) if (!this.IsDevMenu && !ClientState.Condition.Any())
{ {
ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0, 0, 0, 0)); ImGui.PushStyleColor(ImGuiCol.Button, new Vector4(0, 0, 0, 0));
ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0, 0, 0, 0)); ImGui.PushStyleColor(ImGuiCol.ButtonActive, new Vector4(0, 0, 0, 0));
@ -264,7 +270,7 @@ namespace Dalamud {
if (ImGui.Begin("DevMenu Opener", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoSavedSettings)) if (ImGui.Begin("DevMenu Opener", ImGuiWindowFlags.AlwaysAutoResize | ImGuiWindowFlags.NoBackground | ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoSavedSettings))
{ {
if (ImGui.Button("###devMenuOpener", new Vector2(40, 25))) if (ImGui.Button("###devMenuOpener", new Vector2(40, 25)))
this.isImguiDrawDevMenu = true; this.IsDevMenu = true;
ImGui.End(); ImGui.End();
} }
@ -272,7 +278,7 @@ namespace Dalamud {
ImGui.PopStyleColor(8); ImGui.PopStyleColor(8);
} }
if (this.isImguiDrawDevMenu) if (this.IsDevMenu)
{ {
if (ImGui.BeginMainMenuBar()) if (ImGui.BeginMainMenuBar())
{ {
@ -698,7 +704,7 @@ namespace Dalamud {
#endif #endif
private void OnDebugDrawDevMenu(string command, string arguments) { private void OnDebugDrawDevMenu(string command, string arguments) {
this.isImguiDrawDevMenu = !this.isImguiDrawDevMenu; this.IsDevMenu = !this.IsDevMenu;
} }
private void OnOpenLog(string command, string arguments) { private void OnOpenLog(string command, string arguments) {

View file

@ -63,6 +63,15 @@ namespace Dalamud.Plugin
/// </summary> /// </summary>
public readonly SeStringManager SeStringManager; public readonly SeStringManager SeStringManager;
/// <summary>
/// Returns true if Dalamud is running in Debug mode or the /xldev menu is open. This can occur on release builds.
/// </summary>
#if DEBUG
public bool IsDebugging => true;
#else
public bool IsDebugging => this.dalamud.IsDevMenu;
#endif
private readonly Dalamud dalamud; private readonly Dalamud dalamud;
private readonly string pluginName; private readonly string pluginName;
private readonly PluginConfigurations configs; private readonly PluginConfigurations configs;