KasaSceneMgr.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using UnityEngine;
  3. using UnityEngine.UI;
  4. public class KasaSceneMgr<T> : MonoBehaviour where T : KasaSceneMgr<T>
  5. {
  6. public static T Instance { get; protected set; }
  7. protected virtual void Awake()
  8. {
  9. KasaSceneMgr<T>.Instance = (this as T);
  10. this.MainRecet();
  11. GameMain.Instance.BgMgr.ChangeBg(this.m_BgName);
  12. GameMain.Instance.SoundMgr.PlayBGM(this.m_BgmName, 0f, true);
  13. GameMain.Instance.MainCamera.SetControl(this.m_IsControll);
  14. this.SetCamera();
  15. uGUIUtility.GetEventSystem();
  16. if (this.m_uGUIRaycaster)
  17. {
  18. this.m_uGUIRaycaster.enabled = false;
  19. }
  20. if (this.m_IscharaLoad)
  21. {
  22. base.StartCoroutine(KasaiUtility.CharaLoadWait(new Action(this.LoadEnd)));
  23. }
  24. else
  25. {
  26. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  27. GameMain.Instance.MainCamera.FadeIn(0.5f, false, new CameraMain.dgOnCompleteFade(this.FadeInEnd), true, true, default(Color));
  28. }
  29. }
  30. protected virtual void FadeInEnd()
  31. {
  32. if (this.m_uGUIRaycaster)
  33. {
  34. this.m_uGUIRaycaster.enabled = true;
  35. }
  36. }
  37. protected virtual void LoadEnd()
  38. {
  39. GameMain.Instance.MainCamera.FadeIn(0.5f, false, new CameraMain.dgOnCompleteFade(this.FadeInEnd), true, true, default(Color));
  40. }
  41. protected void SetCamera()
  42. {
  43. GameMain.Instance.MainCamera.SetTargetPos(this.m_TargetPos, true);
  44. GameMain.Instance.MainCamera.SetDistance(this.m_Distance, true);
  45. GameMain.Instance.MainCamera.SetAroundAngle(this.m_AroundAngle, true);
  46. }
  47. protected void MainRecet()
  48. {
  49. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  50. GameMain.Instance.CharacterMgr.CharaAllOfsetRot(Vector3.zero);
  51. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  52. GameMain.Instance.MainLight.Reset();
  53. }
  54. protected virtual void FadeOut()
  55. {
  56. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.FadeOutEnd), true, default(Color));
  57. }
  58. protected virtual void FadeOutEnd()
  59. {
  60. GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_JumpLabel);
  61. GameMain.Instance.ScriptMgr.adv_kag.Exec();
  62. }
  63. [SerializeField]
  64. [Header("背景名")]
  65. protected string m_BgName;
  66. [SerializeField]
  67. [Header("BGM")]
  68. protected string m_BgmName;
  69. [SerializeField]
  70. [Header("カメラ設定")]
  71. protected Vector3 m_TargetPos = Vector3.up * 1.61f;
  72. [SerializeField]
  73. protected float m_Distance = 2f;
  74. [SerializeField]
  75. protected Vector2 m_AroundAngle = new Vector2(-180f, 10f);
  76. [SerializeField]
  77. protected bool m_IsControll = true;
  78. [SerializeField]
  79. [Header("キャラクターロードするか")]
  80. protected bool m_IscharaLoad;
  81. [SerializeField]
  82. [Header("uGUI操作管理")]
  83. private GraphicRaycaster m_uGUIRaycaster;
  84. protected string m_NextLabel = string.Empty;
  85. protected string m_CancelLabel = string.Empty;
  86. protected string m_JumpLabel = string.Empty;
  87. }