HotfixInit.cs 659 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using Model;
  3. namespace Hotfix
  4. {
  5. public static class HotfixInit
  6. {
  7. private static void Start()
  8. {
  9. try
  10. {
  11. Hotfix.Scene.AddComponent<ResourcesComponent>();
  12. Hotfix.Scene.AddComponent<UIComponent>();
  13. Hotfix.Scene.AddComponent<UnitComponent>();
  14. Hotfix.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
  15. }
  16. catch (Exception e)
  17. {
  18. Log.Error(e.ToString());
  19. }
  20. }
  21. private static void Update()
  22. {
  23. try
  24. {
  25. ObjectEvents.Instance.Update();
  26. }
  27. catch (Exception e)
  28. {
  29. Log.Error(e.ToString());
  30. }
  31. }
  32. private static void OnApplicationQuit()
  33. {
  34. Hotfix.Close();
  35. }
  36. }
  37. }