Init.cs 848 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System;
  2. using Model;
  3. namespace Hotfix
  4. {
  5. public static class Init
  6. {
  7. public static void Start()
  8. {
  9. try
  10. {
  11. Hotfix.Scene.ModelScene = Game.Scene;
  12. Hotfix.Scene.AddComponent<UIComponent>();
  13. #if ILRuntime
  14. Hotfix.Scene.AddComponent<OpcodeTypeComponent>();
  15. Hotfix.Scene.AddComponent<MessageDispatherComponent>();
  16. #endif
  17. Hotfix.EventSystem.Run(EventIdType.InitSceneStart);
  18. }
  19. catch (Exception e)
  20. {
  21. Log.Error(e.ToStr());
  22. }
  23. }
  24. public static void Update()
  25. {
  26. try
  27. {
  28. Hotfix.EventSystem.Update();
  29. }
  30. catch (Exception e)
  31. {
  32. Log.Error(e.ToStr());
  33. }
  34. }
  35. public static void LateUpdate()
  36. {
  37. try
  38. {
  39. Hotfix.EventSystem.LateUpdate();
  40. }
  41. catch (Exception e)
  42. {
  43. Log.Error(e.ToStr());
  44. }
  45. }
  46. public static void OnApplicationQuit()
  47. {
  48. Hotfix.Close();
  49. }
  50. }
  51. }