Przeglądaj źródła

剧情回顾fix

guodong 3 lat temu
rodzic
commit
90086b4233

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

@@ -21,7 +21,7 @@ namespace GFGGame
         private OnCompleteStoryDialogCall _onCompleteStoryDialogCall;
         private object _onCompleteStoryDialogCallParam;
         //»Ø¹Ë
-        private ArrayList _dialogListLookBack;
+        private List<string> _dialogListLookBack;
         //×Ô¶¯²¥·Å
         private int _speedAutoPlay = 1;
         private bool _autoPlay = false;
@@ -33,6 +33,7 @@ namespace GFGGame
         private int _wordIndex = 0;
         private bool _isShowLetters;
         private string _currentWords;
+        private string _stroyStartID;
 
 
 
@@ -94,9 +95,9 @@ namespace GFGGame
             _speedAutoPlay = 1;
             _autoPlay = false;
             UpdateSpeedUpBtn();
-            _dialogListLookBack = new ArrayList();
+            _dialogListLookBack = new List<string>();
             object[] datas = viewData as object[];
-            string stroyStartID = (string)datas[0];
+            _stroyStartID = (string)datas[0];
             bool skipable = (bool)datas[1];
             _onCompleteStoryDialogCall = (OnCompleteStoryDialogCall)datas[2];
             if (datas.Length > 3)
@@ -110,11 +111,11 @@ namespace GFGGame
             }
 
             _ui.m_btnSkip.enabled = skipable;
-            ShowNextStep(stroyStartID);
+            ShowNextStep(_stroyStartID);
 
             _ui.m_c1.selectedIndex = 0;
             _ui.m_btnAutoPlay.selected = false;
