using System; using System.Collections; using System.Collections.Generic; using MaidStatus; using MaidStatus.CsvData; using UnityEngine; namespace com.workman.cm3d2.scene.dailyEtc { public class DailyAPI { public DailyAPI(SceneMgr sceneMgr) { this.sceneManager = sceneMgr; } public static string dayBgm { get { if (DailyMgr.IsLegacy) { return "BGM015.ogg"; } return "BGM020.ogg"; } } public static string nightBgm { get { if (DailyMgr.IsLegacy) { return "BGM015.ogg"; } return "BGM009.ogg"; } } public static string dayBg { get { if (DailyMgr.IsLegacy) { return "Shitsumu"; } return "ShinShitsumu_ChairRot"; } } public static string nightBg { get { if (DailyMgr.IsLegacy) { return "Shitsumu_Night"; } return "ShinShitsumu_ChairRot_Night"; } } public void SceneStart(bool f_bIsDay, MonoBehaviour f_parent, DailyAPI.dgOnSceneStartCallBack f_dgLoadedFinish) { this.m_bDay = f_bIsDay; this.m_dgStart = f_dgLoadedFinish; GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color)); GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.MainMenu, false); if (GameMain.Instance.CharacterMgr.status.isAvailableCompetitiveShow) { GameMain.Instance.TutorialPanel.SetImage(TutorialPanel.ImageSet.CompetitiveShow, false); } GameMain.Instance.ScriptMgr.adv_kag.MessageWindowMgr.CloseMessageWindowPanel(); GameMain.Instance.MainLight.Reset(); Debug.Log("Daily LightReset"); GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true); if (GameMain.Instance.VRMode) { GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0f, 1.327261f, -0.1473188f), true); GameMain.Instance.MainCamera.SetDistance(3.6f, true); GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(719.8212f, 2.235997f), true); } else { GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0.5609447f, 1.380762f, -1.382336f), true); GameMain.Instance.MainCamera.SetDistance(1.6f, true); GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(245.5691f, 6.273283f), true); } GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false); if (f_bIsDay) { if (DailyMgr.IsLegacy) { GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM015.ogg", 0.5f, true); } else { GameMain.Instance.SoundMgr.PlayBGM("BGM020.ogg", 0.5f, true); } GameMain.Instance.BgMgr.ChangeBg(DailyAPI.dayBg); } else { if (DailyMgr.IsLegacy) { GameMain.Instance.SoundMgr.PlayBGMLegacy("BGM015.ogg", 0.5f, true); } else { GameMain.Instance.SoundMgr.PlayBGM("BGM009.ogg", 0.5f, true); } GameMain.Instance.BgMgr.ChangeBg(DailyAPI.nightBg); } this.SetupTutorial(); CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetStockMaidCount(); i++) { Maid stockMaid = characterMgr.GetStockMaid(i); if (stockMaid != null) { stockMaid.FaceAnime("通常", 0f, 0); stockMaid.FaceBlend("無し"); } } GameMain.Instance.CharacterMgr.DeactivateCharaAll(); GameMain.Instance.CharacterMgr.DeactivateMaid(0); f_parent.StartCoroutine(this.CoCharaLoad()); for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++) { bool flag = false; Maid stockMaid2 = GameMain.Instance.CharacterMgr.GetStockMaid(j); if (stockMaid2 != null && stockMaid2.status.heroineType != HeroineType.Sub) { List learnPossibleClassDatas = stockMaid2.status.jobClass.GetLearnPossibleClassDatas(true, AbstractClassData.ClassType.Share | AbstractClassData.ClassType.New); foreach (JobClass.Data data in learnPossibleClassDatas) { stockMaid2.status.jobClass.Add(data, true, true); flag = true; } } if (flag) { stockMaid2.status.UpdateClassBonusStatus(); } } } private IEnumerator CoCharaLoad() { while (GameMain.Instance.CharacterMgr.IsBusy()) { yield return null; } GameMain.Instance.CharacterMgr.ResetCharaPosAll(); GameMain.Instance.MainCamera.FadeIn(0.5f, false, null, true, true, default(Color)); if (this.m_dgStart != null) { this.m_dgStart(); } yield break; } public void EndNextScene(DailyAPI.EndType f_eEndType, string f_jumpLabelName) { this.jumpLabelName = f_jumpLabelName; this.m_eEndType = f_eEndType; if (this.m_eEndType == DailyAPI.EndType.NormalSceneChange) { GameMain.Instance.SoundMgr.StopBGM(1f); } else if (this.m_eEndType == DailyAPI.EndType.ToFreeMode) { CharacterMgr characterMgr = GameMain.Instance.CharacterMgr; for (int i = 0; i < characterMgr.GetMaidCount(); i++) { if (characterMgr.GetMaid(i) != null) { characterMgr.Deactivate(i, false); } } } GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.OnFinishFadeOut), true, default(Color)); } private void OnFinishFadeOut() { if (!string.IsNullOrEmpty(this.jumpLabelName)) { this.sceneManager.GoToLabel(this.jumpLabelName); } } public void SceneFinish() { if (GameMain.Instance.MainCamera != null) { GameMain.Instance.MainCamera.SetTargetOffset(Vector3.zero, false); } if (GameMain.Instance.CharacterMgr != null) { GameMain.Instance.CharacterMgr.DeactivateCharaAll(); } } public void SetupTutorial() { bool isLegacy = DailyMgr.IsLegacy; bool bDay = this.m_bDay; bool isAvailableTransfer = GameMain.Instance.CharacterMgr.status.isAvailableTransfer; string text = string.Empty; if (isLegacy) { if (bDay) { text = "SceneDailyDayTimeLegacy"; } } else if (bDay) { if (isAvailableTransfer) { text = "SceneDailyDayTimeAvailableTransfer"; } else { text = "SceneDailyDayTime"; } } else if (isAvailableTransfer) { text = "SceneDailyNight"; } else { text = "SceneDailyNight"; } if (string.IsNullOrEmpty(text)) { return; } if (!uGUITutorialPanel.IsOpened()) { uGUITutorialPanel.OpenTutorial(text, null, false); } GameMain.Instance.SysShortcut.strSceneHelpName = text; } private DailyAPI.dgOnSceneStartCallBack m_dgStart; private string jumpLabelName; private SceneMgr sceneManager; private bool m_bDay = true; private DailyAPI.EndType m_eEndType; public delegate void dgOnSceneStartCallBack(); public enum EndType { ToFreeMode, TakeOver, NormalSceneChange } } }