StoryE19P2.cs 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. using System;
  2. using System.Collections;
  3. using Core;
  4. using DG.Tweening;
  5. using GameWorld;
  6. using I2.Loc;
  7. using UnityEngine;
  8. public class StoryE19P2 : BaseBehaviour
  9. {
  10. private bool e19elevator
  11. {
  12. get
  13. {
  14. return RoundStorage.Get("E19_Elevator", false);
  15. }
  16. set
  17. {
  18. RoundStorage.Set("E19_Elevator", value);
  19. }
  20. }
  21. private void Start()
  22. {
  23. this.battleCount = 1;
  24. this.rushCount = 0;
  25. this.battle1Over = false;
  26. this.battle2Over = false;
  27. base.StartCoroutine(this.MainCoroutine());
  28. }
  29. private void Update()
  30. {
  31. if (Core.Input.Game.L2.OnPressed && !this.cheater && this.KillAll() > 0)
  32. {
  33. this.cheater = true;
  34. SingletonMono<MobileInputPlayer>.Instance.Button6Visible = false;
  35. base.StartCoroutine(this.CheaterCoroutine());
  36. }
  37. }
  38. private void OnEnable()
  39. {
  40. EventManager.RegisterEvent<BattleEventArgs>("Battle", new EventManager.FBEventHandler<BattleEventArgs>(this.BattleOver), EventManager.ListenerQueue.Game);
  41. EventManager.RegisterEvent<BattleRushEventArgs>("BattleRush", new EventManager.FBEventHandler<BattleRushEventArgs>(this.BattleRush), EventManager.ListenerQueue.Game);
  42. }
  43. private void OnDisable()
  44. {
  45. EventManager.UnregisterEvent<BattleEventArgs>("Battle", new EventManager.FBEventHandler<BattleEventArgs>(this.BattleOver), EventManager.ListenerQueue.Game);
  46. EventManager.UnregisterEvent<BattleRushEventArgs>("BattleRush", new EventManager.FBEventHandler<BattleRushEventArgs>(this.BattleRush), EventManager.ListenerQueue.Game);
  47. }
  48. private void OnDestroy()
  49. {
  50. R.Ui.Tutorial.Hide(new int?(8));
  51. SingletonMono<MobileInputPlayer>.Instance.Button6Visible = false;
  52. CameraFilterUtils.Remove<CameraFilterPack_Blur_Movie>(null);
  53. CameraFilterUtils.Remove<CameraFilterPack_TV_VHS>(null);
  54. CameraFilterUtils.Remove<CameraFilterPack_TV_PlanetMars>(null);
  55. CameraFilterUtils.Remove<CameraFilterPack_VHS_Tracking>(null);
  56. }
  57. private bool BattleOver(string eventName, object sender, BattleEventArgs args)
  58. {
  59. if (args.Status == BattleEventArgs.BattleStatus.End)
  60. {
  61. if (this.battleCount == 1)
  62. {
  63. this.battle1Over = true;
  64. return true;
  65. }
  66. if (this.battleCount == 2)
  67. {
  68. this.battle2Over = true;
  69. return true;
  70. }
  71. }
  72. return true;
  73. }
  74. private bool BattleRush(string eventDefine, object sender, BattleRushEventArgs msg)
  75. {
  76. this.rushCount = msg.Num;
  77. int num = this.battleCount;
  78. if (num != 1)
  79. {
  80. if (num == 2)
  81. {
  82. this.PlayBattleVoiceTwo();
  83. }
  84. }
  85. else
  86. {
  87. this.PlayBattleVoiceOne();
  88. }
  89. return true;
  90. }
  91. private IEnumerator MainCoroutine()
  92. {
  93. yield return R.Audio.PlayVoiceOver("e19t5", null, false);
  94. while (this.attribute.CurrentHp == this.attribute.MaxHp)
  95. {
  96. yield return null;
  97. }
  98. yield return R.Audio.PlayVoiceOver("e19t6", null, false);
  99. yield return this.attribute.GetComponent<SupplyBoxAction>().WaitForBreak();
  100. yield return new WaitForSeconds(2f);
  101. if (!InputSetting.IsWorking())
  102. {
  103. InputSetting.Resume(false);
  104. }
  105. yield return R.Audio.PlayVoiceOver("e19t7", null, false);
  106. R.Trophy.AwardTrophy(21);
  107. CameraFilterUtils.Create<CameraFilterPack_Blur_Movie>(null);
  108. yield return DOTween.To(delegate(float r)
  109. {
  110. CameraFilterPack_Blur_Movie.ChangeRadius = r;
  111. }, 0f, 500f, 1f).WaitForCompletion();
  112. yield return new WaitForSeconds(3f);
  113. yield return DOTween.To(delegate(float r)
  114. {
  115. CameraFilterPack_Blur_Movie.ChangeRadius = r;
  116. }, 500f, 0f, 1f).WaitForCompletion();
  117. CameraFilterUtils.Remove<CameraFilterPack_Blur_Movie>(null);
  118. R.Ui.Toast.Show(ScriptLocalization.Story.e19s1, 2f, true);
  119. yield return new WaitForSeconds(4f);
  120. string e19s2 = ScriptLocalization.mobile.e19s2;
  121. R.Ui.Toast.Show(e19s2, 2f, true);
  122. yield return new WaitForSeconds(4f);
  123. yield return R.Ui.Tutorial.Show(8);
  124. SingletonMono<MobileInputPlayer>.Instance.Button6Visible = true;
  125. yield return new WaitForSeconds(4f);
  126. yield return R.Ui.Tutorial.Hide(new int?(8));
  127. UnityEngine.Object.Destroy(this.attribute.gameObject);
  128. yield return R.Audio.PlayVoiceOver("e19t8", null, false);
  129. this.battle1.SetActive(true);
  130. while (!this.battle1Over)
  131. {
  132. yield return null;
  133. }
  134. yield return R.Audio.PlayVoiceOver("e19t11", null, false);
  135. this.battle2.SetActive(true);
  136. R.Audio.PlayVoiceOver("e19t12", null, false);
  137. this.battleCount = 2;
  138. while (!this.battle2Over)
  139. {
  140. yield return null;
  141. }
  142. SingletonMono<MobileInputPlayer>.Instance.Button6Visible = false;
  143. CameraFilterUtils.Create<CameraFilterPack_TV_VHS>(null);
  144. yield return new WaitForSeconds(2f);
  145. CameraFilterUtils.Remove<CameraFilterPack_TV_VHS>(null);
  146. yield return R.Audio.PlayVoiceOver("e19t16", null, false);
  147. this.winSupply.gameObject.SetActive(true);
  148. yield return R.Audio.PlayVoiceOver("e19t17", null, false);
  149. yield return this.winSupply.GetComponent<SupplyBoxAction>().WaitForBreak();
  150. yield return R.Audio.PlayVoiceOver("e19t18", null, false);
  151. R.Ui.BlackScene.Alpha = 1f;
  152. yield return new WaitForSeconds(4f);
  153. this.e19elevator = true;
  154. this.outGate.Enter(false);
  155. yield break;
  156. }
  157. private IEnumerator CheaterCoroutine()
  158. {
  159. UnityEngine.Object.Destroy(this.battle1.gameObject);
  160. UnityEngine.Object.Destroy(this.battle2.gameObject);
  161. R.Audio.StopBGM(true);
  162. R.Audio.StopVoiceOver();
  163. CameraFilterUtils.Create<CameraFilterPack_TV_PlanetMars>(null);
  164. this.cheater_text.text = ScriptLocalization.Story.e19s3;
  165. this.cheater_text.color = Color.red;
  166. CameraFilterUtils.Remove<CameraFilterPack_TV_PlanetMars>(null);
  167. yield return R.Audio.PlayVoiceOver("e19t20", null, false);
  168. CameraFilterUtils.Create<CameraFilterPack_VHS_Tracking>(null);
  169. int start = R.GameData.Equipment.CoinNum;
  170. for (int i = 0; i < 120; i++)
  171. {
  172. R.GameData.Equipment.CoinNum = (int)Mathf.Lerp((float)start, 0f, (float)i / 119f);
  173. }
  174. this.cheater_text.text = ScriptLocalization.Story.e19s4;
  175. R.GameData.Equipment.CoinNum = 0;
  176. yield return new WaitForSeconds(3f);
  177. CameraFilterUtils.Remove<CameraFilterPack_VHS_Tracking>(null);
  178. yield return R.Audio.PlayVoiceOver("e19t21", null, false);
  179. this.cheaterEffect.SetActive(true);
  180. yield return new WaitForSeconds(5f);
  181. R.Ui.BlackScene.Alpha = 1f;
  182. R.Audio.StopBGM(true);
  183. InputSetting.Stop(false);
  184. yield return R.Audio.PlayVoiceOver("e19t22", null, false);
  185. yield return new WaitForSeconds(3f);
  186. R.Ui.BlackScene.Alpha = 0f;
  187. yield return R.Ui.Terminal.OpenWithAnim(null);
  188. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e19s6, 0.1f);
  189. yield return new WaitForSeconds(3f);
  190. yield return R.Ui.Terminal.CloseWithAnim();
  191. InputSetting.Resume(false);
  192. yield return R.Ui.LevelSelect.OpenWithAnim(true, true);
  193. yield break;
  194. }
  195. private void PlayBattleVoiceOne()
  196. {
  197. int num = this.rushCount;
  198. if (num == 1)
  199. {
  200. R.Audio.PlayVoiceOver("e19t9", null, false);
  201. return;
  202. }
  203. if (num != 2)
  204. {
  205. return;
  206. }
  207. R.Audio.PlayVoiceOver("e19t10", null, false);
  208. }
  209. private void PlayBattleVoiceTwo()
  210. {
  211. int num = this.rushCount;
  212. if (num == 4)
  213. {
  214. R.Audio.PlayVoiceOver("e19t13", null, false);
  215. return;
  216. }
  217. if (num == 5)
  218. {
  219. R.Audio.PlayVoiceOver("e19t14", null, false);
  220. return;
  221. }
  222. if (num != 6)
  223. {
  224. return;
  225. }
  226. R.Audio.PlayVoiceOver("e19t15", null, false);
  227. }
  228. private int KillAll()
  229. {
  230. int num = 0;
  231. for (int i = 0; i < R.Enemy.Count; i++)
  232. {
  233. EnemyBaseAction component = R.Enemy.EnemyAttributes[i].GetComponent<EnemyBaseAction>();
  234. component.KillSelf();
  235. num++;
  236. }
  237. return num;
  238. }
  239. [SerializeField]
  240. private SupplyAttribute attribute;
  241. [SerializeField]
  242. private SupplyAttribute winSupply;
  243. [SerializeField]
  244. private SceneGate outGate;
  245. [SerializeField]
  246. private GameObject battle1;
  247. [SerializeField]
  248. private GameObject battle2;
  249. [SerializeField]
  250. private GameObject cheaterEffect;
  251. [SerializeField]
  252. private GameObject L2Effect;
  253. [SerializeField]
  254. private TextMesh cheater_text;
  255. private int battleCount;
  256. private int rushCount;
  257. private bool battle1Over;
  258. private bool battle2Over;
  259. private bool cheater;
  260. }