Exemple #1
0
        public override void OnEnter()
        {
            SoundManage musicController = SoundManage.Instance;

            if (musicController != null)
            {
                if (Lower)
                {
                    musicController.LowerBGM();
                }
                else if (Restore)
                {
                    musicController.NormalBGM();
                }
                else
                {
                    musicController.SetBGMVolume(Volume);
                }
            }

            Continue();
        }
Exemple #2
0
        bool AnalyseOneLine(string str)
        {
            if (str.StartsWith("<"))
            {
                if (str.Length < 3)
                {
                    Debug.LogError("无法解析对话文本数据,指令长度过短");
                    return(false);
                }
                string[] paramsStr = str.Substring(3).Trim().Split(',');
                switch (str.Substring(1, 2).ToLower())
                {
                case "pp":    //+8,1,0 设置人物id位置和头像,split获取数组,判断数组长度,若为3则新建并激活位置,为1则激活某个位置 Position,Portrait
                    if (paramsStr.Length != 3)
                    {
                        DebugParamError("pp");
                    }
                    else
                    {
                        ShowCharacter(int.Parse(paramsStr[0]), int.Parse(paramsStr[1]), int.Parse(paramsStr[2]));
                    }
                    break;

                case "ap":    //激活pos处的人物头像 Active,Position
                    if (paramsStr.Length != 1)
                    {
                        DebugParamError("ap");
                    }
                    else
                    {
                        ActivePosition(int.Parse(paramsStr[0]));
                    }
                    break;

                case "rp":    //删除pos处的人物头像 Delete,Position
                    if (paramsStr.Length != 1)
                    {
                        DebugParamError("rp");
                    }
                    else
                    {
                        HideCharacter(int.Parse(paramsStr[0]));
                    }
                    break;

                case "sp":    //抖动此处的头像 Shake,Portrait
                    if (paramsStr.Length != 1)
                    {
                        DebugParamError("sp");
                    }
                    else
                    {
                        ShakePosition(int.Parse(paramsStr[0]));
                    }
                    break;

                case "su":    //抖动整个UI界面且
                    break;

                case "cm":    //更换音乐 Change,Music
                    if (paramsStr.Length != 1)
                    {
                        DebugParamError("cm");
                    }
                    else
                    {
                        musicController.PlayBGMImmediate(int.Parse(paramsStr[0]));
                    }
                    break;

                case "lv":    //降低音量 Lower,Volume
                    musicController.LowerBGM();
                    break;

                case "rv":    //重置音量 Reset,Volume
                    musicController.NormalBGM();
                    break;

                case "cb":    //以某种过渡方式更换背景 Change,Background
                    if (paramsStr.Length == 2)
                    {
                        FadeBackground(int.Parse(paramsStr[0]), float.Parse(paramsStr[1]));
                    }
                    else
                    {
                        DebugParamError("cb");
                    }
                    break;

                case "at":    //自动播放文本 Auto Text
                    bAutoText = true;
                    break;

                case "sa":    //停止自动文本显示 Stop Auto
                    bAutoText = false;
                    break;
                }
                return(false);
            }

            else
            {
                SetTextFrameActive(true);
                if (lastLineIndex != scriptLineIndex)//翻译的不是同一行
                {
                    StartCoroutine(Typing(str));
                }
                return(!bAutoText);
            }
        }