YotogiStageSelectManager.cs 4.4 KB

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