Skip to content

Commit

Permalink
initial version of the plugin based on the Sample Plugin
Browse files Browse the repository at this point in the history
Getting tons of errors and warnings, need to fix at some point.
  • Loading branch information
ericoporto committed Jan 28, 2020
1 parent 85b6bbd commit aaa1d8d
Show file tree
Hide file tree
Showing 10 changed files with 434 additions and 30 deletions.
11 changes: 7 additions & 4 deletions agsget/agsget/Core/agsgetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<OutputType>Library</OutputType>
<TargetFramework>net45</TargetFramework>
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
<AssemblyName>agsget</AssemblyName>
<LangVersion>8</LangVersion>
<Title>agsget</Title>
Expand All @@ -14,6 +14,9 @@
<RepositoryType>git</RepositoryType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>agsget is a package getter for Adventure Game Studio resources.</Description>
<ApplicationIcon />
<StartupObject />
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>


Expand Down
44 changes: 44 additions & 0 deletions agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet.sln
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,13 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net45</TargetFramework>
<Authors>eri0o</Authors>
<Company>Myths Untold</Company>
<Copyright>Copyright © eri0o, 2020</Copyright>
<ApplicationIcon>PluginIcon.ico</ApplicationIcon>
<OutputType>Library</OutputType>
<StartupObject />
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>

<ItemGroup>
<Reference Include="AGS.Types">
<HintPath>/Program Files (x86)/Adventure Game Studio 3.5.0/AGS.Types.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="PluginIcon.ico" />

</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>


<Target Name="ILMerge">
<!-- the ILMergePath property points to the location of ILMerge.exe console application -->
<Exec Command="$(ILMergeConsolePath) Bin\x64\Release\AGS.Plugin.AgsGet-final.dll /out:myapp.exe Bin\x64\Release\AGS.Plugin.AgsGet.dll \..\..\Core\Bin\Release\net45\win-x64\agsget.dll " />
</Target>

</Project>
25 changes: 0 additions & 25 deletions agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AGS.Plugin.AgsGet.sln

This file was deleted.

84 changes: 84 additions & 0 deletions agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGet.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

114 changes: 114 additions & 0 deletions agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetComponent.cs
Original file line number Diff line number Diff line change
@@ -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<MenuCommand> IEditorComponent.GetContextMenu(string controlID)
{
List<MenuCommand> contextMenu = new List<MenuCommand>();
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()
{
}
}
}
33 changes: 33 additions & 0 deletions agsget/agsget/EditorPlugin/AGS.Plugin.AgsGet/AgsGetPane.cs
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
Loading

0 comments on commit aaa1d8d

Please sign in to comment.