示例#1
0
    void UpdataStage(StageData stageData)
    {
        if (stageData == null)
        {
            Debug.Log("quit");
            Application.Quit();
        }
        if (stageData.PreState != null && stageData.PreState.Count >= 0)
        {
            for (int i = 0; i < stageData.PreState.Count; i++)
            {
                if (string.IsNullOrEmpty(stageData.PreState[i]))
                {
                    continue;
                }
                if (int.Parse(stageData.PreState[i]) < 0)
                {
                    if (storyData.GetStateDataByID(-int.Parse(stageData.PreState[i])).state)
                    {
                        curStage  = storyData.GetDefNextByID(stageData.ID); //stageData.defNext;
                        lastStage = curStage;
                        UpdataStage(storyData.GetStageDataByID(curStage));
                        return;
                    }
                }
                else if (int.Parse(stageData.PreState[i]) > 0)
                {
                    if (!storyData.GetStateDataByID(int.Parse(stageData.PreState[i])).state)
                    {
                        curStage  = storyData.GetDefNextByID(stageData.ID); //stageData.defNext;
                        lastStage = curStage;
                        UpdataStage(storyData.GetStageDataByID(curStage));
                        return;
                    }
                }
            }
        }
        if (stageData.State != null && stageData.State.Count >= 0)
        {
            for (int i = 0; i < stageData.State.Count; i++)
            {
                if (string.IsNullOrEmpty(stageData.State[i]))
                {
                    continue;
                }
                if (int.Parse(stageData.State[i]) > 0)
                {
                    storyData.SetStateData(int.Parse(stageData.State[i]), true);
                }
                else if (int.Parse(stageData.State[i]) < 0)
                {
                    storyData.SetStateData(-int.Parse(stageData.State[i]), false);
                }
            }
        }
        canPause   = true;
        canShowMap = true;
        stage.ActInputF(false);
        stage.ActAside(false);
        stageMap.SetMapStage(stageData.ID);
        //stage.ClearVideo();
        if (!string.IsNullOrEmpty(stageData.Video))
        {
            //Debug.Log(stageData.ID.ToString() +" Start");
            if (stageData.Video.Contains(".mp4"))
            {
                stage.ActVideo(true);
                stage.ActImage(false);

                stage.SetVideo(stageData.Video);
                stage.PlayVideo();
            }
            else if (stageData.Video.Contains(".jpg"))
            {
                stage.ActVideo(false);
                stage.ActImage(true);
                stage.SetImage(stageData.Video);
            }
        }
        if (!string.IsNullOrEmpty(stageData.Audio))
        {
            //Debug.Log(stageData.Audio);
            if (stageData.Audio == "clear")
            {
                stage.PlaySound(false);
            }
            else
            {
                stage.SetSound(stageData.Audio);
                stage.PlaySound();
            }
        }
    }