Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions Assets/Game/Addons/ModSupport/ModLoaderInterfaceWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -147,23 +149,23 @@ 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");
increaseLoadOrderButton.OnMouseClick += IncreaseLoadOrderButton_OnMouseClick;
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");
decreaseLoadOrderButton.OnMouseClick += DecreaseLoadOrderButton_OnMouseClick;
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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions Assets/StreamingAssets/Text/ModSystem.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down