123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225 |
- 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<TouchDataBase.Data> GetAllDatas(bool onlyEnabled)
- {
- TouchDataBase.CreateData();
- List<TouchDataBase.Data> list = new List<TouchDataBase.Data>();
- foreach (KeyValuePair<int, KeyValuePair<string, string>> 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<int, TouchDataBase.Data>();
- string[] array = new string[]
- {
- "list"
- };
- KeyValuePair<AFileBase, CsvParser>[] array2 = new KeyValuePair<AFileBase, CsvParser>[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>(afileBase, csvParser);
- }
- foreach (KeyValuePair<int, KeyValuePair<string, string>> keyValuePair in TouchDataBase.commonIdManager.idMap)
- {
- TouchDataBase.basicDatas.Add(keyValuePair.Key, new TouchDataBase.Data(keyValuePair.Key, array2[0].Value));
- }
- foreach (KeyValuePair<AFileBase, CsvParser> 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<int, TouchDataBase.Data> 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<TouchDataBase.TouchPoint, TouchDataBase.PointData> dictionary = new Dictionary<TouchDataBase.TouchPoint, TouchDataBase.PointData>();
- 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<TouchDataBase.TouchPoint, TouchDataBase.PointData>(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<TouchDataBase.PointData> GetAllPointData()
- {
- return new List<TouchDataBase.PointData>(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<TouchDataBase.TouchPoint, TouchDataBase.PointData> touchPointData;
- }
- }
- }
|