123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- using System;
- using System.Collections.Generic;
- using wf;
- namespace Kasizuki
- {
- public static class ManData
- {
- public static int Count
- {
- get
- {
- ManData.CreateData();
- return ManData.commonIdManager.idMap.Count;
- }
- }
- public static bool Contains(string name)
- {
- return ManData.commonIdManager.nameMap.ContainsKey(name);
- }
- public static bool Contains(int id)
- {
- return ManData.commonIdManager.idMap.ContainsKey(id);
- }
- public static int uniqueNameToId(string uniqueName)
- {
- ManData.CreateData();
- NDebug.Assert(ManData.commonIdManager.nameMap.ContainsKey(uniqueName), "傅き.男データ\nユニーク名[" + uniqueName + "]をIDに変換できませんでした");
- return ManData.commonIdManager.nameMap[uniqueName];
- }
- public static string IdToUniqueName(int id)
- {
- ManData.CreateData();
- NDebug.Assert(ManData.commonIdManager.idMap.ContainsKey(id), "傅き.男データ\nID[" + id + "]をユニーク名に変換できませんでした");
- return ManData.commonIdManager.idMap[id].Key;
- }
- public static ManData.Data GetData(int id)
- {
- ManData.CreateData();
- NDebug.Assert(ManData.basicDatas.ContainsKey(id), "傅き.男データ\nID[" + id + "]のデータは存在しません");
- return ManData.basicDatas[id];
- }
- public static ManData.Data GetData(string uniqueName)
- {
- return ManData.GetData(ManData.uniqueNameToId(uniqueName));
- }
- public static bool IsEnabled(string uniqueName)
- {
- ManData.CreateData();
- return ManData.commonIdManager.enabledIdList.Contains(ManData.uniqueNameToId(uniqueName));
- }
- public static bool IsEnabled(int id)
- {
- ManData.CreateData();
- return ManData.commonIdManager.enabledIdList.Contains(id);
- }
- public static List<ManData.Data> GetAllDatas(bool onlyEnabled, bool checkLockNTR = true)
- {
- ManData.CreateData();
- List<ManData.Data> list = new List<ManData.Data>();
- if (checkLockNTR && GameMain.Instance.CharacterMgr.status.lockNTRPlay)
- {
- list.Add(ManData.GetData(10));
- }
- else
- {
- foreach (KeyValuePair<int, KeyValuePair<string, string>> keyValuePair in ManData.commonIdManager.idMap)
- {
- if (!onlyEnabled || ManData.commonIdManager.enabledIdList.Contains(keyValuePair.Key))
- {
- list.Add(ManData.basicDatas[keyValuePair.Key]);
- }
- }
- }
- return list;
- }
- public static List<ManData.Data> GetDatas(Func<ManData.Data, bool> customCheckFunction)
- {
- ManData.CreateData();
- List<ManData.Data> list = new List<ManData.Data>();
- foreach (KeyValuePair<int, KeyValuePair<string, string>> keyValuePair in ManData.commonIdManager.idMap)
- {
- ManData.Data data = ManData.basicDatas[keyValuePair.Key];
- if (customCheckFunction(data))
- {
- list.Add(data);
- }
- }
- return list;
- }
- public static void CreateData()
- {
- if (ManData.commonIdManager != null)
- {
- return;
- }
- ManData.commonIdManager = new CsvCommonIdManager("kasizuki_man", "傅き.男データ", CsvCommonIdManager.Type.IdAndUniqueName, null);
- ManData.basicDatas = new Dictionary<int, ManData.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 = "kasizuki_man_" + 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 ManData.commonIdManager.idMap)
- {
- int key = keyValuePair.Key;
- ManData.Data value = new ManData.Data(key, array2[0].Value);
- ManData.basicDatas.Add(key, value);
- }
- foreach (KeyValuePair<AFileBase, CsvParser> keyValuePair2 in array2)
- {
- keyValuePair2.Value.Dispose();
- keyValuePair2.Key.Dispose();
- }
- }
- private const string csvTopCommonName = "kasizuki_man";
- private const string typeNameForErrorLog = "傅き.男データ";
- private static CsvCommonIdManager commonIdManager;
- private static Dictionary<int, ManData.Data> basicDatas;
- public class Data
- {
- public Data(int uniqueID, CsvParser csv)
- {
- for (int i = 1; i < csv.max_cell_y; i++)
- {
- if (csv.IsCellToExistData(0, i) && csv.GetCellAsInteger(0, i) == uniqueID)
- {
- int num = 1;
- this.ID = uniqueID;
- this.uniqueName = csv.GetCellAsString(num++, i);
- this.drawName = csv.GetCellAsString(num++, i);
- this.modelResourceName = csv.GetCellAsString(num++, i);
- this.profileText = csv.GetCellAsString(num++, i);
- this.favoritePlayText = csv.GetCellAsString(num++, i);
- try
- {
- this.manType = (ManDataType)Enum.ToObject(typeof(ManDataType), this.ID);
- }
- catch (Exception e)
- {
- NDebug.AssertParseError("ManDataType", e);
- }
- }
- }
- }
- public string drawNameTerm
- {
- get
- {
- return "SceneKasizukiMainMenu/男名/" + this.uniqueName;
- }
- }
- public string profileTextTerm
- {
- get
- {
- return "SceneKasizukiMainMenu/男プロフ/" + this.uniqueName;
- }
- }
- public string favoritePlayTextTerm
- {
- get
- {
- return "SceneKasizukiMainMenu/男好プレイ/" + this.uniqueName;
- }
- }
- public readonly int ID;
- public readonly string uniqueName;
- public readonly string drawName;
- public readonly string modelResourceName;
- public readonly string profileText;
- public readonly string favoritePlayText;
- public readonly ManDataType manType;
- }
- }
- }
|