HotUpdateCodeLoader.cs 1.2 KB

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