DailyAPI.cs 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using MaidStatus;
  5. using MaidStatus.CsvData;
  6. using UnityEngine;
  7. namespace com.workman.cm3d2.scene.dailyEtc
  8. {
  9. public class DailyAPI
  10. {
  11. public DailyAPI(SceneMgr sceneMgr)
  12. {
  13. this.sceneManager = sceneMgr;
  14. }
  15. public static string dayBgm
  16. {
  17. get
  18. {
  19. if (DailyMgr.IsLegacy)
  20. {
  21. return "BGM015.ogg";
  22. }
  23. return "BGM020.ogg";
  24. }
  25. }
  26. public static string nightBgm
  27. {
  28. get
  29. {
  30. if (DailyMgr.IsLegacy)
  31. {
  32. return "BGM015.ogg";
  33. }
  34. return "BGM009.ogg";
  35. }
  36. }
  37. public static string dayBg
  38. {
  39. get
  40. {
  41. if (DailyMgr.IsLegacy)
  42. {
  43. return "Shitsumu";
  44. }
  45. return "ShinShitsumu_ChairRot";
  46. }
  47. }
  48. public static string nightBg
  49. {
  50. get
  51. {
  52. if (DailyMgr.IsLegacy)
  53. {
  54. return "Shitsumu_Night";
  55. }
  56. return "ShinShitsumu_ChairRot_Night";
  57. }
  58. }
  59. public void SceneStart(bool f_bIsDay, MonoBehaviour f_parent, DailyAPI.dgOnSceneStartCallBack f_dgLoadedFinish)
  60. {
  61. this.m_bDay = f_bIsDay;
  62. this.m_dgStart = f_dgLoadedFinish;
  63. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  64. GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.MainMenu, false);
  65. if (GameMain.Instance.CharacterMgr.status.isAvailableCompetitiveShow)
  66. {
  67. GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.CompetitiveShow, false);
  68. }
  69. GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel();
  70. GameMain.Instance.MainLight.Reset();
  71. Debug.Log("Daily LightReset");
  72. GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
  73. if (GameMain.Instance.VRMode)
  74. {
  75. GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0f, 1.327261f, -0.1473188f), true);
  76. GameMain.Instance.MainCamera.SetDistance(3.6f, true);
  77. GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(719.8212f, 2.235997f), true);
  78. }
  79. else
  80. {
  81. GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f), true);
  82. GameMain.Instance.MainCamera.SetDistance(1.6f, true);
  83. GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f), true);
  84. }
  85. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  86. if (f_bIsDay)
  87. {
  88. if (DailyMgr.IsLegacy)
  89. {
  90. GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM015.ogg", 0.5f, true);
  91. }
  92. else
  93. {
  94. GameMain.Instance.SoundMgr.PlayBGM("BGM020.ogg", 0.5f, true);
  95. }
  96. GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg);
  97. }
  98. else
  99. {
  100. if (DailyMgr.IsLegacy)
  101. {
  102. GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM015.ogg", 0.5f, true);
  103. }
  104. else
  105. {
  106. GameMain.Instance.SoundMgr.PlayBGM("BGM009.ogg", 0.5f, true);
  107. }
  108. GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg);
  109. }
  110. this.SetupTutorial();
  111. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  112. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  113. {
  114. Maid stockMaid = characterMgr.GetStockMaid(i);
  115. if (stockMaid != null)
  116. {
  117. stockMaid.FaceAnime("通常", 0f, 0);
  118. stockMaid.FaceBlend("無し");
  119. }
  120. }
  121. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  122. GameMain.Instance.CharacterMgr.DeactivateMaid(0);
  123. f_parent.StartCoroutine(this.CoCharaLoad());
  124. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  125. {
  126. bool flag = false;
  127. Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  128. if (stockMaid2 != null && stockMaid2.status.heroineType != HeroineType.Sub)
  129. {
  130. List<JobClass.Data> learnPossibleClassDatas = stockMaid2.status.jobClass.GetLearnPossibleClassDatas(true, AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New);
  131. foreach (JobClass.Data data in learnPossibleClassDatas)
  132. {
  133. stockMaid2.status.jobClass.Add(data, true, true);
  134. flag = true;
  135. }
  136. }
  137. if (flag)
  138. {
  139. stockMaid2.status.UpdateClassBonusStatus();
  140. }
  141. }
  142. }
  143. private IEnumerator CoCharaLoad()
  144. {
  145. while (GameMain.Instance.CharacterMgr.IsBusy())
  146. {
  147. yield return null;
  148. }
  149. GameMain.Instance.CharacterMgr.ResetCharaPosAll();
  150. GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color));
  151. if (this.m_dgStart != null)
  152. {
  153. this.m_dgStart();
  154. }
  155. yield break;
  156. }
  157. public void EndNextScene(DailyAPI.EndType f_eEndType, string f_jumpLabelName)
  158. {
  159. this.jumpLabelName = f_jumpLabelName;
  160. this.m_eEndType = f_eEndType;
  161. if (this.m_eEndType == DailyAPI.EndType.NormalSceneChange)
  162. {
  163. GameMain.Instance.SoundMgr.StopBGM(1f);
  164. }
  165. else if (this.m_eEndType == DailyAPI.EndType.ToFreeMode)
  166. {
  167. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  168. for (int i = 0; i < characterMgr.GetMaidCount(); i++)
  169. {
  170. if (characterMgr.GetMaid(i) != null)
  171. {
  172. characterMgr.Deactivate(i, false);
  173. }
  174. }
  175. }
  176. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnFinishFadeOut), true, default(Color));
  177. }
  178. private void OnFinishFadeOut()
  179. {
  180. if (!string.IsNullOrEmpty(this.jumpLabelName))
  181. {
  182. this.sceneManager.GoToLabel(this.jumpLabelName);
  183. }
  184. }
  185. public void SceneFinish()
  186. {
  187. if (GameMain.Instance.MainCamera != null)
  188. {
  189. GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false);
  190. }
  191. if (GameMain.Instance.CharacterMgr != null)
  192. {
  193. GameMain.Instance.CharacterMgr.DeactivateCharaAll();
  194. }
  195. }
  196. public void SetupTutorial()
  197. {
  198. bool isLegacy = DailyMgr.IsLegacy;
  199. bool bDay = this.m_bDay;
  200. bool isAvailableTransfer = GameMain.Instance.CharacterMgr.status.isAvailableTransfer;
  201. string text = string.Empty;
  202. if (isLegacy)
  203. {
  204. if (bDay)
  205. {
  206. text = "SceneDailyDayTimeLegacy";
  207. }
  208. }
  209. else if (bDay)
  210. {
  211. if (isAvailableTransfer)
  212. {
  213. text = "SceneDailyDayTimeAvailableTransfer";
  214. }
  215. else
  216. {
  217. text = "SceneDailyDayTime";
  218. }
  219. }
  220. else if (isAvailableTransfer)
  221. {
  222. text = "SceneDailyNight";
  223. }
  224. else
  225. {
  226. text = "SceneDailyNight";
  227. }
  228. if (string.IsNullOrEmpty(text))
  229. {
  230. return;
  231. }
  232. if (!uGUITutorialPanel.IsOpened())
  233. {
  234. uGUITutorialPanel.OpenTutorial(text, null, false);
  235. }
  236. GameMain.Instance.SysShortcut.strSceneHelpName = text;
  237. }
  238. private DailyAPI.dgOnSceneStartCallBack m_dgStart;
  239. private string jumpLabelName;
  240. private SceneMgr sceneManager;
  241. private bool m_bDay = true;
  242. private DailyAPI.EndType m_eEndType;
  243. public delegate void dgOnSceneStartCallBack();
  244. public enum EndType
  245. {
  246. ToFreeMode,
  247. TakeOver,
  248. NormalSceneChange
  249. }
  250. }
  251. }