Browse Source

修改SceneController中的立绘渐变出现的函数,改用协程实现
添加CreateRole界面新的特效
添加对话框的入场动画

leiyasi 1 year ago
parent
commit
e42e52b454

+ 23 - 15
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -1,6 +1,6 @@
 using UnityEngine;
 using UnityEngine;
-using System;
-using FairyGUI;
+
+using System.Collections;
 
 
 namespace GFGGame
 namespace GFGGame
 {
 {
@@ -68,27 +68,32 @@ namespace GFGGame
             }
             }
             else
             else
             {
             {
-                void UpdateDialogPicAlpha(object param)
+                IEnumerator UpdateDialogPicAlpha()
                 {
                 {
-                    if (spr != null)
+                    while (true)
                     {
                     {
-                        Color c = spr.color;
-                        if (spr.enabled && c.a < 1f)
+                        if (spr != null)
                         {
                         {
-                            c.a += 0.05f;
-                            spr.color = c;
+                            Color c = spr.color;
+                            if (spr.enabled && c.a < 1f)
+                            {
+                                c.a += 0.055f;
+                                spr.color = c;
+                            }
+                            else
+                            {
+                                break;
+                            }
                         }
                         }
                         else
                         else
                         {
                         {
-                            FairyGUI.Timers.inst.Remove(UpdateDialogPicAlpha);
+                            break;
                         }
                         }
+                        yield return new WaitForEndOfFrame();
                     }
                     }
-                    else
-                    {
-                        FairyGUI.Timers.inst.Remove(UpdateDialogPicAlpha);
-                    }
-
+                    
                 }
                 }
+
                 var resPath = ResPathUtil.GetNpcPicSPath(value);
                 var resPath = ResPathUtil.GetNpcPicSPath(value);
                 Sprite sp = GFGAsset.Load<Sprite>(resPath);
                 Sprite sp = GFGAsset.Load<Sprite>(resPath);
                 DressUpUtil.AddAssetReleaser(tf.gameObject, resPath);
                 DressUpUtil.AddAssetReleaser(tf.gameObject, resPath);
@@ -96,10 +101,13 @@ namespace GFGGame
                 Color c = spr.color;
                 Color c = spr.color;
                 c.a = 0f;
                 c.a = 0f;
                 spr.color = c;
                 spr.color = c;
-                FairyGUI.Timers.inst.AddUpdate(UpdateDialogPicAlpha);
+                FairyGUI.Timers.inst.StartCoroutine(UpdateDialogPicAlpha());
+                //FairyGUI.Timers.inst.AddUpdate(UpdateDialogPicAlpha);
             }
             }
         }
         }
 
 
