Browse Source

添加剧情播放cg逻辑

leiyasi 1 year ago
parent
commit
6f8e7c0e69
1 changed files with 7 additions and 10 deletions
  1. 7 10
      GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

+ 7 - 10
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -407,7 +407,6 @@ namespace GFGGame
             _ui.m_list.visible = false;
         }
 
-        //private int num = 0;
         /// <summary>
         /// 初始化对话框/语音/CG等
         /// </summary>
@@ -445,16 +444,14 @@ namespace GFGGame
             VoiceManager.Instance.LoadRes(ResPathUtil.GetCardSoundPath("test", "wav"));
             _wordList = Regex.Split(words, "&&");
 
-            //++num;
-            // 没有对话
-            if (_wordList.Length == 0)
-            //if (num == 1)
+            if (effectInfo.Length > 0)
             {
                 // 等待CG播放完毕直接进入下一段
-                //Timers.inst.StartCoroutine(WaitCGAnimFinish());
+                Timers.inst.StartCoroutine(WaitCGAnimFinish(int.Parse(effectInfo[1])));
             }
+
             // 有对话
-            else
+            if (_wordList.Length > 0)
             {
                 if (roleName == "self")
                 {
@@ -829,13 +826,13 @@ namespace GFGGame
             Timers.inst.Remove(ShowNextWords);
         }
 
-        private IEnumerator WaitCGAnimFinish()
+        private IEnumerator WaitCGAnimFinish(int times = 1)
         {
-            GameObject cg = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetStoryDialogCGPath("cg_shenjiao"));
+            GameObject cg = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetStoryDialogCGPath("cg_libeihe"));
             Animator animator = cg.GetComponentInChildren<Animator>();
             AnimatorStateInfo info = animator.GetCurrentAnimatorStateInfo(0);
 
-            yield return new WaitForSeconds(info.length);
+            yield return new WaitForSeconds(info.length * times);
             //while (info.normalizedTime < 0.95)
             //{
             //    info = animator.GetCurrentAnimatorStateInfo(0);