StoryDialogView.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. using FairyGUI;
  2. using UnityEngine;
  3. using UI.Main;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Text.RegularExpressions;
  7. using System;
  8. namespace GFGGame
  9. {
  10. public delegate void OnCompleteStoryDialogCall(bool isSkip, object param);
  11. public class StoryDialogView : BaseView
  12. {
  13. private UI_StoryDialogUI _ui;
  14. private UI_CompArrow _arrow;
  15. private GameObject _sceneObject;
  16. private GameObject _scenePrefab;
  17. private GameObject _npcHead;
  18. private DressUpObjUI _dressUpObjUI;
  19. private GoWrapper _npcWrapper;
  20. private GTextField _wordTextField;
  21. //剧情完成回调
  22. private OnCompleteStoryDialogCall _onCompleteStoryDialogCall;
  23. private object _onCompleteStoryDialogCallParam;
  24. //回顾
  25. private List<string> _dialogListLookBack;
  26. //自动播放
  27. private int _speedAutoPlay = 1;
  28. private bool _autoPlay = false;
  29. //剧情状态
  30. private List<StoryDialogCfg> _stepListToRead;
  31. private StoryDialogCfg _currentStepCfg;
  32. private string _nextStepId;
  33. private string[] _wordList;
  34. private int _wordIndex = 0;
  35. private bool _isShowLetters;
  36. private string _currentWords;
  37. private string _stroyStartID;
  38. //屏幕效果中
  39. private Action<object> _onScreenEffectComplete;
  40. public override void Dispose()
  41. {
  42. base.Dispose();
  43. if (_sceneObject != null)
  44. {
  45. GameObject.Destroy(_sceneObject);
  46. _sceneObject = null;
  47. }
  48. _dressUpObjUI?.Dispose();
  49. _dressUpObjUI = null;
  50. _wordTextField = null;
  51. _arrow = null;
  52. _isShowLetters = false;
  53. SceneController.DestroyObjectFromView(_npcHead, _npcWrapper);
  54. _onScreenEffectComplete = null;
  55. Timers.inst.Remove(UpdateLetters);
  56. if (_ui != null)
  57. {
  58. _ui.Dispose();
  59. _ui = null;
  60. }
  61. }
  62. protected override void Init()
  63. {
  64. base.Init();
  65. packageName = UI_StoryDialogUI.PACKAGE_NAME;
  66. _ui = UI_StoryDialogUI.Create();
  67. viewCom = _ui.target;
  68. isfullScreen = true;
  69. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneStoryDialog"));
  70. }
  71. protected override void OnInit()
  72. {
  73. base.OnInit();
  74. _ui.m_dialogText.target.visible = false;
  75. _ui.m_dialogName.target.visible = false;
  76. _ui.m_dialogHead.target.visible = false;
  77. _ui.m_list.visible = false;
  78. _ui.m_btnNext.width = GRoot.inst.width;
  79. _ui.m_btnNext.height = GRoot.inst.height;
  80. _ui.m_btnNext.AddRelation(GRoot.inst, RelationType.Size);
  81. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  82. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  83. _ui.m_btnLookBack.onClick.Add(OnClickBtnLookBack);
  84. _ui.m_btnSkip.onClick.Add(OnBtnSkip);
  85. _ui.m_list.onClickItem.Add(OnClickListItem);
  86. _ui.m_btnSpeedUp.onClick.Add(OnClickBtnSpeedUp);
  87. _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
  88. }
  89. protected override void OnShown()
  90. {
  91. base.OnShown();
  92. if (_sceneObject == null)
  93. {
  94. _sceneObject = GameObject.Instantiate(_scenePrefab);
  95. }
  96. if (_dressUpObjUI == null)
  97. {
  98. _dressUpObjUI = new DressUpObjUI();
  99. }
  100. _speedAutoPlay = FightDataManager.Instance.dialogSpeed;
  101. _autoPlay = false;
  102. UpdateSpeedUpBtn();
  103. _dialogListLookBack = new List<string>();
  104. object[] datas = viewData as object[];
  105. _stroyStartID = (string)datas[0];
  106. bool skipable = (bool)datas[1];
  107. _onCompleteStoryDialogCall = (OnCompleteStoryDialogCall)datas[2];
  108. if (datas.Length > 3)
  109. {
  110. _onCompleteStoryDialogCallParam = datas[3];
  111. }
  112. //
  113. // StoryChapterCfg chapterCfg0 = StoryChapterCfgArray.Instance.GetCfg(MainStoryDataManager.currentChapterCfgId);
  114. // List<StoryLevelCfg> storyLevelCfg0 = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg0.type, chapterCfg0.subType, chapterCfg0.id);
  115. StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(MainStoryDataManager.currentChapterCfgId);
  116. StoryLevelCfg storyLevelCfg = chapterCfg == null ? null : StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(chapterCfg.type, chapterCfg.subType, chapterCfg.id)[0];
  117. if (LauncherConfig.netType == LauncherConfig.EnumNetType.TEMP && chapterCfg != null && storyLevelCfg != null && MainStoryDataManager.currentChapterCfgId == 10001 && storyLevelCfg.order == 1 && !InstanceZonesDataManager.CheckLevelPass(storyLevelCfg.id))
  118. {
  119. // 临时设置都可以跳过对话
  120. skipable = false;
  121. }
  122. else
  123. {
  124. skipable = true;
  125. }
  126. _ui.m_btnSkip.visible = skipable;
  127. ShowNextStep(_stroyStartID);
  128. _ui.m_c1.selectedIndex = 0;
  129. _ui.m_btnAutoPlay.selected = false;
  130. if (_stroyStartID == MainStoryDataManager.priorId)
  131. {
  132. _ui.m_c1.selectedIndex = 1;
  133. // _ui.m_btnAutoPlay.selected = true;
  134. OnClickBtnAutoPlay();
  135. _speedAutoPlay = 1;
  136. FightDataManager.Instance.dialogSpeed = _speedAutoPlay;
  137. }
  138. }
  139. protected override void OnHide()
  140. {
  141. base.OnHide();
  142. Timers.inst.Remove(UpdateLetters);
  143. Timers.inst.Remove(UpdateShake);
  144. Timers.inst.Remove(OnScreenEffectComplete);
  145. Timers.inst.Remove(ShowNextWords);
  146. ScreenBlackController.Instance.HideBlack();
  147. StopAutoPlay();
  148. if (_sceneObject != null)
  149. {
  150. GameObject.Destroy(_sceneObject);
  151. _sceneObject = null;
  152. }
  153. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  154. _onCompleteStoryDialogCall = null;
  155. _onCompleteStoryDialogCallParam = null;
  156. }
  157. private void OnClickBtnBack()
  158. {
  159. // this.Hide();
  160. ViewManager.GoBackFrom(typeof(StoryDialogView).FullName);
  161. // Over(false);
  162. }
  163. private void OnClickBtnNext()
  164. {
  165. // StopAutoPlay();
  166. if(_onScreenEffectComplete != null)
  167. {
  168. Timers.inst.Remove(OnScreenEffectComplete);
  169. _onScreenEffectComplete.Invoke(null);
  170. }
  171. else
  172. {
  173. ShowNextWords();
  174. }
  175. }
  176. private void OnClickBtnLookBack()
  177. {
  178. if (_ui.m_btnSkip.enabled)
  179. {
  180. ViewManager.Show(ViewName.STORY_LOOK_BACK_VIEW, _stroyStartID);
  181. }
  182. else
  183. {
  184. ViewManager.Show(ViewName.STORY_LOOK_BACK_VIEW, _dialogListLookBack);
  185. }
  186. }
  187. private void OnBtnSkip()
  188. {
  189. Over(true);
  190. }
  191. private void OnClickListItem(EventContext context)
  192. {
  193. UI_ListDialogItem dialogItem = UI_ListDialogItem.Proxy(context.data as GObject);
  194. _dialogListLookBack.Add(dialogItem.m_txtContent.text);
  195. string stepID = (string)dialogItem.target.data;
  196. if (stepID == null)
  197. {
  198. stepID = "0";
  199. }
  200. UI_ListDialogItem.ProxyEnd();
  201. OnStepComplete(stepID);
  202. }
  203. private void OnClickBtnSpeedUp()
  204. {
  205. //如果没有自动播放先开始自动播放
  206. if (!_autoPlay)
  207. {
  208. _ui.m_btnAutoPlay.selected = true;
  209. OnClickBtnAutoPlay();
  210. }
  211. _speedAutoPlay = _speedAutoPlay * 2;
  212. if (_speedAutoPlay > GameConst.MAX_SPEED_AUTO_PLAY)
  213. {
  214. _speedAutoPlay = 1;
  215. }
  216. FightDataManager.Instance.dialogSpeed = _speedAutoPlay;
  217. UpdateSpeedUpBtn();
  218. }
  219. private void OnClickBtnAutoPlay()
  220. {
  221. _autoPlay = _ui.m_btnAutoPlay.selected;
  222. if (_autoPlay)
  223. {
  224. ShowNextWords();
  225. }
  226. }
  227. private void InitStepListById(string dialogID)
  228. {
  229. var temp = StoryDialogCfgArray.Instance.GetCfgsByid(dialogID);
  230. _stepListToRead = new List<StoryDialogCfg>(temp);
  231. }
  232. private void ShowNextStep(string nextStepId)
  233. {
  234. if (nextStepId != null)
  235. {
  236. InitStepListById(nextStepId);
  237. }
  238. if (_stepListToRead != null && _stepListToRead.Count > 0)
  239. {
  240. StoryDialogCfg storyDialogCfg = (StoryDialogCfg)_stepListToRead[0];
  241. _stepListToRead.RemoveAt(0);
  242. InitStepContent(storyDialogCfg);
  243. }
  244. else
  245. {
  246. Over();
  247. }
  248. }
  249. private void OnStepComplete(string nextStepId = null)
  250. {
  251. _nextStepId = nextStepId;
  252. _ui.m_dialogText.target.visible = false;
  253. _ui.m_dialogName.target.visible = false;
  254. _ui.m_dialogHead.target.visible = false;
  255. float delay = 0;
  256. //屏幕效果
  257. if (_currentStepCfg != null)
  258. {
  259. if (_currentStepCfg.blackScreenDur > 0)
  260. {
  261. delay = _currentStepCfg.blackScreenDur;
  262. ScreenBlackController.Instance.ShowBlack(delay, this.viewCom, 0);
  263. }
  264. else if (_currentStepCfg.blankScreenDur > 0)
  265. {
  266. delay = _currentStepCfg.blankScreenDur;
  267. UpdatePic("0");
  268. }
  269. }
  270. if (delay > 0)
  271. {
  272. //转换成秒
  273. delay = delay / 1000f;
  274. _onScreenEffectComplete = OnScreenEffectComplete;
  275. Timers.inst.Add(delay, 1, OnScreenEffectComplete);
  276. }
  277. else
  278. {
  279. OnScreenEffectComplete();
  280. }
  281. }
  282. private void OnScreenEffectComplete(object param = null)
  283. {
  284. _onScreenEffectComplete = null;
  285. if (_nextStepId == "0")
  286. {
  287. Over();
  288. }
  289. else
  290. {
  291. ShowNextStep(_nextStepId);
  292. }
  293. }
  294. private void InitStepContent(StoryDialogCfg storyDialogCfg)
  295. {
  296. _currentStepCfg = storyDialogCfg;
  297. UpdateMusic(storyDialogCfg.musicRes);
  298. UpdateBg(storyDialogCfg.bgRes);
  299. UpdatePic(storyDialogCfg.picRes);
  300. PlayEffect(storyDialogCfg.effectInfoArr);
  301. PlayShake(storyDialogCfg.shakeInfoArr);
  302. string content = storyDialogCfg.content;
  303. content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
  304. if (content.IndexOf("//") >= 0)
  305. {
  306. showList(content);
  307. }
  308. else
  309. {
  310. ShowDialog(storyDialogCfg);
  311. }
  312. }
  313. private void showList(string content)
  314. {
  315. StopAutoPlay();
  316. _ui.m_btnAutoPlay.enabled = false;
  317. _wordTextField = null;
  318. _ui.m_dialogText.target.visible = false;
  319. _ui.m_dialogName.target.visible = false;
  320. _ui.m_dialogHead.target.visible = false;
  321. _ui.m_list.visible = true;
  322. _ui.m_list.RemoveChildrenToPool();
  323. string[] list = Regex.Split(content, "//");
  324. _ui.m_list.itemRenderer = (int index, GObject item) =>
  325. {
  326. string itemInfo = list[index];
  327. string[] itemInfoList = Regex.Split(itemInfo, "=");
  328. UI_ListDialogItem dialogItem = UI_ListDialogItem.Proxy(item);
  329. dialogItem.m_txtContent.text = itemInfoList[0];
  330. dialogItem.target.data = itemInfoList.Length > 1 ? itemInfoList[1] : null;
  331. UI_ListDialogItem.ProxyEnd();
  332. };
  333. _ui.m_list.numItems = list.Length;
  334. }
  335. private void ShowDialog(StoryDialogCfg storyDialogCfg)
  336. {
  337. _ui.m_btnAutoPlay.enabled = true;
  338. _ui.m_list.visible = false;
  339. var content = storyDialogCfg.content.Replace("self", RoleDataManager.roleName);
  340. string words = content;
  341. string roleName = storyDialogCfg.name;
  342. string headRes = storyDialogCfg.head;
  343. string headAniRes = storyDialogCfg.headAni;
  344. if (roleName == "self")
  345. {
  346. roleName = RoleDataManager.roleName;
  347. }
  348. //回顾
  349. if (roleName != null)
  350. {
  351. _dialogListLookBack.Add("[color=#FDA2B1]" + roleName + "[/color]");
  352. }
  353. if (!string.IsNullOrEmpty(headAniRes))
  354. {
  355. var headAniCfg = HeadAniCfgArray.Instance.GetCfg(headAniRes);
  356. _ui.m_dialogText.target.visible = false;
  357. _ui.m_dialogName.target.visible = false;
  358. _ui.m_dialogHead.target.visible = true;
  359. _ui.m_dialogHead.m_txtName.text = roleName;
  360. _ui.m_dialogHead.m_comphead.m_head.visible = false;
  361. _ui.m_dialogHead.m_comphead.m_holder.visible = true;
  362. if (headAniCfg.faceId > 0)
  363. {
  364. //换装表情
  365. _ui.m_dialogHead.m_compDressUp.target.visible = true;
  366. _ui.m_dialogHead.m_comphead.target.visible = false;
  367. _dressUpObjUI.ResetSceneObj(80, true, false, null, false);
  368. _dressUpObjUI.dressUpObj.PutOnDressUpData(CustomSuitDataManager.GetCurrentSuitData().dressUpData);
  369. if (_dressUpObjUI.dressUpObj.actionId > 0)
  370. {
  371. _dressUpObjUI.dressUpObj.CancelAction(true);
  372. }
  373. _dressUpObjUI.dressUpObj.AddOrRemove(headAniCfg.faceId, false);
  374. _dressUpObjUI.UpdateWrapper(_ui.m_dialogHead.m_compDressUp.m_holder);
  375. }
  376. else
  377. {
  378. //独立动画
  379. _ui.m_dialogHead.m_compDressUp.target.visible = false;
  380. _ui.m_dialogHead.m_comphead.target.visible = true;
  381. string resPath = ResPathUtil.GetViewEffectPath("ui_nzbq", headAniCfg.headAni);
  382. SceneController.AddObjectToView(null, _npcWrapper, _ui.m_dialogHead.m_comphead.m_holder, resPath, out _npcHead, out _npcWrapper);
  383. }
  384. _wordTextField = _ui.m_dialogHead.m_txtContent;
  385. _arrow = _ui.m_dialogHead.m_iconNext;
  386. }
  387. else if (!string.IsNullOrEmpty(headRes))
  388. {
  389. _ui.m_dialogText.target.visible = false;
  390. _ui.m_dialogName.target.visible = false;
  391. _ui.m_dialogHead.target.visible = true;
  392. _ui.m_dialogHead.m_txtName.text = roleName;
  393. _ui.m_dialogHead.m_comphead.m_head.visible = true;
  394. _ui.m_dialogHead.m_comphead.m_holder.visible = false;
  395. _ui.m_dialogHead.m_comphead.m_head.url = ResPathUtil.GetNpcHeadPath(headRes);
  396. _wordTextField = _ui.m_dialogHead.m_txtContent;
  397. _arrow = _ui.m_dialogHead.m_iconNext;
  398. }
  399. else if (!string.IsNullOrEmpty(roleName))
  400. {
  401. _ui.m_dialogText.target.visible = false;
  402. _ui.m_dialogName.target.visible = true;
  403. _ui.m_dialogHead.target.visible = false;
  404. _ui.m_dialogName.m_txtName.text = roleName;
  405. _wordTextField = _ui.m_dialogName.m_txtContent;
  406. _arrow = _ui.m_dialogName.m_iconNext;
  407. }
  408. else
  409. {
  410. _ui.m_dialogText.target.visible = true;
  411. _ui.m_dialogName.target.visible = false;
  412. _ui.m_dialogHead.target.visible = false;
  413. _wordTextField = _ui.m_dialogText.m_txtContent;
  414. _arrow = _ui.m_dialogText.m_iconNext;
  415. }
  416. _wordList = Regex.Split(words, "&&");
  417. _wordIndex = 0;
  418. ShowNextDialog();
  419. }
  420. private void ShowNextDialog()
  421. {
  422. if (_wordList != null && _wordList.Length > _wordIndex)
  423. {
  424. string itemInfo = _wordList[_wordIndex];
  425. string[] itemInfoList = Regex.Split(itemInfo, "=");
  426. _currentWords = itemInfoList[0];
  427. if (itemInfoList.Length > 1)
  428. {
  429. _wordTextField.data = itemInfoList[1];
  430. }
  431. else
  432. {
  433. _wordTextField.data = null;
  434. }
  435. StartShowLetters();
  436. }
  437. else
  438. {
  439. OnStepComplete();
  440. }
  441. }
  442. private void ShowCurrentWords()
  443. {
  444. _arrow.target.visible = true;
  445. Timers.inst.Remove(UpdateLetters);
  446. _wordTextField.text = _currentWords;
  447. _dialogListLookBack.Add(_currentWords);
  448. _isShowLetters = false;
  449. _wordIndex++;
  450. if (_autoPlay)
  451. {
  452. Timers.inst.Add(GameConst.NEXT_WORDS_INTERVAL_MAX / _speedAutoPlay, 1, ShowNextWords);
  453. }
  454. }
  455. private void ShowNextWords(object param = null)
  456. {
  457. if (_wordTextField != null)
  458. {
  459. if (_isShowLetters)
  460. {
  461. ShowCurrentWords();
  462. }
  463. else
  464. {
  465. string stepID = (string)_wordTextField.data;
  466. if (stepID != null)
  467. {
  468. OnStepComplete(stepID);
  469. }
  470. else
  471. {
  472. ShowNextDialog();
  473. }
  474. }
  475. }
  476. }
  477. private void StartShowLetters()
  478. {
  479. _isShowLetters = true;
  480. _arrow.target.visible = false;
  481. _wordTextField.verticalAlign = VertAlignType.Top;
  482. _wordTextField.text = "";
  483. ArrayList letters = StoryUtil.GetLettersList(_currentWords);
  484. Timers.inst.Add(GameConst.LETTERS_INTERVAL_MAX / _speedAutoPlay, 0, UpdateLetters, letters);
  485. }
  486. private void UpdateLetters(object param)
  487. {
  488. ArrayList letters = (ArrayList)param;
  489. if (letters == null || letters.Count <= 0)
  490. {
  491. ShowCurrentWords();
  492. }
  493. else
  494. {
  495. string letter = (string)letters[0];
  496. letters.RemoveAt(0);
  497. _wordTextField.text = _wordTextField.text + letter;
  498. }
  499. }
  500. private void UpdateBg(string value)
  501. {
  502. if (value.Length > 0)
  503. {
  504. SceneController.UpdateDialogBg(value, _sceneObject);
  505. }
  506. }
  507. private void UpdatePic(string value)
  508. {
  509. if (value.Length > 0)
  510. {
  511. SceneController.UpdateDialogPic(value, _sceneObject);
  512. }
  513. }
  514. private void UpdateMusic(string value)
  515. {
  516. if (value.Length > 0)
  517. {
  518. if (value == "0")
  519. {
  520. MusicManager.Instance.Stop();
  521. }
  522. else
  523. {
  524. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(value, "mp3"));
  525. }
  526. }
  527. }
  528. private void PlayEffect(string[] infos)
  529. {
  530. }
  531. private void PlayShake(int[] shakeInfoArr)
  532. {
  533. if (shakeInfoArr != null && shakeInfoArr.Length > 0)
  534. {
  535. Vector3 position = _sceneObject.transform.position;
  536. position.x = (float)shakeInfoArr[0] / GameConst.PIXELS_PER_UNITY_UNIT;
  537. position.y = (float)shakeInfoArr[1] / GameConst.PIXELS_PER_UNITY_UNIT;
  538. _sceneObject.transform.position = position;
  539. float attenuationX = (float)shakeInfoArr[2] / GameConst.PIXELS_PER_UNITY_UNIT;
  540. float attenuationY = (float)shakeInfoArr[3] / GameConst.PIXELS_PER_UNITY_UNIT;
  541. float interval = (float)shakeInfoArr[4] / 1000;
  542. float duration = (float)shakeInfoArr[5] / 1000;
  543. int repeat = Mathf.RoundToInt(duration / interval);
  544. Timers.inst.Add(interval, 0, UpdateShake, new float[] { attenuationX, attenuationY });
  545. }
  546. }
  547. private void UpdateShake(object param)
  548. {
  549. float[] attenuations = param as float[];
  550. float attenuationX = attenuations[0];
  551. float attenuationY = attenuations[1];
  552. Vector3 position = _sceneObject.transform.position;
  553. bool done = false;
  554. bool doneX = false;
  555. float absX = Mathf.Abs(position.x);
  556. if (absX > attenuationX)
  557. {
  558. int dir = (int)(position.x / absX);
  559. position.x = Mathf.Abs(position.x) - attenuationX;
  560. position.x *= -1 * dir;
  561. }
  562. else
  563. {
  564. doneX = true;
  565. position.x = 0;
  566. }
  567. bool doneY = false;
  568. float absY = Mathf.Abs(position.y);
  569. if (absY > attenuationY)
  570. {
  571. int dir = (int)(position.y / absY);
  572. position.y = Mathf.Abs(position.y) - attenuationY;
  573. position.y *= -1 * dir;
  574. }
  575. else
  576. {
  577. doneY = true;
  578. position.y = 0;
  579. }
  580. done = doneX && doneY;
  581. _sceneObject.transform.position = position;
  582. if (done)
  583. {
  584. Timers.inst.Remove(UpdateShake);
  585. }
  586. }
  587. private void Over(bool isSkip = false)
  588. {
  589. if (_onCompleteStoryDialogCall != null)
  590. {
  591. _onCompleteStoryDialogCall(isSkip, _onCompleteStoryDialogCallParam);
  592. }
  593. }
  594. private void UpdateSpeedUpBtn()
  595. {
  596. if (_speedAutoPlay > 1)
  597. {
  598. _ui.m_btnSpeedUp.text = "x" + _speedAutoPlay;
  599. }
  600. else
  601. {
  602. _ui.m_btnSpeedUp.text = "";
  603. }
  604. }
  605. private void StopAutoPlay()
  606. {
  607. _autoPlay = false;
  608. _ui.m_btnAutoPlay.selected = false;
  609. Timers.inst.Remove(ShowNextWords);
  610. }
  611. }
  612. }