Entry.cs 1009 B

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