Added option to not display confirmations for chat commands
This commit is contained in:
@@ -78,6 +78,14 @@ public class PluginConfiguration : IPluginConfiguration, ISavable
|
|||||||
|
|
||||||
public EditorConfigurationEntries EditorConfiguration { get; set; } = new();
|
public EditorConfigurationEntries EditorConfiguration { get; set; } = new();
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class CommandSettingsEntries
|
||||||
|
{
|
||||||
|
public bool PrintSuccessMessages { get; set; } = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CommandSettingsEntries CommandSettings { get; set; } = new();
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
private readonly SaveService _saveService;
|
private readonly SaveService _saveService;
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using CustomizePlus.UI.Windows.MainWindow.Tabs.Templates;
|
|||||||
using CustomizePlus.UI.Windows.MainWindow;
|
using CustomizePlus.UI.Windows.MainWindow;
|
||||||
using static System.Windows.Forms.AxHost;
|
using static System.Windows.Forms.AxHost;
|
||||||
using CustomizePlus.Profiles.Data;
|
using CustomizePlus.Profiles.Data;
|
||||||
|
using CustomizePlus.Configuration.Data;
|
||||||
|
|
||||||
namespace CustomizePlus.Core.Services;
|
namespace CustomizePlus.Core.Services;
|
||||||
|
|
||||||
@@ -25,6 +26,7 @@ public class CommandService : IDisposable
|
|||||||
private readonly MainWindow _mainWindow;
|
private readonly MainWindow _mainWindow;
|
||||||
private readonly BoneEditorPanel _boneEditorPanel;
|
private readonly BoneEditorPanel _boneEditorPanel;
|
||||||
private readonly MessageService _messageService;
|
private readonly MessageService _messageService;
|
||||||
|
private readonly PluginConfiguration _pluginConfiguration;
|
||||||
|
|
||||||
private static readonly string[] Commands = new[] { "/customize", "/c+" };
|
private static readonly string[] Commands = new[] { "/customize", "/c+" };
|
||||||
|
|
||||||
@@ -36,7 +38,8 @@ public class CommandService : IDisposable
|
|||||||
ChatService chatService,
|
ChatService chatService,
|
||||||
BoneEditorPanel boneEditorPanel,
|
BoneEditorPanel boneEditorPanel,
|
||||||
Logger logger,
|
Logger logger,
|
||||||
MessageService messageService)
|
MessageService messageService,
|
||||||
|
PluginConfiguration pluginConfiguration)
|
||||||
{
|
{
|
||||||
_profileManager = profileManager;
|
_profileManager = profileManager;
|
||||||
_gameObjectService = gameObjectService;
|
_gameObjectService = gameObjectService;
|
||||||
@@ -46,13 +49,15 @@ public class CommandService : IDisposable
|
|||||||
_mainWindow = mainWindow;
|
_mainWindow = mainWindow;
|
||||||
_boneEditorPanel = boneEditorPanel;
|
_boneEditorPanel = boneEditorPanel;
|
||||||
_messageService = messageService;
|
_messageService = messageService;
|
||||||
|
_pluginConfiguration = pluginConfiguration;
|
||||||
|
|
||||||
foreach (var command in Commands)
|
foreach (var command in Commands)
|
||||||
{
|
{
|
||||||
_commandManager.AddHandler(command, new CommandInfo(OnMainCommand) { HelpMessage = "Toggles main plugin window if no commands passed. Use \"/customize help\" for list of available commands." });
|
_commandManager.AddHandler(command, new CommandInfo(OnMainCommand) { HelpMessage = "Toggles main plugin window if no commands passed. Use \"/customize help\" for list of available commands." });
|
||||||
}
|
}
|
||||||
|
|
||||||
chatService.PrintInChat($"Started!"); //safe to assume at this point we have successfully initialized
|
if (_pluginConfiguration.CommandSettings.PrintSuccessMessages)
|
||||||
|
chatService.PrintInChat($"Started!"); //safe to assume at this point we have successfully initialized
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
@@ -212,13 +217,14 @@ public class CommandService : IDisposable
|
|||||||
else
|
else
|
||||||
_profileManager.SetEnabled(targetProfile, !targetProfile.Enabled);
|
_profileManager.SetEnabled(targetProfile, !targetProfile.Enabled);
|
||||||
|
|
||||||
_chatService.PrintInChat(new SeStringBuilder()
|
if (_pluginConfiguration.CommandSettings.PrintSuccessMessages)
|
||||||
.AddText("Profile ")
|
_chatService.PrintInChat(new SeStringBuilder()
|
||||||
.AddYellow(targetProfile.Name)
|
.AddText("Profile ")
|
||||||
.AddText(" was successfully ")
|
.AddYellow(targetProfile.Name)
|
||||||
.AddBlue(state != null ? ((bool)state ? "enabled" : "disabled") : "toggled")
|
.AddText(" was successfully ")
|
||||||
.AddText(" for ")
|
.AddBlue(state != null ? ((bool)state ? "enabled" : "disabled") : "toggled")
|
||||||
.AddRed(targetProfile.CharacterName).BuiltString);
|
.AddText(" for ")
|
||||||
|
.AddRed(targetProfile.CharacterName).BuiltString);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ public class SettingsTab
|
|||||||
using (var child2 = ImRaii.Child("SettingsChild"))
|
using (var child2 = ImRaii.Child("SettingsChild"))
|
||||||
{
|
{
|
||||||
DrawInterface();
|
DrawInterface();
|
||||||
|
DrawCommands();
|
||||||
DrawAdvancedSettings();
|
DrawAdvancedSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,6 +96,30 @@ public class SettingsTab
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Chat Commands Settings
|
||||||
|
private void DrawCommands()
|
||||||
|
{
|
||||||
|
var isShouldDraw = ImGui.CollapsingHeader("Chat Commands");
|
||||||
|
|
||||||
|
if (!isShouldDraw)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DrawPrintSuccessMessages();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawPrintSuccessMessages()
|
||||||
|
{
|
||||||
|
var isChecked = _configuration.CommandSettings.PrintSuccessMessages;
|
||||||
|
|
||||||
|
if (CtrlHelper.CheckboxWithTextAndHelp("##displaychatcommandconfirms", "Print Successful Command Execution Messages to Chat",
|
||||||
|
"Controls whether successful execution of chat commands will be acknowledged by separate chat message or not.", ref isChecked))
|
||||||
|
{
|
||||||
|
_configuration.CommandSettings.PrintSuccessMessages = isChecked;
|
||||||
|
_configuration.Save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Interface Settings
|
#region Interface Settings
|
||||||
|
|
||||||
private void DrawInterface()
|
private void DrawInterface()
|
||||||
@@ -117,8 +142,8 @@ public class SettingsTab
|
|||||||
{
|
{
|
||||||
var isChecked = _configuration.UISettings.HideWindowInCutscene;
|
var isChecked = _configuration.UISettings.HideWindowInCutscene;
|
||||||
|
|
||||||
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowincutscene", "Hide plugin windows in cutscenes",
|
if (CtrlHelper.CheckboxWithTextAndHelp("##hidewindowincutscene", "Hide Plugin Windows in Cutscenes",
|
||||||
"Controls whether any Fantasia+ windows are hidden during cutscenes or not.", ref isChecked))
|
"Controls whether any Customize+ windows are hidden during cutscenes or not.", ref isChecked))
|
||||||
{
|
{
|
||||||
_configuration.UISettings.HideWindowInCutscene = isChecked;
|
_configuration.UISettings.HideWindowInCutscene = isChecked;
|
||||||
_configuration.Save();
|
_configuration.Save();
|
||||||
@@ -129,7 +154,7 @@ public class SettingsTab
|
|||||||
{
|
{
|
||||||
var isChecked = _configuration.UISettings.FoldersDefaultOpen;
|
var isChecked = _configuration.UISettings.FoldersDefaultOpen;
|
||||||
|
|
||||||
if (CtrlHelper.CheckboxWithTextAndHelp("##foldersdefaultopen", "Open all folders by default",
|
if (CtrlHelper.CheckboxWithTextAndHelp("##foldersdefaultopen", "Open All Folders by Default",
|
||||||
"Controls whether folders in template and profile lists are open by default or not.", ref isChecked))
|
"Controls whether folders in template and profile lists are open by default or not.", ref isChecked))
|
||||||
{
|
{
|
||||||
_configuration.UISettings.FoldersDefaultOpen = isChecked;
|
_configuration.UISettings.FoldersDefaultOpen = isChecked;
|
||||||
|
|||||||
Reference in New Issue
Block a user