diff --git a/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs b/Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs index c368f61ffa..467c9e3265 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}) - 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(); + 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