YotogiStageSelectManager.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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. return true;
  73. }
  74. public static void SelectStage(YotogiStage.Data data, bool isDayTime)
  75. {
  76. if (YotogiStage.IsEnabled(data.id))
  77. {
  78. YotogiStageSelectManager.SelectedStage = data;
  79. YotogiStageSelectManager.SelectedStageRefDayTime = isDayTime;
  80. }
  81. }
  82. private void OnSelectEvent(YotogiStageUnit click_unit)
  83. {
  84. YotogiStage.Data stage_data = click_unit.stage_data;
  85. YotogiStageSelectManager.SelectStage(stage_data, GameMain.Instance.CharacterMgr.status.isDaytime);
  86. stage_data.stageSelectCameraData.Apply();
  87. GameMain.Instance.SoundMgr.PlayBGM(stage_data.bgmFileName, 1f, true);
  88. }
  89. private void OnClickOK()
  90. {
  91. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  92. {
  93. this.Finish();
  94. }
  95. }
  96. protected override void OnFinish()
  97. {
  98. base.OnFinish();
  99. this.maid_.Visible = true;
  100. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  101. {
  102. this.yotogi_mgr_.CallScreen(YotogiManager.CallScreenType.Null.ToString());
  103. }
  104. }
  105. public override void Update()
  106. {
  107. base.Update();
  108. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  109. {
  110. this.Finish();
  111. }
  112. }
  113. protected override void FadeIn()
  114. {
  115. base.FadeIn();
  116. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  117. {
  118. this.Finish();
  119. }
  120. }
  121. public static YotogiStage.Data SelectedStage;
  122. public static bool SelectedStageRefDayTime;
  123. private Maid maid_;
  124. private YotogiManager yotogi_mgr_;
  125. private UIScrollView scroll_view_;
  126. private bool fix_stage_;
  127. }