YotogiStageSelectManager.cs 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class YotogiStageSelectManager : WfScreenChildren
  6. {
  7. public override void Awake()
  8. {
  9. base.Awake();
  10. this.yotogi_mgr_ = base.GetComponentInParent<YotogiManager>();
  11. this.scroll_view_ = UTY.GetChildObject(base.root_obj, "StageSelectViewer/StageViewer/Contents", false).GetComponent<UIScrollView>();
  12. }
  13. protected override void OnCall()
  14. {
  15. if (!this.yotogi_mgr_.is_new_yotogi_mode)
  16. {
  17. uGUITutorialPanel.OpenTutorial("YotogiStageSelect", null, false);
  18. }
  19. if (!this.yotogi_mgr_.is_new_yotogi_mode)
  20. {
  21. GameMain.Instance.SysShortcut.strSceneHelpName = "YotogiStageSelect";
  22. }
  23. this.fix_stage_ = false;
  24. this.maid_ = this.yotogi_mgr_.maid;
  25. this.maid_.Visible = true;
  26. this.maid_.AllProcPropSeqStart();
  27. GameMain.Instance.MainLight.Reset();
  28. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  29. GameMain.Instance.CharacterMgr.DeactivateManAll();
  30. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  31. GameMain.Instance.SoundMgr.VoiceStopAll();
  32. GameObject childObject = UTY.GetChildObject(base.root_obj, "StageSelectViewer/StageViewer/Contents/StageUnitParent", false);
  33. Transform transform = childObject.transform;
  34. for (int i = 0; i < transform.childCount; i++)
  35. {
  36. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  37. }
  38. transform.DetachChildren();
  39. bool isDaytime = GameMain.Instance.CharacterMgr.status.isDaytime;
  40. int clubGrade = GameMain.Instance.CharacterMgr.status.clubGrade;
  41. base.SetFadeTime(0.5f);
  42. UIButton component = UTY.GetChildObject(base.root_obj, "Ok", false).GetComponent<UIButton>();
  43. component.onClick.Clear();
  44. EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.OnClickOK));
  45. string path = string.Empty;
  46. path = "SceneYotogi/StageSelect/Prefab/StageUnit";
  47. List<YotogiStage.Data> allDatas = YotogiStage.GetAllDatas(true);
  48. allDatas.Sort();
  49. YotogiStageUnit yotogiStageUnit = null;
  50. for (int j = 0; j < allDatas.Count; j++)
  51. {
  52. GameObject gameObject = Utility.CreatePrefab(childObject, path, true);
  53. YotogiStageUnit component2 = gameObject.GetComponent<YotogiStageUnit>();
  54. component2.SetStageData(allDatas[j], allDatas[j].isYotogiPlayable(this.maid_, clubGrade, true), isDaytime);
  55. component2.SetOnSelectEvent(new YotogiStageUnit.OnSelectEvent(this.OnSelectEvent));
  56. if (yotogiStageUnit == null)
  57. {
  58. yotogiStageUnit = gameObject.GetComponent<YotogiStageUnit>();
  59. }
  60. }
  61. childObject.GetComponent<UIGrid>().Reposition();
  62. this.scroll_view_.ResetPosition();
  63. childObject.GetComponent<UIWFTabPanel>().UpdateChildren();
  64. if (yotogiStageUnit != null)
  65. {
  66. childObject.GetComponent<UIWFTabPanel>().Select(yotogiStageUnit.button);
  67. }
  68. }
  69. protected override bool IsCallFadeIn()
  70. {
  71. if (this.maid_.IsBusy)
  72. {
  73. return false;
  74. }
  75. this.maid_.FaceAnime("通常", 0f, 0);
  76. this.maid_.FaceBlend("無し");
  77. this.maid_.Visible = false;
  78. if (this.yotogi_mgr_.is_new_yotogi_mode)
  79. {
  80. base.SetFadeStatus(WfScreenChildren.FadeStatus.Wait);
  81. float fade_time = base.fade_time;
  82. base.SetFadeTime(0f);
  83. this.Finish();
  84. base.SetFadeTime(fade_time);
  85. return false;
  86. }
  87. return true;
  88. }
  89. public static void SelectStage(YotogiStage.Data data, bool isDayTime)
  90. {
  91. if (YotogiStage.IsEnabled(data.id))
  92. {
  93. YotogiStageSelectManager.SelectedStage = data;
  94. YotogiStageSelectManager.SelectedStageRefDayTime = isDayTime;
  95. }
  96. }
  97. private void OnSelectEvent(YotogiStageUnit click_unit)
  98. {
  99. YotogiStage.Data stage_data = click_unit.stage_data;
  100. YotogiStageSelectManager.SelectStage(stage_data, GameMain.Instance.CharacterMgr.status.isDaytime);
  101. stage_data.stageSelectCameraData.Apply();
  102. GameMain.Instance.SoundMgr.PlayBGM(stage_data.bgmFileName, 1f, true);
  103. }
  104. private void OnClickOK()
  105. {
  106. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  107. {
  108. this.Finish();
  109. }
  110. }
  111. protected override void OnFinish()
  112. {
  113. base.OnFinish();
  114. this.maid_.Visible = true;
  115. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  116. {
  117. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString());
  118. }
  119. }
  120. public override void Update()
  121. {
  122. base.Update();
  123. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  124. {
  125. this.Finish();
  126. }
  127. }
  128. protected override void FadeIn()
  129. {
  130. base.FadeIn();
  131. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  132. {
  133. this.Finish();
  134. }
  135. }
  136. public static YotogiStage.Data SelectedStage;
  137. public static bool SelectedStageRefDayTime;
  138. private Maid maid_;
  139. private YotogiManager yotogi_mgr_;
  140. private UIScrollView scroll_view_;
  141. private bool fix_stage_;
  142. }