HotUpdateEntry.cs 1.5 KB

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