ShadowOne.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using UnityEngine;
  2. using GadgetCore.API;
  3. using UnityEngine.SceneManagement;
  4. using GadgetCore.API.ConfigMenu;
  5. using System;
  6. using System.Collections.Generic;
  7. namespace ShadowOne
  8. {
  9. [Gadget("ShadowOne", RequiredOnClients: false)]
  10. public class ShadowOne : Gadget<ShadowOne>
  11. {
  12. public const string MOD_VERSION = "1.2"; // Set this to the version of your mod.
  13. public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.
  14. public override IGadgetConfigMenu GetConfigMenu() { return null; }
  15. public override string GetModDescription()
  16. {
  17. return "A mod that adds the missing shadow to the version number.";
  18. }
  19. protected override void Initialize()
  20. {
  21. Logger.Log("Shadow One v" + Info.Mod.Version);
  22. Core.logger = Logger;
  23. SceneManager.sceneLoaded += OnSceneLoaded;
  24. ChangeMenuText();
  25. }
  26. internal static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
  27. {
  28. if (scene.buildIndex == 0)
  29. {
  30. ChangeMenuText();
  31. }
  32. }
  33. private static void ChangeMenuText()
  34. {
  35. try
  36. {
  37. var text = "v1.5.1";
  38. var textElement = GameObject.Find("MAIN").transform.Find("-").Find("txtALPHA").gameObject;
  39. var textElementShadow = textElement.transform.Find("txt0").gameObject;
  40. textElement.GetComponent<TextMesh>().text = text;
  41. textElementShadow.GetComponent<TextMesh>().text = text;
  42. }
  43. catch (Exception e) { Core.logger.Log(e); }
  44. }
  45. }
  46. }