GameStart.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Reflection;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. public class GameStart : MonoBehaviour
  6. {
  7. public ShaderVariantCollection ShaderVariantCollection;
  8. public LoadType LoadType;
  9. public string h5Url;
  10. private GameStartUIPanel _gameStartUIPanel;
  11. private GameZip _gameZip;
  12. [ContextMenu("asdada")]
  13. public void Test()
  14. {
  15. }
  16. public void Start()
  17. {
  18. PottingMobile.InitializeSdk();
  19. PottingMobile.withLogDebug(true);
  20. ShaderVariantCollection.WarmUp();
  21. _gameStartUIPanel = GetComponent<GameStartUIPanel>();
  22. #if UNITY_ANDROID&& !UNITY_EDITOR
  23. _gameZip = new GameZip();
  24. _gameZip.Start(_gameStartUIPanel, this, StartLoadGame);
  25. #else
  26. StartLoadGame();
  27. #endif
  28. }
  29. private void StartLoadGame()
  30. {
  31. string typeName = "GameApplction";
  32. // lock (ActivatorLoock)
  33. {
  34. Assembly assembly = Assembly.Load("Fort23.Mono");
  35. System.Type type = assembly.GetType(typeName);
  36. IGameStart iGameStart = System.Activator.CreateInstance(type) as IGameStart;
  37. iGameStart.StartGame(LoadType, h5Url, _gameStartUIPanel, delegate { gameObject.SetActive(false); });
  38. }
  39. }
  40. private void Update()
  41. {
  42. FileDownloadSystem.Instance.Update();
  43. }
  44. }