Update to GamecraftModdingAPI v1.0

This commit is contained in:
NGnius (Graham) 2020-05-22 15:02:23 -04:00
parent ff64700784
commit 0cca5543c7
2 changed files with 24 additions and 16 deletions

View file

@ -11,7 +11,11 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Lib.Harmony" Version="1.2.0.1" /> <PackageReference Include="Lib.Harmony" Version="2.0.0.10" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<!--Start Dependencies--> <!--Start Dependencies-->
@ -364,6 +368,14 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Blocks.TimerBlock.dll</HintPath>
</Reference> </Reference>
<Reference Include="Gamecraft.CharacterVulnerability">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerability.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.CharacterVulnerabilityGui">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.CharacterVulnerabilityGui.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Effects"> <Reference Include="Gamecraft.Effects">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Effects.dll</HintPath>
@ -392,6 +404,10 @@
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.Wires.Mockup.dll</HintPath>
</Reference> </Reference>
<Reference Include="Gamecraft.GUI.WorldSpaceGuis">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.GUI.WorldSpaceGuis.dll</HintPath>
</Reference>
<Reference Include="Gamecraft.Tweaks"> <Reference Include="Gamecraft.Tweaks">
<HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\Gamecraft.Tweaks.dll</HintPath>
@ -780,7 +796,6 @@
<HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
<HintPath>..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath> <HintPath>..\..\ref\Gamecraft_Data\Managed\VisualProfiler.dll</HintPath>
</Reference> </Reference>
<Reference Include="Microsoft.CSharp" />
</ItemGroup> </ItemGroup>
<!--End Dependencies--> <!--End Dependencies-->

View file

@ -1,8 +1,7 @@
using System.Reflection; using System.Reflection;
using IllusionPlugin; using IllusionPlugin;
// using GamecraftModdingAPI; //using GamecraftModdingAPI;
using GamecraftModdingAPI.Commands;
namespace HelloModdingWorld namespace HelloModdingWorld
{ {
@ -14,8 +13,6 @@ namespace HelloModdingWorld
public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default
// To change the version, change <Version>0.0.1</Version> in HelloModdingWorld.csproj // To change the version, change <Version>0.0.1</Version> in HelloModdingWorld.csproj
private static readonly string helloWorldCommandName = "HelloWorld"; // command name
// called when Gamecraft shuts down // called when Gamecraft shuts down
public void OnApplicationQuit() public void OnApplicationQuit()
{ {
@ -34,18 +31,14 @@ namespace HelloModdingWorld
// check out the modding API docs here: https://mod.exmods.org/ // check out the modding API docs here: https://mod.exmods.org/
// Initialize this mod // Initialize this mod
// create SimpleCustomCommandEngine // create HelloWorld command
// this writes "Hello modding world!" when you execute it in Gamecraft's console // this writes "Hello modding world!" when you execute it in Gamecraft's console
// (use the forward-slash key '/' to open the console in Gamecraft when in a game) // (use the forward-slash key '/' to open the console in Gamecraft when in a game)
SimpleCustomCommandEngine helloWorldCommand = new SimpleCustomCommandEngine( GamecraftModdingAPI.Commands.CommandBuilder.Builder()
() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); }, // command action .Name("HelloWorld") // command name (used to invoke it in the console)
// also try using CommandLogWarning or CommandLogError instead of CommandLog .Description("Says Hello modding world!") // command description (displayed in help and hint toolbar)
helloWorldCommandName, // command name (used to invoke it in the console) .Action(() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); })
"Says Hello modding world!" // command description (displayed when help command is executed) .Build(); // construct and automatically register the command so the modding API knows about it
); // this command can also be executed using the Command Computer
// register the command so the modding API knows about it
CommandManager.AddCommand(helloWorldCommand);
GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up"); GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has started up");
} }