using System; using System.Collections.Generic; using System.IO; using UnityEngine; using wf; namespace PrivateMaidMode { public static class TouchDataBase { public static int Count { get { TouchDataBase.CreateData(); return TouchDataBase.commonIdManager.idMap.Count; } } public static bool Contains(int id) { TouchDataBase.CreateData(); return TouchDataBase.commonIdManager.idMap.ContainsKey(id); } public static TouchDataBase.Data GetData(int id) { TouchDataBase.CreateData(); NDebug.Assert(TouchDataBase.basicDatas.ContainsKey(id), "プライベートメイドお触りモード\nID[" + id + "]のデータは存在しません"); return TouchDataBase.basicDatas[id]; } public static bool IsEnabled(int id) { TouchDataBase.CreateData(); return TouchDataBase.commonIdManager.enabledIdList.Contains(id); } public static List GetAllDatas(bool onlyEnabled) { TouchDataBase.CreateData(); List list = new List(); foreach (KeyValuePair> keyValuePair in TouchDataBase.commonIdManager.idMap) { if (!onlyEnabled || TouchDataBase.commonIdManager.enabledIdList.Contains(keyValuePair.Key)) { list.Add(TouchDataBase.basicDatas[keyValuePair.Key]); } } return list; } public static void CreateData() { if (TouchDataBase.commonIdManager != null) { return; } TouchDataBase.commonIdManager = new CsvCommonIdManager("private_maidmode_touch", "プライベートメイドお触りモード", CsvCommonIdManager.Type.IdOnly, null); TouchDataBase.basicDatas = new Dictionary(); string[] array = new string[] { "list" }; KeyValuePair[] array2 = new KeyValuePair[array.Length]; for (int i = 0; i < array2.Length; i++) { string text = "private_maidmode_touch_" + array[i] + ".nei"; AFileBase afileBase = GameUty.FileSystem.FileOpen(text); CsvParser csvParser = new CsvParser(); bool condition = csvParser.Open(afileBase); NDebug.Assert(condition, text + "\nopen failed."); array2[i] = new KeyValuePair(afileBase, csvParser); } foreach (KeyValuePair> keyValuePair in TouchDataBase.commonIdManager.idMap) { TouchDataBase.basicDatas.Add(keyValuePair.Key, new TouchDataBase.Data(keyValuePair.Key, array2[0].Value)); } foreach (KeyValuePair keyValuePair2 in array2) { keyValuePair2.Value.Dispose(); keyValuePair2.Key.Dispose(); } } private const string csvTopCommonName = "private_maidmode_touch"; private const string typeNameForErrorLog = "プライベートメイドお触りモード"; private static CsvCommonIdManager commonIdManager; private static Dictionary basicDatas; public enum TouchPoint { Head, Bust, Back, Hip, SecretPart, Hand, Leg } public class PointData { public PointData(TouchDataBase.TouchPoint point, int addExcitement, int addMood) { this.point = point; this.addExcitement = addExcitement; this.addMood = addMood; switch (point) { case TouchDataBase.TouchPoint.Head: this.scriptLabelName = "*頭"; break; case TouchDataBase.TouchPoint.Bust: this.scriptLabelName = "*胸"; break; case TouchDataBase.TouchPoint.Back: this.scriptLabelName = "*背中"; break; case TouchDataBase.TouchPoint.Hip: this.scriptLabelName = "*尻"; break; case TouchDataBase.TouchPoint.SecretPart: this.scriptLabelName = "*秘部"; break; case TouchDataBase.TouchPoint.Hand: this.scriptLabelName = "*手"; break; case TouchDataBase.TouchPoint.Leg: this.scriptLabelName = "*足"; break; } if (string.IsNullOrEmpty(this.scriptLabelName)) { Debug.LogError("部位の情報が不正です"); } } public readonly TouchDataBase.TouchPoint point; public readonly int addExcitement; public readonly int addMood; public readonly string scriptLabelName; } public class Data { public Data(int id, CsvParser basicCsv) { for (int i = 1; i < basicCsv.max_cell_y; i++) { if (basicCsv.IsCellToExistData(0, i) && basicCsv.GetCellAsInteger(0, i) == id) { int num = 1; this.id = id; this.phaseType = basicCsv.GetCellAsInteger(num++, i); this.ftFile = Path.ChangeExtension(basicCsv.GetCellAsString(num++, i), ".ks"); this.rcRegisterFile = Path.ChangeExtension(basicCsv.GetCellAsString(num++, i), ".ks"); this.rcRegisterLabel = basicCsv.GetCellAsString(num++, i); this.touchScriptFile = Path.ChangeExtension(basicCsv.GetCellAsString(num++, i), ".ks"); this.successFile = Path.ChangeExtension(basicCsv.GetCellAsString(num++, i), ".ks"); this.successLabel = basicCsv.GetCellAsString(num++, i); this.failureFile = Path.ChangeExtension(basicCsv.GetCellAsString(num++, i), ".ks"); this.failureLabel = basicCsv.GetCellAsString(num++, i); Dictionary dictionary = new Dictionary(); for (int j = 0; j < Enum.GetNames(typeof(TouchDataBase.TouchPoint)).Length; j++) { bool flag = basicCsv.GetCellAsString(num++, i) == "〇"; int cellAsInteger = basicCsv.GetCellAsInteger(num++, i); int cellAsInteger2 = basicCsv.GetCellAsInteger(num++, i); if (flag) { dictionary.Add((TouchDataBase.TouchPoint)j, new TouchDataBase.PointData((TouchDataBase.TouchPoint)j, cellAsInteger, cellAsInteger2)); } } this.touchPointData = new ReadOnlyDictionary(dictionary); break; } } } public bool EnabledPoint(TouchDataBase.TouchPoint point) { return this.touchPointData.ContainsKey(point); } public TouchDataBase.PointData GetPointData(TouchDataBase.TouchPoint point) { return (!this.touchPointData.ContainsKey(point)) ? null : this.touchPointData[point]; } public List GetAllPointData() { return new List(this.touchPointData.GetValueArray()); } public readonly int id; public readonly int phaseType; public readonly string ftFile; public readonly string rcRegisterFile; public readonly string rcRegisterLabel; public readonly string successFile; public readonly string successLabel; public readonly string failureFile; public readonly string failureLabel; public readonly string touchScriptFile; private readonly ReadOnlyDictionary touchPointData; } } }