From aaa1d8db6cde7f2606e1818c82240aeda1c2d61c Mon Sep 17 00:00:00 2001 From: ericoporto Date: Tue, 28 Jan 2020 02:45:42 +0000 Subject: [PATCH] initial version of the plugin based on the Sample Plugin Getting tons of errors and warnings, need to fix at some point. --- agsget/agsget/Core/agsgetCore.csproj | 11 +- .../agsget/EditorPlugin/AGS.Plugin.AgsGet.sln | 44 +++++++ .../AGS.Plugin.AgsGet.csproj | 32 ++++- .../AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln | 25 ---- .../AGS.Plugin.AgsGet/AgsGet.Designer.cs | 84 ++++++++++++ .../AGS.Plugin.AgsGet/AgsGetComponent.cs | 114 +++++++++++++++++ .../AGS.Plugin.AgsGet/AgsGetPane.cs | 33 +++++ .../AGS.Plugin.AgsGet/AgsGetPane.resx | 120 ++++++++++++++++++ .../AGS.Plugin.AgsGet/PluginIcon.ico | Bin 0 -> 1406 bytes .../AGS.Plugin.AgsGet/PluginMain.cs | 1 + 10 files changed, 434 insertions(+), 30 deletions(-) create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet.sln delete mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGet.Designer.cs create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.cs create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.resx create mode 100644 agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginIcon.ico diff --git a/agsget/agsget/Core/agsgetCore.csproj b/agsget/agsget/Core/agsgetCore.csproj index 24eaa3f..5367dfa 100644 --- a/agsget/agsget/Core/agsgetCore.csproj +++ b/agsget/agsget/Core/agsgetCore.csproj @@ -1,10 +1,10 @@ - + - Exe - netcoreapp3.1 + Library + net45 true - win-x64 + win-x86 agsget 8 agsget @@ -14,6 +14,9 @@ git true agsget is a package getter for Adventure Game Studio resources. + + + AnyCPU;x86 diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet.sln b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet.sln new file mode 100644 index 0000000..3a41333 --- /dev/null +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet.sln @@ -0,0 +1,44 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AGS.Plugin.AgsGet", "AGS.Plugin.AgsGet\AGS.Plugin.AgsGet.csproj", "{540DA59C-39F9-4B95-B2C0-8458FF7E0B95}" + ProjectSection(ProjectDependencies) = postProject + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B} = {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B} + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "agsgetCore", "..\Core\agsgetCore.csproj", "{CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|Any CPU.Build.0 = Debug|Any CPU + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|x86.ActiveCfg = Release|x86 + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|x86.Build.0 = Release|x86 + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|Any CPU.ActiveCfg = Release|Any CPU + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|Any CPU.Build.0 = Release|Any CPU + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|x86.ActiveCfg = Release|x86 + {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|x86.Build.0 = Release|x86 + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Debug|x86.ActiveCfg = Release|x86 + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Debug|x86.Build.0 = Release|x86 + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Release|Any CPU.Build.0 = Release|Any CPU + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Release|x86.ActiveCfg = Release|x86 + {CC9603CE-4260-4DA7-BF6C-131DECC5BE5B}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {48CB1F02-43D3-4BA3-9247-9BDBCC3A3D6D} + EndGlobalSection +EndGlobal diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.csproj b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.csproj index a206077..d3ed552 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.csproj +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.csproj @@ -1,13 +1,43 @@  - netstandard2.0 + net45 + eri0o + Myths Untold + Copyright © eri0o, 2020 + PluginIcon.ico + Library + + AnyCPU;x86 + + + + + + + /Program Files (x86)/Adventure Game Studio 3.5.0/AGS.Types.dll + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln deleted file mode 100644 index dc77121..0000000 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AGS.Plugin.AgsGet", "AGS.Plugin.AgsGet.csproj", "{540DA59C-39F9-4B95-B2C0-8458FF7E0B95}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Debug|Any CPU.Build.0 = Debug|Any CPU - {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|Any CPU.ActiveCfg = Release|Any CPU - {540DA59C-39F9-4B95-B2C0-8458FF7E0B95}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {48CB1F02-43D3-4BA3-9247-9BDBCC3A3D6D} - EndGlobalSection -EndGlobal diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGet.Designer.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGet.Designer.cs new file mode 100644 index 0000000..d587906 --- /dev/null +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGet.Designer.cs @@ -0,0 +1,84 @@ +namespace AGS.Plugin.AgsGet +{ + partial class AgsGetPane + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.btnShowGameData = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 44); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(227, 13); + this.label1.TabIndex = 0; + this.label1.Text = "The text below will be saved into the game file:"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(16, 60); + this.textBox1.Multiline = true; + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(347, 179); + this.textBox1.TabIndex = 1; + this.textBox1.Text = "Type random stuff in me"; + // + // btnShowGameData + // + this.btnShowGameData.Location = new System.Drawing.Point(16, 10); + this.btnShowGameData.Name = "btnShowGameData"; + this.btnShowGameData.Size = new System.Drawing.Size(181, 25); + this.btnShowGameData.TabIndex = 2; + this.btnShowGameData.Text = "Show game information"; + this.btnShowGameData.UseVisualStyleBackColor = true; + this.btnShowGameData.Click += new System.EventHandler(this.btnShowGameData_Click); + // + // AgsGetPane + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnShowGameData); + this.Controls.Add(this.textBox1); + this.Controls.Add(this.label1); + this.Name = "AgsGetPane"; + this.Size = new System.Drawing.Size(388, 260); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Button btnShowGameData; + } +} diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs new file mode 100644 index 0000000..16c3737 --- /dev/null +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs @@ -0,0 +1,114 @@ +using AGS.Types; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Text; + +namespace AGS.Plugin.AgsGet +{ + public class AgsGetComponent : IEditorComponent + { + /* MAKE SURE THAT YOU CHANGE THE ID's BELOW TO APPROPRIATE NAMES + * FOR YOUR PLUGIN. + * If you leave them as they are, they could conflict with another + * plugin that has also left them alone, and your plugins would not + * work together. + */ + private const string COMPONENT_ID = "AgsGetComponent"; + private const string CONTROL_ID_CONTEXT_MENU_OPTION = "AgsGetPluginOptionClick"; + private const string CONTROL_ID_ROOT_NODE = "AgsGetPluginRoot"; + private const string CONTROL_ID_MAIN_MENU_OPTION = "AgsGetPluginMainMenuOptionClick"; + private const string NEW_MAIN_MENU_ID = "AgsGetPluginMenu"; + + private IAGSEditor _editor; + private ContentDocument _pane; + private MenuCommands _mainMenuItems; + + public AgsGetComponent(IAGSEditor editor) + { + _editor = editor; + _editor.GUIController.RegisterIcon("AgsGetPluginIcon", GetIcon("PluginIcon.ico")); + _editor.GUIController.ProjectTree.AddTreeRoot(this, CONTROL_ID_ROOT_NODE, "AgsGet plugin", "AgsGetPluginIcon"); + _pane = new ContentDocument(new AgsGetPane(editor), "Plugin pane", this); + + _mainMenuItems = new MenuCommands(NEW_MAIN_MENU_ID); + _mainMenuItems.Commands.Add(new MenuCommand(CONTROL_ID_MAIN_MENU_OPTION, "Main menu option")); + _editor.GUIController.AddMenu(this, NEW_MAIN_MENU_ID, "AgsGetPlugin", _editor.GUIController.FileMenuID); + _editor.GUIController.AddMenuItems(this, _mainMenuItems); + } + + private Icon GetIcon(string fileName) + { + return new Icon(this.GetType(), fileName); + } + + string IEditorComponent.ComponentID + { + get { return COMPONENT_ID; } + } + + IList IEditorComponent.GetContextMenu(string controlID) + { + List contextMenu = new List(); + contextMenu.Add(new MenuCommand(CONTROL_ID_CONTEXT_MENU_OPTION, "AgsGet context menu option")); + return contextMenu; + } + + void IEditorComponent.CommandClick(string controlID) + { + if (controlID == CONTROL_ID_CONTEXT_MENU_OPTION) + { + _editor.GUIController.ShowMessage("You clicked the context menu option!", MessageBoxIconType.Information); + } + else if (controlID == CONTROL_ID_MAIN_MENU_OPTION) + { + _editor.GUIController.ShowMessage("You clicked the main menu option!", MessageBoxIconType.Information); + } + else if (controlID == CONTROL_ID_ROOT_NODE) + { + _editor.GUIController.AddOrShowPane(_pane); + } + } + + void IEditorComponent.PropertyChanged(string propertyName, object oldValue) + { + } + + void IEditorComponent.BeforeSaveGame() + { + } + + void IEditorComponent.RefreshDataFromGame() + { + // A new game has been loaded, so remove the existing pane + _editor.GUIController.RemovePaneIfExists(_pane); + } + + void IEditorComponent.GameSettingsChanged() + { + } + + void IEditorComponent.ToXml(System.Xml.XmlTextWriter writer) + { + writer.WriteElementString("TextBoxContents", ((AgsGetPane)_pane.Control).TextBoxContents); + } + + void IEditorComponent.FromXml(System.Xml.XmlNode node) + { + if (node == null) + { + // node will be null if loading a 2.72 game or if + // the game hasn't used this plugin before + ((AgsGetPane)_pane.Control).TextBoxContents = "Default text"; + } + else + { + ((AgsGetPane)_pane.Control).TextBoxContents = node.SelectSingleNode("TextBoxContents").InnerText; + } + } + + void IEditorComponent.EditorShutdown() + { + } + } +} diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.cs new file mode 100644 index 0000000..b9fe9c5 --- /dev/null +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.cs @@ -0,0 +1,33 @@ +using AGS.Types; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Text; +using System.Windows.Forms; + +namespace AGS.Plugin.AgsGet +{ + public partial class AgsGetPane : EditorContentPanel + { + private IAGSEditor _editor; + + public AgsGetPane(IAGSEditor editor) + { + InitializeComponent(); + _editor = editor; + } + + public string TextBoxContents + { + get { return textBox1.Text; } + set { textBox1.Text = value; } + } + + private void btnShowGameData_Click(object sender, EventArgs e) + { + _editor.GUIController.ShowMessage("The game name is: " + _editor.CurrentGame.Settings.GameName, MessageBoxIconType.Information); + } + } +} diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.resx b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginIcon.ico b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginIcon.ico new file mode 100644 index 0000000000000000000000000000000000000000..66536d84e56150e4a7e9c79215349d590bee30a9 GIT binary patch literal 1406 zcmZQzU<5(|0R|w+!H~hqz#zuJz@P!dKp_SNAO?wp07woS2-cQm2v)6Q2yACyFbi7E z;2$2(aQyHgh8G|IGx#$6XJAjIY9`h6iEY! z4dH`L05hR{ptDf85QPviun9l`6dqI%O#KHIVGZ^`Yzf2$P;3aK^^veS1H*xG28IXU W85lmkXJGg}pMl{|J+LeU>IDFUVlDgt literal 0 HcmV?d00001 diff --git a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginMain.cs b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginMain.cs index 65714ea..d03e324 100644 --- a/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginMain.cs +++ b/agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/PluginMain.cs @@ -13,6 +13,7 @@ public class PluginMain : AGS.Types.IAGSEditorPlugin public PluginMain(IAGSEditor editor) { _editor = editor; + _editor.AddComponent(new AgsGetComponent(editor)); }