Init.cs 762 B

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