StoryE1.cs 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Core;
  5. using DG.Tweening;
  6. using DG.Tweening.Core;
  7. using DG.Tweening.Plugins.Options;
  8. using ExtensionMethods;
  9. using I2.Loc;
  10. using UnityEngine;
  11. using UnityStandardAssets.ImageEffects;
  12. public class StoryE1 : BaseBehaviour
  13. {
  14. private void Start()
  15. {
  16. base.StartCoroutine(this.Sequence0());
  17. }
  18. private void Update()
  19. {
  20. if (this._skippable && this._useHint && Core.Input.AnyKey.OnClick && R.Mode.IsInStoryMode() && (this._pressTrangleToPassTweener == null || !this._pressTrangleToPassTweener.IsPlaying()))
  21. {
  22. this._pressTrangleToPass.gameObject.SetActive(true);
  23. this._pressTrangleToPassTweener = DOTween.Sequence().Append(this._pressTrangleToPass.DOFade(1f, 0.5f)).Append(this._pressTrangleToPass.DOFade(0f, 0.5f).SetDelay(1.5f));
  24. }
  25. if (this._skippable && Core.Input.AnyKey.LongPressed && R.Mode.IsInStoryMode())
  26. {
  27. base.StopCoroutine(this.Sequence0());
  28. base.StartCoroutine(this.Sequence1());
  29. }
  30. }
  31. private void OnDestroy()
  32. {
  33. if (!SingletonMono<AudioManager>.ApplicationIsQuitting)
  34. {
  35. R.Audio.StopVoiceOver();
  36. }
  37. }
  38. private IEnumerator Sequence0()
  39. {
  40. R.Camera.Controller.IsFollowPivot = false;
  41. R.Camera.Controller.MovableCamera.position = Vector3.zero.SetZ(-10f);
  42. R.Ui.HideUI(true);
  43. R.Mode.EnterMode(Mode.AllMode.Story);
  44. R.Player.Action.TurnRound(1);
  45. this._useHint = true;
  46. yield return new WaitForSeconds(0.5f);
  47. this.BlackMaskFade(0f, 0f);
  48. R.Ui.BlackScene.Alpha = 1f;
  49. YieldInstruction voiceOver = R.Audio.PlayVoiceOver("e1t1", null, false);
  50. yield return R.Ui.BlackScene.FadeTransparent(2f, false);
  51. yield return voiceOver;
  52. voiceOver = R.Audio.PlayVoiceOver("e1t2", null, false);
  53. this.audioSources.Add(R.Audio.PlayEffect(205, null));
  54. yield return this._sceneSprites.DOScale(new Vector3(2.5f, 2.5f, 1f), 10f).SetEase(Ease.InSine).WaitForCompletion();
  55. AudioSource audioEffect206 = R.Audio.PlayEffect(206, null);
  56. audioEffect206.loop = true;
  57. this.audioSources.Add(audioEffect206);
  58. yield return voiceOver;
  59. this._skippable = true;
  60. yield return R.Audio.PlayVoiceOver("e1t3", null, false);
  61. SunShafts sun = Camera.main.gameObject.AddComponent<SunShafts>();
  62. sun.sunThreshold = Color.black;
  63. sun.sunShaftBlurRadius = 10f;
  64. sun.sunShaftsShader = Shader.Find("Hidden/SunShaftsComposite");
  65. sun.simpleClearShader = Shader.Find("Hidden/SimpleClear");
  66. DOTween.To(() => sun.sunShaftIntensity, delegate(float intensity)
  67. {
  68. sun.sunShaftIntensity = intensity;
  69. }, 1.5f, 0.1f).OnComplete(delegate
  70. {
  71. UnityEngine.Object.Destroy(sun);
  72. }).WaitForCompletion();
  73. this._judasShadow.parent.parent.gameObject.SetActive(true);
  74. SpriteRenderer judas = this._judasShadow.parent.GetComponent<SpriteRenderer>();
  75. this._judasShadow.DOShakePosition(1.5f, new Vector3(0.4f, 0.4f, 0f), 30, 90f, false, true).WaitForCompletion();
  76. this._judasShadow.GetComponent<SpriteRenderer>().DOFade(0f, 0.5f).SetDelay(1f);
  77. yield return judas.DOFade(0f, 0.5f).SetDelay(1f).WaitForCompletion();
  78. this._judasShadow.parent.parent.gameObject.SetActive(false);
  79. yield return R.Audio.PlayVoiceOver("e1t4", null, false);
  80. yield return R.Audio.PlayVoiceOver("e1t5", null, false);
  81. yield return this.BlackMaskFade(1f, 5f);
  82. yield return R.Audio.PlayVoiceOver("e1t6", null, false);
  83. yield return R.Audio.PlayVoiceOver("e1t7", null, false);
  84. this._useHint = false;
  85. this._pressTrangleToPass.DOFade(0f, 0.5f);
  86. this._pressTrangleToStart.gameObject.SetActive(true);
  87. this._pressTrangleToStart.DOFade(1f, 1f);
  88. yield return new WaitForSeconds(10f);
  89. this._pressTrangleToStart.DOFade(0f, 1f);
  90. this._skippable = false;
  91. this.BlackMaskFade(0f, 5f);
  92. yield return R.Audio.PlayVoiceOver("e1t8", null, false);
  93. voiceOver = R.Audio.PlayVoiceOver("e1t9", null, false);
  94. audioEffect206.DOFade(0f, 1f);
  95. this.audioSources.Add(R.Audio.PlayEffect(207, null));
  96. yield return this._sceneSprites.DOScale(new Vector3(1f, 1f, 1f), 10f).SetEase(Ease.InSine).WaitForCompletion();
  97. yield return voiceOver;
  98. R.Camera.Controller.CameraShake(1f, 0.1f, CameraController.ShakeTypeEnum.Rect, false);
  99. yield return R.Audio.PlayVoiceOver("e1t10", null, false);
  100. yield return R.Audio.PlayVoiceOver("e1t11", null, false);
  101. voiceOver = R.Audio.PlayVoiceOver("e1t12", null, false);
  102. CameraFilterUtils.Create<CameraFilterPack_Blur_Movie>(null);
  103. yield return DOTween.To(delegate(float r)
  104. {
  105. CameraFilterPack_Blur_Movie.ChangeRadius = r;
  106. }, 0f, 500f, 5f).WaitForCompletion();
  107. yield return DOTween.To(delegate(float r)
  108. {
  109. CameraFilterPack_Blur_Movie.ChangeRadius = r;
  110. }, 500f, 0f, 5f).WaitForCompletion();
  111. CameraFilterUtils.Remove<CameraFilterPack_Blur_Movie>(null);
  112. yield return voiceOver;
  113. yield return R.Audio.PlayVoiceOver("e1t13", null, false);
  114. this.BlackMaskFade(1f, 2f);
  115. yield return R.Audio.PlayVoiceOver("e1t14", null, false);
  116. yield return new WaitForSeconds(2f);
  117. yield return R.Ui.Terminal.OpenWithAnim(null);
  118. yield return R.Ui.Terminal.PrintShellPrompt();
  119. yield return R.Ui.Terminal.Println(ScriptLocalization.Story.e1s1, 0.1f);
  120. R.Trophy.AwardTrophy(1);
  121. yield return new WaitForSeconds(1f);
  122. yield return R.Ui.Terminal.CloseWithAnim();
  123. yield return R.Ui.BlackScene.FadeBlack(0f, false);
  124. R.Mode.ExitMode(Mode.AllMode.Story);
  125. InputSetting.Stop(true);
  126. R.Camera.Controller.IsFollowPivot = true;
  127. this._gate1.Enter(false);
  128. yield break;
  129. }
  130. private IEnumerator Sequence1()
  131. {
  132. R.Mode.ExitMode(Mode.AllMode.Story);
  133. InputSetting.Stop(true);
  134. yield return R.Ui.BlackScene.FadeBlack(2f, false);
  135. this.BlackMaskFade(1f, 0f);
  136. R.Camera.Controller.IsFollowPivot = true;
  137. for (int i = 0; i < this.audioSources.Count; i++)
  138. {
  139. if (this.audioSources[i] != null)
  140. {
  141. this.audioSources[i].Stop();
  142. }
  143. }
  144. R.Ui.UISubtitle.FadeOut();
  145. CameraFilterUtils.Remove<CameraFilterPack_Blur_Movie>(null);
  146. this._gate2.Enter(false);
  147. yield break;
  148. }
  149. private YieldInstruction BlackMaskFade(float endValue, float duration)
  150. {
  151. return this._blackMask.DOFade(endValue, duration).WaitForCompletion();
  152. }
  153. [SerializeField]
  154. private SceneGate _gate1;
  155. [SerializeField]
  156. private SceneGate _gate2;
  157. [SerializeField]
  158. private UIWidget _pressTrangleToPass;
  159. [SerializeField]
  160. private UIWidget _pressTrangleToStart;
  161. [SerializeField]
  162. private Transform _sceneSprites;
  163. [SerializeField]
  164. private SpriteRenderer _blackMask;
  165. [SerializeField]
  166. private Transform _judasShadow;
  167. private bool _skippable;
  168. private bool _useHint;
  169. private Sequence _pressTrangleToPassTweener;
  170. private List<AudioSource> audioSources = new List<AudioSource>();
  171. }