Entry.cs 1.1 KB

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