HotUpdateEntry.cs 1.6 KB

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