YotogiOldStageSelectManager.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. using System;
  2. using System.Collections.Generic;
  3. using MaidStatus.Old;
  4. using UnityEngine;
  5. using wf;
  6. public class YotogiOldStageSelectManager : WfScreenChildren
  7. {
  8. public override void Awake()
  9. {
  10. base.Awake();
  11. this.yotogi_mgr_ = base.GetComponentInParent<YotogiOldManager>();
  12. this.scroll_view_ = UTY.GetChildObject(base.root_obj, "StageSelectViewer/StageViewer/Contents", false).GetComponent<UIScrollView>();
  13. }
  14. protected override void OnCall()
  15. {
  16. this.fix_stage_ = false;
  17. this.maid_ = this.yotogi_mgr_.maid;
  18. this.maid_.Visible = true;
  19. this.maid_.AllProcPropSeqStart();
  20. GameMain.Instance.MainLight.Reset();
  21. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  22. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  23. GameMain.Instance.SoundMgr.VoiceStopAll();
  24. GameObject childObject = UTY.GetChildObject(base.root_obj, "StageSelectViewer/StageViewer/Contents/StageUnitParent", false);
  25. Transform transform = childObject.transform;
  26. for (int i = 0; i < transform.childCount; i++)
  27. {
  28. UnityEngine.Object.Destroy(transform.GetChild(i).gameObject);
  29. }
  30. transform.DetachChildren();
  31. if (this.maid_.status.OldStatus.condition == Condition.Osioki)
  32. {
  33. base.SetFadeTime(0f);
  34. this.fix_stage_ = true;
  35. base.root_obj.SetActive(false);
  36. YotogiOldStageSelectManager.SelectStage(YotogiOld.stage_data_list[YotogiOld.Stage.SMル\u30FCム]);
  37. }
  38. else
  39. {
  40. base.SetFadeTime(0.5f);
  41. UIButton component = UTY.GetChildObject(base.root_obj, "Ok", false).GetComponent<UIButton>();
  42. component.onClick.Clear();
  43. EventDelegate.Add(component.onClick, new EventDelegate.Callback(this.OnClickOK));
  44. string path = string.Empty;
  45. List<KeyValuePair<YotogiOld.StageData, bool>> playableStageList = YotogiOld.GetPlayableStageList(99, null);
  46. path = "SceneYotogi/StageSelect/Prefab/Old/StageUnit";
  47. YotogiOldStageUnit yotogiOldStageUnit = null;
  48. for (int j = 0; j < playableStageList.Count; j++)
  49. {
  50. GameObject gameObject = Utility.CreatePrefab(childObject, path, true);
  51. YotogiOldStageUnit component2 = gameObject.GetComponent<YotogiOldStageUnit>();
  52. component2.SetStageData(playableStageList[j].Key, playableStageList[j].Value);
  53. component2.SetOnSelectEvent(new YotogiOldStageUnit.OnSelectEvent(this.OnSelectEvent));
  54. if (yotogiOldStageUnit == null)
  55. {
  56. yotogiOldStageUnit = gameObject.GetComponent<YotogiOldStageUnit>();
  57. }
  58. }
  59. childObject.GetComponent<UIGrid>().Reposition();
  60. this.scroll_view_.ResetPosition();
  61. childObject.GetComponent<UIWFTabPanel>().UpdateChildren();
  62. if (yotogiOldStageUnit != null)
  63. {
  64. childObject.GetComponent<UIWFTabPanel>().Select(yotogiOldStageUnit.button);
  65. }
  66. }
  67. }
  68. protected override bool IsCallFadeIn()
  69. {
  70. if (this.maid_.IsBusy)
  71. {
  72. return false;
  73. }
  74. this.maid_.FaceAnime("通常", 0f, 0);
  75. this.maid_.FaceBlend("無し");
  76. this.maid_.Visible = false;
  77. return true;
  78. }
  79. public static void SelectStage(YotogiOld.StageData data)
  80. {
  81. YotogiOldStageSelectManager.StageName = data.stage_name;
  82. YotogiOldStageSelectManager.StagePrefab = data.prefab_name;
  83. }
  84. private void OnSelectEvent(YotogiOldStageUnit click_unit)
  85. {
  86. YotogiOld.StageData stage_data = click_unit.stage_data;
  87. YotogiOldStageSelectManager.SelectStage(stage_data);
  88. GameMain.Instance.MainCamera.SetFromScriptOnTarget(stage_data.camera_data.stage_select_camera_center, stage_data.camera_data.stage_select_camera_radius, stage_data.camera_data.stage_select_camera_rotate);
  89. GameMain.Instance.SoundMgr.PlayBGM(click_unit.stage_data.bgm_file, 1f, true);
  90. }
  91. private void OnClickOK()
  92. {
  93. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  94. {
  95. this.Finish();
  96. }
  97. }
  98. protected override void OnFinish()
  99. {
  100. base.OnFinish();
  101. this.maid_.Visible = true;
  102. if (this.yotogi_mgr_.null_mgr.IsExistNextLabel())
  103. {
  104. this.yotogi_mgr_.CallScreen(YotogiOldManager.CallScreenType.Null.ToString());
  105. }
  106. }
  107. public override void Update()
  108. {
  109. base.Update();
  110. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  111. {
  112. this.Finish();
  113. }
  114. }
  115. protected override void FadeIn()
  116. {
  117. base.FadeIn();
  118. if (this.fix_stage_ && base.fade_status == WfScreenChildren.FadeStatus.Wait)
  119. {
  120. this.Finish();
  121. }
  122. }
  123. public static string StageName = string.Empty;
  124. public static string StagePrefab = string.Empty;
  125. private Maid maid_;
  126. private YotogiOldManager yotogi_mgr_;
  127. private UIScrollView scroll_view_;
  128. private bool fix_stage_;
  129. }