SceneWarning.cs 2.1 KB

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