123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- using System;
- using System.Reflection;
- using ThirdParty;
- using UnityEngine;
- using UnityEngine.Playables;
- public class GameStart : MonoBehaviour
- {
- public ShaderVariantCollection ShaderVariantCollection;
- public LoadType LoadType;
- public string h5Url;
- public bool isOpenHotFix;
- public bool isLoadDll;
- private GameStartUIPanel _gameStartUIPanel;
- private GameZip _gameZip;
- [ContextMenu("asdada")]
- public void Test()
- {
- }
- public void Start()
- {
- float bl = (Screen.dpi / 160) - 1;
- float b = bl / 1.75f;
- if (b > 1)
- {
- b = 1;
- }
- if (b < 0)
- {
- b = 0;
- }
- float bili = Mathf.Lerp(1, 0.7f, b);
- Screen.SetResolution((int)(Screen.width * bili), (int)(Screen.height * bili), true);
- QualitySettings.vSyncCount = 0;
- Application.targetFrameRate = 60;
- PottingMobile.InitializeSdk();
- PottingMobile.withLogDebug(true);
- ShaderVariantCollection.WarmUp();
- _gameStartUIPanel = GetComponent<GameStartUIPanel>();
- HotSyncContent.isOpenDllStreamingLoad = isLoadDll;
- HotSyncContent.isOpenHotFix = isOpenHotFix;
- GameLoadDll gameLoadDll = new GameLoadDll();
- gameLoadDll.StartLoadDll(_gameStartUIPanel, this, "http://129.204.254.216:8080/resource/010test/init.dll",
- DllLoadFinish);
- }
- private void DllLoadFinish()
- {
- // StartLoadGame();
- #if UNITY_ANDROID&& !UNITY_EDITOR
- _gameZip = new GameZip();
- _gameZip.Start(_gameStartUIPanel, this, StartLoadGame);
- #else
- StartLoadGame();
- #endif
- }
- private void StartLoadGame()
- {
- string typeName = "GameApplction";
- // lock (ActivatorLoock)
- {
- Assembly assembly = Assembly.Load("Fort23.Mono");
- Debug.Log("assembly" + assembly);
- System.Type type = assembly.GetType(typeName);
- Debug.Log("assembly——type" + type);
- IGameStart iGameStart = System.Activator.CreateInstance(type) as IGameStart;
- iGameStart.StartGame(LoadType, h5Url, _gameStartUIPanel, delegate { gameObject.SetActive(false); });
- }
- }
- private void Update()
- {
- FileDownloadSystem.Instance.Update();
- }
- }
|