-            if (stroyStartID == MainStoryDataManager.priorId)
+            if (_stroyStartID == MainStoryDataManager.priorId)
             {
                 _ui.m_c1.selectedIndex = 1;
                 // _ui.m_btnAutoPlay.selected = true;
@@ -156,7 +157,7 @@ namespace GFGGame
 
         private void OnClickBtnLookBack()
         {
-            ViewManager.Show(ViewName.STORY_LOOK_BACK_VIEW, _dialogListLookBack);
+            ViewManager.Show(ViewName.STORY_LOOK_BACK_VIEW, _stroyStartID);
         }
 
         private void OnBtnSkip()
@@ -388,7 +389,6 @@ namespace GFGGame
                 string itemInfo = _wordList[_wordIndex];
                 string[] itemInfoList = Regex.Split(itemInfo, "=");
                 _currentWords = itemInfoList[0];
-                StartShowLetters();
                 if (itemInfoList.Length > 1)
                 {
                     _wordTextField.data = itemInfoList[1];
@@ -397,6 +397,7 @@ namespace GFGGame
                 {
                     _wordTextField.data = null;
                 }
+                StartShowLetters();
             }
             else
             {

+ 208 - 5
GameClient/Assets/Game/HotUpdate/Views/MainStory/StoryLookBackView.cs

@@ -1,11 +1,22 @@
-using FairyGUI;
 using UI.Main;
-using System.Collections;
+using System.Text.RegularExpressions;
+using System.Collections.Generic;
+
 namespace GFGGame
 {
     public class StoryLookBackView : BaseWindow
     {
         private UI_StoryLookBackUI _ui;
+        private List<StoryDialogCfg> _stepListToRead;
+        private List<string> _dialogListLookBack;
+        private StoryDialogCfg _currentStepCfg;
+        private string _nextStepId;
+        private string[] _wordList;
+        private int _wordIndex = 0;
+        private bool _isShowLetters;
+        private string _currentWords;
+        private string _currentData;
+
         protected override void OnInit()
         {
             base.OnInit();
@@ -22,11 +33,18 @@ namespace GFGGame
         {
             base.OnShown();
             _ui.m_content.m_txtContent.text = "";
-            ArrayList dialogRead = (ArrayList)viewData;
-            if(dialogRead != null)
+            _dialogListLookBack = new List<string>();
+            string stroyStartID = (string)this.viewData;
+
+            ShowNextStep(stroyStartID);
+
+
+
+
+            if (stroyStartID != null)
             {
                 string content = "";
-                foreach(string words in dialogRead)
+                foreach (string words in _dialogListLookBack)
                 {
                     content += words + "\n";
                 }
@@ -39,5 +57,190 @@ namespace GFGGame
         {
             base.OnHide();
         }
+
+        private void InitStepListById(string dialogID)
+        {
+            var temp = StoryDialogCfgArray.Instance.GetCfgs(dialogID);
+            _stepListToRead = new List<StoryDialogCfg>(temp);
+        }
+
+        private void ShowNextStep(string nextStepId)
+        {
+            if (nextStepId != null)
+            {
+                InitStepListById(nextStepId);
+            }
+            if (_stepListToRead != null && _stepListToRead.Count > 0)
+            {
+                StoryDialogCfg storyDialogCfg = (StoryDialogCfg)_stepListToRead[0];
+                _stepListToRead.RemoveAt(0);
+                InitStepContent(storyDialogCfg);
+            }
+            else
+            {
+                
+            }
+        }
+
+        private void InitStepContent(StoryDialogCfg storyDialogCfg)
+        {
+            string content = storyDialogCfg.content;
+            content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
+            if (content.IndexOf("//") >= 0)
+            {
+                showList(content);
+            }
+            else
+            {
+                ShowDialog(storyDialogCfg);
+            }
+        }
+
+        private void showList(string content)
+        {
+            _currentData = null;
+            string[] list = Regex.Split(content, "//");
+            string itemInfo = list[0];
+            string[] itemInfoList = Regex.Split(itemInfo, "=");
+            _dialogListLookBack.Add(itemInfoList[0]);
+            string stepID = itemInfoList.Length > 1 ? itemInfoList[1] : null;
+            if (stepID == null)
+            {
+                stepID = "0";
+            }
+            OnStepComplete(stepID);
+        }
+
+        private void OnStepComplete(string nextStepId = null)
+        {
+            _nextStepId = nextStepId;
+            OnScreenEffectComplete();
+        }
+
+        private void OnScreenEffectComplete(object param = null)
+        {
+            if (_nextStepId == "0")
+            {
+                Over();
+            }
+            else
+            {
+                ShowNextStep(_nextStepId);
+            }
+        }
+
+        private void ShowDialog(StoryDialogCfg storyDialogCfg)
+        {
+            var content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
+            string words = content;
+            string roleName = storyDialogCfg.name;
+            if (roleName == "self")
+            {
+                roleName = RoleDataManager.roleName;
+            }
+            //»Ø¹Ë
+            if (!string.IsNullOrEmpty(roleName))
+            {
+                _dialogListLookBack.Add("[color=#FDA2B1]" + roleName + "[/color]");
+            }
+            _wordList = Regex.Split(words, "&&");
+            _wordIndex = 0;
+            ShowNextDialog();
+        }
+
+
+        private void ShowNextDialog()
+        {
+            if (_wordList != null && _wordList.Length > _wordIndex)
+            {
+                string itemInfo = _wordList[_wordIndex];
+                string[] itemInfoList = Regex.Split(itemInfo, "=");
+                _currentWords = itemInfoList[0];
+                if (itemInfoList.Length > 1)
+                {
+                    _currentData = itemInfoList[1];
+                }
+                else
+                {
+                    _currentData = null;
+                }
+                ShowCurrentWords();
+            }
+            else
+            {
+                OnStepComplete();
+            }
+        }
+
+        private void ShowCurrentWords()
+        {
+            _dialogListLookBack.Add(_currentWords);
+            _wordIndex++;
+            ShowNextWords(null);
+        }
+
+        private void ShowNextWords(object param = null)
+        {
+            string stepID = _currentData;
+            if (stepID != null)
+            {
+                OnStepComplete(stepID);
+            }
+            else
+            {
+                ShowNextDialog();
+            }
+        }
+
+        private void UpdateBg(string value)
+        {
+            if (value.Length > 0)
+            {
+                
+            }
+        }
+
+        private void UpdatePic(string value)
+        {
+            if (value.Length > 0)
+            {
+                
+            }
+        }
+
+        private void UpdateMusic(string value)
+        {
+            if (value.Length > 0)
+            {
+                if (value == "0")
+                {
+                    MusicManager.Instance.Stop();
+                }
+                else
+                {
+                    MusicManager.Instance.Play(ResPathUtil.GetMusicPath(value, "mp3"));
+                }
+            }
+        }
+
+        private void PlayEffect(string[] infos)
+        {
+
+        }
+
+        private void PlayShake(int[] shakeInfoArr)
+        {
+            if (shakeInfoArr != null && shakeInfoArr.Length > 0)
+            {
+                
+            }
+        }
+
+        private void Over(bool isSkip = false)
+        {
+            
+        }
+
+
     }
 }