using System; using Cysharp.Threading.Tasks; using UnityEngine; using YooAsset; namespace ZGame { public class Global : MonoBehaviour { [SerializeField] private EPlayMode _loadType = EPlayMode.EditorSimulateMode; [SerializeField] private float time; [SerializeField] private GameInitType _gameInitType = GameInitType.None; [SerializeField] private Camera _playerCamera; [SerializeField] private Camera _playerUICamera; [SerializeField] private AudioListener _eye; [SerializeField] private GameObject uiLoading; private LoadDll loadDll; public EPlayMode playMode => this._loadType; private void Awake() { Console.Write(String.Empty); DontDestroyOnLoad(this.gameObject); #if UNITY_EDITOR // this._loadType = EPlayMode.EditorSimulateMode; #elif UNITY_ANDROID|| PLATFORM_ANDROID|| ENABLE_WEBCAM|| UNITY_WEBGL|| UNITY_EDITOR_WIN this._loadType = EPlayMode.HostPlayMode; #endif this.loadDll = new LoadDll(); this.Initialized().Forget(); } private async UniTask Initialized() { await ResourceComponent.Instance.InitLoadModeAsync(this._loadType, "DefaultPackage"); // loadDll await this.loadDll.DownloadAsync(); this.loadDll.OnStart(gameObject, playMode, (int)this._gameInitType, Callback); } private void Callback() { this.uiLoading.SetActive(false); } } }