12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using UnityEngine;
- using UnityEngine.Rendering;
- using UnityEngine.SceneManagement;
- public class DanceMain : MonoBehaviour
- {
- public static string RecetJumpLabel { private get; set; }
- public List<Maid> DanceMaid
- {
- get
- {
- return this.m_listMaid;
- }
- }
- public Maid UserMaid
- {
- get
- {
- return this.m_maidUser;
- }
- }
- public bool IsDanceEnd { get; private set; }
- public Transform OvrCamTrans
- {
- get
- {
- return this.m_trOvrDummyCam;
- }
- }
- public float DepthFocalSize
- {
- get
- {
- return this.m_DepthFocalSize;
- }
- set
- {
- this.m_DepthFocalSize = value;
- if (RhythmAction_Mgr.Instance)
- {
- RhythmAction_Mgr.Instance.SetFocalSize(value);
- }
- }
- }
- public string GetFolderPathToBinaryData()
- {
- string binaryFolderName = this.BinaryFolderName;
- string text = Path.GetFileNameWithoutExtension(this.BinaryFolderName).ToLower();
- return "Assets/Resources/SceneDance/" + Path.GetFileNameWithoutExtension(this.BinaryFolderName).ToLower() + "/";
- }
- private void Awake()
- {
- this.m_boDebugDummyBody = false;
- NTime.Reset();
- string name = SceneManager.GetActiveScene().name;
- if (name.ToLower().Contains("_release") && !this.UseBinaryData)
- {
- Debug.LogError("ダンスシーン:" + name + " でUseBinaryDataがONになっていません。強制でONにします。");
- this.UseBinaryData = true;
- }
- Dictionary<string, string> tag_backup = GameMain.Instance.ScriptMgr.adv_kag.tag_backup;
- string strScriptLabel;
- if (tag_backup != null && tag_backup.TryGetValue("label", out strScriptLabel))
- {
- this.m_strScriptLabel = strScriptLabel;
- }
- NDebug.Assert(this.m_listDummyAnimChara.Count == this.m_listAnimName.Count, "m_listDummyAnimChara と m_listAnimName の数は同一でないといけません。");
- NDebug.Assert(this.m_AnimatorData != null, "AnimatorDataが外れています。");
- NDebug.Assert(this.m_listTestPreset.Count == this.m_listAnimName.Count, "プリセット数が不正です。");
- NDebug.Assert(!string.IsNullOrEmpty(this.m_strMasterAudioFileName), "マスター用MasterAudioFileNameが必要です。");
- bool flag = DanceMain.IsDanceRecet;
- flag |= (RhythmAction_Mgr.NowState == RhythmAction_Mgr.DanceState.Dance_Second);
- flag |= (RhythmAction_Mgr.NowDance == RhythmAction_Mgr.DanceType.Encore);
- flag |= RhythmAction_Mgr.IsVSDance;
- if (flag && !DanceMain.KaraokeMode)
- {
- DanceSelect.SelectMaidActive(DanceMain.SelectDanceData);
- DanceMain.IsDanceRecet = false;
- }
- if (this.time_line_binary_ == null)
- {
- this.maid_data_binary_ = new DanceObjectDataBinary();
- this.maid_item_binary_ = new DanceObjectDataBinary();
- this.maid_event_binary_ = new DanceObjectDataBinary();
- this.time_line_binary_ = new AWReadBinaryData();
- if (this.UseBinaryData)
- {
- string file_name = this.GetFolderPathToBinaryData() + "item_data.bytes";
- this.maid_item_binary_.ReadData(file_name);
- NDebug.Assert(this.m_listItemObject.Count == this.maid_item_binary_.datas.Length, "アイテム数がバイナリデータと不一致");
- this.maid_item_binary_.Restoration(false);
- for (int i = 0; i < this.m_listItemObject.Count; i++)
- {
- if (!(this.m_listItemObject[i] != null))
- {
- this.m_listItemObject[i] = this.maid_item_binary_.datas[i].obj;
- }
- }
- file_name = this.GetFolderPathToBinaryData() + "event_data.bytes";
- this.maid_event_binary_.ReadData(file_name);
- NDebug.Assert(this.m_listEventObject.Count == this.maid_event_binary_.datas.Length, "イベント数がバイナリデータと不一致");
- this.maid_event_binary_.Restoration(false);
- for (int j = 0; j < this.m_listEventObject.Count; j++)
- {
- if (!(this.m_listEventObject[j] != null))
- {
- this.m_listEventObject[j] = this.maid_event_binary_.datas[j].obj;
- }
- }
- file_name = this.GetFolderPathToBinaryData() + "maid_data.bytes";
- this.maid_data_binary_.ReadData(file_name);
- NDebug.Assert(this.m_listDummyAnimChara.Count == this.maid_data_binary_.datas.Length, "メイド数がバイナリデータと不一致");
- this.maid_data_binary_.Restoration(true);
- for (int k = 0; k < this.m_listDummyAnimChara.Count; k++)
- {
- if (!(this.m_listDummyAnimChara[k] != null))
- {
- this.m_listDummyAnimChara[k] = this.maid_data_binary_.datas[k].obj;
- this.m_listDebugObj.Add(this.m_listDummyAnimChara[k]);
- }
- }
- file_name = this.GetFolderPathToBinaryData() + "timeline_data.bytes";
- this.time_line_binary_.ReadFile(file_name);
- this.maid_item_binary_.AttachObject(this.m_AnimatorData.getTake(this.m_strPlayTakeName));
- this.maid_event_binary_.AttachObject(this.m_AnimatorData.getTake(this.m_strPlayTakeName));
- }
- }
- this.m_listKuchiPattern = new string[this.m_listKuchiPakuFile.Count];
- Func<string, string> func = delegate(string fn)
- {
- TextAsset textAsset = Resources.Load("SceneDance/" + fn) as TextAsset;
- NDebug.Assert(textAsset != null, "口パクパターンテキストファイルが開けません。" + fn);
- string text3 = textAsset.text;
- NDebug.Assert(text3.Length != 0, "口パクパターンファイル内が空です。" + fn);
- return Regex.Replace(text3, "(\\r|\\n| )", string.Empty);
- };
- for (int l = 0; l < this.m_listKuchiPakuFile.Count; l++)
- {
- string text = this.m_listKuchiPakuFile[l];
- if (!string.IsNullOrEmpty(text))
- {
- this.m_listKuchiPattern[l] = func(text);
- }
- }
- if (this.m_KuchipakuCacheFileName != null)
- {
- for (int m2 = 0; m2 < this.m_KuchipakuCacheFileName.Length; m2++)
- {
- string text2 = this.m_KuchipakuCacheFileName[m2];
- if (!string.IsNullOrEmpty(text2))
- {
- this.m_KuchiPatternCache[text2] = func(text2);
- }
- }
- }
- this.m_AnimatorData.playOnStart = null;
- this.m_AnimatorData.bAutoTimeUpdate = false;
- if (GameMain.Instance.VRMode && GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") == 1)
- {
- this.m_trOvrDummyCam = new GameObject("OvrDummyDanceCam").transform;
- this.m_trOvrDummyCam.gameObject.AddComponent<Camera>().enabled = false;
- this.m_OvrCam = GameMain.Instance.OvrMgr.OvrCamera;
- }
- GameObject gameObject = GameObject.Find("RhythmAction_Mgr");
- if (!gameObject)
- {
- gameObject = UnityEngine.Object.Instantiate<GameObject>(Resources.Load<GameObject>("SceneDance/Rhythm_Action/Prefab/RhythmAction_Mgr"));
- }
- if (!RhythmAction_Mgr.Instance)
- {
- gameObject.GetComponent<RhythmAction_Mgr>().InstanceInit();
- }
- for (int n = 0; n < this.m_listTestPreset.Count; n++)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(n);
- if (maid)
- {
- if (!this.m_maidUser)
- {
- this.m_maidUser = DanceSelect.SelectTopMaid;
- }
- maid.Visible = true;
- }
- }
- if (!this.m_maidUser)
- {
- this.m_maidUser = GameMain.Instance.CharacterMgr.GetMaid(0);
- }
- if (DanceMain.KaraokeMode)
- {
- return;
- }
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- if (DanceMain.SelectDanceData != null)
- {
- for (int num = 0; num < DanceMain.SelectDanceData.select_chara_num; num++)
- {
- RhythmAction_Mgr.Instance.FactOrderList.Add(GameMain.Instance.CharacterMgr.GetMaid(num));
- }
- }
- if (RhythmAction_Mgr.NowDance != RhythmAction_Mgr.DanceType.BenchMark && DanceMain.SelectDanceData != null && DanceMain.SelectDanceData.maid_order.Count > 0 && (!RhythmAction_Mgr.IsVSDance || !VsDanceDataMgr.Instance.CurrentSetting.isFixedMaidOrder))
- {
- List<Maid> list = new List<Maid>();
- for (int num2 = 0; num2 < DanceMain.SelectDanceData.maid_order.Count; num2++)
- {
- list.Add(GameMain.Instance.CharacterMgr.GetMaid(num2));
- }
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- GameMain.Instance.CharacterMgr.DeactivateMaid(0);
- for (int num3 = 0; num3 < DanceMain.SelectDanceData.maid_order.Count; num3++)
- {
- int index = DanceMain.SelectDanceData.maid_order[num3];
- if (list[index])
- {
- GameMain.Instance.CharacterMgr.SetActiveMaid(list[index], num3);
- list[index].Visible = true;
- }
- }
- }
- if (this.m_listTestPreset.Count <= RhythmAction_Mgr.Instance.FactOrderList.Count)
- {
- if (!RhythmAction_Mgr.Instance.FactOrderList.Any((Maid e) => !e) && DanceMain.SelectDanceData != null)
- {
- goto IL_99B;
- }
- }
- for (int num4 = 0; num4 < this.m_listTestPreset.Count; num4++)
- {
- Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(num4);
- if (!maid2)
- {
- maid2 = GameMain.Instance.CharacterMgr.AddStockMaid();
- GameMain.Instance.CharacterMgr.SetActiveMaid(maid2, num4);
- CharacterMgr.Preset preset;
- if (DanceMain.SelectDanceData != null && num4 < DanceMain.SelectDanceData.preset_name.Count && !string.IsNullOrEmpty(DanceMain.SelectDanceData.preset_name[num4]))
- {
- preset = GameMain.Instance.CharacterMgr.PresetLoadFromResources(DanceMain.SelectDanceData.preset_name[num4]);
- }
- else
- {
- preset = GameMain.Instance.CharacterMgr.PresetLoadFromResources(this.m_listTestPreset[num4]);
- }
- if (preset != null)
- {
- GameMain.Instance.CharacterMgr.PresetSet(maid2, preset);
- }
- this.m_listTempMaid.Add(maid2);
- maid2.Visible = true;
- }
- }
- if (DanceMain.SelectDanceData != null)
- {
- for (int num5 = 0; num5 < DanceMain.SelectDanceData.maid_order.Count; num5++)
- {
- int index2 = DanceMain.SelectDanceData.maid_order[num5];
- if (!RhythmAction_Mgr.Instance.FactOrderList[index2])
- {
- RhythmAction_Mgr.Instance.FactOrderList[index2] = GameMain.Instance.CharacterMgr.GetMaid(num5);
- }
- }
- }
- IL_99B:
- if (this.m_PresetCopyToDummyChara != null)
- {
- NDebug.Assert(this.m_PresetCopyToDummyChara.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "PresetCopyToDummyChara は listDummyAnimChara の数以下である必要があります。");
- for (int num6 = 0; num6 < this.m_PresetCopyToDummyChara.Length; num6++)
- {
- int num7 = this.m_PresetCopyToDummyChara[num6];
- if (num7 != num6)
- {
- Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(num7);
- if (maid3)
- {
- byte[] buffer = GameMain.Instance.CharacterMgr.PresetSaveNotWriteFile(maid3, CharacterMgr.PresetType.All);
- BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
- CharacterMgr.Preset f_prest = GameMain.Instance.CharacterMgr.PresetLoad(binaryReader, string.Empty);
- binaryReader.Close();
- Maid maidDest = GameMain.Instance.CharacterMgr.GetMaid(num6);
- if (maidDest != null && this.m_listTempMaid.Find((Maid m) => m == maidDest) != null)
- {
- GameMain.Instance.CharacterMgr.PresetSet(maidDest, f_prest);
- maidDest.AllProcPropSeqStart();
- }
- else
- {
- Debug.LogError("Presetコピー先メイドが居ないか、一時雇用メイドではありません。");
- }
- }
- }
- }
- }
- this.m_KuchipakuAudioStartTimeAtMaid = new float[this.m_listDummyAnimChara.Count<GameObject>()];
- for (int num8 = 0; num8 < this.m_KuchipakuAudioStartTimeAtMaid.Length; num8++)
- {
- this.m_KuchipakuAudioStartTimeAtMaid[num8] = 0f;
- }
- }
- private void Start()
- {
- if (GameMain.Instance.VRMode)
- {
- GameObject gameObject = GameObject.Find("effect");
- if (gameObject != null)
- {
- ParticleSystem[] componentsInChildren = gameObject.GetComponentsInChildren<ParticleSystem>(true);
- foreach (ParticleSystem particleSystem in componentsInChildren)
- {
- Renderer component = particleSystem.GetComponent<Renderer>();
- if (component != null)
- {
- component.shadowCastingMode = ShadowCastingMode.Off;
- component.receiveShadows = false;
- }
- }
- }
- }
- if (!DanceMain.KaraokeMode)
- {
- GameMain.Instance.BgMgr.DeleteBg();
- }
- GameMain.Instance.MainLight.Reset();
- GameMain.Instance.SoundMgr.StopBGM(0f);
- GameMain.Instance.MainCamera.gameObject.SetActive(true);
- if (!DanceMain.KaraokeMode)
- {
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, false);
- }
- for (int j = 0; j < this.m_listEventObject.Count; j++)
- {
- GameObject gameObject2 = this.m_listEventObject[j];
- NDebug.Assert(!this.m_htEventObj.ContainsKey(gameObject2.name), "listEventObjectに複数同じObjectを追加しようとしました。" + this.m_listEventObject[j].name);
- this.m_htEventObj.Add(gameObject2.name, gameObject2);
- }
- this.m_takeNow = this.m_AnimatorData.getTake(this.m_strPlayTakeName);
- NDebug.Assert(this.m_takeNow != null, "再生するテイク名PlayTakeNameが不正です。" + this.m_strPlayTakeName);
- }
- public void SetFace(int f_nMaidNo, string f_strFace)
- {
- RhythmAction_Mgr.Instance.SetTimeLineFace(f_nMaidNo, f_strFace);
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
- if (RhythmAction_Mgr.Instance.GetMaidFaceStop(f_nMaidNo))
- {
- return;
- }
- maid.FaceAnime(f_strFace, 1f, 0);
- }
- public void SetFaceBlend(int f_nMaidNo, string f_strFace)
- {
- RhythmAction_Mgr.Instance.SetTimeLineFaceBlend(f_nMaidNo, f_strFace);
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
- if (RhythmAction_Mgr.Instance.GetMaidFaceBlendStop(f_nMaidNo))
- {
- return;
- }
- maid.FaceBlend(f_strFace);
- }
- public void SetMaidVisible(int f_nMaidNo, bool visible)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
- maid.transform.localScale = ((!visible) ? Vector3.zero : Vector3.one);
- }
- public void SwitchObject(string f_strObjName, bool bEnable)
- {
- (this.m_htEventObj[f_strObjName] as GameObject).SetActive(bEnable);
- }
- public void EyeToCam(int f_nMaidNo, string f_strType)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(f_nMaidNo);
- try
- {
- maid.EyeToCamera((Maid.EyeMoveType)Enum.Parse(typeof(Maid.EyeMoveType), f_strType), 0f);
- }
- catch (Exception ex)
- {
- NDebug.Assert("EyeToCam 目線タイプ " + f_strType + " は不正です。\n" + ex.Message, false);
- }
- }
- public void FadeOut(float f_fTime)
- {
- GameMain.Instance.MainCamera.FadeOut(f_fTime, false, null, false, default(Color));
- }
- public void FadeIn(float f_fTime)
- {
- GameMain.Instance.MainCamera.FadeIn(f_fTime, false, null, false, true, default(Color));
- }
- public void ChangeAnimation(int maidNo, string animName, float fadeTime)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
- try
- {
- maid.CrossFade(animName + ".anm", false, false, false, fadeTime, 1f);
- }
- catch (Exception ex)
- {
- NDebug.Assert(string.Concat(new object[]
- {
- "ChangeAnimation メイド ",
- maidNo,
- " : ",
- animName,
- " は不正です。\n",
- ex.Message
- }), false);
- }
- }
- public void ChangeKuchipaku(int maidNo, string kuchipakuName)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
- maid.StartKuchipakuPattern((!(this.m_audioNew != null)) ? 0f : (this.m_audioNew.time * -1f), this.m_KuchiPatternCache[kuchipakuName], true);
- }
- public void SetActiveObj(GameObject targetObj, bool visible)
- {
- targetObj.SetActive(visible);
- }
- public void SetEyeTarget(int maidNo, GameObject targetObj)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(maidNo);
- maid.EyeToTargetObject(targetObj.transform, 0f);
- }
- private void ChangeObj(AMTake f_take, string f_strOldObjName, GameObject f_goNew)
- {
- AMTranslationTrack[] array = f_take.findTranslationTrack(f_strOldObjName);
- for (int i = 0; i < array.Length; i++)
- {
- array[i].changeObject(f_goNew.transform);
- }
- AMRotationTrack[] array2 = f_take.findRotationTrack(f_strOldObjName);
- for (int j = 0; j < array2.Length; j++)
- {
- array2[j].changeObject(f_goNew.transform);
- }
- AMPropertyTrack[] array3 = f_take.findPropertyTrack(f_strOldObjName);
- for (int k = 0; k < array3.Length; k++)
- {
- array3[k].changeObject(f_goNew);
- }
- }
- public void OnDestroy()
- {
- this.Uninit();
- NUty.GCFree();
- Debug.Log("DanceMain::OnDestroy");
- }
- private void Uninit()
- {
- if (this.m_bFinished)
- {
- return;
- }
- if (RhythmAction_Mgr.Instance && DanceMain.KaraokeMode)
- {
- RhythmAction_Mgr.Instance.KaraokeEnd();
- }
- Debug.Log("DanceMain::Uninit");
- this.m_AnimatorData.StopLoop();
- if (GameMain.Instance.MainLight != null)
- {
- GameMain.Instance.MainLight.Reset();
- }
- if (GameMain.Instance.MainCamera != null)
- {
- GameMain.Instance.MainCamera.Reset(CameraMain.CameraType.Target, true);
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- }
- if (GameMain.Instance.SoundMgr != null)
- {
- GameMain.Instance.SoundMgr.StopBGM(0f);
- }
- if (GameMain.Instance.CharacterMgr != null)
- {
- GameMain.Instance.CharacterMgr.ResetCharaPosAll();
- }
- for (int i = 0; i < this.m_listMaid.Count; i++)
- {
- if (this.m_listMaid[i] != null)
- {
- this.m_listMaid[i].transform.localScale = Vector3.one;
- this.m_listMaid[i].StopKuchipakuPattern();
- this.m_listMaid[i].EyeToCamera(Maid.EyeMoveType.目と顔を向ける, 0f);
- this.m_listMaid[i].AllIKDetach(0f);
- this.m_listMaid[i].body0.IKCtrl.SetPelvisPull(false);
- this.m_listMaid[i].SetAutoTwist(Maid.AutoTwist.WristL, true);
- this.m_listMaid[i].SetAutoTwist(Maid.AutoTwist.WristR, true);
- Transform[] componentsInChildren = this.m_listMaid[i].gameObject.GetComponentsInChildren<Transform>(true);
- foreach (Transform transform in componentsInChildren)
- {
- transform.gameObject.layer = LayerMask.NameToLayer("Charactor");
- }
- }
- }
- for (int k = 0; k < this.m_listItemObject.Count; k++)
- {
- if (this.m_listItemObject[k] != null)
- {
- UnityEngine.Object.DestroyImmediate(this.m_listItemObject[k]);
- }
- }
- this.m_listItemObject.Clear();
- for (int l = 0; l < this.m_listTempMaid.Count; l++)
- {
- GameMain.Instance.CharacterMgr.BanishmentMaid(this.m_listTempMaid[l]);
- }
- if (!DanceMain.KaraokeMode)
- {
- if (this.DanceMaid.Any((Maid maid) => maid != null))
- {
- GameMain.Instance.CharacterMgr.DeactivateCharaAll();
- }
- if (this.m_maidUser != null && this.m_maidUser != GameMain.Instance.CharacterMgr.GetMaid(0))
- {
- GameMain.Instance.CharacterMgr.DeactivateMaid(0);
- GameMain.Instance.CharacterMgr.SetActiveMaid(this.m_maidUser, 0);
- }
- }
- this.m_eMode = DanceMain.Mode.Finish;
- this.m_bFinished = true;
- }
- private void ToFinish()
- {
- this.IsDanceEnd = !this.IsForceDanceEnd;
- RhythmAction_Mgr.Instance.RhythmGame_End();
- this.Uninit();
- if (!DanceMain.IsDanceRecet)
- {
- DanceSelect.SetNextDance();
- }
- else
- {
- NDebug.Assert(!string.IsNullOrEmpty(DanceMain.RecetJumpLabel), "やりなおし時に飛ぶラベルが設定されてません");
- }
- Debug.Log("Dance ToFinish Script");
- if (!string.IsNullOrEmpty(this.m_strScriptLabel))
- {
- if (DanceMain.IsDanceRecet)
- {
- Debug.Log("OnEndScene JumpTo " + DanceMain.RecetJumpLabel);
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(DanceMain.RecetJumpLabel);
- }
- else
- {
- if (DanceMain.SelectDanceData != null)
- {
- GameMain.Instance.ScriptMgr.EvalScript("tf['dance_scene_name'] = '" + DanceMain.SelectDanceData.scene_name + "';");
- }
- Debug.Log("OnEndScene JumpTo " + this.m_strScriptLabel);
- GameMain.Instance.ScriptMgr.adv_kag.JumpLabel(this.m_strScriptLabel);
- }
- GameMain.Instance.ScriptMgr.adv_kag.Exec();
- }
- Debug.Log("Dance Finish!!");
- }
- private IEnumerator LoadMotionScript()
- {
- if (this.m_AdjustScript.IndexOf(".ks") < 0)
- {
- this.m_AdjustScript += ".ks";
- }
- NDebug.Assert(!string.IsNullOrEmpty(this.m_ScriptLabel), string.Format("{0}の飛び先が未指定です。", this.m_AdjustScript));
- if (this.m_ScriptLabel.IndexOf("*") < 0)
- {
- this.m_ScriptLabel = "*" + this.m_ScriptLabel;
- }
- ScriptManager script_mgr = GameMain.Instance.ScriptMgr;
- script_mgr.StopMotionScript();
- script_mgr.is_motion_blend = true;
- script_mgr.LoadMotionScript(0, false, this.m_AdjustScript, this.m_ScriptLabel, string.Empty, string.Empty, false, true, false);
- float timer = 0f;
- while (timer <= this.m_LoadScriptTime)
- {
- timer += Time.deltaTime;
- yield return null;
- }
- script_mgr.StopMotionScript();
- this.m_eMode = DanceMain.Mode.LoadAnim;
- yield break;
- }
- private void Update()
- {
- if (this.m_eMode == DanceMain.Mode.ActiveCam)
- {
- if (GameMain.Instance.MainCamera.gameObject.activeSelf)
- {
- GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
- GameMain.Instance.MainCamera.SetCameraType(CameraMain.CameraType.Free);
- GameMain.Instance.MainCamera.SetControl(false);
- if (this.m_camDummyCamera != null)
- {
- if (!GameMain.Instance.VRMode)
- {
- AMTranslationTrack amtranslationTrack = this.m_takeNow.findTranslationTrack(this.m_camDummyCamera.gameObject.transform);
- amtranslationTrack.obj = GameMain.Instance.MainCamera.gameObject.transform;
- foreach (AMAction amaction in amtranslationTrack.cache)
- {
- AMTranslationAction amtranslationAction = (AMTranslationAction)amaction;
- amtranslationAction.obj = GameMain.Instance.MainCamera.gameObject.transform;
- }
- AMRotationTrack amrotationTrack = this.m_takeNow.findRotationTrack(this.m_camDummyCamera.gameObject.transform);
- amrotationTrack.obj = GameMain.Instance.MainCamera.gameObject.transform;
- foreach (AMAction amaction2 in amrotationTrack.cache)
- {
- AMRotationAction amrotationAction = (AMRotationAction)amaction2;
- amrotationAction.obj = GameMain.Instance.MainCamera.gameObject.transform;
- }
- }
- else if (GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") != 0)
- {
- AMTranslationTrack amtranslationTrack2 = this.m_takeNow.findTranslationTrack(this.m_camDummyCamera.gameObject.transform);
- amtranslationTrack2.obj = this.m_trOvrDummyCam;
- foreach (AMAction amaction3 in amtranslationTrack2.cache)
- {
- AMTranslationAction amtranslationAction2 = (AMTranslationAction)amaction3;
- amtranslationAction2.obj = this.m_trOvrDummyCam;
- }
- AMRotationTrack amrotationTrack2 = this.m_takeNow.findRotationTrack(this.m_camDummyCamera.gameObject.transform);
- amrotationTrack2.obj = this.m_trOvrDummyCam;
- foreach (AMAction amaction4 in amrotationTrack2.cache)
- {
- AMRotationAction amrotationAction2 = (AMRotationAction)amaction4;
- amrotationAction2.obj = this.m_trOvrDummyCam;
- }
- }
- this.m_camDummyCamera.gameObject.SetActive(false);
- }
- if (!GameMain.Instance.VRMode)
- {
- this.ChangeObj(this.m_takeNow, "CameraMain", GameMain.Instance.MainCamera.gameObject);
- }
- else if (GameMain.Instance.CMSystem.GetTmpGenericFlag("ダンスOVRカメラタイプ") == 0)
- {
- if (!DanceMain.KaraokeMode)
- {
- GameMain.Instance.MainCamera.SetTargetPos(new Vector3(0f, 1.16f, 0f), true);
- GameMain.Instance.MainCamera.SetAroundAngle(new Vector2(180f, 0f), true);
- GameMain.Instance.MainCamera.SetDistance(5f, true);
- }
- }
- else
- {
- GameObject y = GameObject.Find("__GameMain__/Camera/CameraMain/CameraMain");
- AMBinaryDataBaseObject[] binary_data_list = this.time_line_binary_.binary_data_list;
- if (binary_data_list != null)
- {
- for (int i = 0; i < binary_data_list.Length; i++)
- {
- if (binary_data_list[i].obj == y)
- {
- binary_data_list[i].SetGameObject(this.m_trOvrDummyCam.gameObject);
- }
- }
- }
- }
- this.ChangeObj(this.m_takeNow, "MainDirectionalLight", GameMain.Instance.MainLight.gameObject);
- if (DanceMain.SelectDanceData == null || string.IsNullOrEmpty(DanceMain.SelectDanceData.bgm_file_name))
- {
- GameMain.Instance.SoundMgr.PlayDanceBGM(this.m_strMasterAudioFileName, 0f, true);
- }
- else
- {
- GameMain.Instance.SoundMgr.PlayDanceBGM(DanceMain.SelectDanceData.bgm_file_name + ".ogg", 0f, true);
- }
- AudioSource audioSourceBgm = GameMain.Instance.SoundMgr.GetAudioSourceBgm();
- audioSourceBgm.Stop();
- AMAudioTrack[] array = this.m_takeNow.findAudioTrack(this.m_strDummyAudioObjectName);
- foreach (AMAudioTrack amaudioTrack in array)
- {
- amaudioTrack.ChangeAudioSource(audioSourceBgm);
- }
- this.m_audioNew = audioSourceBgm;
- if (!this.m_boDebugDummyBody)
- {
- for (int k = 0; k < this.m_listAnimName.Count; k++)
- {
- this.m_listMaid.Add(GameMain.Instance.CharacterMgr.GetMaid(k));
- }
- for (int l = 0; l < this.m_listMaid.Count; l++)
- {
- this.m_listMaid[l].EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
- }
- NDebug.Assert(this.m_listKuchiPattern.Length == this.m_listMaid.Count, "メイド数と口パクパターン数が異なります。");
- for (int m = 0; m < this.m_listMaid.Count; m++)
- {
- if (!string.IsNullOrEmpty(this.m_listKuchiPattern[m]))
- {
- this.m_listMaid[m].StartKuchipakuPattern(0f, this.m_listKuchiPattern[m], true);
- }
- }
- }
- this.m_eMode = DanceMain.Mode.LoadChara;
- }
- }
- else if (this.m_eMode == DanceMain.Mode.LoadChara)
- {
- if (!GameMain.Instance.CharacterMgr.IsBusy() || this.m_listMaid.Count == 0)
- {
- if (!this.m_boDebugDummyBody)
- {
- int num = 1;
- for (;;)
- {
- string arg = "f";
- AMAnimationTrack amanimationTrack = this.m_takeNow.findAnimationTrack(arg + num);
- if (amanimationTrack == null)
- {
- break;
- }
- int num2 = num - 1;
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(num2);
- IEnumerator enumerator5 = Enum.GetValues(typeof(Maid.AutoTwist)).GetEnumerator();
- try
- {
- while (enumerator5.MoveNext())
- {
- object obj = enumerator5.Current;
- maid.SetAutoTwist((Maid.AutoTwist)obj, true);
- }
- }
- finally
- {
- IDisposable disposable;
- if ((disposable = (enumerator5 as IDisposable)) != null)
- {
- disposable.Dispose();
- }
- }
- if (!string.IsNullOrEmpty(this.m_listAnimName[num2]))
- {
- string name = maid.CrossFade(this.m_listAnimName[num2] + ".anm", false, false, false, 0f, 1f);
- Animation component = maid.body0.m_Bones.GetComponent<Animation>();
- component.Stop();
- amanimationTrack.obj = maid.body0.m_Bones;
- foreach (AMAction amaction5 in amanimationTrack.cache)
- {
- AMAnimationAction amanimationAction = (AMAnimationAction)amaction5;
- amanimationAction.amClip = component.GetClip(name);
- amanimationAction.obj = maid.body0.m_Bones;
- }
- }
- else
- {
- this.m_focePauseAnim.Add(new DanceMain.AnimTime
- {
- anim = maid.body0.m_Bones.GetComponent<Animation>()
- });
- }
- if (this.UseFloorHitY)
- {
- maid.body0.SetBoneHitHeightY(this.m_fFloorY);
- }
- num++;
- }
- for (int n = 0; n < this.m_listDummyAnimChara.Count; n++)
- {
- Maid maid2 = GameMain.Instance.CharacterMgr.GetMaid(n);
- for (int num3 = 0; num3 < this.m_listItemObject.Count; num3++)
- {
- Transform transform = CMT.SearchObjObj(this.m_listDummyAnimChara[n].transform, this.m_listItemObject[num3].transform);
- if (transform != null)
- {
- Transform transform2 = transform;
- string name2 = transform2.parent.name;
- Transform parent = CMT.SearchObjName(maid2.gameObject.transform, name2, true);
- transform2.SetParent(parent, false);
- }
- }
- }
- if (this.m_MoveToDummyCharaPos != null)
- {
- NDebug.Assert(this.m_MoveToDummyCharaPos.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "MoveToDummyCharaPos は listDummyAnimChara の数以下である必要があります。");
- for (int num4 = 0; num4 < this.m_MoveToDummyCharaPos.Length; num4++)
- {
- if (this.m_MoveToDummyCharaPos[num4])
- {
- Vector3 position = this.m_listDummyAnimChara[num4].transform.position;
- Maid maid3 = GameMain.Instance.CharacterMgr.GetMaid(num4);
- if (maid3 != null)
- {
- maid3.SetPos(position);
- }
- }
- }
- }
- if (this.m_LayerChangeToDummyChara != null)
- {
- NDebug.Assert(this.m_LayerChangeToDummyChara.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "LayerChangeToDummyChara は listDummyAnimChara の数以下である必要があります。");
- for (int num5 = 0; num5 < this.m_LayerChangeToDummyChara.Length; num5++)
- {
- if (this.m_LayerChangeToDummyChara[num5])
- {
- int layer = this.m_listDummyAnimChara[num5].layer;
- Maid maid4 = GameMain.Instance.CharacterMgr.GetMaid(num5);
- if (maid4 != null)
- {
- Transform[] componentsInChildren = maid4.gameObject.GetComponentsInChildren<Transform>(true);
- foreach (Transform transform3 in componentsInChildren)
- {
- transform3.gameObject.layer = layer;
- }
- }
- }
- }
- }
- if (this.m_EyeTarget != null)
- {
- NDebug.Assert(this.m_EyeTarget.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "EyeTarget は listDummyAnimChara の数以下である必要があります。");
- for (int num7 = 0; num7 < this.m_EyeTarget.Length; num7++)
- {
- if (this.m_EyeTarget[num7] != null)
- {
- Maid maid5 = GameMain.Instance.CharacterMgr.GetMaid(num7);
- if (maid5 != null)
- {
- maid5.EyeToCamera(Maid.EyeMoveType.目だけ向ける, 0f);
- maid5.body0.trsLookTarget = this.m_EyeTarget[num7].transform;
- }
- }
- }
- }
- if (this.m_MotionCacheEnable != null)
- {
- NDebug.Assert(this.m_MotionCacheEnable.Length <= this.m_listDummyAnimChara.Count<GameObject>(), "MotionCacheEnable は listDummyAnimChara の数以下である必要があります。");
- for (int num8 = 0; num8 < this.m_MotionCacheEnable.Length; num8++)
- {
- if (this.m_MotionCacheEnable[num8])
- {
- Maid maid6 = GameMain.Instance.CharacterMgr.GetMaid(num8);
- if (maid6 != null)
- {
- for (int num9 = 0; num9 < this.m_MotionCacheFileName.Length; num9++)
- {
- maid6.CacheAnime(this.m_MotionCacheFileName[num9], false, false);
- }
- }
- }
- }
- }
- for (int num10 = 0; num10 < this.m_listDebugObj.Count; num10++)
- {
- UnityEngine.Object.DestroyImmediate(this.m_listDebugObj[num10]);
- }
- this.m_listDebugObj.Clear();
- }
- if (string.IsNullOrEmpty(this.m_AdjustScript))
- {
- this.m_eMode = DanceMain.Mode.LoadAnim;
- }
- else
- {
- base.StartCoroutine(this.LoadMotionScript());
- this.m_eMode = DanceMain.Mode.LoadScript;
- }
- }
- }
- else if (this.m_eMode == DanceMain.Mode.LoadAnim)
- {
- this.m_AnimatorData.Play(this.m_takeNow.name, true, 0f, false, this.time_line_binary_.GetTrackIDList());
- this.m_fTakeStartRealTime = Time.realtimeSinceStartup;
- this.m_fNowRealTime = this.m_fTakeStartRealTime;
- this.m_eMode = DanceMain.Mode.Exec;
- }
- else if (this.m_eMode == DanceMain.Mode.Exec)
- {
- bool isPause = RhythmAction_Mgr.Instance.IsPause;
- if (!isPause)
- {
- float num11 = RhythmAction_Mgr.Instance.DanceDeltaTime;
- if (this.m_audioNew != null && this.m_audioNew.isPlaying)
- {
- float time = this.m_audioNew.time;
- for (int num12 = 0; num12 < this.m_listMaid.Count; num12++)
- {
- this.m_listMaid[num12].FoceKuchipakuUpdate(time);
- }
- if (this.m_bAudioFirst)
- {
- float num13 = time;
- num11 = Time.realtimeSinceStartup - this.m_fTakeStartRealTime;
- this.m_bAudioFirst = false;
- this.m_fOffsetTime = num13 - num11;
- RhythmAction_Mgr.Instance.RhythmGame_Start();
- }
- }
- this.m_fNowRealTime += num11;
- }
- if (isPause != this.m_pauseBack)
- {
- foreach (DanceMain.AnimTime animTime in this.m_focePauseAnim)
- {
- if (isPause)
- {
- IEnumerator enumerator8 = animTime.anim.GetEnumerator();
- try
- {
- while (enumerator8.MoveNext())
- {
- object obj2 = enumerator8.Current;
- AnimationState animationState = (AnimationState)obj2;
- animTime.stateTimeList.Add(new DanceMain.AnimTime.StateTime
- {
- state = animationState,
- time = animationState.time
- });
- animationState.speed = 0f;
- }
- }
- finally
- {
- IDisposable disposable2;
- if ((disposable2 = (enumerator8 as IDisposable)) != null)
- {
- disposable2.Dispose();
- }
- }
- }
- else
- {
- foreach (DanceMain.AnimTime.StateTime stateTime in animTime.stateTimeList)
- {
- stateTime.state.time = stateTime.time;
- stateTime.state.speed = 1f;
- }
- animTime.stateTimeList.Clear();
- }
- }
- this.m_pauseBack = isPause;
- }
- if (this.IsForceDanceEnd || this.m_AnimatorData.takeName == null || this.IsDanceSkip || (DanceMain.KaraokeMode && Input.GetKeyDown(KeyCode.Return)))
- {
- this.ToFinish();
- }
- }
- else if (this.m_eMode == DanceMain.Mode.Finish)
- {
- }
- if (this.m_AnimatorData.takeName != null)
- {
- NTime.UpdateNowTime(this.m_fNowRealTime - this.m_fTakeStartRealTime + this.m_fOffsetTime);
- this.time_line_binary_.Update(NTime.time);
- }
- if (GameMain.Instance.VRMode && this.m_trOvrDummyCam != null && this.m_OvrCam != null)
- {
- this.m_OvrCam.SetPos(this.m_trOvrDummyCam.position);
- this.m_OvrCam.SetRotation(this.m_trOvrDummyCam.rotation.eulerAngles);
- }
- }
- private const string m_RhythmMgr_Path = "SceneDance/Rhythm_Action/Prefab/RhythmAction_Mgr";
- public static bool IsDanceRecet;
- public static DanceData SelectDanceData;
- public static bool KaraokeMode;
- private DanceMain.Mode m_eMode;
- public bool m_boDebugDummyBody;
- public Camera m_camDummyCamera;
- public List<GameObject> m_listDebugObj;
- public AnimatorData m_AnimatorData;
- public List<GameObject> m_listDummyAnimChara;
- public List<string> m_listAnimName;
- public List<GameObject> m_listEventObject;
- private Hashtable m_htEventObj = new Hashtable();
- public List<string> m_listTestPreset;
- public List<GameObject> m_listItemObject = new List<GameObject>();
- public List<string> m_listKuchiPakuFile = new List<string>();
- private string[] m_listKuchiPattern;
- private List<Maid> m_listMaid = new List<Maid>();
- public string m_strDummyAudioObjectName;
- private AudioSource m_audioNew;
- public string m_strMasterAudioFileName;
- public string m_strPlayTakeName = "Take1";
- private AMTake m_takeNow;
- private string m_strScriptLabel = string.Empty;
- private List<Maid> m_listTempMaid = new List<Maid>();
- private Maid m_maidUser;
- [HideInInspector]
- public bool IsForceDanceEnd;
- [HideInInspector]
- public bool IsDanceSkip;
- private OvrCamera m_OvrCam;
- private Transform m_trOvrDummyCam;
- public bool UseBinaryData;
- public string BinaryFolderName;
- private DanceObjectDataBinary maid_data_binary_;
- private DanceObjectDataBinary maid_item_binary_;
- private DanceObjectDataBinary maid_event_binary_;
- private AWReadBinaryData time_line_binary_;
- [Header("物理境界を変更するか?")]
- public bool UseFloorHitY;
- public float m_fFloorY;
- [SerializeField]
- [Header("被写界深度の焦点")]
- private float m_DepthFocalSize = 1.2f;
- [SerializeField]
- [Header("マイク位置調整等に使うモーションスクリプト名")]
- private string m_AdjustScript = string.Empty;
- [SerializeField]
- private string m_ScriptLabel = string.Empty;
- [SerializeField]
- [Header("AdjustScript読み込みに要する時間")]
- private float m_LoadScriptTime = 3f;
- [SerializeField]
- [Header("初期化時にダミーキャラの位置にメイドを移動させるメイド番号スイッチ")]
- public bool[] m_MoveToDummyCharaPos;
- [SerializeField]
- [Header("初期化時にダミーキャラのLayerをメイドに設定させるメイド番号スイッチ")]
- public bool[] m_LayerChangeToDummyChara;
- public Light[] m_OffScreenLight;
- [SerializeField]
- [Header("初期化時にメイドの視線に設定するオブジェクト対メイド番号")]
- public GameObject[] m_EyeTarget;
- [SerializeField]
- [Header("特定メイド番号からダミーメイドへの容姿のコピー(Elementが元メイド番号/値が先メイド番号")]
- public int[] m_PresetCopyToDummyChara;
- [SerializeField]
- [Header("途中でモーションを変えるメイド番号のファイル名リスト")]
- public bool[] m_MotionCacheEnable;
- [SerializeField]
- [Header("途中でモーションを変える場合のファイル名リスト")]
- public string[] m_MotionCacheFileName;
- [SerializeField]
- [Header("途中で口パクを変える場合のファイル名リスト")]
- public string[] m_KuchipakuCacheFileName;
- private Dictionary<string, string> m_KuchiPatternCache = new Dictionary<string, string>();
- public float[] m_KuchipakuAudioStartTimeAtMaid;
- private List<DanceMain.AnimTime> m_focePauseAnim = new List<DanceMain.AnimTime>();
- private bool m_pauseBack;
- private bool m_bFinished;
- private float m_fNowRealTime;
- private float m_fTakeStartRealTime;
- private float m_fOffsetTime;
- private bool m_bAudioFirst = true;
- private enum Mode
- {
- ActiveCam,
- LoadChara,
- LoadAnim,
- Exec,
- Finish,
- LoadScript
- }
- private class AnimTime
- {
- public Animation anim;
- public List<DanceMain.AnimTime.StateTime> stateTimeList = new List<DanceMain.AnimTime.StateTime>();
- public class StateTime
- {
- public AnimationState state;
- public float time;
- }
- }
- }
|