mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Add locking and color options and commands.
This commit is contained in:
parent
a84a66a344
commit
27c41cac49
5 changed files with 73 additions and 22 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using ImGuiNET;
|
||||
|
||||
namespace Glamourer.Gui;
|
||||
|
||||
|
|
@ -21,6 +22,9 @@ public enum ColorId
|
|||
FavoriteStarOn,
|
||||
FavoriteStarHovered,
|
||||
FavoriteStarOff,
|
||||
QuickDesignButton,
|
||||
QuickDesignFrame,
|
||||
QuickDesignBg,
|
||||
}
|
||||
|
||||
public static class Colors
|
||||
|
|
@ -46,6 +50,9 @@ public static class Colors
|
|||
ColorId.FavoriteStarOn => (0xFF40D0D0, "Favored Item", "The color of the star for favored items and of the border in the unlock overview tab." ),
|
||||
ColorId.FavoriteStarHovered => (0xFFD040D0, "Favorite Star Hovered", "The color of the star for favored items when it is hovered." ),
|
||||
ColorId.FavoriteStarOff => (0x20808080, "Favorite Star Outline", "The color of the star for items that are not favored when it is not hovered." ),
|
||||
ColorId.QuickDesignButton => (0x900A0A0A, "Quick Design Bar Button Background", "The color of button frames in the quick design bar." ),
|
||||
ColorId.QuickDesignFrame => (0x90383838, "Quick Design Bar Combo Background", "The color of the combo background in the quick design bar." ),
|
||||
ColorId.QuickDesignBg => (0x00F0F0F0, "Quick Design Bar Window Background", "The color of the window background in the quick design bar." ),
|
||||
_ => (0x00000000, string.Empty, string.Empty ),
|
||||
// @formatter:on
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public class DesignQuickBar : Window, IDisposable
|
|||
{
|
||||
private ImGuiWindowFlags GetFlags
|
||||
=> _config.LockDesignQuickBar
|
||||
? ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoBackground
|
||||
? ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing | ImGuiWindowFlags.NoMove
|
||||
: ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoFocusOnAppearing;
|
||||
|
||||
private readonly Configuration _config;
|
||||
|
|
@ -32,6 +32,7 @@ public class DesignQuickBar : Window, IDisposable
|
|||
private readonly ObjectManager _objects;
|
||||
private readonly IKeyState _keyState;
|
||||
private readonly ImRaii.Style _windowPadding = new();
|
||||
private readonly ImRaii.Color _windowColor = new();
|
||||
private DateTime _keyboardToggle = DateTime.UnixEpoch;
|
||||
|
||||
public DesignQuickBar(Configuration config, DesignCombo designCombo, StateManager stateManager, IKeyState keyState,
|
||||
|
|
@ -64,10 +65,16 @@ public class DesignQuickBar : Window, IDisposable
|
|||
Size = new Vector2(12 * ImGui.GetFrameHeight(), ImGui.GetFrameHeight());
|
||||
|
||||
_windowPadding.Push(ImGuiStyleVar.WindowPadding, new Vector2(ImGuiHelpers.GlobalScale * 4));
|
||||
_windowColor.Push(ImGuiCol.WindowBg, ColorId.QuickDesignBg.Value())
|
||||
.Push(ImGuiCol.Button, ColorId.QuickDesignButton.Value())
|
||||
.Push(ImGuiCol.FrameBg, ColorId.QuickDesignFrame.Value());
|
||||
}
|
||||
|
||||
public override void PostDraw()
|
||||
=> _windowPadding.Dispose();
|
||||
{
|
||||
_windowPadding.Dispose();
|
||||
_windowColor.Dispose();
|
||||
}
|
||||
|
||||
|
||||
public override void Draw()
|
||||
|
|
|
|||
|
|
@ -79,6 +79,13 @@ public class MainWindow : Window, IDisposable
|
|||
IsOpen = _config.DebugMode;
|
||||
}
|
||||
|
||||
public override void PreDraw()
|
||||
{
|
||||
Flags = _config.LockMainWindow
|
||||
? Flags | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize
|
||||
: Flags & ~(ImGuiWindowFlags.NoMove |ImGuiWindowFlags.NoResize);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
=> _event.Unsubscribe(OnTabSelected);
|
||||
|
||||
|
|
|
|||
|
|
@ -137,6 +137,8 @@ public class SettingsTab : ITab
|
|||
_config.HideWindowInCutscene = v;
|
||||
_uiBuilder.DisableCutsceneUiHide = !v;
|
||||
});
|
||||
Checkbox("Lock Main Window", "Prevent the main window from being moved and lock it in place.", _config.LockMainWindow,
|
||||
v => _config.LockMainWindow = v);
|
||||
|
||||
ImGui.Dummy(Vector2.Zero);
|
||||
ImGui.Separator();
|
||||
|
|
|
|||
|
|
@ -35,10 +35,11 @@ public class CommandService : IDisposable
|
|||
private readonly DesignManager _designManager;
|
||||
private readonly DesignConverter _converter;
|
||||
private readonly DesignFileSystem _designFileSystem;
|
||||
private readonly Configuration _config;
|
||||
|
||||
public CommandService(ICommandManager commands, MainWindow mainWindow, IChatGui chat, ActorService actors, ObjectManager objects,
|
||||
AutoDesignApplier autoDesignApplier, StateManager stateManager, DesignManager designManager, DesignConverter converter,
|
||||
DesignFileSystem designFileSystem, AutoDesignManager autoDesignManager)
|
||||
DesignFileSystem designFileSystem, AutoDesignManager autoDesignManager, Configuration config)
|
||||
{
|
||||
_commands = commands;
|
||||
_mainWindow = mainWindow;
|
||||
|
|
@ -51,6 +52,7 @@ public class CommandService : IDisposable
|
|||
_converter = converter;
|
||||
_designFileSystem = designFileSystem;
|
||||
_autoDesignManager = autoDesignManager;
|
||||
_config = config;
|
||||
|
||||
_commands.AddHandler(MainCommandString, new CommandInfo(OnGlamourer) { HelpMessage = "Open or close the Glamourer window." });
|
||||
_commands.AddHandler(ApplyCommandString,
|
||||
|
|
@ -64,7 +66,33 @@ public class CommandService : IDisposable
|
|||
}
|
||||
|
||||
private void OnGlamourer(string command, string arguments)
|
||||
=> _mainWindow.Toggle();
|
||||
{
|
||||
if (arguments.Length > 0)
|
||||
switch (arguments)
|
||||
{
|
||||
case "qdb":
|
||||
case "quick":
|
||||
case "bar":
|
||||
case "designs":
|
||||
case "design":
|
||||
case "design bar":
|
||||
_config.ShowDesignQuickBar = !_config.ShowDesignQuickBar;
|
||||
_config.Save();
|
||||
return;
|
||||
case "lock":
|
||||
case "unlock":
|
||||
_config.LockMainWindow = !_config.LockMainWindow;
|
||||
_config.Save();
|
||||
return;
|
||||
default:
|
||||
_chat.Print("Use without argument to toggle the main window.");
|
||||
_chat.Print(new SeStringBuilder().AddCommand("qdb", "Toggles the quick design bar on or off.").BuiltString);
|
||||
_chat.Print(new SeStringBuilder().AddCommand("lock", "Toggles the lock of the main window on or off.").BuiltString);
|
||||
return;
|
||||
}
|
||||
|
||||
_mainWindow.Toggle();
|
||||
}
|
||||
|
||||
private void OnGlamour(string command, string arguments)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue