From ce3cdfa5c4ab9f98fb6e86da323fc44b675cf95b Mon Sep 17 00:00:00 2001 From: Pierre Etchemaite Date: Mon, 11 Nov 2024 04:20:12 +0100 Subject: [PATCH 1/3] Add a button to copy modlist to the clipboard Should help with exchanging mod lists --- .../ModSupport/ModLoaderInterfaceWindow.cs | 41 +++++++++++++++++-- Assets/StreamingAssets/Text/ModSystem.txt | 3 ++ 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs index c368f61ffa..78be639812 100644 --- a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs +++ b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs @@ -19,6 +19,7 @@ using DaggerfallWorkshop.Game.UserInterfaceWindows; using DaggerfallWorkshop.Game.Utility.ModSupport; using DaggerfallWorkshop.Game.Utility.ModSupport.ModSettings; +using System.Text; public class ModLoaderInterfaceWindow : DaggerfallPopupWindow { @@ -52,6 +53,7 @@ struct ModSettings readonly Button refreshButton = new Button(); readonly Button enableAllButton = new Button(); readonly Button disableAllButton = new Button(); + readonly Button copyToClipboardButton = new Button(); readonly Button saveAndCloseButton = new Button(); readonly Button extractFilesButton = new Button(); readonly Button showModDescriptionButton = new Button(); @@ -147,7 +149,7 @@ protected override void Setup() ModListPanel.Components.Add(backButton); increaseLoadOrderButton.Size = new Vector2(40, 12); - increaseLoadOrderButton.Position = new Vector2(62, 150); + increaseLoadOrderButton.Position = new Vector2(42, 150); increaseLoadOrderButton.Outline.Enabled = true; increaseLoadOrderButton.BackgroundColor = textColor; increaseLoadOrderButton.Label.Text = ModManager.GetText("increase"); @@ -155,7 +157,7 @@ protected override void Setup() ModListPanel.Components.Add(increaseLoadOrderButton); decreaseLoadOrderButton.Size = new Vector2(40, 12); - decreaseLoadOrderButton.Position = new Vector2(21, 150); + decreaseLoadOrderButton.Position = new Vector2(1, 150); decreaseLoadOrderButton.Outline.Enabled = true; decreaseLoadOrderButton.BackgroundColor = textColor; decreaseLoadOrderButton.Label.Text = ModManager.GetText("lower"); @@ -163,7 +165,7 @@ protected override void Setup() ModListPanel.Components.Add(decreaseLoadOrderButton); enableAllButton.Size = new Vector2(40, 12); - enableAllButton.Position = new Vector2(21, 163); + enableAllButton.Position = new Vector2(1, 163); enableAllButton.Outline.Enabled = true; enableAllButton.BackgroundColor = textColor; enableAllButton.VerticalAlignment = VerticalAlignment.Bottom; @@ -173,7 +175,7 @@ protected override void Setup() ModListPanel.Components.Add(enableAllButton); disableAllButton.Size = new Vector2(40, 12); - disableAllButton.Position = new Vector2(62, 163); + disableAllButton.Position = new Vector2(42, 163); disableAllButton.Outline.Enabled = true; disableAllButton.BackgroundColor = textColor; disableAllButton.VerticalAlignment = VerticalAlignment.Bottom; @@ -182,6 +184,16 @@ protected override void Setup() disableAllButton.OnMouseClick += DisableAllButton_OnMouseClick; ModListPanel.Components.Add(disableAllButton); + copyToClipboardButton.Size = new Vector2(36, 12); + copyToClipboardButton.Position = new Vector2(83, 163); + copyToClipboardButton.Outline.Enabled = true; + copyToClipboardButton.BackgroundColor = textColor; + disableAllButton.VerticalAlignment = VerticalAlignment.Bottom; + copyToClipboardButton.Label.Text = ModManager.GetText("copyToClipboard"); + copyToClipboardButton.ToolTipText = ModManager.GetText("copyToClipboardInfo"); + copyToClipboardButton.OnMouseClick += CopyToClipboardButton_OnMouseClick; + ModListPanel.Components.Add(copyToClipboardButton); + //Add main mod panel ModPanel.Outline.Enabled = true; ModPanel.BackgroundColor = backgroundColor; @@ -682,6 +694,27 @@ void DisableAllButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) UpdateModPanel(); } + private void CopyToClipboardButton_OnMouseClick(BaseScreenComponent sender, Vector2 position) + { + StringBuilder text = new StringBuilder(); + text.Append(String.Format("{0} {1} {2}\r\n", VersionInfo.DaggerfallUnityProductName, VersionInfo.DaggerfallUnityStatus, VersionInfo.DaggerfallUnityVersion)); + for (int i = 0; i < modSettings.Length; i++) + { + text.Append(String.Format("[{0}] {1} ({2})\r\n", modSettings[i].enabled ? 'x' : ' ', modSettings[i].modInfo.ModTitle, modSettings[i].modInfo.ModVersion)); + } + UnityEngine.TextEditor textEditor = new UnityEngine.TextEditor(); + textEditor.text = text.ToString(); + textEditor.SelectAll(); + textEditor.Copy(); + + DaggerfallMessageBox CopiedToClipboardMessageBox = new DaggerfallMessageBox(uiManager, this, true); + CopiedToClipboardMessageBox.ClickAnywhereToClose = true; + CopiedToClipboardMessageBox.ParentPanel.BackgroundTexture = null; + + CopiedToClipboardMessageBox.SetText(ModManager.GetText("modsCopiedToClipboard")); + uiManager.PushWindow(CopiedToClipboardMessageBox); + } + void ShowModDescriptionPopUp_OnMouseClick(BaseScreenComponent sender, Vector2 position) { if (modSettings == null || modSettings.Length < 1) diff --git a/Assets/StreamingAssets/Text/ModSystem.txt b/Assets/StreamingAssets/Text/ModSystem.txt index bf8b455b59..27d2a20771 100644 --- a/Assets/StreamingAssets/Text/ModSystem.txt +++ b/Assets/StreamingAssets/Text/ModSystem.txt @@ -26,6 +26,9 @@ enableAll, ALL ON enableAllInfo, Enable All Mods disableAll, ALL OFF disableAllInfo, Disable All Mods +copyToClipboard, ->Clipboard +copyToClipboardInfo, Copy the list of mods to the host clipboard +modsCopiedToClipboard, List of mods copied to clipboard enabled, Enabled enabledInfo, Toggle Mod refresh, Refresh From adbedc357061a59da3c650af3451fe602df95e0e Mon Sep 17 00:00:00 2001 From: Pierre Etchemaite Date: Thu, 9 Apr 2026 23:16:15 +0200 Subject: [PATCH 2/3] Adding mods GUIDs By popular demand, adding mods GUIDs to clipboard output --- Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs index 78be639812..3cb7e1f424 100644 --- a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs +++ b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs @@ -700,7 +700,7 @@ private void CopyToClipboardButton_OnMouseClick(BaseScreenComponent sender, Vect text.Append(String.Format("{0} {1} {2}\r\n", VersionInfo.DaggerfallUnityProductName, VersionInfo.DaggerfallUnityStatus, VersionInfo.DaggerfallUnityVersion)); for (int i = 0; i < modSettings.Length; i++) { - text.Append(String.Format("[{0}] {1} ({2})\r\n", modSettings[i].enabled ? 'x' : ' ', modSettings[i].modInfo.ModTitle, modSettings[i].modInfo.ModVersion)); + text.Append(String.Format("[{0}] {1} ({2}) (GUID {3})\r\n", modSettings[i].enabled ? 'x' : ' ', modSettings[i].modInfo.ModTitle, modSettings[i].modInfo.ModVersion, modSettings[i].modInfo.GUID)); } UnityEngine.TextEditor textEditor = new UnityEngine.TextEditor(); textEditor.text = text.ToString(); From c94ea9a5d4d6600b5ed75816c04b2fd9c225a1ef Mon Sep 17 00:00:00 2001 From: Pierre Etchemaite Date: Thu, 9 Apr 2026 23:36:06 +0200 Subject: [PATCH 3/3] Replacing parenthesis with dash Matter of taste --- Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs index 3cb7e1f424..467c9e3265 100644 --- a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs +++ b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs @@ -700,7 +700,7 @@ private void CopyToClipboardButton_OnMouseClick(BaseScreenComponent sender, Vect text.Append(String.Format("{0} {1} {2}\r\n", VersionInfo.DaggerfallUnityProductName, VersionInfo.DaggerfallUnityStatus, VersionInfo.DaggerfallUnityVersion)); for (int i = 0; i < modSettings.Length; i++) { - text.Append(String.Format("[{0}] {1} ({2}) (GUID {3})\r\n", modSettings[i].enabled ? 'x' : ' ', modSettings[i].modInfo.ModTitle, modSettings[i].modInfo.ModVersion, modSettings[i].modInfo.GUID)); + text.Append(String.Format("[{0}] {1} ({2}) - GUID {3}\r\n", modSettings[i].enabled ? 'x' : ' ', modSettings[i].modInfo.ModTitle, modSettings[i].modInfo.ModVersion, modSettings[i].modInfo.GUID)); } UnityEngine.TextEditor textEditor = new UnityEngine.TextEditor(); textEditor.text = text.ToString();