Init.cs 861 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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<OpcodeTypeComponent>();
  12. Hotfix.Scene.ModelScene.AddComponent<NetOuterComponent>();
  13. Hotfix.Scene.ModelScene.AddComponent<ResourcesComponent>();
  14. Hotfix.Scene.ModelScene.AddComponent<BehaviorTreeComponent>();
  15. Hotfix.Scene.AddComponent<UIComponent>();
  16. Hotfix.Scene.AddComponent<UnitComponent>();
  17. Hotfix.Scene.GetComponent<EventComponent>().Run(EventIdType.InitSceneStart);
  18. }
  19. catch (Exception e)
  20. {
  21. Log.Error(e.ToString());
  22. }
  23. }
  24. private static void Update()
  25. {
  26. try
  27. {
  28. ObjectEvents.Instance.Update();
  29. }
  30. catch (Exception e)
  31. {
  32. Log.Error(e.ToString());
  33. }
  34. }
  35. private static void OnApplicationQuit()
  36. {
  37. Hotfix.Close();
  38. }
  39. }
  40. }