mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 21:24:16 +01:00
Add Open/Close SFX to Window (#1298)
Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
This commit is contained in:
parent
2cf3b93b64
commit
e52f7696ba
3 changed files with 34 additions and 0 deletions
|
|
@ -208,6 +208,12 @@ internal sealed class DalamudConfiguration : IServiceType
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDocking { get; set; }
|
public bool IsDocking { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether or not plugin user interfaces should trigger sound effects.
|
||||||
|
/// This setting is effected by the in-game "System Sounds" option and volume.
|
||||||
|
/// </summary>
|
||||||
|
public bool EnablePluginUISoundEffects { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether viewports should always be disabled.
|
/// Gets or sets a value indicating whether viewports should always be disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,12 @@ public class SettingsTabLook : SettingsTab
|
||||||
c => c.IsDocking,
|
c => c.IsDocking,
|
||||||
(v, c) => c.IsDocking = v),
|
(v, c) => c.IsDocking = v),
|
||||||
|
|
||||||
|
new SettingsEntry<bool>(
|
||||||
|
Loc.Localize("DalamudSettingEnablePluginUISoundEffects", "Enable sound effects for plugin windows"),
|
||||||
|
Loc.Localize("DalamudSettingEnablePluginUISoundEffectsHint", "This will allow you to enable or disable sound effects generated by plugin user interfaces.\nThis is affected by your in-game `System Sounds` volume settings."),
|
||||||
|
c => c.EnablePluginUISoundEffects,
|
||||||
|
(v, c) => c.EnablePluginUISoundEffects = v),
|
||||||
|
|
||||||
new SettingsEntry<bool>(
|
new SettingsEntry<bool>(
|
||||||
Loc.Localize("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
Loc.Localize("DalamudSettingToggleGamepadNavigation", "Control plugins via gamepad"),
|
||||||
Loc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
Loc.Localize("DalamudSettingToggleGamepadNavigationHint", "This will allow you to toggle between game and plugin navigation via L1+L3.\nToggle the PluginInstaller window via R3 if ImGui navigation is enabled."),
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ using System.Numerics;
|
||||||
|
|
||||||
using Dalamud.Configuration.Internal;
|
using Dalamud.Configuration.Internal;
|
||||||
using Dalamud.Game.ClientState.Keys;
|
using Dalamud.Game.ClientState.Keys;
|
||||||
|
using FFXIVClientStructs.FFXIV.Client.UI;
|
||||||
using ImGuiNET;
|
using ImGuiNET;
|
||||||
|
|
||||||
namespace Dalamud.Interface.Windowing;
|
namespace Dalamud.Interface.Windowing;
|
||||||
|
|
@ -16,6 +17,7 @@ public abstract class Window
|
||||||
private bool internalLastIsOpen = false;
|
private bool internalLastIsOpen = false;
|
||||||
private bool internalIsOpen = false;
|
private bool internalIsOpen = false;
|
||||||
private bool nextFrameBringToFront = false;
|
private bool nextFrameBringToFront = false;
|
||||||
|
private DalamudConfiguration Configuration;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Window"/> class.
|
/// Initializes a new instance of the <see cref="Window"/> class.
|
||||||
|
|
@ -31,6 +33,7 @@ public abstract class Window
|
||||||
this.WindowName = name;
|
this.WindowName = name;
|
||||||
this.Flags = flags;
|
this.Flags = flags;
|
||||||
this.ForceMainWindow = forceMainWindow;
|
this.ForceMainWindow = forceMainWindow;
|
||||||
|
this.Configuration = Service<DalamudConfiguration>.Get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -55,6 +58,21 @@ public abstract class Window
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool RespectCloseHotkey { get; set; } = true;
|
public bool RespectCloseHotkey { get; set; } = true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether this window should not generate sound effects when opening and closing.
|
||||||
|
/// </summary>
|
||||||
|
public bool DisableWindowSounds { get; set; } = false;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value representing the sound effect id to be played when the window is opened.
|
||||||
|
/// </summary>
|
||||||
|
public uint OnOpenSfxId { get; set; } = 23u;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value representing the sound effect id to be played when the window is closed.
|
||||||
|
/// </summary>
|
||||||
|
public uint OnCloseSfxId { get; set; } = 24u;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the position of this window.
|
/// Gets or sets the position of this window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
@ -219,6 +237,8 @@ public abstract class Window
|
||||||
this.OnClose();
|
this.OnClose();
|
||||||
|
|
||||||
this.IsFocused = false;
|
this.IsFocused = false;
|
||||||
|
|
||||||
|
if (this.Configuration.EnablePluginUISoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnCloseSfxId, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
@ -243,6 +263,8 @@ public abstract class Window
|
||||||
{
|
{
|
||||||
this.internalLastIsOpen = this.internalIsOpen;
|
this.internalLastIsOpen = this.internalIsOpen;
|
||||||
this.OnOpen();
|
this.OnOpen();
|
||||||
|
|
||||||
|
if (this.Configuration.EnablePluginUISoundEffects && !this.DisableWindowSounds) UIModule.PlaySound(this.OnOpenSfxId, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
var wasFocused = this.IsFocused;
|
var wasFocused = this.IsFocused;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue