VRYotogiOldSelectMenu.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. [RequireComponent(typeof(UIPanel))]
  6. public class VRYotogiOldSelectMenu : WfFadeBehaviour
  7. {
  8. public Maid maid { get; set; }
  9. public static VRYotogiOldSelectMenu Createprefab(GameObject parent)
  10. {
  11. return Utility.CreatePrefab(parent, "SceneYotogi/Yotogi/Prefab/Old/VR YotogiSelectMenu", true).GetComponentInChildren<VRYotogiOldSelectMenu>();
  12. }
  13. public void Awake()
  14. {
  15. this.bgSprite.alpha = 0f;
  16. this.bgSprite.width = 1550;
  17. this.bgSprite.height = 850;
  18. this.yotogiPlay = false;
  19. this.panel = base.GetComponent<UIPanel>();
  20. this.cblConfig.gameObject.SetActive(false);
  21. }
  22. public void Call()
  23. {
  24. this.yotogiPlay = false;
  25. this.stageSelectMgr.onClickEnterEvent.Clear();
  26. EventDelegate.Add(this.stageSelectMgr.onClickEnterEvent, new EventDelegate.Callback(this.OnEnterStageSelect));
  27. this.stageSelectMgr.visibledCancelBtn = false;
  28. this.skillSelectMgr.SetCancelButtonText("Cancel");
  29. this.skillSelectMgr.OnUpdateFadeOut(0f);
  30. WfFadeJob.Create(this.stageSelectMgr, null, this.fadeTime, iTween.EaseType.easeOutSine);
  31. }
  32. public void CallFromYotogiScene(YotogiOld.StageData stageData, int spotNo, YotogiOld.VRSkillData skill)
  33. {
  34. float num = this.fadeTime;
  35. this.fadeTime = 0f;
  36. this.Call();
  37. this.yotogiPlay = true;
  38. this.stageSelectMgr.SetStageData(stageData.stage, spotNo);
  39. this.skillSelectMgr.selectedSkill = skill;
  40. this.skillSelectMgr.SetCancelButtonText("End");
  41. this.OnEnterStageSelect();
  42. this.fadeTime = num;
  43. this.skillSelectMgr.SelectCategory(skill.skill.category.ToString());
  44. }
  45. public void CallCBLConfig()
  46. {
  47. this.callVRConfig = false;
  48. WfFadeJob.Create(this.cblConfig, this, this.fadeTime, iTween.EaseType.easeOutSine);
  49. }
  50. public void CallVRConfig()
  51. {
  52. this.callVRConfig = true;
  53. WfFadeJob.Create(null, this, this.fadeTime, iTween.EaseType.easeOutSine);
  54. }
  55. public void CallConfig()
  56. {
  57. if (BaseMgr<ConfigMgr>.Instance != null)
  58. {
  59. BaseMgr<ConfigMgr>.Instance.OpenConfigPanel();
  60. }
  61. }
  62. private void OnEnterStageSelect()
  63. {
  64. this.stageSelectMgr.visibledCancelBtn = true;
  65. this.stageSelectMgr.onClickCancelEvent.Clear();
  66. EventDelegate.Add(this.stageSelectMgr.onClickCancelEvent, new EventDelegate.Callback(this.OnCancelStageSelect));
  67. this.skillSelectMgr.onClickStageSelect.Clear();
  68. EventDelegate.Add(this.skillSelectMgr.onClickStageSelect, new EventDelegate.Callback(this.OnClickStageSelect));
  69. this.skillSelectMgr.onClickCancelEvent.Clear();
  70. EventDelegate.Add(this.skillSelectMgr.onClickCancelEvent, new EventDelegate.Callback(this.onClickEnd));
  71. this.skillSelectMgr.onClickEnterEvent.Clear();
  72. EventDelegate.Add(this.skillSelectMgr.onClickEnterEvent, new EventDelegate.Callback(this.OnEnterSkill));
  73. this.skillSelectMgr.UpdateData(GameMain.Instance.CharacterMgr.GetMaid(0), this.stageSelectMgr.selectStageData.stage, this.stageSelectMgr.selectSpotNo);
  74. WfFadeJob.Create(this.skillSelectMgr, this.stageSelectMgr, this.fadeTime, iTween.EaseType.easeOutSine);
  75. }
  76. private void OnEnterSkill()
  77. {
  78. YotogiOldManager.select_vr_stage_data = this.stageSelectMgr.selectStageData;
  79. YotogiOldManager.select_vr_stage_spot_no = this.stageSelectMgr.selectSpotNo;
  80. YotogiOldManager.select_vr_skill_data = this.skillSelectMgr.selectedSkill;
  81. YotogiOldStageSelectManager.SelectStage(YotogiOldManager.select_vr_stage_data);
  82. YotogiOldStageSelectManager.StagePrefab = ((!GameMain.Instance.CharacterMgr.status.isDaytime) ? YotogiOldManager.select_vr_stage_data.prefab_name_night : YotogiOldManager.select_vr_stage_data.prefab_name);
  83. int flag = GameMain.Instance.CharacterMgr.status.GetFlag("時間帯");
  84. Dictionary<YotogiOld.Stage, string> dictionary = new Dictionary<YotogiOld.Stage, string>();
  85. if (flag == 1)
  86. {
  87. dictionary = new Dictionary<YotogiOld.Stage, string>
  88. {
  89. {
  90. YotogiOld.Stage.海,
  91. "BGM014"
  92. },
  93. {
  94. YotogiOld.Stage.畑,
  95. "BGM_vr0006"
  96. },
  97. {
  98. YotogiOld.Stage.ヴィラ,
  99. "BGM_vr0006"
  100. },
  101. {
  102. YotogiOld.Stage.ベットル\u30FCム,
  103. "BGM_vr0006"
  104. },
  105. {
  106. YotogiOld.Stage.露天風呂,
  107. "BGM006"
  108. }
  109. };
  110. }
  111. else if (flag == 2)
  112. {
  113. dictionary = new Dictionary<YotogiOld.Stage, string>
  114. {
  115. {
  116. YotogiOld.Stage.海,
  117. "BGM014"
  118. },
  119. {
  120. YotogiOld.Stage.畑,
  121. "BGM014"
  122. },
  123. {
  124. YotogiOld.Stage.ヴィラ,
  125. "BGM013"
  126. },
  127. {
  128. YotogiOld.Stage.ベットル\u30FCム,
  129. "BGM013"
  130. },
  131. {
  132. YotogiOld.Stage.露天風呂,
  133. "BGM011"
  134. }
  135. };
  136. }
  137. else if (flag == 3)
  138. {
  139. dictionary = new Dictionary<YotogiOld.Stage, string>
  140. {
  141. {
  142. YotogiOld.Stage.海,
  143. "BGM_vr0002"
  144. },
  145. {
  146. YotogiOld.Stage.畑,
  147. "BGM_vr0001"
  148. },
  149. {
  150. YotogiOld.Stage.ヴィラ,
  151. "BGM013"
  152. },
  153. {
  154. YotogiOld.Stage.ベットル\u30FCム,
  155. "BGM013"
  156. },
  157. {
  158. YotogiOld.Stage.露天風呂,
  159. "BGM011"
  160. }
  161. };
  162. }
  163. if (dictionary.ContainsKey(YotogiOldManager.select_vr_stage_data.stage))
  164. {
  165. GameMain.Instance.SoundMgr.PlayBGM(dictionary[YotogiOldManager.select_vr_stage_data.stage] + ".ogg", 0.3f, true);
  166. }
  167. if (this.onEnterSkillEvent != null)
  168. {
  169. this.onEnterSkillEvent(this.stageSelectMgr.selectStageData, this.stageSelectMgr.selectSpotNo, this.skillSelectMgr.selectedSkill);
  170. }
  171. }
  172. private void OnClickStageSelect()
  173. {
  174. WfFadeJob.Create(this.stageSelectMgr, this.skillSelectMgr, this.fadeTime, iTween.EaseType.easeOutSine);
  175. }
  176. private void OnCancelStageSelect()
  177. {
  178. WfFadeJob.Create(this.skillSelectMgr, this.stageSelectMgr, this.fadeTime, iTween.EaseType.easeOutSine);
  179. }
  180. private void onClickEnd()
  181. {
  182. if (!this.yotogiPlay)
  183. {
  184. this.Call();
  185. }
  186. if (this.onCancelEvent != null)
  187. {
  188. this.onCancelEvent();
  189. }
  190. }
  191. public override void OnStartedFadeOut()
  192. {
  193. this.uiMask.enabled = true;
  194. }
  195. public override void OnCompleteFadeIn()
  196. {
  197. this.uiMask.enabled = false;
  198. }
  199. public override void OnCompleteFadeOut()
  200. {
  201. if (this.callVRConfig)
  202. {
  203. this.callVRConfig = false;
  204. VRCanvasManager instance = VRCanvasManager.Instance;
  205. if (instance != null)
  206. {
  207. this.uiMask.enabled = false;
  208. instance.OpenVRConfig(delegate
  209. {
  210. this.uiMask.enabled = true;
  211. WfFadeJob.Create(this, null, this.fadeTime, iTween.EaseType.easeOutSine);
  212. });
  213. }
  214. else
  215. {
  216. WfFadeJob.Create(this, null, this.fadeTime, iTween.EaseType.easeOutSine);
  217. }
  218. }
  219. }
  220. public override void OnUpdateFadeIn(float val)
  221. {
  222. this.panel.alpha = val;
  223. }
  224. public override void OnUpdateFadeOut(float val)
  225. {
  226. this.panel.alpha = val;
  227. }
  228. [SerializeField]
  229. public YotogiOldVRStageSelectManager stageSelectMgr;
  230. [SerializeField]
  231. public YotogiOldVRSkillSelectManager skillSelectMgr;
  232. [SerializeField]
  233. private UISprite bgSprite;
  234. [SerializeField]
  235. private UIWFHitMasks uiMask;
  236. [SerializeField]
  237. private VRChuBLipMenu cblConfig;
  238. [SerializeField]
  239. public float fadeTime = 0.3f;
  240. public VRYotogiOldSelectMenu.EventOnEnterSkill onEnterSkillEvent;
  241. public Action onCancelEvent;
  242. public bool yotogiPlay;
  243. private UIPanel panel;
  244. private bool callVRConfig;
  245. public delegate void EventOnEnterSkill(YotogiOld.StageData stageData, int spotNo, YotogiOld.VRSkillData skill);
  246. }