Init.cs 633 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Base;
  3. using UnityEngine;
  4. using Object = Base.Object;
  5. namespace Model
  6. {
  7. public class Init: MonoBehaviour
  8. {
  9. private void Start()
  10. {
  11. BsonClassMapRegister.Register();
  12. Object.ObjectManager.Register("Model", typeof(Game).Assembly);
  13. Object.ObjectManager.Register("Controller", DllHelper.GetController());
  14. Game.Scene.AddComponent<EventComponent>().Run(EventIdType.InitSceneStart);
  15. }
  16. private void Update()
  17. {
  18. try
  19. {
  20. Object.ObjectManager.Update();
  21. }
  22. catch (Exception e)
  23. {
  24. Log.Error(e.ToString());
  25. }
  26. }
  27. private void OnApplicationQuit()
  28. {
  29. Game.Close();
  30. }
  31. }
  32. }