SceneWarning.cs 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System;
  2. using UnityEngine;
  3. public class SceneWarning : MonoBehaviour
  4. {
  5. private void Awake()
  6. {
  7. GameObject gameObject = GameObject.Find("UI Root/Warning");
  8. GameObject gameObject2 = GameObject.Find("UI Root/Warning_tr");
  9. GameObject gameObject3 = GameObject.Find("UI Root/Warning_cbl_tr");
  10. gameObject.gameObject.SetActive(false);
  11. gameObject2.gameObject.SetActive(false);
  12. gameObject3.gameObject.SetActive(false);
  13. gameObject.gameObject.SetActive(true);
  14. }
  15. private void Start()
  16. {
  17. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  18. GameMain.Instance.MainCamera.FadeOutNoUI(0f, true);
  19. GameMain.Instance.MainCamera.FadeIn(1f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color));
  20. this.m_eMode = SceneWarning.Mode.FadeIn;
  21. GameMain.Instance.SysShortcut.gameObject.SetActive(false);
  22. }
  23. private void Update()
  24. {
  25. if (this.m_eMode == SceneWarning.Mode.ClickWait)
  26. {
  27. if (this.GetAnyMouseAndKey())
  28. {
  29. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.IClick);
  30. GameMain.Instance.LoadIcon.SetForceDraw(true);
  31. GameMain.Instance.CharacterMgr.LoadDefault();
  32. this.m_eMode = SceneWarning.Mode.Loading;
  33. }
  34. }
  35. else if (this.m_eMode == SceneWarning.Mode.Loading && !GameMain.Instance.CharacterMgr.IsBusy())
  36. {
  37. GameMain.Instance.LoadIcon.SetForceDraw(false);
  38. GameMain.Instance.CharacterMgr.VisibleAll(false);
  39. GameMain.Instance.MainCamera.FadeOut(1f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color));
  40. GameMain.Instance.MainCamera.FadeInNoUI(0f, true);
  41. this.m_eMode = SceneWarning.Mode.FadeOut;
  42. }
  43. }
  44. private void OnCompleteFadeIn()
  45. {
  46. this.m_eMode = SceneWarning.Mode.ClickWait;
  47. }
  48. private void OnCompleteFadeOut()
  49. {
  50. GameMain.Instance.ScriptMgr.LoadAdvScenarioScript("AllMain.ks", string.Empty);
  51. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  52. }
  53. private bool GetAnyMouseAndKey()
  54. {
  55. return NInput.GetMouseButtonUp(0) || NInput.GetMouseButtonUp(1) || NInput.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.Return) || GameMain.Instance.IsForceSkip();
  56. }
  57. private SceneWarning.Mode m_eMode;
  58. private enum Mode
  59. {
  60. FadeIn,
  61. ClickWait,
  62. Loading,
  63. FadeOut
  64. }
  65. }