Exemple #1
0
    public NrcGameStageObserver(NrcSceneLoader nrcSceneLoader)
    {
        _nrcSceneLoader   = nrcSceneLoader;
        _stageDataBase    = nrcSceneLoader.StageDataBase;
        _playerController = nrcSceneLoader.PlayerController;
        _gameUIController = nrcSceneLoader.GameUIController;
        _nowStageId       = 1;

        //スタート前カウントダウンが終了したときに呼ばれる
        _gameUIController.GameUIBeforeStarEffectService.GameUIBeforeStarEffectEndEvent += () =>
        {
            CharacterStart();
            _gameUIController.GameUICountDownService.StartAsync(_clearTime);
        };

        //ステージタイムリミット終了時に呼ばれる
        _gameUIController.GameUICountDownService.GameUICountDownEndEvent += () =>
        {
            CharacterPause();
            _gameUIController.GameUIStageClearEffectService.StartAsync();
        };

        //ステージクリア表示終了時に呼ばれる
        _gameUIController.GameUIStageClearEffectService.GameUIStageClearEffectEndEvent += () =>
        {
            CharacterPause();

            int lastStageNum = _stageDataBase.GetSize();
            if (lastStageNum == _nowStageId)
            {
                _gameUIController.GameUIGameClearEffectService.StartAsync();
            }
            else
            {
                NextStage();
            }
        };

        //EnemyTargetが全滅したときに呼ばれる
        NrcGameManager.NrcGameEnemyTargetService.EnemyTargetAllDeadEvent += () =>
        {
            CharacterPause();
            _gameUIController.Stop();
            _gameUIController.GameUIGameOverEffectService.StartAsync();
        };

        //ゲームオーバー表示終了時に呼ばれる
        _gameUIController.GameUIGameOverEffectService.GameUIGameOverEndEvent += () =>
        {
            CharacterPause();
            StageLoad(1);
        };

        _gameUIController.GameUIGameClearEffectService.GameUIGameClearEndEvent += () =>
        {        //ステージシーンの読み込み。
            {
                AsyncOperation ope = SceneManager.LoadSceneAsync("Title", LoadSceneMode.Single);
            }
        };
    }
    public override StageDataBase[] BuildStrategys()
    {
        Dictionary <string, List <AssetDataInfo> > datas = GetAllDatas();

        List <StageDataBase> strategies = new List <StageDataBase>();

        _index_data = new IndexData();

        int quitCount = 50;

        while ((_index_data.NextIndex < (datas.Count)) && quitCount > 0)
        {
            StageDataBase zipStrategy = BuildZipDownloadStrategy(datas);
            StageDataBase abStrategy  = BuildABDownloadStrategy(datas);

            if (zipStrategy != null)
            {
                strategies.Add(zipStrategy);
            }
            if (abStrategy != null)
            {
                strategies.Add(abStrategy);
            }

            quitCount--;
        }

        return(strategies.ToArray());
    }
Exemple #3
0
    protected override void OnDownloadSuccessful(AssetDownInfo info, HttpDownLoadAsync loadAsync)
    {
        Debug.Log("Asset下载成功!");
        if (_downLoad_error.Contains(info))
        {
            _downLoad_error.Remove(info);
        }

        if (StageDataBase.CheckVersionIsDownLoadComplete(info.Version))
        {
            // 一个版本下载完毕
            VersionDownLoadComplete(info.Version);
        }

        _current_strategy.TryRemove(info);

        if (IsDone)
        {
            if (_stage_index < (_strategy_bases.Length - 1))
            {
                _stage_index++;
                Debug.Log("换阶段了 STAGE_INDEX=" + _stage_index);
            }
            else
            {
                if (_downLoad_error.Count <= 0)
                {
                    UpdateStageResult.DownLoad.ClearAll();
                }

                OnAllDownLoadComplete();
                if (DownLoadCompleteEvent != null)
                {
                    DownLoadCompleteEvent(this);
                }
                FileManifestManager.WriteABDataByCurrent();

                isDone = true;

                Debug.Log("全部下载完成!!!!!!!");
            }
        }
        else
        {
            AssetDataInfo dataInfo = info.ToAssetDataInfo();
            if (_current_strategy.AssetType == eUpdateAssetType.Zip)
            {
                FileManifestManager.UpdateLocalFenBaoData(dataInfo);
            }
            else
            {
                FileManifestManager.UpdateLocalABData(dataInfo);
            }
        }

        TryStartDownLoad();
    }
    public ClearState()
    {
        nextStageUI = GameObject.Find("NextStageUI").GetComponent <Image>();
        clearUI     = GameObject.Find("ClearUI").GetComponent <Image>();
        effect      = GameObject.Find("ClearEffect").GetComponent <ParticleSystem>();
        goalDoor    = GameObject.Find("goalDoor").GetComponent <Animator>();
        clearLight  = GameObject.Find("clearLight").GetComponent <Light>();

        stageDataBase = AssetDatabase.LoadAssetAtPath <StageDataBase>("Assets/Script/GameState/StageSelect/Stages/StageDataBase.asset");

        forwardAngle  = Quaternion.Euler(0, 90, 0);
        backwardAngle = Quaternion.Euler(0, -90, 0);

        hasInput = false;
    }
    public ZipDecompressStage(StageDataBase stage)
    {
        _owner            = stage;
        _decompress_queue = new List <AssetDownInfo>();
        List <AssetDataInfo> localAllZip = FileManifestManager.LocalFenBao.GetAllZip();

        if (localAllZip == null)
        {
            return;
        }

        for (int i = 0; i < localAllZip.Count; i++)
        {
            AssetDataInfo dataInfo = localAllZip[i];
            _decompress_queue.Add(dataInfo.ToAssetDownInfo(i));
        }
        _index = localAllZip.Count;
    }