fix: distinguish between closed and hidden
This commit is contained in:
parent
5ada83b8b3
commit
7945690c7a
@ -39,13 +39,13 @@ namespace PeepingTom {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.plugin.Ui.Visible = true;
|
this.plugin.Ui.WantsOpen = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLogout(IntPtr ptr) {
|
private void OnLogout(IntPtr ptr) {
|
||||||
this.logoutHook.Original(ptr);
|
this.logoutHook.Original(ptr);
|
||||||
|
|
||||||
this.plugin.Ui.Visible = false;
|
this.plugin.Ui.WantsOpen = false;
|
||||||
this.plugin.Watcher.ClearPrevious();
|
this.plugin.Watcher.ClearPrevious();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,9 +39,9 @@ namespace PeepingTom {
|
|||||||
|
|
||||||
private void OnCommand(string command, string args) {
|
private void OnCommand(string command, string args) {
|
||||||
if (args == "config" || args == "c") {
|
if (args == "config" || args == "c") {
|
||||||
this.Ui.SettingsVisible = true;
|
this.Ui.SettingsOpen = true;
|
||||||
} else {
|
} else {
|
||||||
this.Ui.Visible = true;
|
this.Ui.WantsOpen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ namespace PeepingTom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void ConfigUI(object sender, EventArgs args) {
|
private void ConfigUI(object sender, EventArgs args) {
|
||||||
this.Ui.SettingsVisible = true;
|
this.Ui.SettingsOpen = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,18 @@ namespace PeepingTom {
|
|||||||
|
|
||||||
private Optional<Actor> previousFocus = new Optional<Actor>();
|
private Optional<Actor> previousFocus = new Optional<Actor>();
|
||||||
|
|
||||||
private bool visible = false;
|
private bool _wantsOpen = false;
|
||||||
public bool Visible {
|
public bool WantsOpen {
|
||||||
get { return this.visible; }
|
get => this._wantsOpen;
|
||||||
set { this.visible = value; }
|
set => this._wantsOpen = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool settingsVisible = false;
|
public bool Visible { get; private set; }
|
||||||
public bool SettingsVisible {
|
|
||||||
get { return this.settingsVisible; }
|
private bool _settingsOpen = false;
|
||||||
set { this.settingsVisible = value; }
|
public bool SettingsOpen {
|
||||||
|
get => this._settingsOpen;
|
||||||
|
set => this._settingsOpen = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PluginUI(PeepingTomPlugin plugin) {
|
public PluginUI(PeepingTomPlugin plugin) {
|
||||||
@ -33,12 +35,12 @@ namespace PeepingTom {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() {
|
public void Dispose() {
|
||||||
this.Visible = false;
|
this.WantsOpen = false;
|
||||||
this.SettingsVisible = false;
|
this.SettingsOpen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw() {
|
public void Draw() {
|
||||||
if (this.SettingsVisible) {
|
if (this.SettingsOpen) {
|
||||||
ShowSettings();
|
ShowSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +53,7 @@ namespace PeepingTom {
|
|||||||
|| this.plugin.Interface.ClientState.Condition[ConditionFlag.OccupiedInCutSceneEvent];
|
|| this.plugin.Interface.ClientState.Condition[ConditionFlag.OccupiedInCutSceneEvent];
|
||||||
|
|
||||||
// FIXME: this could just be a boolean expression
|
// FIXME: this could just be a boolean expression
|
||||||
bool shouldBeShown = this.Visible;
|
bool shouldBeShown = this.WantsOpen;
|
||||||
if (inCombat && !this.plugin.Config.ShowInCombat) {
|
if (inCombat && !this.plugin.Config.ShowInCombat) {
|
||||||
shouldBeShown = false;
|
shouldBeShown = false;
|
||||||
} else if (inInstance && !this.plugin.Config.ShowInInstance) {
|
} else if (inInstance && !this.plugin.Config.ShowInInstance) {
|
||||||
@ -60,6 +62,8 @@ namespace PeepingTom {
|
|||||||
shouldBeShown = false;
|
shouldBeShown = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Visible = shouldBeShown;
|
||||||
|
|
||||||
if (shouldBeShown) {
|
if (shouldBeShown) {
|
||||||
ShowMainWindow();
|
ShowMainWindow();
|
||||||
}
|
}
|
||||||
@ -86,7 +90,7 @@ namespace PeepingTom {
|
|||||||
private void ShowSettings() {
|
private void ShowSettings() {
|
||||||
// 700x250 if setting a size
|
// 700x250 if setting a size
|
||||||
ImGui.SetNextWindowSize(new Vector2(700, 250));
|
ImGui.SetNextWindowSize(new Vector2(700, 250));
|
||||||
if (ImGui.Begin($"{this.plugin.Name} settings", ref this.settingsVisible)) {
|
if (ImGui.Begin($"{this.plugin.Name} settings", ref this._settingsOpen)) {
|
||||||
if (ImGui.BeginTabBar("##settings-tabs")) {
|
if (ImGui.BeginTabBar("##settings-tabs")) {
|
||||||
if (ImGui.BeginTabItem("Markers")) {
|
if (ImGui.BeginTabItem("Markers")) {
|
||||||
bool markTargeted = this.plugin.Config.MarkTargeted;
|
bool markTargeted = this.plugin.Config.MarkTargeted;
|
||||||
@ -352,7 +356,7 @@ namespace PeepingTom {
|
|||||||
if (!this.plugin.Config.AllowMovement) {
|
if (!this.plugin.Config.AllowMovement) {
|
||||||
flags |= ImGuiWindowFlags.NoMove;
|
flags |= ImGuiWindowFlags.NoMove;
|
||||||
}
|
}
|
||||||
if (ImGui.Begin(this.plugin.Name, ref this.visible, flags)) {
|
if (ImGui.Begin(this.plugin.Name, ref this._wantsOpen, flags)) {
|
||||||
ImGui.Text("Targeting you");
|
ImGui.Text("Targeting you");
|
||||||
bool anyHovered = false;
|
bool anyHovered = false;
|
||||||
if (ImGui.ListBoxHeader("##targeting", targeting.Count, 5)) {
|
if (ImGui.ListBoxHeader("##targeting", targeting.Count, 5)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user