Experimental re-imagining of Pixi with less C#
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.1KB

  1. using System.Reflection;
  2. using IllusionPlugin;
  3. //using GamecraftModdingAPI;
  4. namespace HelloModdingWorld
  5. {
  6. public class MyPlugin : IEnhancedPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
  7. {
  8. public override string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // HelloModdingWorld by default
  9. // To change the name, change the project's name
  10. public override string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString(); // 0.0.1 by default
  11. // To change the version, change <Version>0.0.1</Version> in HelloModdingWorld.csproj
  12. // called when Gamecraft shuts down
  13. public override void OnApplicationQuit()
  14. {
  15. // Shutdown this mod
  16. GamecraftModdingAPI.Utility.Logging.LogDebug($"{Name} has shutdown");
  17. // Shutdown the Gamecraft modding API last
  18. GamecraftModdingAPI.Main.Shutdown();
  19. }
  20. // called when Gamecraft starts up
  21. public override void OnApplicationStart()
  22. {
  23. // Initialize the Gamecraft modding API first
  24. GamecraftModdingAPI.Main.Init();
  25. // check out the modding API docs here: https://mod.exmods.org/
  26. // Initialize this mod
  27. // create HelloWorld command
  28. // this writes "Hello modding world!" when you execute it in Gamecraft's console
  29. // (use the forward-slash key '/' to open the console in Gamecraft when in a game)
  30. GamecraftModdingAPI.Commands.CommandBuilder.Builder()
  31. .Name("HelloWorld") // command name (used to invoke it in the console)
  32. .Description("Says Hello modding world!") // command description (displayed in help and hint toolbar)
  33. .Action(() => { GamecraftModdingAPI.Utility.Logging.CommandLog("Hello modding world!"); })
  34. .Build(); // construct and automatically register the command so the modding API knows about it
  35. GamecraftModdingAPI.Utility.Logging.MetaLog($"{Name} has started up");
  36. }
  37. // unused methods
  38. public override void OnFixedUpdate() { } // called once per physics update
  39. public override void OnUpdate() { } // called once per rendered frame (frame update)
  40. }
  41. }