Exemplo n.º 1
0
 /// <summary>
 /// 隐藏界面并延时进入游戏
 /// </summary>
 private void HideAndGoToPlay(EPlayMode EPM)
 {
     m_Sound.DOFade(0f, 1f);
     m_AT.Play("Hide");
     m_DoubleButton.enabled = false;
     m_DoubleButton.enabled = false;
     StartCoroutine(DelayTOGame(EPM));
 }
Exemplo n.º 2
0
    /// <summary>
    /// 初始化游戏
    /// 进入场景之前调用
    /// </summary>
    /// <param name="EPM"></param>
    public void InitGame(EPlayMode EPM)
    {
        PlayMode       = EPM;
        _nowGridIndex  = 0;
        _lastSafeIndex = 0;

        JumpCount = 0;
        Grids     = new Queue <SGrid>();
    }
Exemplo n.º 3
0
 public void SetMode(EPlayMode game_mode)
 {
     mGameMode = game_mode;
 }
Exemplo n.º 4
0
        /// <summary>
        /// 异步初始化
        /// </summary>
        public static InitializationOperation InitializeAsync(InitializeParameters parameters)
        {
            if (parameters == null)
            {
                throw new Exception($"YooAsset create parameters is null.");
            }

            if (parameters.LocationServices == null)
            {
                throw new Exception($"{nameof(IBundleServices)} is null.");
            }
            else
            {
                _locationServices = parameters.LocationServices;
            }

#if !UNITY_EDITOR
            if (parameters is EditorSimulateModeParameters)
            {
                throw new Exception($"Editor simulate mode only support unity editor.");
            }
#endif

            // 创建驱动器
            if (_isInitialize == false)
            {
                _isInitialize = true;
                UnityEngine.GameObject driverGo = new UnityEngine.GameObject("[YooAsset]");
                driverGo.AddComponent <YooAssetDriver>();
                UnityEngine.Object.DontDestroyOnLoad(driverGo);
            }
            else
            {
                throw new Exception("YooAsset is initialized yet.");
            }

            // 检测参数范围
            if (parameters.AssetLoadingMaxNumber < 1)
            {
                parameters.AssetLoadingMaxNumber = 1;
                YooLogger.Warning($"{nameof(parameters.AssetLoadingMaxNumber)} minimum value is 1");
            }
            if (parameters.OperationSystemMaxTimeSlice < 30)
            {
                parameters.OperationSystemMaxTimeSlice = 30;
                YooLogger.Warning($"{nameof(parameters.OperationSystemMaxTimeSlice)} minimum value is 30 milliseconds");
            }

            // 鉴定运行模式
            if (parameters is EditorSimulateModeParameters)
            {
                _playMode = EPlayMode.EditorSimulateMode;
            }
            else if (parameters is OfflinePlayModeParameters)
            {
                _playMode = EPlayMode.OfflinePlayMode;
            }
            else if (parameters is HostPlayModeParameters)
            {
                _playMode = EPlayMode.HostPlayMode;
            }
            else
            {
                throw new NotImplementedException();
            }

            // 初始化异步操作系统
            OperationSystem.Initialize(parameters.OperationSystemMaxTimeSlice);

            // 初始化下载系统
            if (_playMode == EPlayMode.HostPlayMode)
            {
#if UNITY_WEBGL
                throw new Exception($"{EPlayMode.HostPlayMode} not supports WebGL platform !");
#else
                var hostPlayModeParameters = parameters as HostPlayModeParameters;
                DownloadSystem.Initialize(hostPlayModeParameters.BreakpointResumeFileSize);
#endif
            }

            // 初始化资源系统
            InitializationOperation initializeOperation;
            if (_playMode == EPlayMode.EditorSimulateMode)
            {
                _editorSimulateModeImpl = new EditorSimulateModeImpl();
                _bundleServices         = _editorSimulateModeImpl;
                AssetSystem.Initialize(true, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
                var editorSimulateModeParameters = parameters as EditorSimulateModeParameters;
                initializeOperation = _editorSimulateModeImpl.InitializeAsync(
                    editorSimulateModeParameters.LocationToLower,
                    editorSimulateModeParameters.SimulatePatchManifestPath);
            }
            else if (_playMode == EPlayMode.OfflinePlayMode)
            {
                _offlinePlayModeImpl = new OfflinePlayModeImpl();
                _bundleServices      = _offlinePlayModeImpl;
                AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
                initializeOperation = _offlinePlayModeImpl.InitializeAsync(parameters.LocationToLower);
            }
            else if (_playMode == EPlayMode.HostPlayMode)
            {
                _hostPlayModeImpl = new HostPlayModeImpl();
                _bundleServices   = _hostPlayModeImpl;
                AssetSystem.Initialize(false, parameters.AssetLoadingMaxNumber, parameters.DecryptionServices, _bundleServices);
                var hostPlayModeParameters = parameters as HostPlayModeParameters;
                initializeOperation = _hostPlayModeImpl.InitializeAsync(
                    hostPlayModeParameters.LocationToLower,
                    hostPlayModeParameters.ClearCacheWhenDirty,
                    hostPlayModeParameters.DefaultHostServer,
                    hostPlayModeParameters.FallbackHostServer);
            }
            else
            {
                throw new NotImplementedException();
            }

            // 监听初始化结果
            initializeOperation.Completed += InitializeOperation_Completed;
            return(initializeOperation);
        }
Exemplo n.º 5
0
    private IEnumerator DelayTOGame(EPlayMode EPM)
    {
        yield return(new WaitForSeconds(1));

        CSceneManager.Instance.ChangeSceneImmediately("03_Game");
    }
Exemplo n.º 6
0
 public void SetPlayOrder(EPlayMode ePlayMode)
 {
     this.GetFunction <NativeSetPlayOrderE>(this.Functions.SetPlayOrder12)(this.ObjectAddress, ePlayMode);
 }
Exemplo n.º 7
0
 public static extern void set_Nolo_PlayMode(EPlayMode ModeType);