123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using MaidStatus;
- using MaidStatus.CsvData;
- using PrivateMaidMode;
- 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);
- if (PluginData.IsEnabled("GP002") && !DailyMgr.IsLegacy)
- {
- this.m_isPrivate = PrivateModeMgr.Instance.LoadPrivateMaid(this.m_bDay);
- }
- 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<JobClass.Data> 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;
- }
- yield return null;
- yield return null;
- if (this.m_isPrivate)
- {
- this.SetMaidCollider(true);
- PrivateModeMgr.Instance.LoadLocation();
- }
- else
- {
- 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;
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- if (this.m_isPrivate)
- {
- this.SetMaidCollider(false);
- }
- if (this.m_eEndType == DailyAPI.EndType.NormalSceneChange)
- {
- GameMain.Instance.SoundMgr.StopBGM(1f);
- }
- else if (this.m_eEndType == DailyAPI.EndType.ToFreeMode)
- {
- 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));
- }
- public void SetMaidCollider(bool isActive)
- {
- if (this.m_isPrivate)
- {
- if (isActive)
- {
- MaidColliderCollect maidColliderCollect = MaidColliderCollect.AddColliderCollect(PrivateModeMgr.Instance.PrivateMaid);
- List<CapsuleCollider> list = maidColliderCollect.AddCollider(MaidColliderCollect.ColliderType.Grab);
- for (int i = 0; i < list.Count; i++)
- {
- ColliderEventVR colliderEventVR = list[i].gameObject.AddComponent<ColliderEventVR>();
- colliderEventVR.onMouseDown = delegate()
- {
- if (BasePanelMgr.IsOpen())
- {
- return;
- }
- this.EndNextScene(DailyAPI.EndType.NormalSceneChange, "label_privatemaidmodeevent");
- };
- }
- }
- else
- {
- Maid privateMaid = PrivateModeMgr.Instance.PrivateMaid;
- if (privateMaid != null && privateMaid.GetComponent<MaidColliderCollect>() != null)
- {
- privateMaid.GetComponent<MaidColliderCollect>().RemoveCollider(MaidColliderCollect.ColliderType.Grab);
- UnityEngine.Object.Destroy(privateMaid.GetComponent<MaidColliderCollect>());
- }
- }
- }
- }
- private void OnFinishFadeOut()
- {
- if (this.m_isPrivate)
- {
- GameMain.Instance.CharacterMgr.DeactivateMaid(0);
- }
- 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;
- bool flag = PluginData.IsEnabled("GP001FB");
- string text = string.Empty;
- if (isLegacy)
- {
- if (bDay)
- {
- text = "SceneDailyDayTimeLegacy";
- }
- }
- else if (bDay)
- {
- if (isAvailableTransfer)
- {
- text = "SceneDailyDayTimeAvailableTransfer";
- if (flag)
- {
- text = "SceneDailyDayTimeAvailableTransfer_GP001FB";
- }
- }
- else
- {
- text = "SceneDailyDayTime";
- if (flag)
- {
- text = "SceneDailyDayTime_GP001FB";
- }
- }
- }
- 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 bool m_isPrivate;
- private DailyAPI.EndType m_eEndType;
- public delegate void dgOnSceneStartCallBack();
- public enum EndType
- {
- ToFreeMode,
- TakeOver,
- NormalSceneChange
- }
- }
- }
|