Example #1
0
 public void Win()
 {
     mineGroup.Win();
     DungeonStoryPlayer.PlayAfterBossDialog(delegate()
     {
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.GAME_WIN, this));
     });
 }
Example #2
0
 public void EndMoveToNext()
 {
     ScrollSceneManager.instance.DisableScroll();
     enemyGroup.InstUnits();
     if (enemyGroup.wave == DungeonManager.enemyWave.Count)
     {
         DungeonStoryPlayer.PlayPreBossDialog(delegate()
         {
             enemyGroup.MoveForward();
             mineGroup.MoveForward();
             CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
         });
     }
     else
     {
         enemyGroup.MoveForward();
         mineGroup.MoveForward();
         CEventDispatcher.GetInstance().DispatchEvent(new CBaseEvent(CEventType.NEXT_BATTALE_START, this));
     }
 }
Example #3
0
    /// <summary>
    /// 优化。。。在选择关卡的时候就开始加载,读取进度条的时候完成剩下的加载
    /// </summary>
    /// <returns></returns>
    IEnumerator Init()
    {
        /* 加载UI界面 */
        yield return(StartCoroutine(AssetManager.LoadAsset(Const.FightPanel, AssetManager.AssetType.UI, true)));

        GameObject panel = AssetManager.GetGameObject(Const.FightPanel, UIContainer.instance.transform);

        if (UIContainer.instance != null)
        {
            UIContainer.instance.fightPanel = panel;
        }
        /*加载场景资源*/
        string sceneAssetName = Encoding.Default.GetString(SceneSetting.scene);

        yield return(StartCoroutine(AssetManager.LoadAsset(sceneAssetName, AssetManager.AssetType.Scene, false)));

        AssetManager.GetGameObject(sceneAssetName, sceneParent);
        /* 加载所有用到的模型资源 */
        Dictionary <int, HeroData> HeroDataDic = Util.GetDic <MsgHeroData, HeroData>();

        for (int i = 0; i < PlayerData.GetInstance().CurrentFightHero.Count; i++)
        {
            int    id            = PlayerData.GetInstance().CurrentFightHero[i];
            string heroModelName = Encoding.Default.GetString(HeroDataDic[id].model);
            yield return(StartCoroutine(AssetManager.LoadAsset(heroModelName, AssetManager.AssetType.Model, false)));
        }
        Dictionary <int, MonsterData> MonsterDataDic = Util.GetDic <MsgMonsterData, MonsterData>();

        for (int i = 0; i < enemyWave.Count; i++)
        {
            for (int j = 0; j < enemyWave[i].Length; j++)
            {
                MonsterData monsterData      = MonsterDataDic[enemyWave[i][j]];
                string      monsterModelName = Encoding.Default.GetString(monsterData.model);
                yield return(StartCoroutine(AssetManager.LoadAsset(monsterModelName, AssetManager.AssetType.Model, false)));
            }
        }
        /*全部加载完成后才刷兵*/
        mineGroup.InstUnits();
        enemyGroup.InstUnits();
        //等候刷兵初始化的卡顿
        yield return(1);

        yield return(1);

        yield return(1);

        //清除加载界面
        if (LoadScene.obj != null)
        {
            Destroy(LoadScene.obj);
        }
        //播放剧情
        DungeonStoryData storyData;

        if (SceneSetting.story == 0 || !isFirstPlay)
        {
            storyData = null;
        }
        else
        {
            yield return(StartCoroutine(AssetManager.LoadAsset(SceneSetting.story.ToString(), AssetManager.AssetType.Story, false)));

            storyData = AssetManager.GetAsset <DungeonStoryData>(SceneSetting.story.ToString());
        }
        DungeonStoryPlayer.PlayStory(storyData,
                                     () => {
            mineGroup.MoveForward();
            enemyGroup.MoveForward();
            //初始化乌鸦空袭
            KongxiManager.instance.Init(Util.GetConfigString(SceneSetting.airRaid));
            //初始化副本数值
            DungeonRecord.dungeonStartTime = Time.time;
            maxWave = enemyWave.Count;
            curWave = 1;
            ViewMapper <FightPanel> .instance.UpdateWave();
            //时间限制
            if (SceneSetting.timeLimit != 0)
            {
                UpdateTimeUI();
                enabled = true;
            }
            else
            {
                ViewMapper <FightPanel> .instance.HideTimeUI();
            }
        });
    }