+
+
         public static void UpdateFightTarget(string value, GameObject sceneObj)
         public static void UpdateFightTarget(string value, GameObject sceneObj)
         {
         {
             Transform tf = sceneObj.transform.Find("Npc");
             Transform tf = sceneObj.transform.Find("Npc");

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CreateRole/UI_CreateRoleUI.cs

@@ -9,6 +9,7 @@ namespace UI.CreateRole
         public GComponent target;
         public GComponent target;
         public GLoader m_loaBg;
         public GLoader m_loaBg;
         public UI_EnvelopeModel m_envelopeModel;
         public UI_EnvelopeModel m_envelopeModel;
+        public GGraph m_BgEffectHolder;
         public Transition m_t_Open;
         public Transition m_t_Open;
         public Transition m_t_In;
         public Transition m_t_In;
         public Transition m_t_AfterOpen;
         public Transition m_t_AfterOpen;
@@ -61,6 +62,7 @@ namespace UI.CreateRole
         {
         {
             m_loaBg = (GLoader)comp.GetChild("loaBg");
             m_loaBg = (GLoader)comp.GetChild("loaBg");
             m_envelopeModel = (UI_EnvelopeModel)UI_EnvelopeModel.Create(comp.GetChild("envelopeModel"));
             m_envelopeModel = (UI_EnvelopeModel)UI_EnvelopeModel.Create(comp.GetChild("envelopeModel"));
+            m_BgEffectHolder = (GGraph)comp.GetChild("BgEffectHolder");
             m_t_Open = comp.GetTransition("t_Open");
             m_t_Open = comp.GetTransition("t_Open");
             m_t_In = comp.GetTransition("t_In");
             m_t_In = comp.GetTransition("t_In");
             m_t_AfterOpen = comp.GetTransition("t_AfterOpen");
             m_t_AfterOpen = comp.GetTransition("t_AfterOpen");
@@ -70,6 +72,7 @@ namespace UI.CreateRole
             m_loaBg = null;
             m_loaBg = null;
             m_envelopeModel.Dispose();
             m_envelopeModel.Dispose();
             m_envelopeModel = null;
             m_envelopeModel = null;
+            m_BgEffectHolder = null;
             m_t_Open = null;
             m_t_Open = null;
             m_t_In = null;
             m_t_In = null;
             m_t_AfterOpen = null;
             m_t_AfterOpen = null;

+ 3 - 0
GameClient/Assets/Game/HotUpdate/FairyGUI/GenCode/CreateRole/UI_EnvelopeModel.cs

@@ -12,6 +12,7 @@ namespace UI.CreateRole
         public GButton m_btnDice;
         public GButton m_btnDice;
         public GTextInput m_inputName;
         public GTextInput m_inputName;
         public GGraph m_ShanZiEffectHolder;
         public GGraph m_ShanZiEffectHolder;
+        public GGraph m_TextEffectHolder;
         public GGraph m_trailEffectHolder;
         public GGraph m_trailEffectHolder;
         public UI_Envelope m_envelope;
         public UI_Envelope m_envelope;
         public Transition m_t_In;
         public Transition m_t_In;
@@ -69,6 +70,7 @@ namespace UI.CreateRole
             m_btnDice = (GButton)comp.GetChild("btnDice");
             m_btnDice = (GButton)comp.GetChild("btnDice");
             m_inputName = (GTextInput)comp.GetChild("inputName");
             m_inputName = (GTextInput)comp.GetChild("inputName");
             m_ShanZiEffectHolder = (GGraph)comp.GetChild("ShanZiEffectHolder");
             m_ShanZiEffectHolder = (GGraph)comp.GetChild("ShanZiEffectHolder");
+            m_TextEffectHolder = (GGraph)comp.GetChild("TextEffectHolder");
             m_trailEffectHolder = (GGraph)comp.GetChild("trailEffectHolder");
             m_trailEffectHolder = (GGraph)comp.GetChild("trailEffectHolder");
             m_envelope = (UI_Envelope)UI_Envelope.Create(comp.GetChild("envelope"));
             m_envelope = (UI_Envelope)UI_Envelope.Create(comp.GetChild("envelope"));
             m_t_In = comp.GetTransition("t_In");
             m_t_In = comp.GetTransition("t_In");
@@ -82,6 +84,7 @@ namespace UI.CreateRole
             m_btnDice = null;
             m_btnDice = null;
             m_inputName = null;
             m_inputName = null;
             m_ShanZiEffectHolder = null;
             m_ShanZiEffectHolder = null;
+            m_TextEffectHolder = null;
             m_trailEffectHolder = null;
             m_trailEffectHolder = null;
             m_envelope.Dispose();
             m_envelope.Dispose();
             m_envelope = null;
             m_envelope = null;

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

@@ -19,6 +19,7 @@ namespace UI.Main
         public GButton m_btnAutoPlay;
         public GButton m_btnAutoPlay;
         public GButton m_btnSpeedUp;
         public GButton m_btnSpeedUp;
         public GButton m_btnSkip;
         public GButton m_btnSkip;
+        public Transition m_t0;
         public const string URL = "ui://mfvz4q8kxuzk2i";
         public const string URL = "ui://mfvz4q8kxuzk2i";
         public const string PACKAGE_NAME = "Main";
         public const string PACKAGE_NAME = "Main";
         public const string RES_NAME = "StoryDialogUI";
         public const string RES_NAME = "StoryDialogUI";
@@ -78,6 +79,7 @@ namespace UI.Main
             m_btnAutoPlay = (GButton)comp.GetChild("btnAutoPlay");
             m_btnAutoPlay = (GButton)comp.GetChild("btnAutoPlay");
             m_btnSpeedUp = (GButton)comp.GetChild("btnSpeedUp");
             m_btnSpeedUp = (GButton)comp.GetChild("btnSpeedUp");
             m_btnSkip = (GButton)comp.GetChild("btnSkip");
             m_btnSkip = (GButton)comp.GetChild("btnSkip");
+            m_t0 = comp.GetTransition("t0");
         }
         }
         public void Dispose(bool disposeTarget = false)
         public void Dispose(bool disposeTarget = false)
         {
         {
@@ -96,6 +98,7 @@ namespace UI.Main
             m_btnAutoPlay = null;
             m_btnAutoPlay = null;
             m_btnSpeedUp = null;
             m_btnSpeedUp = null;
             m_btnSkip = null;
             m_btnSkip = null;
+            m_t0 = null;
             if(disposeTarget && target != null)
             if(disposeTarget && target != null)
             {
             {
                 target.RemoveFromParent();
                 target.RemoveFromParent();

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/CreateRole/CreateRoleView.cs

@@ -64,6 +64,7 @@ namespace GFGGame
             switch (state)
             switch (state)
             {
             {
                 case State.IN:
                 case State.IN:
+                    _effectUIDic.Add("FX_ALL_BG", EffectUIPool.CreateEffectUI(_ui.m_BgEffectHolder, "ui_CreateRoleUI/After_Open", "FX_ALL_BG"));
                     _effectUIDic.Add("FX_Flower", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_envelope.m_flowerEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_Flower"));
                     _effectUIDic.Add("FX_Flower", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_envelope.m_flowerEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_Flower"));
                     _effectUIDic.Add("FX_LiuSu", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_envelope.m_LiuSuEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_LiuSu"));
                     _effectUIDic.Add("FX_LiuSu", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_envelope.m_LiuSuEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_LiuSu"));
                     _effectUIDic.Add("FX_taril", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_trailEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_taril"));
                     _effectUIDic.Add("FX_taril", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_trailEffectHolder, "ui_CreateRoleUI/Before_Open", "FX_taril"));
@@ -82,6 +83,7 @@ namespace GFGGame
                 case State.OPEN:
                 case State.OPEN:
                     EffectUIPool.Recycle(_effectUIDic["FX_player"]);
                     EffectUIPool.Recycle(_effectUIDic["FX_player"]);
                     _effectUIDic.Remove("FX_player");
                     _effectUIDic.Remove("FX_player");
+                    _effectUIDic.Add("FX_Text", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_TextEffectHolder, "ui_CreateRoleUI/After_Open", "FX_Text"));
                     _effectUIDic.Add("FX_ShanZi", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_ShanZiEffectHolder, "ui_CreateRoleUI/After_Open", "FX_ShanZi"));
                     _effectUIDic.Add("FX_ShanZi", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_ShanZiEffectHolder, "ui_CreateRoleUI/After_Open", "FX_ShanZi"));
                     _effectUIDic.Add("FX_Niao", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_NiaoEffectHolder, "ui_CreateRoleUI/After_Open", "FX_Niao"));
                     _effectUIDic.Add("FX_Niao", EffectUIPool.CreateEffectUI(_ui.m_envelopeModel.m_NiaoEffectHolder, "ui_CreateRoleUI/After_Open", "FX_Niao"));
                     _ui.m_envelopeModel.m_envelope.target.touchable = false;
                     _ui.m_envelopeModel.m_envelope.target.touchable = false;

+ 40 - 2
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryDialogView.cs

@@ -33,8 +33,11 @@ namespace GFGGame
         private string[] _wordList;
         private string[] _wordList;
         private int _wordIndex = 0;
         private int _wordIndex = 0;
         private bool _isShowLetters;
         private bool _isShowLetters;
+        private bool _canClickBtnNext;
+        private bool _waitPic;
         private string _currentWords;
         private string _currentWords;
         private string _storyStartID;
         private string _storyStartID;
+        private string lastTextFieldType;   // 上一段文本框的类型
 
 
         //屏幕效果中
         //屏幕效果中
         private Action<object> _onScreenEffectComplete;
         private Action<object> _onScreenEffectComplete;
@@ -111,6 +114,7 @@ namespace GFGGame
             }
             }
             _speedAutoPlay = FightDataManager.Instance.dialogSpeed;
             _speedAutoPlay = FightDataManager.Instance.dialogSpeed;
             _autoPlay = false;
             _autoPlay = false;
+            lastTextFieldType = "";
             UpdateSpeedUpBtn();
             UpdateSpeedUpBtn();
             _dialogListLookBack = new List<string>();
             _dialogListLookBack = new List<string>();
             object[] datas = viewData as object[];
             object[] datas = viewData as object[];
@@ -146,6 +150,7 @@ namespace GFGGame
                 FightDataManager.Instance.dialogSpeed = _speedAutoPlay;
                 FightDataManager.Instance.dialogSpeed = _speedAutoPlay;
             }
             }
             _ui.m_btnBack.visible = InstanceZonesDataManager.CheckLevelPass(100001001);
             _ui.m_btnBack.visible = InstanceZonesDataManager.CheckLevelPass(100001001);
+            
         }
         }
 
 
         protected override void OnHide()
         protected override void OnHide()
@@ -176,6 +181,10 @@ namespace GFGGame
 
 
         private void OnClickBtnNext()
         private void OnClickBtnNext()
         {
         {
+            if (!_canClickBtnNext)
+            {
+                return;
+            }
             // StopAutoPlay();
             // StopAutoPlay();
             if (_onScreenEffectComplete != null)
             if (_onScreenEffectComplete != null)
             {
             {
@@ -317,6 +326,9 @@ namespace GFGGame
 
 
         private void InitStepContent(StoryDialogCfg storyDialogCfg)
         private void InitStepContent(StoryDialogCfg storyDialogCfg)
         {
         {
+            _canClickBtnNext = true;
+            _waitPic = false;
+
             _currentStepCfg = storyDialogCfg;
             _currentStepCfg = storyDialogCfg;
             UpdateMusic(storyDialogCfg.musicRes);
             UpdateMusic(storyDialogCfg.musicRes);
             UpdateBg(storyDialogCfg.bgRes);
             UpdateBg(storyDialogCfg.bgRes);
@@ -433,6 +445,7 @@ namespace GFGGame
                 }
                 }
                 _wordTextField = _ui.m_dialogHead.m_txtContent;
                 _wordTextField = _ui.m_dialogHead.m_txtContent;
                 _arrow = _ui.m_dialogHead.m_iconNext;
                 _arrow = _ui.m_dialogHead.m_iconNext;
+                lastTextFieldType = "head";
             }
             }
             else if (!string.IsNullOrEmpty(headRes))
             else if (!string.IsNullOrEmpty(headRes))
             {
             {
@@ -446,6 +459,7 @@ namespace GFGGame
                 _ui.m_dialogHead.m_comphead.m_head.url = ResPathUtil.GetNpcHeadPath(headRes);
                 _ui.m_dialogHead.m_comphead.m_head.url = ResPathUtil.GetNpcHeadPath(headRes);
                 _wordTextField = _ui.m_dialogHead.m_txtContent;
                 _wordTextField = _ui.m_dialogHead.m_txtContent;
                 _arrow = _ui.m_dialogHead.m_iconNext;
                 _arrow = _ui.m_dialogHead.m_iconNext;
+                lastTextFieldType = "head";
             }
             }
             else if (!string.IsNullOrEmpty(roleName))
             else if (!string.IsNullOrEmpty(roleName))
             {
             {
@@ -455,6 +469,18 @@ namespace GFGGame
                 _ui.m_dialogName.m_txtName.text = roleName;
                 _ui.m_dialogName.m_txtName.text = roleName;
                 _wordTextField = _ui.m_dialogName.m_txtContent;
                 _wordTextField = _ui.m_dialogName.m_txtContent;
                 _arrow = _ui.m_dialogName.m_iconNext;
                 _arrow = _ui.m_dialogName.m_iconNext;
+
+                if (!lastTextFieldType.Equals("name"))
+                {
+                    lastTextFieldType = "name";
+                    _ui.m_t0.Play();
+
+                    // Wait pic's animation finished 
+                    if(storyDialogCfg.picRes.Length > 0 && !storyDialogCfg.picRes.Equals("0"))
+                    {
+                        _waitPic = true;
+                    }
+                }
             }
             }
             else
             else
             {
             {
@@ -463,9 +489,11 @@ namespace GFGGame
                 _ui.m_dialogHead.target.visible = false;
                 _ui.m_dialogHead.target.visible = false;
                 _wordTextField = _ui.m_dialogText.m_txtContent;
                 _wordTextField = _ui.m_dialogText.m_txtContent;
                 _arrow = _ui.m_dialogText.m_iconNext;
                 _arrow = _ui.m_dialogText.m_iconNext;
+                lastTextFieldType = "text";
             }
             }
             _wordList = Regex.Split(words, "&&");
             _wordList = Regex.Split(words, "&&");
             _wordIndex = 0;
             _wordIndex = 0;
+
             ShowNextDialog();
             ShowNextDialog();
         }
         }
 
 
@@ -485,7 +513,8 @@ namespace GFGGame
                 {
                 {
                     _wordTextField.data = null;
                     _wordTextField.data = null;
                 }
                 }
-                StartShowLetters();
+
+                Timers.inst.StartCoroutine(StartShowLetters());
             }
             }
             else
             else
             {
             {
@@ -530,13 +559,22 @@ namespace GFGGame
             }
             }
         }
         }
 
 
-        private void StartShowLetters()
+        private IEnumerator StartShowLetters()
         {
         {
             _isShowLetters = true;
             _isShowLetters = true;
             _arrow.target.visible = false;
             _arrow.target.visible = false;
             _wordTextField.verticalAlign = VertAlignType.Top;
             _wordTextField.verticalAlign = VertAlignType.Top;
             _wordTextField.text = "";
             _wordTextField.text = "";
             ArrayList letters = StoryUtil.GetLettersList(_currentWords);
             ArrayList letters = StoryUtil.GetLettersList(_currentWords);
+
+            if (_waitPic)
+            {
+                _waitPic = false;
+                _canClickBtnNext = false;
+                yield return new WaitForSeconds(0.5f);
+                _canClickBtnNext = true;
+            }
+
             Timers.inst.Add(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay, 0, UpdateLetters, letters);
             Timers.inst.Add(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay, 0, UpdateLetters, letters);
         }
         }
 
 

BIN
GameClient/Assets/ResIn/UI/CreateRole/CreateRole_fui.bytes


BIN
GameClient/Assets/ResIn/UI/Main/Main_fui.bytes