diff --git a/Data/logo_128.png b/Data/logo_128.png deleted file mode 100644 index a6fb267..0000000 Binary files a/Data/logo_128.png and /dev/null differ diff --git a/FFXIV_Vibe_Plugin/App/App.cs b/FFXIV_Vibe_Plugin/App/App.cs index 3f0ca0f..893f815 100644 --- a/FFXIV_Vibe_Plugin/App/App.cs +++ b/FFXIV_Vibe_Plugin/App/App.cs @@ -13,7 +13,8 @@ using Dalamud.Game.Network; using Dalamud.Game.Command; using Dalamud.Game.ClientState; using Dalamud.Game.ClientState.Objects; -using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; +using FFXIVClientStructs.FFXIV.Client.Graphics.Kernel; +using Dalamud.Interface.Windowing; // FFXIV_Vibe_Plugin libs using FFXIV_Vibe_Plugin.Commons; @@ -24,7 +25,7 @@ using FFXIV_Vibe_Plugin.Migrations; namespace FFXIV_Vibe_Plugin { - internal class App { + public class App { private Dalamud.Game.Gui.ChatGui? DalamudChat { get; init; } public Configuration Configuration { get; init; } private GameNetwork GameNetwork { get; init; } @@ -35,12 +36,13 @@ namespace FFXIV_Vibe_Plugin { private DalamudPluginInterface PluginInterface { get; init; } // Custom variables from Kacie + private readonly Plugin Plugin; private readonly bool wasInit = false; - public readonly string CommandName = ""; + public readonly string CommandName = ""; + public PluginUI PluginUi { get; init; } private readonly string ShortName = ""; private bool _firstUpdated = false; private readonly PlayerStats PlayerStats; - private PluginUI PluginUi { get; init; } private ConfigurationProfile ConfigurationProfile; private readonly Logger Logger; private readonly ActionEffect hook_ActionEffect; @@ -51,8 +53,8 @@ namespace FFXIV_Vibe_Plugin { // Experiments private readonly NetworkCapture experiment_networkCapture; - public App(string commandName, string shortName, GameNetwork gameNetwork, ClientState clientState, DataManager dataManager, Dalamud.Game.Gui.ChatGui? dalamudChat, Configuration configuration, SigScanner scanner, ObjectTable gameObjects, DalamudPluginInterface pluginInterface) { - return; + public App(Plugin plugin, string commandName, string shortName, GameNetwork gameNetwork, ClientState clientState, DataManager dataManager, Dalamud.Game.Gui.ChatGui? dalamudChat, Configuration configuration, SigScanner scanner, ObjectTable gameObjects, DalamudPluginInterface pluginInterface) { + this.Plugin = plugin; this.CommandName = commandName; this.ShortName = shortName; this.GameNetwork = gameNetwork; @@ -63,25 +65,33 @@ namespace FFXIV_Vibe_Plugin { this.GameObjects = gameObjects; this.Scanner = scanner; this.PluginInterface = pluginInterface; + + if (DalamudChat != null) { DalamudChat.ChatMessage += ChatWasTriggered; } this.Logger = new Logger(this.DalamudChat, ShortName, Logger.LogLevel.VERBOSE); + // Migrations Migration migration = new(Configuration, Logger); migration.Patch_0_2_0_to_1_0_0_config_profile(); + + // Configuration Profile this.ConfigurationProfile = this.Configuration.GetDefaultProfile(); + + // Patterns this.Patterns = new Patterns(); this.Patterns.SetCustomPatterns(this.ConfigurationProfile.PatternList); + + // Initialize the devices Controller - /* TODO: this.DeviceController = new Device.DevicesController(this.Logger, this.Configuration, this.ConfigurationProfile, this.Patterns);*/ - this.DeviceController = null; + this.DeviceController = new Device.DevicesController(this.Logger, this.Configuration, this.ConfigurationProfile, this.Patterns); if (this.ConfigurationProfile.AUTO_CONNECT) { Thread t = new(delegate () { Thread.Sleep(2000); @@ -89,10 +99,13 @@ namespace FFXIV_Vibe_Plugin { }); t.Start(); } + + // Initialize Hook ActionEffect this.hook_ActionEffect = new(this.DataManager, this.Logger, this.Scanner, clientState, gameObjects); this.hook_ActionEffect.ReceivedEvent += SpellWasTriggered; + // Init the login event. this.ClientState.Login += this.ClientState_LoginEvent; @@ -101,24 +114,25 @@ namespace FFXIV_Vibe_Plugin { this.PlayerStats = new PlayerStats(this.Logger, this.ClientState); PlayerStats.Event_CurrentHpChanged += this.PlayerCurrentHPChanged; PlayerStats.Event_MaxHpChanged += this.PlayerCurrentHPChanged; + // Triggers this.TriggersController = new Triggers.TriggersController(this.Logger, this.PlayerStats, this.ConfigurationProfile); // UI this.PluginUi = new PluginUI(this, this.Logger, this.PluginInterface, this.Configuration, this.ConfigurationProfile, this.DeviceController, this.TriggersController, this.Patterns); - + // Experimental this.experiment_networkCapture = new NetworkCapture(this.Logger, this.GameNetwork); // Make sure we set the current profile everywhere. this.SetProfile(this.Configuration.CurrentProfileName); - - // Set the init variable + + // Set the init variable this.wasInit = true; } - public void Dispose() { + public void Dispose() { if (!this.wasInit) { return; } this.Logger.Debug("Disposing plugin..."); @@ -171,8 +185,8 @@ namespace FFXIV_Vibe_Plugin { this.Command_SendIntensity(args); } else if (args.StartsWith("stop")) { this.DeviceController.SendVibeToAll(0); - } - // Experimental + } + // Experimental else if (args.StartsWith("exp_network_start")) { this.experiment_networkCapture.StartNetworkCapture(); } else if (args.StartsWith("exp_network_stop")) { @@ -192,23 +206,20 @@ namespace FFXIV_Vibe_Plugin { } private void DisplayUI() { - if (this.PluginUi != null) { - this.PluginUi.Display(); - } + this.Plugin.DrawConfigUI(); + } - private void DisplayConfigUI() { - this.PluginUi.Display(); + private void DisplayConfigUI() { + this.Plugin.DrawConfigUI(); } - public void DrawUI() { - - if(this.PluginUi == null) { - return; + public void DrawUI() { + + if(this.PluginUi == null) { + return; } - this.PluginUi.Draw(); - if (this.ClientState.IsLoggedIn) { this.PlayerStats.Update(this.ClientState); } @@ -220,10 +231,10 @@ namespace FFXIV_Vibe_Plugin { } } - public void Command_DeviceController_Connect() { - if (this.DeviceController == null) { - this.Logger.Error("No device controller available to connect."); - return; + public void Command_DeviceController_Connect() { + if (this.DeviceController == null) { + this.Logger.Error("No device controller available to connect."); + return; } if (this.ConfigurationProfile != null) { string host = this.ConfigurationProfile.BUTTPLUG_SERVER_HOST; @@ -232,10 +243,10 @@ namespace FFXIV_Vibe_Plugin { } } - private void Command_DeviceController_Disconnect() { - if (this.DeviceController == null) { - this.Logger.Error("No device controller available to disconnect."); - return; + private void Command_DeviceController_Disconnect() { + if (this.DeviceController == null) { + this.Logger.Error("No device controller available to disconnect."); + return; } this.DeviceController.Disconnect(); } @@ -251,13 +262,13 @@ namespace FFXIV_Vibe_Plugin { } catch (Exception e) when (e is FormatException or IndexOutOfRangeException) { this.Logger.Error($"Malformed arguments for send [intensity].", e); return; - } - - if (this.DeviceController == null) { - this.Logger.Error("No device controller available to send intensity."); - return; - } - + } + + if (this.DeviceController == null) { + this.Logger.Error("No device controller available to send intensity."); + return; + } + this.DeviceController.SendVibeToAll(intensity); } diff --git a/FFXIV_Vibe_Plugin/App/Commons/Logger.cs b/FFXIV_Vibe_Plugin/App/Commons/Logger.cs index 26b61b5..52a7778 100644 --- a/FFXIV_Vibe_Plugin/App/Commons/Logger.cs +++ b/FFXIV_Vibe_Plugin/App/Commons/Logger.cs @@ -9,7 +9,7 @@ using Dalamud.IoC; namespace FFXIV_Vibe_Plugin.Commons { - internal class Logger { + public class Logger { // Initialize the Dalamud.Gui system. private readonly Dalamud.Game.Gui.ChatGui? DalamudChatGui; diff --git a/FFXIV_Vibe_Plugin/App/Commons/Structures.cs b/FFXIV_Vibe_Plugin/App/Commons/Structures.cs index 96be861..b66016c 100644 --- a/FFXIV_Vibe_Plugin/App/Commons/Structures.cs +++ b/FFXIV_Vibe_Plugin/App/Commons/Structures.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; namespace FFXIV_Vibe_Plugin.Commons { - internal class Structures { + public class Structures { public enum ActionEffectType : byte { Any = 0, diff --git a/FFXIV_Vibe_Plugin/App/Data/logo.png b/FFXIV_Vibe_Plugin/App/Data/logo.png deleted file mode 100644 index 27abd80..0000000 Binary files a/FFXIV_Vibe_Plugin/App/Data/logo.png and /dev/null differ diff --git a/FFXIV_Vibe_Plugin/App/Devices/DevicesController.cs b/FFXIV_Vibe_Plugin/App/Devices/DevicesController.cs index 52c9d16..c161669 100644 --- a/FFXIV_Vibe_Plugin/App/Devices/DevicesController.cs +++ b/FFXIV_Vibe_Plugin/App/Devices/DevicesController.cs @@ -14,7 +14,7 @@ using Buttplug; #endregion namespace FFXIV_Vibe_Plugin.Device { - internal class DevicesController { + public class DevicesController { private readonly Logger Logger; private readonly Configuration Configuration; private ConfigurationProfile Profile; diff --git a/FFXIV_Vibe_Plugin/App/PlayerStats.cs b/FFXIV_Vibe_Plugin/App/PlayerStats.cs index 2d603c3..77dd16c 100644 --- a/FFXIV_Vibe_Plugin/App/PlayerStats.cs +++ b/FFXIV_Vibe_Plugin/App/PlayerStats.cs @@ -5,7 +5,7 @@ using FFXIV_Vibe_Plugin.Commons; namespace FFXIV_Vibe_Plugin { - internal class PlayerStats { + public class PlayerStats { private readonly Logger Logger; // EVENTS @@ -27,33 +27,33 @@ namespace FFXIV_Vibe_Plugin { this.UpdatePlayerState(clientState); this.UpdatePlayerName(clientState); this.UpdateCurrentHp(clientState); - } - - public void UpdatePlayerState(ClientState clientState) { - if(clientState != null && clientState.LocalPlayer != null) { - if(this._CurrentHp == -1 || this._MaxHp == -1) { - this.Logger.Debug($"UpdatePlayerState {this._CurrentHp} {this._MaxHp}"); - this._CurrentHp = this._prevCurrentHp = clientState.LocalPlayer.CurrentHp; + } + + public void UpdatePlayerState(ClientState clientState) { + if(clientState != null && clientState.LocalPlayer != null) { + if(this._CurrentHp == -1 || this._MaxHp == -1) { + this.Logger.Debug($"UpdatePlayerState {this._CurrentHp} {this._MaxHp}"); + this._CurrentHp = this._prevCurrentHp = clientState.LocalPlayer.CurrentHp; this._MaxHp = this._prevMaxHp = clientState.LocalPlayer.MaxHp; this.Logger.Debug($"UpdatePlayerState {this._CurrentHp} {this._MaxHp}"); } - } + } } - public string UpdatePlayerName(ClientState clientState) { - if(clientState != null && clientState.LocalPlayer != null) { - this.PlayerName = clientState.LocalPlayer.Name.TextValue; - } - return this.PlayerName; + public string UpdatePlayerName(ClientState clientState) { + if(clientState != null && clientState.LocalPlayer != null) { + this.PlayerName = clientState.LocalPlayer.Name.TextValue; + } + return this.PlayerName; } - public string GetPlayerName() { - return this.PlayerName; + public string GetPlayerName() { + return this.PlayerName; } private void UpdateCurrentHp(ClientState clientState) { // Updating current values - if(clientState != null && clientState.LocalPlayer != null) { + if(clientState != null && clientState.LocalPlayer != null) { this._CurrentHp = clientState.LocalPlayer.CurrentHp; this._MaxHp = clientState.LocalPlayer.MaxHp; } diff --git a/FFXIV_Vibe_Plugin/App/Triggers/Trigger.cs b/FFXIV_Vibe_Plugin/App/Triggers/Trigger.cs index 8717f5d..92aaa19 100644 --- a/FFXIV_Vibe_Plugin/App/Triggers/Trigger.cs +++ b/FFXIV_Vibe_Plugin/App/Triggers/Trigger.cs @@ -7,13 +7,13 @@ using System.Threading.Tasks; using FFXIV_Vibe_Plugin.Device; namespace FFXIV_Vibe_Plugin.Triggers { - enum KIND { + public enum KIND { Chat, Spell, HPChange } - enum DIRECTION { + public enum DIRECTION { Any, Outgoing, Incoming, diff --git a/FFXIV_Vibe_Plugin/App/Triggers/TriggersController.cs b/FFXIV_Vibe_Plugin/App/Triggers/TriggersController.cs index f0d9388..e4f993e 100644 --- a/FFXIV_Vibe_Plugin/App/Triggers/TriggersController.cs +++ b/FFXIV_Vibe_Plugin/App/Triggers/TriggersController.cs @@ -12,7 +12,7 @@ using FFXIV_Vibe_Plugin.Commons; using System.Text.RegularExpressions; namespace FFXIV_Vibe_Plugin.Triggers { - internal class TriggersController { + public class TriggersController { private readonly Logger Logger; private readonly PlayerStats PlayerStats; private ConfigurationProfile Profile; diff --git a/FFXIV_Vibe_Plugin/App/UI/PluginUI.cs b/FFXIV_Vibe_Plugin/App/UI/PluginUI.cs index 2dc1221..51505c4 100644 --- a/FFXIV_Vibe_Plugin/App/UI/PluginUI.cs +++ b/FFXIV_Vibe_Plugin/App/UI/PluginUI.cs @@ -1,19 +1,26 @@ -using Dalamud.Game.Text; -using Dalamud.Interface.Colors; -using Dalamud.Interface.Components; -using Dalamud.Plugin; -using FFXIV_Vibe_Plugin.Commons; -using ImGuiNET; -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Numerics; +using System.Numerics; + +// Dalamud libs +using ImGuiNET; +using Dalamud.Game.Text; +using Dalamud.Interface.Colors; +using Dalamud.Interface.Components; +using Dalamud.Plugin; +using Dalamud.Interface.Windowing; + +// FFXIV_Vibe_Plugin libs +using FFXIV_Vibe_Plugin.Commons; + + namespace FFXIV_Vibe_Plugin { - class PluginUI : IDisposable { + public class PluginUI : Window, IDisposable { private int frameCounter = 0; @@ -33,15 +40,9 @@ namespace FFXIV_Vibe_Plugin { private readonly string DonationLink = "http://paypal.me/kaciedev"; - // this extra bool exists for ImGui, since you can't ref a property - private bool visible = false; - public bool Visible { - get { return this.visible; } - set { this.visible = value; } - } private bool _expandedOnce = false; private readonly int WIDTH = 700; - private readonly int HEIGHT = 800; + private readonly int HEIGHT = 600; private readonly int COLUMN0_WIDTH = 130; private string _tmp_void = ""; @@ -72,19 +73,30 @@ namespace FFXIV_Vibe_Plugin { // Trigger private Triggers.Trigger? SelectedTrigger = null; - private string triggersViewMode = "default"; // default|edit|delete; - - /** Constructor */ + private string triggersViewMode = "default"; // default|edit|delete; + + /** Constructor */ + + public PluginUI( - App currentPlugin, - Logger logger, - DalamudPluginInterface pluginInterface, - Configuration configuration, - ConfigurationProfile profile, - Device.DevicesController deviceController, - Triggers.TriggersController triggersController, - Patterns Patterns - ) { + App currentPlugin, + Logger logger, + DalamudPluginInterface pluginInterface, + Configuration configuration, + ConfigurationProfile profile, + Device.DevicesController deviceController, + Triggers.TriggersController triggersController, + Patterns Patterns + ) : base( + "FFXIV_Vibe_Plugin_UI", + ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | + ImGuiWindowFlags.NoScrollWithMouse) { + + this.Size = new Vector2(this.WIDTH, this.HEIGHT); + ImGui.SetNextWindowPos(new Vector2(100, 100), ImGuiCond.Appearing); + + + //if(ImGui.Begin("FFXIV Vibe Plugin", ref this.visible, ImGuiWindowFlags.None)) { this.Logger = logger; this.Configuration = configuration; this.ConfigurationProfile = profile; @@ -96,30 +108,25 @@ namespace FFXIV_Vibe_Plugin { this.LoadImages(); } - public void Display() { - this.Visible = true; - this._expandedOnce = false; - } - /** * Function that will load all the images so that they are usable. * Don't forget to add the image into the project file. */ private void LoadImages() { List images = new(); - images.Add("logo.png"); + images.Add("icon.png"); string assemblyLocation = System.Reflection.Assembly.GetExecutingAssembly().Location; - foreach(string img in images) { - string imagePath = Path.Combine(Path.GetDirectoryName(assemblyLocation)!, $"Data\\Images\\{img}"); + foreach (string img in images) { + string imagePath = Path.Combine(Path.GetDirectoryName(assemblyLocation)!, $"{img}"); this.loadedImages.Add(img, this.PluginInterface.UiBuilder.LoadImage(imagePath)); } } public void Dispose() { // Dispose all loaded images. - foreach(KeyValuePair img in this.loadedImages) { - if(img.Value != null) img.Value.Dispose(); + foreach (KeyValuePair img in this.loadedImages) { + if (img.Value != null) img.Value.Dispose(); } } @@ -127,7 +134,7 @@ namespace FFXIV_Vibe_Plugin { this.ConfigurationProfile = profile; } - public void Draw() { + public override void Draw() { // This is our only draw handler attached to UIBuilder, so it needs to be // able to draw any windows we might have open. // Each method checks its own visibility/state to ensure it only draws when @@ -135,61 +142,52 @@ namespace FFXIV_Vibe_Plugin { // There are other ways to do this, but it is generally best to keep the number of // draw delegates as low as possible. DrawMainWindow(); - frameCounter = (frameCounter+1) % 400; + frameCounter = (frameCounter + 1) % 400; } - public void DrawMainWindow() { - if(!Visible) { - return; - } - if(!this._expandedOnce) { + public void DrawMainWindow() { + + if (!this._expandedOnce) { ImGui.SetNextWindowCollapsed(false); this._expandedOnce = true; + } + + ImGui.Spacing(); + + FFXIV_Vibe_Plugin.UI.UIBanner.Draw(this.frameCounter, this.Logger, this.loadedImages["icon.png"], this.DonationLink, this.DevicesController); + + // Back to on column + ImGui.Columns(1); + + // Tab header + if (ImGui.BeginTabBar("##ConfigTabBar", ImGuiTabBarFlags.None)) { + if (ImGui.BeginTabItem("Connect")) { + FFXIV_Vibe_Plugin.UI.UIConnect.Draw(this.Configuration, this.ConfigurationProfile, this.app, this.DevicesController); + ImGui.EndTabItem(); + } + + if (ImGui.BeginTabItem("Options")) { + this.DrawOptionsTab(); + ImGui.EndTabItem(); + } + if (ImGui.BeginTabItem("Devices")) { + this.DrawDevicesTab(); + ImGui.EndTabItem(); + } + if (ImGui.BeginTabItem("Triggers")) { + this.DrawTriggersTab(); + ImGui.EndTabItem(); + } + if (ImGui.BeginTabItem("Patterns")) { + this.DrawPatternsTab(); + ImGui.EndTabItem(); + } + if (ImGui.BeginTabItem("Help")) { + this.DrawHelpTab(); + ImGui.EndTabItem(); + } } - - ImGui.SetNextWindowPos(new Vector2(100, 100), ImGuiCond.Appearing); - ImGui.SetNextWindowSize(new Vector2(this.WIDTH, this.HEIGHT), ImGuiCond.Appearing); - ImGui.SetNextWindowSizeConstraints(new Vector2(this.WIDTH, this.HEIGHT), new Vector2(float.MaxValue, float.MaxValue)); - if(ImGui.Begin("FFXIV Vibe Plugin", ref this.visible, ImGuiWindowFlags.None)) { - ImGui.Spacing(); - - FFXIV_Vibe_Plugin.UI.UIBanner.Draw(this.frameCounter, this.Logger, this.loadedImages["logo.png"], this.DonationLink, this.DevicesController); - - // Back to on column - ImGui.Columns(1); - - // Tab header - if(ImGui.BeginTabBar("##ConfigTabBar", ImGuiTabBarFlags.None)) { - if(ImGui.BeginTabItem("Connect")) { - FFXIV_Vibe_Plugin.UI.UIConnect.Draw(this.Configuration, this.ConfigurationProfile, this.app, this.DevicesController); - ImGui.EndTabItem(); - } - - if(ImGui.BeginTabItem("Options")) { - this.DrawOptionsTab(); - ImGui.EndTabItem(); - } - if(ImGui.BeginTabItem("Devices")) { - this.DrawDevicesTab(); - ImGui.EndTabItem(); - } - if(ImGui.BeginTabItem("Triggers")) { - this.DrawTriggersTab(); - ImGui.EndTabItem(); - } - if(ImGui.BeginTabItem("Patterns")) { - this.DrawPatternsTab(); - ImGui.EndTabItem(); - } - if(ImGui.BeginTabItem("Help")) { - this.DrawHelpTab(); - ImGui.EndTabItem(); - } - } - } - - ImGui.End(); } public void DrawOptionsTab() { @@ -209,22 +207,22 @@ namespace FFXIV_Vibe_Plugin { string[] PROFILES = this.Configuration.Profiles.Select(profile => profile.Name).ToArray(); int currentProfileIndex = this.Configuration.Profiles.FindIndex(profile => profile.Name == this.Configuration.CurrentProfileName); ImGui.SetNextItemWidth(350); - if(ImGui.Combo("###CONFIGURATION_CURRENT_PROFILE", ref currentProfileIndex, PROFILES, PROFILES.Length)) { + if (ImGui.Combo("###CONFIGURATION_CURRENT_PROFILE", ref currentProfileIndex, PROFILES, PROFILES.Length)) { this.Configuration.CurrentProfileName = this.Configuration.Profiles[currentProfileIndex].Name; this.app.SetProfile(this.Configuration.CurrentProfileName); this.Logger.Debug($"New profile selected: {this.Configuration.CurrentProfileName}"); this.Configuration.Save(); } ImGui.TableNextColumn(); - if(ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Trash)) { - if(this.Configuration.Profiles.Count <= 1) { + if (ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Trash)) { + if (this.Configuration.Profiles.Count <= 1) { string errorMsg = "You can't delete this profile. At least one profile should exists. Create another one before deleting."; this.Logger.Error(errorMsg); this._tmp_currentProfile_ErrorMsg = errorMsg; } else { this.Configuration.RemoveProfile(this.ConfigurationProfile.Name); ConfigurationProfile? newProfileToUse = this.Configuration.GetFirstProfile(); - if(newProfileToUse != null) { + if (newProfileToUse != null) { this.app.SetProfile(newProfileToUse.Name); } this.Configuration.Save(); @@ -235,15 +233,15 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Add new profile: "); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(350); - if(ImGui.InputText("###CONFIGURATION_NEW_PROFILE_NAME", ref _tmp_currentProfileNameToAdd, 150)) { + if (ImGui.InputText("###CONFIGURATION_NEW_PROFILE_NAME", ref _tmp_currentProfileNameToAdd, 150)) { this._tmp_currentProfile_ErrorMsg = ""; } ImGui.TableNextColumn(); - if(this._tmp_currentProfileNameToAdd.Length > 0) { - if(ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus)) { - if(this._tmp_currentProfileNameToAdd.Trim() != "") { + if (this._tmp_currentProfileNameToAdd.Length > 0) { + if (ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus)) { + if (this._tmp_currentProfileNameToAdd.Trim() != "") { bool wasAdded = this.Configuration.AddProfile(this._tmp_currentProfileNameToAdd); - if(!wasAdded) { + if (!wasAdded) { string errorMsg = $"The current profile name '{this._tmp_currentProfileNameToAdd}' already exists!"; this.Logger.Error(errorMsg); this._tmp_currentProfile_ErrorMsg = errorMsg; @@ -261,14 +259,14 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Rename current profile"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(350); - if(ImGui.InputText("###CONFIGURATION_CURRENT_PROFILE_RENAME", ref this.ConfigurationProfile.Name, 150)) { + if (ImGui.InputText("###CONFIGURATION_CURRENT_PROFILE_RENAME", ref this.ConfigurationProfile.Name, 150)) { this.Configuration.CurrentProfileName = this.ConfigurationProfile.Name; this.Configuration.Save(); } ImGui.EndTable(); - if(this._tmp_currentProfile_ErrorMsg != "") { + if (this._tmp_currentProfile_ErrorMsg != "") { ImGui.TextColored(ImGuiColors.DalamudRed, this._tmp_currentProfile_ErrorMsg); } }; @@ -288,7 +286,7 @@ namespace FFXIV_Vibe_Plugin { bool config_AUTO_OPEN = this.ConfigurationProfile.AUTO_OPEN; ImGui.Text("Automatically open configuration panel."); ImGui.TableNextColumn(); - if(ImGui.Checkbox("###GENERAL_OPTIONS_AUTO_OPEN", ref config_AUTO_OPEN)) { + if (ImGui.Checkbox("###GENERAL_OPTIONS_AUTO_OPEN", ref config_AUTO_OPEN)) { this.ConfigurationProfile.AUTO_OPEN = config_AUTO_OPEN; this.Configuration.Save(); } @@ -301,7 +299,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); int config_MAX_VIBE_THRESHOLD = this.ConfigurationProfile.MAX_VIBE_THRESHOLD; ImGui.SetNextItemWidth(201); - if(ImGui.SliderInt("###OPTION_MaximumThreshold", ref config_MAX_VIBE_THRESHOLD, 2, 100)) { + if (ImGui.SliderInt("###OPTION_MaximumThreshold", ref config_MAX_VIBE_THRESHOLD, 2, 100)) { this.ConfigurationProfile.MAX_VIBE_THRESHOLD = config_MAX_VIBE_THRESHOLD; this.Configuration.Save(); } @@ -312,7 +310,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Log casted spells:"); ImGui.TableNextColumn(); - if(ImGui.Checkbox("###OPTION_VERBOSE_SPELL", ref this.ConfigurationProfile.VERBOSE_SPELL)) { + if (ImGui.Checkbox("###OPTION_VERBOSE_SPELL", ref this.ConfigurationProfile.VERBOSE_SPELL)) { this.Configuration.Save(); } ImGui.SameLine(); @@ -323,7 +321,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Log chat triggered:"); ImGui.TableNextColumn(); - if(ImGui.Checkbox("###OPTION_VERBOSE_CHAT", ref this.ConfigurationProfile.VERBOSE_CHAT)) { + if (ImGui.Checkbox("###OPTION_VERBOSE_CHAT", ref this.ConfigurationProfile.VERBOSE_CHAT)) { this.Configuration.Save(); } ImGui.SameLine(); @@ -333,7 +331,7 @@ namespace FFXIV_Vibe_Plugin { } ImGui.EndChild(); - if(this.ConfigurationProfile.VERBOSE_CHAT || this.ConfigurationProfile.VERBOSE_SPELL) { + if (this.ConfigurationProfile.VERBOSE_CHAT || this.ConfigurationProfile.VERBOSE_SPELL) { ImGui.TextColored(ImGuiColors.DalamudOrange, "Please, disabled chat and spell logs for better ingame performance."); } } @@ -344,76 +342,76 @@ namespace FFXIV_Vibe_Plugin { ImGui.TextColored(ImGuiColors.DalamudViolet, "Actions"); ImGui.BeginChild("###DevicesTab_General", new Vector2(-1, 40f), true); { - if(this.DevicesController.IsScanning()) { - if(ImGui.Button("Stop scanning", new Vector2(100, 24))) { + if (this.DevicesController.IsScanning()) { + if (ImGui.Button("Stop scanning", new Vector2(100, 24))) { this.DevicesController.StopScanningDevice(); } } else { - if(ImGui.Button("Scan device", new Vector2(100, 24))) { + if (ImGui.Button("Scan device", new Vector2(100, 24))) { this.DevicesController.ScanDevice(); } } ImGui.SameLine(); - if(ImGui.Button("Update Battery", new Vector2(100, 24))) { + if (ImGui.Button("Update Battery", new Vector2(100, 24))) { this.DevicesController.UpdateAllBatteryLevel(); } ImGui.SameLine(); - if(ImGui.Button("Stop All", new Vector2(100, 24))) { + if (ImGui.Button("Stop All", new Vector2(100, 24))) { this.DevicesController.StopAll(); this.simulator_currentAllIntensity = 0; } } ImGui.EndChild(); - if(ImGui.CollapsingHeader($"All devices")) { + if (ImGui.CollapsingHeader($"All devices")) { ImGui.Text("Send to all:"); ImGui.SameLine(); ImGui.SetNextItemWidth(200); - if(ImGui.SliderInt("###SendVibeAll_Intensity", ref this.simulator_currentAllIntensity, 0, 100)) { + if (ImGui.SliderInt("###SendVibeAll_Intensity", ref this.simulator_currentAllIntensity, 0, 100)) { this.DevicesController.SendVibeToAll(this.simulator_currentAllIntensity); } } - foreach(Device.Device device in this.DevicesController.GetDevices()) { - if(ImGui.CollapsingHeader($"[{device.Id}] {device.Name} - Battery: {device.GetBatteryPercentage()}")) { + foreach (Device.Device device in this.DevicesController.GetDevices()) { + if (ImGui.CollapsingHeader($"[{device.Id}] {device.Name} - Battery: {device.GetBatteryPercentage()}")) { ImGui.TextWrapped(device.ToString()); - if(device.CanVibrate) { + if (device.CanVibrate) { ImGui.TextColored(ImGuiColors.DalamudViolet, "VIBRATE"); ImGui.Indent(10); - for(int i = 0; i < device.VibrateMotors; i++) { + for (int i = 0; i < device.VibrateMotors; i++) { ImGui.Text($"Motor {i + 1}: "); ImGui.SameLine(); ImGui.SetNextItemWidth(200); - if(ImGui.SliderInt($"###{device.Id} Intensity Vibrate Motor {i}", ref device.CurrentVibrateIntensity[i], 0, 100)) { + if (ImGui.SliderInt($"###{device.Id} Intensity Vibrate Motor {i}", ref device.CurrentVibrateIntensity[i], 0, 100)) { this.DevicesController.SendVibrate(device, device.CurrentVibrateIntensity[i], i); } } ImGui.Unindent(10); } - if(device.CanRotate) { + if (device.CanRotate) { ImGui.TextColored(ImGuiColors.DalamudViolet, "ROTATE"); ImGui.Indent(10); - for(int i = 0; i < device.RotateMotors; i++) { + for (int i = 0; i < device.RotateMotors; i++) { ImGui.Text($"Motor {i + 1}: "); ImGui.SameLine(); ImGui.SetNextItemWidth(200); - if(ImGui.SliderInt($"###{device.Id} Intensity Rotate Motor {i}", ref device.CurrentRotateIntensity[i], 0, 100)) { + if (ImGui.SliderInt($"###{device.Id} Intensity Rotate Motor {i}", ref device.CurrentRotateIntensity[i], 0, 100)) { this.DevicesController.SendRotate(device, device.CurrentRotateIntensity[i], i, true); } } ImGui.Unindent(10); } - if(device.CanLinear) { + if (device.CanLinear) { ImGui.TextColored(ImGuiColors.DalamudViolet, "LINEAR VIBES"); ImGui.Indent(10); - for(int i = 0; i < device.LinearMotors; i++) { + for (int i = 0; i < device.LinearMotors; i++) { ImGui.Text($"Motor {i + 1}: "); ImGui.SameLine(); ImGui.SetNextItemWidth(200); - if(ImGui.SliderInt($"###{device.Id} Intensity Linear Motor {i}", ref device.CurrentLinearIntensity[i], 0, 100)) { + if (ImGui.SliderInt($"###{device.Id} Intensity Linear Motor {i}", ref device.CurrentLinearIntensity[i], 0, 100)) { this.DevicesController.SendLinear(device, device.CurrentLinearIntensity[i], 500, i); } } @@ -427,40 +425,40 @@ namespace FFXIV_Vibe_Plugin { public unsafe void DrawTriggersTab() { List triggers = this.TriggerController.GetTriggers(); string selectedId = this.SelectedTrigger != null ? this.SelectedTrigger.Id : ""; - if(ImGui.BeginChild("###TriggersSelector", new Vector2(ImGui.GetWindowContentRegionMax().X/3, -ImGui.GetFrameHeightWithSpacing()), true)) { + if (ImGui.BeginChild("###TriggersSelector", new Vector2(ImGui.GetWindowContentRegionMax().X / 3, -ImGui.GetFrameHeightWithSpacing()), true)) { ImGui.SetNextItemWidth(185); ImGui.InputText("###TriggersSelector_SearchBar", ref this.CURRENT_TRIGGER_SELECTOR_SEARCHBAR, 200); - ImGui.Spacing(); - - for(int triggerIndex=0; triggerIndex -1 && ImGui.IsMouseReleased(ImGuiMouseButton.Left)) { + if (ImGui.BeginDragDropTarget()) { + if (this._tmp_currentDraggingTriggerIndex > -1 && ImGui.IsMouseReleased(ImGuiMouseButton.Left)) { int srcIndex = this._tmp_currentDraggingTriggerIndex; int targetIndex = triggerIndex; (triggers[srcIndex], triggers[targetIndex]) = (triggers[targetIndex], triggers[srcIndex]); @@ -476,11 +474,11 @@ namespace FFXIV_Vibe_Plugin { } ImGui.SameLine(); - if(ImGui.BeginChild("###TriggerViewerPanel", new Vector2(0, -ImGui.GetFrameHeightWithSpacing()), true)) { - if(this.triggersViewMode == "default") { + if (ImGui.BeginChild("###TriggerViewerPanel", new Vector2(0, -ImGui.GetFrameHeightWithSpacing()), true)) { + if (this.triggersViewMode == "default") { ImGui.Text("Please select or add a trigger"); - } else if(this.triggersViewMode == "edit") { - if(this.SelectedTrigger != null) { + } else if (this.triggersViewMode == "edit") { + if (this.SelectedTrigger != null) { // Init table ImGui.BeginTable("###TRIGGER_FORM_TABLE_GENERAL", 2); @@ -498,7 +496,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Enabled:"); ImGui.TableNextColumn(); - if(ImGui.Checkbox("###TRIGGER_ENABLED", ref this.SelectedTrigger.Enabled)) { + if (ImGui.Checkbox("###TRIGGER_ENABLED", ref this.SelectedTrigger.Enabled)) { this.Configuration.Save(); }; ImGui.TableNextRow(); @@ -507,8 +505,8 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Trigger Name:"); ImGui.TableNextColumn(); - if(ImGui.InputText("###TRIGGER_NAME", ref this.SelectedTrigger.Name, 99)) { - if(this.SelectedTrigger.Name == "") { + if (ImGui.InputText("###TRIGGER_NAME", ref this.SelectedTrigger.Name, 99)) { + if (this.SelectedTrigger.Name == "") { this.SelectedTrigger.Name = "no_name"; } this.Configuration.Save(); @@ -534,9 +532,9 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); string[] TRIGGER_KIND = System.Enum.GetNames(typeof(Triggers.KIND)); int currentKind = (int)this.SelectedTrigger.Kind; - if(ImGui.Combo("###TRIGGER_FORM_KIND", ref currentKind, TRIGGER_KIND, TRIGGER_KIND.Length)) { + if (ImGui.Combo("###TRIGGER_FORM_KIND", ref currentKind, TRIGGER_KIND, TRIGGER_KIND.Length)) { this.SelectedTrigger.Kind = currentKind; - if(currentKind == (int)Triggers.KIND.HPChange) { + if (currentKind == (int)Triggers.KIND.HPChange) { this.SelectedTrigger.StartAfter = 0; this.SelectedTrigger.StopAfter = 0; } @@ -548,7 +546,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Player name:"); ImGui.TableNextColumn(); - if(ImGui.InputText("###TRIGGER_CHAT_FROM_PLAYER_NAME", ref this.SelectedTrigger.FromPlayerName, 100)) { + if (ImGui.InputText("###TRIGGER_CHAT_FROM_PLAYER_NAME", ref this.SelectedTrigger.FromPlayerName, 100)) { this.SelectedTrigger.FromPlayerName = this.SelectedTrigger.FromPlayerName.Trim(); this.Configuration.Save(); }; @@ -562,14 +560,14 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Start after"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(185); - if(ImGui.SliderFloat("###TRIGGER_FORM_START_AFTER", ref this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { + if (ImGui.SliderFloat("###TRIGGER_FORM_START_AFTER", ref this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { this.SelectedTrigger.StartAfter = Helpers.ClampFloat(this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER); this.Configuration.Save(); } ImGui.SameLine(); ImGui.SetNextItemWidth(45); - if(ImGui.InputFloat("###TRIGGER_FORM_START_AFTER_INPUT", ref this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { + if (ImGui.InputFloat("###TRIGGER_FORM_START_AFTER_INPUT", ref this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { this.SelectedTrigger.StartAfter = Helpers.ClampFloat(this.SelectedTrigger.StartAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER); this.Configuration.Save(); } @@ -582,13 +580,13 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Stop after"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(185); - if(ImGui.SliderFloat("###TRIGGER_FORM_STOP_AFTER", ref this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { + if (ImGui.SliderFloat("###TRIGGER_FORM_STOP_AFTER", ref this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { this.SelectedTrigger.StopAfter = Helpers.ClampFloat(this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER); this.Configuration.Save(); } ImGui.SameLine(); ImGui.SetNextItemWidth(45); - if(ImGui.InputFloat("###TRIGGER_FORM_STOP_AFTER_INPUT", ref this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { + if (ImGui.InputFloat("###TRIGGER_FORM_STOP_AFTER_INPUT", ref this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER)) { this.SelectedTrigger.StopAfter = Helpers.ClampFloat(this.SelectedTrigger.StopAfter, this.TRIGGER_MIN_AFTER, this.TRIGGER_MAX_AFTER); this.Configuration.Save(); } @@ -601,7 +599,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Priority"); ImGui.TableNextColumn(); - if(ImGui.InputInt("###TRIGGER_FORM_PRIORITY", ref this.SelectedTrigger.Priority, 1)) { + if (ImGui.InputInt("###TRIGGER_FORM_PRIORITY", ref this.SelectedTrigger.Priority, 1)) { this.Configuration.Save(); } ImGui.SameLine(); @@ -613,7 +611,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.Separator(); // TRIGGER KIND:CHAT OPTIONS - if(this.SelectedTrigger.Kind == (int)Triggers.KIND.Chat) { + if (this.SelectedTrigger.Kind == (int)Triggers.KIND.Chat) { // TRIGGER FORM_TABLE_KIND_CHAT ImGui.BeginTable("###TRIGGER_FORM_TABLE_KIND_CHAT", 2); @@ -625,7 +623,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Chat text:"); ImGui.TableNextColumn(); string currentChatText = this.SelectedTrigger.ChatText; - if(ImGui.InputText("###TRIGGER_CHAT_TEXT", ref currentChatText, 250)) { + if (ImGui.InputText("###TRIGGER_CHAT_TEXT", ref currentChatText, 250)) { this.SelectedTrigger.ChatText = currentChatText.ToLower(); // ChatMsg is always lower this.Configuration.Save(); }; @@ -639,8 +637,8 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); int currentTypeAllowed = 0; string[] ChatTypesAllowedStrings = Enum.GetNames(typeof(XivChatType)); - if(ImGui.Combo("###TRIGGER_CHAT_TEXT_TYPE_ALLOWED", ref currentTypeAllowed, ChatTypesAllowedStrings, ChatTypesAllowedStrings.Length)) { - if(!this.SelectedTrigger.AllowedChatTypes.Contains(currentTypeAllowed)) { + if (ImGui.Combo("###TRIGGER_CHAT_TEXT_TYPE_ALLOWED", ref currentTypeAllowed, ChatTypesAllowedStrings, ChatTypesAllowedStrings.Length)) { + if (!this.SelectedTrigger.AllowedChatTypes.Contains(currentTypeAllowed)) { int XivChatTypeValue = (int)(XivChatType)Enum.Parse(typeof(XivChatType), ChatTypesAllowedStrings[currentTypeAllowed]); this.SelectedTrigger.AllowedChatTypes.Add(XivChatTypeValue); } @@ -649,14 +647,14 @@ namespace FFXIV_Vibe_Plugin { ImGuiComponents.HelpMarker("Select some chats to observe or unselect all to watch every chats."); ImGui.TableNextRow(); - if(this.SelectedTrigger.AllowedChatTypes.Count > 0) { + if (this.SelectedTrigger.AllowedChatTypes.Count > 0) { ImGui.TableNextColumn(); ImGui.Text("Allowed Type:"); ImGui.TableNextColumn(); - for(int indexAllowedChatType = 0; indexAllowedChatType < this.SelectedTrigger.AllowedChatTypes.Count; indexAllowedChatType++) { + for (int indexAllowedChatType = 0; indexAllowedChatType < this.SelectedTrigger.AllowedChatTypes.Count; indexAllowedChatType++) { int XivChatTypeValue = this.SelectedTrigger.AllowedChatTypes[indexAllowedChatType]; - if(ImGuiComponents.IconButton(indexAllowedChatType, Dalamud.Interface.FontAwesomeIcon.Minus)) { + if (ImGuiComponents.IconButton(indexAllowedChatType, Dalamud.Interface.FontAwesomeIcon.Minus)) { this.SelectedTrigger.AllowedChatTypes.RemoveAt(indexAllowedChatType); this.Configuration.Save(); }; @@ -679,14 +677,14 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableSetupColumn("###TRIGGER_FORM_TABLE_KIND_SPELL_COL2", ImGuiTableColumnFlags.WidthStretch); // TRIGGER KIND:SPELL OPTIONS - if(this.SelectedTrigger.Kind == (int)Triggers.KIND.Spell){ + if (this.SelectedTrigger.Kind == (int)Triggers.KIND.Spell) { // TRIGGER TYPE ImGui.TableNextColumn(); ImGui.Text("Type:"); ImGui.TableNextColumn(); string[] TRIGGER = System.Enum.GetNames(typeof(FFXIV_Vibe_Plugin.Commons.Structures.ActionEffectType)); int currentEffectType = (int)this.SelectedTrigger.ActionEffectType; - if(ImGui.Combo("###TRIGGER_FORM_EVENT", ref currentEffectType, TRIGGER, TRIGGER.Length)) { + if (ImGui.Combo("###TRIGGER_FORM_EVENT", ref currentEffectType, TRIGGER, TRIGGER.Length)) { this.SelectedTrigger.ActionEffectType = currentEffectType; this.SelectedTrigger.Reset(); this.Configuration.Save(); @@ -697,7 +695,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); ImGui.Text("Spell Text:"); ImGui.TableNextColumn(); - if(ImGui.InputText("###TRIGGER_FORM_SPELLNAME", ref this.SelectedTrigger.SpellText, 100)) { + if (ImGui.InputText("###TRIGGER_FORM_SPELLNAME", ref this.SelectedTrigger.SpellText, 100)) { this.Configuration.Save(); } ImGui.SameLine(); @@ -710,7 +708,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextColumn(); string[] DIRECTIONS = System.Enum.GetNames(typeof(Triggers.DIRECTION)); int currentDirection = (int)this.SelectedTrigger.Direction; - if(ImGui.Combo("###TRIGGER_FORM_DIRECTION", ref currentDirection, DIRECTIONS, DIRECTIONS.Length)) { + if (ImGui.Combo("###TRIGGER_FORM_DIRECTION", ref currentDirection, DIRECTIONS, DIRECTIONS.Length)) { this.SelectedTrigger.Direction = currentDirection; this.Configuration.Save(); } @@ -719,36 +717,35 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextRow(); } - if( + if ( this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Damage || this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Heal - || - this.SelectedTrigger.Kind == (int)Triggers.KIND.HPChange) - { + || + this.SelectedTrigger.Kind == (int)Triggers.KIND.HPChange) { // Min/Max amount values string type = ""; - if(this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Damage) { type = "damage"; } - if(this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Heal) { type = "heal"; } - if(this.SelectedTrigger.Kind == (int)Triggers.KIND.HPChange) { type = "health"; } - - // TRIGGER AMOUNT IN PERCENTAGE + if (this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Damage) { type = "damage"; } + if (this.SelectedTrigger.ActionEffectType == (int)Structures.ActionEffectType.Heal) { type = "heal"; } + if (this.SelectedTrigger.Kind == (int)Triggers.KIND.HPChange) { type = "health"; } + + // TRIGGER AMOUNT IN PERCENTAGE ImGui.TableNextColumn(); ImGui.Text("Amount in percentage?"); ImGui.TableNextColumn(); - if(ImGui.Checkbox("###TRIGGER_AMOUNT_IN_PERCENTAGE", ref this.SelectedTrigger.AmountInPercentage)){ + if (ImGui.Checkbox("###TRIGGER_AMOUNT_IN_PERCENTAGE", ref this.SelectedTrigger.AmountInPercentage)) { this.SelectedTrigger.AmountMinValue = 0; this.SelectedTrigger.AmountMaxValue = 100; this.Configuration.Save(); - } - - - - // TRIGGER MIN_VALUE + } + + + + // TRIGGER MIN_VALUE ImGui.TableNextColumn(); ImGui.Text($"Min {type} value:"); ImGui.TableNextColumn(); if (this.SelectedTrigger.AmountInPercentage) { - if(ImGui.SliderInt("###TRIGGER_FORM_MIN_AMOUNT", ref this.SelectedTrigger.AmountMinValue, 0, 100)) { + if (ImGui.SliderInt("###TRIGGER_FORM_MIN_AMOUNT", ref this.SelectedTrigger.AmountMinValue, 0, 100)) { this.Configuration.Save(); } } else { @@ -766,8 +763,7 @@ namespace FFXIV_Vibe_Plugin { if (ImGui.SliderInt("###TRIGGER_FORM_MAX_AMOUNT", ref this.SelectedTrigger.AmountMaxValue, 0, 100)) { this.Configuration.Save(); } - } - else { + } else { if (ImGui.InputInt("###TRIGGER_FORM_MAX_AMOUNT", ref this.SelectedTrigger.AmountMaxValue, 100)) { this.Configuration.Save(); } @@ -781,15 +777,15 @@ namespace FFXIV_Vibe_Plugin { // TRIGGER COMBO_DEVICES Dictionary visitedDevice = DevicesController.GetVisitedDevices(); - if(visitedDevice.Count == 0) { + if (visitedDevice.Count == 0) { ImGui.TextColored(ImGuiColors.DalamudRed, "Please connect yourself to intiface and add device(s)..."); } else { string[] devicesStrings = visitedDevice.Keys.ToArray(); ImGui.Combo("###TRIGGER_FORM_COMBO_DEVICES", ref this.TRIGGER_CURRENT_SELECTED_DEVICE, devicesStrings, devicesStrings.Length); ImGui.SameLine(); List triggerDevices = this.SelectedTrigger.Devices; - if(ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus)) { - if(this.TRIGGER_CURRENT_SELECTED_DEVICE >= 0) { + if (ImGuiComponents.IconButton(Dalamud.Interface.FontAwesomeIcon.Plus)) { + if (this.TRIGGER_CURRENT_SELECTED_DEVICE >= 0) { Device.Device device = visitedDevice[devicesStrings[this.TRIGGER_CURRENT_SELECTED_DEVICE]]; Triggers.TriggerDevice newTriggerDevice = new(device); triggerDevices.Add(newTriggerDevice); @@ -799,35 +795,35 @@ namespace FFXIV_Vibe_Plugin { string[] patternNames = this.Patterns.GetAllPatterns().Select(p => p.Name).ToArray(); - for(int indexDevice = 0; indexDevice < triggerDevices.Count; indexDevice++) { + for (int indexDevice = 0; indexDevice < triggerDevices.Count; indexDevice++) { string prefixLabel = $"###TRIGGER_FORM_COMBO_DEVICE_${indexDevice}"; Triggers.TriggerDevice triggerDevice = triggerDevices[indexDevice]; string deviceName = triggerDevice.Device != null ? triggerDevice.Device.Name : "UnknownDevice"; - if(ImGui.CollapsingHeader($"{deviceName}")) { + if (ImGui.CollapsingHeader($"{deviceName}")) { ImGui.Indent(10); - if(triggerDevice != null && triggerDevice.Device != null) { - if(triggerDevice.Device.CanVibrate) { - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_VIBRATE", ref triggerDevice.ShouldVibrate)) { + if (triggerDevice != null && triggerDevice.Device != null) { + if (triggerDevice.Device.CanVibrate) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_VIBRATE", ref triggerDevice.ShouldVibrate)) { triggerDevice.ShouldStop = false; this.Configuration.Save(); } ImGui.SameLine(); ImGui.Text("Should Vibrate"); - if(triggerDevice.ShouldVibrate) { + if (triggerDevice.ShouldVibrate) { ImGui.Indent(20); - for(int motorId = 0; motorId < triggerDevice.Device.VibrateMotors; motorId++) { + for (int motorId = 0; motorId < triggerDevice.Device.VibrateMotors; motorId++) { ImGui.Text($"Motor {motorId + 1}"); ImGui.SameLine(); // Display Vibrate Motor checkbox - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_VIBRATE_MOTOR_{motorId}", ref triggerDevice.VibrateSelectedMotors[motorId])) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_VIBRATE_MOTOR_{motorId}", ref triggerDevice.VibrateSelectedMotors[motorId])) { this.Configuration.Save(); } - if(triggerDevice.VibrateSelectedMotors[motorId]) { + if (triggerDevice.VibrateSelectedMotors[motorId]) { ImGui.SameLine(); ImGui.SetNextItemWidth(90); - if(ImGui.Combo($"###{prefixLabel}_VIBRATE_PATTERNS_{motorId}", ref triggerDevice.VibrateMotorsPattern[motorId], patternNames, patternNames.Length)) { + if (ImGui.Combo($"###{prefixLabel}_VIBRATE_PATTERNS_{motorId}", ref triggerDevice.VibrateMotorsPattern[motorId], patternNames, patternNames.Length)) { this.Configuration.Save(); } @@ -835,8 +831,8 @@ namespace FFXIV_Vibe_Plugin { int currentPatternIndex = triggerDevice.VibrateMotorsPattern[motorId]; ImGui.SameLine(); ImGui.SetNextItemWidth(180); - if(ImGui.SliderInt($"{prefixLabel}_SHOULD_VIBRATE_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.VibrateMotorsThreshold[motorId], 0, 100)) { - if(triggerDevice.VibrateMotorsThreshold[motorId] > 0) { + if (ImGui.SliderInt($"{prefixLabel}_SHOULD_VIBRATE_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.VibrateMotorsThreshold[motorId], 0, 100)) { + if (triggerDevice.VibrateMotorsThreshold[motorId] > 0) { triggerDevice.VibrateSelectedMotors[motorId] = true; } this.Configuration.Save(); @@ -846,33 +842,33 @@ namespace FFXIV_Vibe_Plugin { ImGui.Indent(-20); } } - if(triggerDevice.Device.CanRotate) { - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_ROTATE", ref triggerDevice.ShouldRotate)) { + if (triggerDevice.Device.CanRotate) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_ROTATE", ref triggerDevice.ShouldRotate)) { triggerDevice.ShouldStop = false; this.Configuration.Save(); } ImGui.SameLine(); ImGui.Text("Should Rotate"); - if(triggerDevice.ShouldRotate) { + if (triggerDevice.ShouldRotate) { ImGui.Indent(20); - for(int motorId = 0; motorId < triggerDevice.Device.RotateMotors; motorId++) { + for (int motorId = 0; motorId < triggerDevice.Device.RotateMotors; motorId++) { ImGui.Text($"Motor {motorId + 1}"); ImGui.SameLine(); - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_ROTATE_MOTOR_{motorId}", ref triggerDevice.RotateSelectedMotors[motorId])) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_ROTATE_MOTOR_{motorId}", ref triggerDevice.RotateSelectedMotors[motorId])) { this.Configuration.Save(); } - if(triggerDevice.RotateSelectedMotors[motorId]) { + if (triggerDevice.RotateSelectedMotors[motorId]) { ImGui.SameLine(); ImGui.SetNextItemWidth(90); - if(ImGui.Combo($"###{prefixLabel}_ROTATE_PATTERNS_{motorId}", ref triggerDevice.RotateMotorsPattern[motorId], patternNames, patternNames.Length)) { + if (ImGui.Combo($"###{prefixLabel}_ROTATE_PATTERNS_{motorId}", ref triggerDevice.RotateMotorsPattern[motorId], patternNames, patternNames.Length)) { this.Configuration.Save(); } // Special intensity pattern asks for intensity param. int currentPatternIndex = triggerDevice.RotateMotorsPattern[motorId]; ImGui.SameLine(); ImGui.SetNextItemWidth(180); - if(ImGui.SliderInt($"{prefixLabel}_SHOULD_ROTATE_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.RotateMotorsThreshold[motorId], 0, 100)) { - if(triggerDevice.RotateMotorsThreshold[motorId] > 0) { + if (ImGui.SliderInt($"{prefixLabel}_SHOULD_ROTATE_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.RotateMotorsThreshold[motorId], 0, 100)) { + if (triggerDevice.RotateMotorsThreshold[motorId] > 0) { triggerDevice.RotateSelectedMotors[motorId] = true; } this.Configuration.Save(); @@ -883,33 +879,33 @@ namespace FFXIV_Vibe_Plugin { ImGui.Indent(-20); } } - if(triggerDevice.Device.CanLinear) { - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_LINEAR", ref triggerDevice.ShouldLinear)) { + if (triggerDevice.Device.CanLinear) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_LINEAR", ref triggerDevice.ShouldLinear)) { triggerDevice.ShouldStop = false; this.Configuration.Save(); } ImGui.SameLine(); ImGui.Text("Should Linear"); - if(triggerDevice.ShouldLinear) { + if (triggerDevice.ShouldLinear) { ImGui.Indent(20); - for(int motorId = 0; motorId < triggerDevice.Device.LinearMotors; motorId++) { + for (int motorId = 0; motorId < triggerDevice.Device.LinearMotors; motorId++) { ImGui.Text($"Motor {motorId + 1}"); ImGui.SameLine(); - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_LINEAR_MOTOR_{motorId}", ref triggerDevice.LinearSelectedMotors[motorId])) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_LINEAR_MOTOR_{motorId}", ref triggerDevice.LinearSelectedMotors[motorId])) { this.Configuration.Save(); } - if(triggerDevice.LinearSelectedMotors[motorId]) { + if (triggerDevice.LinearSelectedMotors[motorId]) { ImGui.SameLine(); ImGui.SetNextItemWidth(90); - if(ImGui.Combo($"###{prefixLabel}_LINEAR_PATTERNS_{motorId}", ref triggerDevice.LinearMotorsPattern[motorId], patternNames, patternNames.Length)) { + if (ImGui.Combo($"###{prefixLabel}_LINEAR_PATTERNS_{motorId}", ref triggerDevice.LinearMotorsPattern[motorId], patternNames, patternNames.Length)) { this.Configuration.Save(); } // Special intensity pattern asks for intensity param. int currentPatternIndex = triggerDevice.LinearMotorsPattern[motorId]; ImGui.SameLine(); ImGui.SetNextItemWidth(180); - if(ImGui.SliderInt($"{prefixLabel}_SHOULD_LINEAR_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.LinearMotorsThreshold[motorId], 0, 100)) { - if(triggerDevice.LinearMotorsThreshold[motorId] > 0) { + if (ImGui.SliderInt($"{prefixLabel}_SHOULD_LINEAR_MOTOR_{motorId}_THRESHOLD", ref triggerDevice.LinearMotorsThreshold[motorId], 0, 100)) { + if (triggerDevice.LinearMotorsThreshold[motorId] > 0) { triggerDevice.LinearSelectedMotors[motorId] = true; } this.Configuration.Save(); @@ -919,8 +915,8 @@ namespace FFXIV_Vibe_Plugin { ImGui.Indent(-20); } } - if(triggerDevice.Device.CanStop) { - if(ImGui.Checkbox($"{prefixLabel}_SHOULD_STOP", ref triggerDevice.ShouldStop)) { + if (triggerDevice.Device.CanStop) { + if (ImGui.Checkbox($"{prefixLabel}_SHOULD_STOP", ref triggerDevice.ShouldStop)) { triggerDevice.ShouldVibrate = false; triggerDevice.ShouldRotate = false; triggerDevice.ShouldLinear = false; @@ -931,7 +927,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.SameLine(); ImGuiComponents.HelpMarker("Instantly stop all motors for this device."); } - if(ImGui.Button($"Remove###{prefixLabel}_REMOVE")) { + if (ImGui.Button($"Remove###{prefixLabel}_REMOVE")) { triggerDevices.RemoveAt(indexDevice); this.Logger.Log($"DEBUG: removing {indexDevice}"); this.Configuration.Save(); @@ -946,11 +942,11 @@ namespace FFXIV_Vibe_Plugin { } else { ImGui.TextColored(ImGuiColors.DalamudRed, "Current selected trigger is null"); } - } else if(this.triggersViewMode == "delete") { - if(this.SelectedTrigger != null) { + } else if (this.triggersViewMode == "delete") { + if (this.SelectedTrigger != null) { ImGui.TextColored(ImGuiColors.DalamudRed, $"Are you sure you want to delete trigger ID: {this.SelectedTrigger.Id}"); - if(ImGui.Button("Yes")) { - if(this.SelectedTrigger != null) { + if (ImGui.Button("Yes")) { + if (this.SelectedTrigger != null) { this.TriggerController.RemoveTrigger(this.SelectedTrigger); this.SelectedTrigger = null; this.Configuration.Save(); @@ -958,7 +954,7 @@ namespace FFXIV_Vibe_Plugin { this.triggersViewMode = "default"; }; ImGui.SameLine(); - if(ImGui.Button("No")) { + if (ImGui.Button("No")) { this.SelectedTrigger = null; this.triggersViewMode = "default"; }; @@ -967,7 +963,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.EndChild(); } - if(ImGui.Button("Add")) { + if (ImGui.Button("Add")) { Triggers.Trigger trigger = new("New Trigger"); this.TriggerController.AddTrigger(trigger); this.SelectedTrigger = trigger; @@ -975,7 +971,7 @@ namespace FFXIV_Vibe_Plugin { this.Configuration.Save(); }; ImGui.SameLine(); - if(ImGui.Button("Delete")) { + if (ImGui.Button("Delete")) { this.triggersViewMode = "delete"; } @@ -993,7 +989,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Pattern Name:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(300); - if(ImGui.InputText("###PATTERNS_CURRENT_PATTERN_NAME_TO_ADD", ref this._tmp_currentPatternNameToAdd, 150)) { + if (ImGui.InputText("###PATTERNS_CURRENT_PATTERN_NAME_TO_ADD", ref this._tmp_currentPatternNameToAdd, 150)) { this._tmp_currentPatternNameToAdd = this._tmp_currentPatternNameToAdd.Trim(); } ImGui.TableNextRow(); @@ -1001,10 +997,10 @@ namespace FFXIV_Vibe_Plugin { ImGui.Text("Pattern Value:"); ImGui.TableNextColumn(); ImGui.SetNextItemWidth(300); - if(ImGui.InputText("###PATTERNS_CURRENT_PATTERN_VALUE_TO_ADD", ref this._tmp_currentPatternValueToAdd, 500)) { + if (ImGui.InputText("###PATTERNS_CURRENT_PATTERN_VALUE_TO_ADD", ref this._tmp_currentPatternValueToAdd, 500)) { this._tmp_currentPatternValueToAdd = this._tmp_currentPatternValueToAdd.Trim(); string value = this._tmp_currentPatternValueToAdd.Trim(); - if(value == "") { + if (value == "") { this._tmp_currentPatternValueState = "unset"; } else { this._tmp_currentPatternValueState = Helpers.RegExpMatch(this.Logger, this._tmp_currentPatternValueToAdd, this.VALID_REGEXP_PATTERN) ? "valid" : "unvalid"; @@ -1014,9 +1010,9 @@ namespace FFXIV_Vibe_Plugin { - if(this._tmp_currentPatternNameToAdd.Trim() != "" && this._tmp_currentPatternValueState == "valid") { + if (this._tmp_currentPatternNameToAdd.Trim() != "" && this._tmp_currentPatternValueState == "valid") { ImGui.TableNextColumn(); - if(ImGui.Button("Save")) { + if (ImGui.Button("Save")) { Pattern newPattern = new(this._tmp_currentPatternNameToAdd, this._tmp_currentPatternValueToAdd); this.Patterns.AddCustomPattern(newPattern); this.ConfigurationProfile.PatternList = this.Patterns.GetCustomPatterns(); @@ -1028,7 +1024,7 @@ namespace FFXIV_Vibe_Plugin { } ImGui.TableNextRow(); - if(this._tmp_currentPatternValueState == "unvalid") { + if (this._tmp_currentPatternValueState == "unvalid") { ImGui.TableNextColumn(); ImGui.TextColored(ImGuiColors.DalamudRed, "WRONG FORMAT!"); ImGui.TableNextColumn(); @@ -1044,7 +1040,7 @@ namespace FFXIV_Vibe_Plugin { ImGui.Separator(); - if(customPatterns.Count == 0) { + if (customPatterns.Count == 0) { ImGui.Text("No custom patterns, please add some"); } else { ImGui.TextColored(ImGuiColors.DalamudViolet, "Custom Patterns:"); @@ -1064,31 +1060,31 @@ namespace FFXIV_Vibe_Plugin { ImGui.TableNextRow(); - for(int patternIndex = 0; patternIndex < customPatterns.Count; patternIndex++) { + for (int patternIndex = 0; patternIndex < customPatterns.Count; patternIndex++) { Pattern pattern = customPatterns[patternIndex]; - if(!Helpers.RegExpMatch(this.Logger, pattern.Name, this.CURRENT_PATTERN_SEARCHBAR)) { + if (!Helpers.RegExpMatch(this.Logger, pattern.Name, this.CURRENT_PATTERN_SEARCHBAR)) { continue; } ImGui.TableNextColumn(); ImGui.Text($"{pattern.Name}"); - if(ImGui.IsItemHovered()) { + if (ImGui.IsItemHovered()) { ImGui.SetTooltip($"{pattern.Name}"); } ImGui.TableNextColumn(); string valueShort = pattern.Value; - if(valueShort.Length > 70) { + if (valueShort.Length > 70) { valueShort = $"{valueShort[..70]}..."; } ImGui.Text(valueShort); - if(ImGui.IsItemHovered()) { + if (ImGui.IsItemHovered()) { ImGui.SetTooltip($"{pattern.Value}"); } ImGui.TableNextColumn(); - if(ImGuiComponents.IconButton(patternIndex, Dalamud.Interface.FontAwesomeIcon.Trash)) { + if (ImGuiComponents.IconButton(patternIndex, Dalamud.Interface.FontAwesomeIcon.Trash)) { bool ok = this.Patterns.RemoveCustomPattern(pattern); - if(!ok) { + if (!ok) { this.Logger.Error($"Could not remove pattern {pattern.Name}"); } else { List newPatternList = this.Patterns.GetCustomPatterns(); @@ -1097,7 +1093,7 @@ namespace FFXIV_Vibe_Plugin { } } ImGui.SameLine(); - if(ImGuiComponents.IconButton(patternIndex, Dalamud.Interface.FontAwesomeIcon.Pen)) { + if (ImGuiComponents.IconButton(patternIndex, Dalamud.Interface.FontAwesomeIcon.Pen)) { this._tmp_currentPatternNameToAdd = pattern.Name; this._tmp_currentPatternValueToAdd = pattern.Value; this._tmp_currentPatternValueState = "valid"; diff --git a/FFXIV_Vibe_Plugin/FFXIV_Vibe_Plugin.csproj b/FFXIV_Vibe_Plugin/FFXIV_Vibe_Plugin.csproj index 64c578b..008eba7 100644 --- a/FFXIV_Vibe_Plugin/FFXIV_Vibe_Plugin.csproj +++ b/FFXIV_Vibe_Plugin/FFXIV_Vibe_Plugin.csproj @@ -1,12 +1,12 @@ - - - 0.0.0.1 - A sample plugin. - - https://github.com/goatcorp/SamplePlugin + KacieXX + Karsian + 1.7.0.1 + A plugin to help you vibe your controller or toys + kacieXX 2023 + https://github.com/kaciexx/FFXIV_Vibe_Plugin @@ -21,9 +21,9 @@ - + PreserveNewest - false + true diff --git a/FFXIV_Vibe_Plugin/Plugin.cs b/FFXIV_Vibe_Plugin/Plugin.cs index c0f96e8..f3e105e 100644 --- a/FFXIV_Vibe_Plugin/Plugin.cs +++ b/FFXIV_Vibe_Plugin/Plugin.cs @@ -7,7 +7,6 @@ using Dalamud.Game.Network; using Dalamud.Interface.Windowing; using Dalamud.IoC; using Dalamud.Plugin; -using FFXIV_Vibe_Plugin.Windows; using System.IO; namespace FFXIV_Vibe_Plugin { @@ -42,14 +41,7 @@ namespace FFXIV_Vibe_Plugin { this.CommandManager = commandManager; this.Configuration = this.PluginInterface.GetPluginConfig() as Configuration ?? new Configuration(); - this.Configuration.Initialize(this.PluginInterface); - - // you might normally want to embed resources and load them from the manifest stream - var imagePath = Path.Combine(PluginInterface.AssemblyLocation.Directory?.FullName!, "logo.png"); - var logoImage = this.PluginInterface.UiBuilder.LoadImage(imagePath); - - WindowSystem.AddWindow(new ConfigWindow(this)); - WindowSystem.AddWindow(new MainWindow(this, logoImage)); + this.Configuration.Initialize(this.PluginInterface); this.CommandManager.AddHandler(CommandName, new CommandInfo(OnCommand) { HelpMessage = "A vibe plugin for fun..." @@ -59,7 +51,10 @@ namespace FFXIV_Vibe_Plugin { this.PluginInterface.UiBuilder.OpenConfigUi += DrawConfigUI; // Init our own app - this.app = new FFXIV_Vibe_Plugin.App(CommandName, ShortName, gameNetwork, clientState, dataManager, DalamudChat, Configuration, scanner, gameObjects, pluginInterface); + this.app = new FFXIV_Vibe_Plugin.App(this, CommandName, ShortName, gameNetwork, clientState, dataManager, DalamudChat, Configuration, scanner, gameObjects, pluginInterface); + + // Setting the windows + WindowSystem.AddWindow(this.app.PluginUi); } public void Dispose() { @@ -70,18 +65,15 @@ namespace FFXIV_Vibe_Plugin { private void OnCommand(string command, string args) { - // in response to the slash command, just display our main ui - WindowSystem.GetWindow("My Amazing Window").IsOpen = true; this.app.OnCommand(command, args); } private void DrawUI() { - this.WindowSystem.Draw(); - this.app.DrawUI(); + this.WindowSystem.Draw(); } public void DrawConfigUI() { - WindowSystem.GetWindow("A Wonderful Configuration Window").IsOpen = true; + WindowSystem.GetWindow("FFXIV_Vibe_Plugin_UI").IsOpen = true; } } } diff --git a/FFXIV_Vibe_Plugin/Windows/ConfigWindow.cs b/FFXIV_Vibe_Plugin/Windows/ConfigWindow.cs deleted file mode 100644 index d09287a..0000000 --- a/FFXIV_Vibe_Plugin/Windows/ConfigWindow.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Windowing; -using ImGuiNET; - -namespace FFXIV_Vibe_Plugin.Windows; - -public class ConfigWindow : Window, IDisposable { - private Configuration Configuration; - - public ConfigWindow(Plugin plugin) : base( - "A Wonderful Configuration Window", - ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoCollapse | ImGuiWindowFlags.NoScrollbar | - ImGuiWindowFlags.NoScrollWithMouse) { - this.Size = new Vector2(232, 75); - this.SizeCondition = ImGuiCond.Always; - - this.Configuration = plugin.Configuration; - } - - public void Dispose() { } - - public override void Draw() { - // can't ref a property, so use a local copy - /*var configValue = this.Configuration.SomePropertyToBeSavedAndWithADefault; - if (ImGui.Checkbox("Random Config Bool", ref configValue)) { - this.Configuration.SomePropertyToBeSavedAndWithADefault = configValue; - // can save immediately on change, if you don't want to provide a "Save and Close" button - this.Configuration.Save(); - }*/ - } -} diff --git a/FFXIV_Vibe_Plugin/Windows/MainWindow.cs b/FFXIV_Vibe_Plugin/Windows/MainWindow.cs deleted file mode 100644 index c047068..0000000 --- a/FFXIV_Vibe_Plugin/Windows/MainWindow.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Numerics; -using Dalamud.Interface.Windowing; -using ImGuiNET; -using ImGuiScene; - -namespace FFXIV_Vibe_Plugin.Windows; - -public class MainWindow : Window, IDisposable { - private TextureWrap GoatImage; - private Plugin Plugin; - - public MainWindow(Plugin plugin, TextureWrap goatImage) : base( - "My Amazing Window", ImGuiWindowFlags.NoScrollbar | ImGuiWindowFlags.NoScrollWithMouse) { - this.SizeConstraints = new WindowSizeConstraints { - MinimumSize = new Vector2(375, 330), - MaximumSize = new Vector2(float.MaxValue, float.MaxValue) - }; - - this.GoatImage = goatImage; - this.Plugin = plugin; - } - - public void Dispose() { - this.GoatImage.Dispose(); - } - - public override void Draw() { - /*ImGui.Text($"The random config bool is {this.Plugin.Configuration.SomePropertyToBeSavedAndWithADefault}");*/ - - if (ImGui.Button("Show Settings")) { - this.Plugin.DrawConfigUI(); - } - - ImGui.Spacing(); - - ImGui.Text("Have a goat:"); - ImGui.Indent(55); - ImGui.Image(this.GoatImage.ImGuiHandle, new Vector2(this.GoatImage.Width, this.GoatImage.Height)); - ImGui.Unindent(55); - } -} diff --git a/README.md b/README.md index 4e18bf3..d466331 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@

- +

A plugin for FFXIV that will let you vibe your controller or toys. diff --git a/Data/logo.png b/images/icon.png similarity index 100% rename from Data/logo.png rename to images/icon.png diff --git a/repo.json b/repo.json index 60dbfc7..6dac387 100644 --- a/repo.json +++ b/repo.json @@ -13,7 +13,7 @@ "wave" ], "DalamudApiLevel": 7, - "IconUrl": "https://github.com/kaciexx/FFXIV_Vibe_Plugin/raw/master/Data/logo.png", + "IconUrl": "https://github.com/kaciexx/FFXIV_Vibe_Plugin/raw/master/images/logo.png", "IsHide": "False", "IsTestingExclusive": "False", "LastUpdated": 1662225133,