HotUpdateEntry.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using Assets.Game.Launcher.HotUpdateProxy;
  2. using ET;
  3. using System;
  4. using System.Threading;
  5. using UniFramework.Pooling;
  6. using UnityEngine;
  7. namespace GFGGame.HotUpdate
  8. {
  9. public class HotUpdateEntry
  10. {
  11. public static void Start()
  12. {
  13. //UniFramework
  14. // 初始化对象池系统
  15. UniPooling.Initalize();
  16. //Reporter
  17. Reporter reporter = GameObject.Find("Reporter").GetComponent<Reporter>();
  18. reporter.numOfCircleToShow = 10;
  19. reporter.isOpen = LauncherConfig.onDebug > 0;
  20. //ET
  21. System.AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
  22. {
  23. Log.Error(e.ExceptionObject.ToString());
  24. };
  25. SynchronizationContext.SetSynchronizationContext(ThreadSynchronizationContext.Instance);
  26. LitJson.UnityTypeBindings.Register();
  27. ETTask.ExceptionHandler += Log.Error;
  28. Log.ILog = new UnityLogger();
  29. Options.Instance = new Options();
  30. TimeInfo.Instance.TimeZone = 8;
  31. try
  32. {
  33. HotUpdateProxy.Instance.update = Game.Update;
  34. HotUpdateProxy.Instance.lateUpdate = Game.LateUpdate;
  35. //退出进程被杀掉了,暂不执行
  36. //HotUpdateProxy.Instance.onApplicationQuit = Game.Close;
  37. Game.EventSystem.Add(HotUpdateCodeLoader.Instance.GetTypes());
  38. Game.EventSystem.Publish(new ET.EventType.AppStart());
  39. }
  40. catch (Exception e)
  41. {
  42. Log.Error(e);
  43. }
  44. GameController.Start();
  45. }
  46. }
  47. }