|
@@ -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)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|