HotUpdateCodeLoader.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections;
  3. using System.Reflection;
  4. using UnityEngine;
  5. using GFGGame.Launcher;
  6. using System.Collections.Generic;
  7. using HybridCLR;
  8. using System.Linq;
  9. using YooAsset;
  10. namespace GFGGame
  11. {
  12. public class HotUpdateCodeLoader : SingletonMonoBase<HotUpdateCodeLoader>
  13. {
  14. public static List<string> AOTMetaAssemblyNames { get; } = new List<string>()
  15. {
  16. "mscorlib.dll",
  17. "System.dll",
  18. "System.Core.dll",
  19. "Game.Launcher.dll",
  20. "ThirdParty.dll"
  21. };
  22. public Type[] allTypes;
  23. public Type[] GetTypes()
  24. {
  25. return this.allTypes;
  26. }
  27. private void Awake()
  28. {
  29. DontDestroyOnLoad(this.gameObject);
  30. }
  31. public void StartLoad()
  32. {
  33. Debug.Log("StartLoad - WebGL version (no hot update)");
  34. StartCoroutine(LoadGameScene());
  35. }
  36. IEnumerator LoadGameScene()
  37. {
  38. // 这里可以添加一些加载前的准备工作
  39. Debug.Log("Preparing to load game scene...");
  40. // 直接加载游戏场景
  41. var sceneHandle = YooAssets.LoadSceneAsync("Assets/ResIn/Scene/HotUpdate.unity");
  42. yield return sceneHandle;
  43. Debug.Log("Game scene loaded successfully");
  44. }
  45. }
  46. }