Entry.cs 989 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Linq;
  3. using System.Reflection;
  4. namespace ET
  5. {
  6. public class MonoEntry : IEntry
  7. {
  8. public void Start()
  9. {
  10. try
  11. {
  12. string[] assemblyNames = { "Unity.Model.dll", "Unity.Hotfix.dll", "Unity.ModelView.dll", "Unity.HotfixView.dll" };
  13. foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
  14. {
  15. string assemblyName = $"{assembly.GetName().Name}.dll";
  16. if (!assemblyNames.Contains(assemblyName))
  17. {
  18. continue;
  19. }
  20. Game.EventSystem.Add(assembly);
  21. }
  22. ProtobufHelper.Init();
  23. Game.Options = new Options();
  24. Game.EventSystem.Publish(new EventType.AppStart()).Coroutine();
  25. }
  26. catch (Exception e)
  27. {
  28. Log.Error(e);
  29. }
  30. }
  31. public void Update()
  32. {
  33. ThreadSynchronizationContext.Instance.Update();
  34. Game.EventSystem.Update();
  35. }
  36. public void LateUpdate()
  37. {
  38. Game.EventSystem.LateUpdate();
  39. }
  40. public void OnApplicationQuit()
  41. {
  42. Game.Close();
  43. }
  44. }
  45. }