浏览代码

添加动画白色遮罩转场

leiyasi 1 年之前
父节点
当前提交
bfcab8b730

+ 1 - 47
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -140,56 +140,10 @@ namespace GFGGame
             {
                 string res = value.Split('/')[1];
                 animObj = PrefabManager.Instance.InstantiateSync(ResPathUtil.GetStoryDialogCGPath(value, res));
-                Timers.inst.StartCoroutine(InitModel(animObj));
-                StoryDialogDataManager.Instance.dialogShowDelay = 0.4f;
+                //StoryDialogDataManager.Instance.dialogShowDelay = 0.4f;
             }
         }
 
-        private static IEnumerator InitModel(GameObject obj)
-        {
-            // 未加载到live2D之前,不做显示
-            obj.transform.localScale = Vector3.zero;
-            StoryDialogDataManager.Instance.waiting = true;
-            CubismRenderController[] cubismModels;
-            cubismModels = obj.transform.GetComponentsInChildren<CubismRenderController>();
-            while (cubismModels.Length == 0)
-            {
-                yield return new WaitForEndOfFrame();
-                cubismModels = obj.transform.GetComponentsInChildren<CubismRenderController>();
-            }
-            //List<SpriteRenderer> spriteRenderers = new List<SpriteRenderer>(obj.transform.GetComponentsInChildren<SpriteRenderer>());
-            obj.transform.localScale = Vector3.one;
-            //Ease ease = Ease.Linear;
-            //DOTween.To(() => 0, (value) =>
-            //{
-            //    if (cubismModels == null)
-            //    {
-            //        return;
-            //    }
-
-            //    for (int j = 0; j < cubismModels.Length; j++)
-            //    {
-            //        cubismModels[j].Opacity = value;
-            //    }
-
-            //    for (int i = 0; i < spriteRenderers.Count; i++)
-            //    {
-            //        if (spriteRenderers[i] == null)
-            //        {
-            //            spriteRenderers.RemoveAt(i);
-            //            continue;
-            //        }
-            //        Color color = spriteRenderers[i].color;
-            //        color.a = value;
-            //        spriteRenderers[i].color = color;
-            //    }
-            //}, 1, 0.5f).SetEase(ease).OnComplete(() =>
-            //{
-            //    StoryDialogDataManager.Instance.waiting = false;
-            //}).SetAutoKill().SetId("fade");
-            StoryDialogDataManager.Instance.waiting = false;
-        }
-
 
         public static void ControlBgVisible(GameObject sceneObj, bool isShow)
         {

+ 9 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/Main/UI_StoryDialogUI.cs

@@ -23,6 +23,9 @@ namespace UI.Main
         public GTextField m_txtPlayName;
         public GGroup m_comPlayName;
         public Transition m_t0;
+        public Transition m_showMask;
+        public Transition m_hideMask;
+        public Transition m_hide;
         public const string URL = "ui://mfvz4q8kxuzk2i";
         public const string PACKAGE_NAME = "Main";
         public const string RES_NAME = "StoryDialogUI";
@@ -86,6 +89,9 @@ namespace UI.Main
             m_txtPlayName = (GTextField)comp.GetChild("txtPlayName");
             m_comPlayName = (GGroup)comp.GetChild("comPlayName");
             m_t0 = comp.GetTransition("t0");
+            m_showMask = comp.GetTransition("showMask");
+            m_hideMask = comp.GetTransition("hideMask");
+            m_hide = comp.GetTransition("hide");
         }
         public void Dispose(bool disposeTarget = false)
         {
@@ -109,6 +115,9 @@ namespace UI.Main
             m_txtPlayName = null;
             m_comPlayName = null;
             m_t0 = null;
+            m_showMask = null;
+            m_hideMask = null;
+            m_hide = null;
             if(disposeTarget && target != null)
             {
                 target.RemoveFromParent();

+ 4 - 3
GameClient/Assets/Game/HotUpdate/Sound/MusicManager.cs

@@ -57,7 +57,7 @@ namespace GFGGame
             
         }
 
-        public void PlayCroutine(string path, bool must = false)
+        public void PlayCroutine(string path, bool must = false, float volume = 1.0f)
         {
             if(currentName != path || must)
             {
@@ -69,17 +69,18 @@ namespace GFGGame
                 handle?.Release();
                 if (_isOn)
                 {
-                    coroutine = StartCoroutine(Play(path));
+                    coroutine = StartCoroutine(Play(path, volume));
                 }
             }
         }
 
-        private IEnumerator Play(string path)
+        private IEnumerator Play(string path, float volume = 1.0f)
         {
             //AudioClip clip = GFGAsset.Load<AudioClip>(path);
             handle = YooAssets.LoadAssetAsync<AudioClip>(path);
             yield return handle;
             player.clip = handle.AssetObject as AudioClip;
+            player.volume = volume;
             player.Play();
         }
 

+ 14 - 4
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -361,6 +361,7 @@ namespace GFGGame
         {
             _canClickBtnNext = false;
             StoryDialogDataManager.Instance.waitPicFade = false;
+            _ui.m_hide.Play();  // 隐藏遮罩
             HideAllDialogUI();
 
             // Init resource
@@ -684,7 +685,6 @@ namespace GFGGame
             _wordTextField.verticalAlign = VertAlignType.Top;
             _wordTextField.text = "";
             _canClickBtnNext = false;
-
             while (StoryDialogDataManager.Instance.waitPicFade || StoryDialogDataManager.Instance.waiting)
             {
                 //Debug.Log("等待立绘/动画结束");
@@ -736,13 +736,23 @@ namespace GFGGame
                 if (value == "0")
                 {
                     SceneController.ControlBgVisible(_sceneObject, true);
+                    SceneController.UpdateDialogAnim(value, ref _animObject);
                 }
+                // 播放动画
                 else
                 {
-                    SceneController.ControlBgVisible(_sceneObject, false);
+                    StoryDialogDataManager.Instance.waiting = true;
+
+                    _ui.m_showMask.Play(() =>
+                    {
+                        _ui.m_hideMask.Play();
+                        SceneController.ControlBgVisible(_sceneObject, false);
+                        SceneController.UpdateDialogAnim(value, ref _animObject);
+                    });
+                    
 
                 }
-                SceneController.UpdateDialogAnim(value, ref _animObject);
+                
             }
         }
 
@@ -774,7 +784,7 @@ namespace GFGGame
                 }
                 else
                 {
-                    MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(value, "mp3"));
+                    MusicManager.Instance.PlayCroutine(ResPathUtil.GetMusicPath(value, "mp3"), false, 0.5f);
                 }
             }
         }

二进制
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes