Init.cs 772 B

123456789101112131415161718192021222324252627282930
  1. using System.Reflection;
  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. Object.ObjectManager.Register("Base", typeof(Game).Assembly);
  12. Object.ObjectManager.Register("Model", typeof(Init).Assembly);
  13. GameObject code = (GameObject)Resources.Load("Code");
  14. byte[] assBytes = code.Get<TextAsset>("Controller.dll").bytes;
  15. byte[] mdbBytes = code.Get<TextAsset>("Controller.dll.mdb").bytes;
  16. Assembly assembly = Assembly.Load(assBytes, mdbBytes);
  17. Object.ObjectManager.Register("Controller", assembly);
  18. Game.Scene.AddComponent<EventComponent>().Run(EventIdType.InitSceneStart);
  19. }
  20. private void Update()
  21. {
  22. Base.Object.ObjectManager.Update();
  23. }
  24. }
  25. }