Magically import images and more into Gamecraft as blocks
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.

69 lines
2.0KB

  1. using System;
  2. using System.Reflection;
  3. using System.IO;
  4. using System.Runtime.CompilerServices;
  5. using UnityEngine;
  6. using Unity.Mathematics; // float3
  7. using IllusionPlugin;
  8. using GamecraftModdingAPI.Utility;
  9. using Pixi.Common;
  10. using Pixi.Images;
  11. using Pixi.Robots;
  12. namespace Pixi
  13. {
  14. public class PixiPlugin : IPlugin // the Illusion Plugin Architecture (IPA) will ignore classes that don't implement IPlugin'
  15. {
  16. public string Name { get; } = Assembly.GetExecutingAssembly().GetName().Name; // Pixi
  17. // To change the name, change the project's name
  18. public string Version { get; } = Assembly.GetExecutingAssembly().GetName().Version.ToString();
  19. // To change the version, change <Version>#.#.#</Version> in Pixi.csproj
  20. // called when Gamecraft shuts down
  21. public void OnApplicationQuit()
  22. {
  23. // Shutdown this mod
  24. Logging.LogDebug($"{Name} has shutdown");
  25. // Shutdown the Gamecraft modding API last
  26. GamecraftModdingAPI.Main.Shutdown();
  27. }
  28. // called when Gamecraft starts up
  29. public void OnApplicationStart()
  30. {
  31. // Initialize the Gamecraft modding API first
  32. GamecraftModdingAPI.Main.Init();
  33. // check out the modding API docs here: https://mod.exmods.org/
  34. // Initialize Pixi mod
  35. CommandRoot root = new CommandRoot();
  36. // 2D Image Functionality
  37. root.Inject(new ImageCanvasImporter());
  38. root.Inject(new ImageTextBlockImporter());
  39. root.Inject(new ImageCommandImporter());
  40. // Robot functionality
  41. root.Inject(new RobotInternetImporter());
  42. //RobotCommands.CreateRobotCRFCommand();
  43. //RobotCommands.CreateRobotFileCommand();
  44. #if DEBUG
  45. // Development functionality
  46. RobotCommands.CreatePartDumpCommand();
  47. #endif
  48. }
  49. // unused methods
  50. public void OnFixedUpdate() { } // called once per physics update
  51. public void OnLevelWasInitialized(int level) { } // called after a level is initialized
  52. public void OnLevelWasLoaded(int level) { } // called after a level is loaded
  53. public void OnUpdate() { } // called once per rendered frame (frame update)
  54. }
  55. }