123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using UnityEngine;
- using wf;
- public class VsDanceDataMgr
- {
- public static VsDanceDataMgr Instance { get; private set; }
- public VsDanceDataMgr.DanceBattleSetting CurrentSetting
- {
- get
- {
- return this.m_NowSetting;
- }
- }
- private void Init()
- {
- CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "dancebattle_setting_enabled_list", ref this.m_SettingEnableList);
- KasaiUtility.CsvReadY("dancebattle_setting.nei", new Action<CsvParser, int>(this.ReadSettingData), 1, null);
- CsvCommonIdManager.ReadEnabledIdList(CsvCommonIdManager.FileSystemType.Normal, true, "dance_enemy_enabled_list", ref this.m_EnemyEnableList);
- KasaiUtility.CsvReadY("dance_enemy.nei", new Action<CsvParser, int>(this.ReadEnemyData), 1, null);
- KasaiUtility.CsvReadY("substitute_dance_enemy.nei", new Action<CsvParser, int>(this.ReadSubstituteEnemyData), 1, null);
- foreach (DanceData danceData in DanceSelect.GetDanceDataList())
- {
- this.m_DanceDataList.Add(danceData.ID, danceData);
- }
- }
- private void ReadSettingData(CsvParser csv, int cy)
- {
- int cellAsInteger = csv.GetCellAsInteger(0, cy);
- if (!this.m_SettingEnableList.Contains(cellAsInteger))
- {
- return;
- }
- this.m_BattleSettingData.Add(cellAsInteger, new VsDanceDataMgr.DanceBattleSetting(csv, cy));
- }
- private void ReadEnemyData(CsvParser csv, int cy)
- {
- int cellAsInteger = csv.GetCellAsInteger(0, cy);
- if (!this.m_EnemyEnableList.Contains(cellAsInteger))
- {
- return;
- }
- this.m_DanceEnemyData.Add(cellAsInteger, this.CreateEnemyData(csv, cy));
- }
- private void ReadSubstituteEnemyData(CsvParser csv, int cy)
- {
- int cellAsInteger = csv.GetCellAsInteger(0, cy);
- if (!this.m_EnemyEnableList.Contains(cellAsInteger))
- {
- return;
- }
- this.m_SubstituteEnemyData.Add(cellAsInteger, this.CreateEnemyData(csv, cy));
- }
- private DanceEnemyParam CreateEnemyData(CsvParser csv, int cy)
- {
- int num = 0;
- DanceEnemyParam danceEnemyParam = new DanceEnemyParam();
- danceEnemyParam.ID = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.Name = csv.GetCellAsString(num++, cy);
- num++;
- danceEnemyParam.UseVoltage = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.EvalueRate.Add(Dance_Note.Evaluation.PERFECT, csv.GetCellAsInteger(num++, cy));
- danceEnemyParam.EvalueRate.Add(Dance_Note.Evaluation.GREAT, csv.GetCellAsInteger(num++, cy));
- danceEnemyParam.EvalueRate.Add(Dance_Note.Evaluation.GOOD, csv.GetCellAsInteger(num++, cy));
- danceEnemyParam.EvalueRate.Add(Dance_Note.Evaluation.BAD, csv.GetCellAsInteger(num++, cy));
- danceEnemyParam.EvalueRate.Add(Dance_Note.Evaluation.MISS, csv.GetCellAsInteger(num++, cy));
- danceEnemyParam.PushRate = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.InitialAppeal = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.ApeealRate = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.ApeealMax = csv.GetCellAsInteger(num++, cy);
- danceEnemyParam.AppealCutInEffect = Resources.Load<GameObject>("SceneDance/Rhythm_Action/Prefab/AppealCutIn/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.ReversalCutInEffect = Resources.Load<GameObject>("SceneDance/Rhythm_Action/Prefab/ReversalCutIn/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.PersonalVoice1 = csv.GetCellAsString(num++, cy);
- danceEnemyParam.PersonalVoice2 = csv.GetCellAsString(num++, cy);
- danceEnemyParam.JobVoice = csv.GetCellAsString(num++, cy);
- danceEnemyParam.ReversalVoice = csv.GetCellAsString(num++, cy);
- danceEnemyParam.ConfrontCutin = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/CutInTex/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.PersonalCutin1 = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/CutInTex/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.PersonalCutin2 = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/CutInTex/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.JobCutin = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/CutInTex/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.ReversalCutin = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/CutInTex/" + csv.GetCellAsString(num++, cy));
- danceEnemyParam.Icon = Resources.Load<Sprite>("SceneDance/Rhythm_Action/Sprite/EnemyIcon/" + csv.GetCellAsString(num++, cy));
- return danceEnemyParam;
- }
- public void SelectSetting(int id)
- {
- this.m_NowSetting = this.m_BattleSettingData[id];
- }
- public DanceEnemyParam GetCurrentEnemy(bool is_2nd)
- {
- int key = (!is_2nd) ? this.CurrentSetting.Enemy1stID : this.CurrentSetting.Enemy2ndID;
- if (!GameMain.Instance.CharacterMgr.status.lockUserDraftMaid)
- {
- return (!this.m_DanceEnemyData.ContainsKey(key)) ? null : this.m_DanceEnemyData[key];
- }
- return (!this.m_SubstituteEnemyData.ContainsKey(key)) ? null : this.m_SubstituteEnemyData[key];
- }
- public void MusicRelese(int setting_id)
- {
- foreach (int key in this.m_BattleSettingData[setting_id].ClearReleaseList)
- {
- this.m_DanceDataList[key].IsPlayable = true;
- RhythmAction_Mgr.MusicReleaseFlag = this.m_DanceDataList[key].scenario_progress;
- }
- }
- public void Serialize(BinaryWriter bw)
- {
- bw.Write("COM3D2_DANCEDATA");
- bw.Write(1f);
- bw.Write("COM3D2_DANCE_ID_START");
- foreach (int num in this.m_DanceDataList.Keys)
- {
- bw.Write(num.ToString());
- }
- bw.Write("COM3D2_DANCE_ID_END");
- foreach (DanceData danceData in this.m_DanceDataList.Values)
- {
- bw.Write(danceData.IsPlayable);
- }
- }
- public void Deserialize(BinaryReader br, int misc_ver)
- {
- foreach (DanceData danceData in this.m_DanceDataList.Values)
- {
- danceData.Recet();
- }
- if (misc_ver <= 1060)
- {
- foreach (DanceData danceData2 in this.m_DanceDataList.Values)
- {
- danceData2.IsPlayable = (danceData2.scenario_progress <= RhythmAction_Mgr.MusicReleaseFlag);
- }
- return;
- }
- string a = br.ReadString();
- NDebug.Assert(a == "COM3D2_DANCEDATA", "VsDanceDataMgr.ヘッダーが違います");
- int num = br.ReadInt32();
- List<int> list = new List<int>();
- string text = br.ReadString();
- string text2 = br.ReadString();
- while (text2 != "COM3D2_DANCE_ID_END")
- {
- list.Add(int.Parse(text2));
- text2 = br.ReadString();
- }
- foreach (int key in list)
- {
- if (this.m_DanceDataList.ContainsKey(key))
- {
- this.m_DanceDataList[key].IsPlayable = br.ReadBoolean();
- }
- else
- {
- br.ReadBoolean();
- }
- }
- }
- public static void CreateInstance()
- {
- VsDanceDataMgr.Instance = new VsDanceDataMgr();
- VsDanceDataMgr.Instance.Init();
- }
- private const int m_CheckMiscVer = 1060;
- private const string m_SaveHeader = "COM3D2_DANCEDATA";
- private const float m_SaveVer = 1f;
- private HashSet<int> m_SettingEnableList = new HashSet<int>();
- private Dictionary<int, VsDanceDataMgr.DanceBattleSetting> m_BattleSettingData = new Dictionary<int, VsDanceDataMgr.DanceBattleSetting>();
- private VsDanceDataMgr.DanceBattleSetting m_NowSetting;
- private HashSet<int> m_EnemyEnableList = new HashSet<int>();
- private Dictionary<int, DanceEnemyParam> m_DanceEnemyData = new Dictionary<int, DanceEnemyParam>();
- private Dictionary<int, DanceEnemyParam> m_SubstituteEnemyData = new Dictionary<int, DanceEnemyParam>();
- private Dictionary<int, DanceData> m_DanceDataList = new Dictionary<int, DanceData>();
- public enum ForcedVictory
- {
- Nothing,
- ForceWin,
- ForceLose
- }
- public class DanceBattleSetting
- {
- public DanceBattleSetting(CsvParser csv, int cy)
- {
- int num = 0;
- this.ID = csv.GetCellAsInteger(num++, cy);
- num++;
- this.Enemy1stID = csv.GetCellAsInteger(num++, cy);
- this.Enemy2ndID = csv.GetCellAsInteger(num++, cy);
- string cellAsString = csv.GetCellAsString(num++, cy);
- int num2 = (!(cellAsString != "Free")) ? -1 : int.Parse(cellAsString);
- if (num2 != -1)
- {
- this.specifyDanceData = DanceSelect.GetDanceData(num2);
- }
- else
- {
- this.specifyDanceData = null;
- }
- this.ClearReleaseList = new List<int>();
- string cellAsString2 = csv.GetCellAsString(num++, cy);
- if (!string.IsNullOrEmpty(cellAsString2))
- {
- foreach (string s in cellAsString2.Split(new char[]
- {
- ','
- }))
- {
- this.ClearReleaseList.Add(int.Parse(s));
- }
- }
- this.BattlePersonalList = new List<string>();
- string cellAsString3 = csv.GetCellAsString(num++, cy);
- if (!string.IsNullOrEmpty(cellAsString3))
- {
- foreach (string item in cellAsString3.Split(new char[]
- {
- ','
- }))
- {
- this.BattlePersonalList.Add(item);
- }
- }
- else
- {
- this.BattlePersonalList = new List<string>
- {
- "Muku",
- "Majime",
- "Rindere"
- };
- }
- string cellAsString4 = csv.GetCellAsString(num++, cy);
- if (!string.IsNullOrEmpty(cellAsString4))
- {
- this.specifyVictoryState = (VsDanceDataMgr.ForcedVictory)Enum.Parse(typeof(VsDanceDataMgr.ForcedVictory), cellAsString4);
- }
- else
- {
- this.specifyVictoryState = VsDanceDataMgr.ForcedVictory.Nothing;
- }
- string cellAsString5 = csv.GetCellAsString(num++, cy);
- if (!string.IsNullOrEmpty(cellAsString5))
- {
- this.fixedMaidOrder = cellAsString5.Split(new char[]
- {
- ','
- });
- }
- else
- {
- this.fixedMaidOrder = new string[0];
- }
- }
- public bool isSpecifiedVictoryState
- {
- get
- {
- return this.specifyVictoryState != VsDanceDataMgr.ForcedVictory.Nothing;
- }
- }
- public bool isFixedMaidOrder
- {
- get
- {
- return this.fixedMaidOrder != null && this.fixedMaidOrder.Length > 0;
- }
- }
- public bool IsCanBattleParticipate(Maid maid)
- {
- if (!maid.status.mainChara)
- {
- return false;
- }
- string uniqueName = maid.status.personal.uniqueName;
- return this.BattlePersonalList.Contains(uniqueName);
- }
- public readonly int ID;
- public readonly int Enemy1stID;
- public readonly int Enemy2ndID;
- public readonly DanceData specifyDanceData;
- public readonly List<int> ClearReleaseList;
- public readonly List<string> BattlePersonalList;
- public readonly VsDanceDataMgr.ForcedVictory specifyVictoryState;
- public readonly string[] fixedMaidOrder;
- }
- }
|