Init.cs 727 B

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