using System; using System.Collections.Generic; using wf; public static class Trophy { public static int Count { get { Trophy.CreateData(); return Trophy.commonIdManager.idMap.Count; } } public static bool Contains(string name) { return Trophy.commonIdManager.nameMap.ContainsKey(name); } public static bool Contains(int id) { return Trophy.commonIdManager.idMap.ContainsKey(id); } public static int uniqueNameToId(string name) { Trophy.CreateData(); NDebug.Assert(Trophy.commonIdManager.nameMap.ContainsKey(name), "トロフィー\nユニーク名[" + name + "]をIDに変換できませんでした"); return Trophy.commonIdManager.nameMap[name]; } public static string IdToUniqueName(int id) { Trophy.CreateData(); NDebug.Assert(Trophy.commonIdManager.idMap.ContainsKey(id), "トロフィー\nID[" + id + "]をユニーク名に変換できませんでした"); return Trophy.commonIdManager.idMap[id].Key; } public static Trophy.Data GetData(int id) { Trophy.CreateData(); NDebug.Assert(Trophy.basicDatas.ContainsKey(id), "トロフィー\nID[" + id + "]のデータは存在しません"); return Trophy.basicDatas[id]; } public static Trophy.Data GetData(string uniqueName) { return Trophy.GetData(Trophy.uniqueNameToId(uniqueName)); } public static bool IsEnabled(string uniqueName) { Trophy.CreateData(); return Trophy.commonIdManager.enabledIdList.Contains(Trophy.uniqueNameToId(uniqueName)); } public static bool IsEnabled(int id) { Trophy.CreateData(); return Trophy.commonIdManager.enabledIdList.Contains(id); } public static List GetAllDatas(bool onlyEnabled) { Trophy.CreateData(); List list = new List(); foreach (KeyValuePair> keyValuePair in Trophy.commonIdManager.idMap) { if (!onlyEnabled || Trophy.commonIdManager.enabledIdList.Contains(keyValuePair.Key)) { list.Add(Trophy.basicDatas[keyValuePair.Key]); } } return list; } public static void CreateData() { if (Trophy.commonIdManager != null) { return; } Trophy.commonIdManager = new CsvCommonIdManager("trophy", "トロフィー", CsvCommonIdManager.Type.IdOnly, null); Trophy.basicDatas = new Dictionary(); string[] array = new string[] { "list" }; KeyValuePair[] array2 = new KeyValuePair[array.Length]; for (int i = 0; i < array2.Length; i++) { string text = "trophy_" + 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 Trophy.commonIdManager.idMap) { int key = keyValuePair.Key; Trophy.Data value = new Trophy.Data(key, array2[0].Value); Trophy.basicDatas.Add(key, value); } foreach (KeyValuePair keyValuePair2 in array2) { keyValuePair2.Value.Dispose(); keyValuePair2.Key.Dispose(); } } private const string csvTopCommonName = "trophy"; private const string typeNameForErrorLog = "トロフィー"; private static CsvCommonIdManager commonIdManager; private static Dictionary basicDatas; public class Data { public Data(int uniqueId, CsvParser basicCsv) { for (int i = 1; i < basicCsv.max_cell_y; i++) { if (basicCsv.IsCellToExistData(0, i) && basicCsv.GetCellAsInteger(0, i) == uniqueId) { int num = 1; this.id = uniqueId; this.rarity = basicCsv.GetCellAsInteger(num++, i); this.name = basicCsv.GetCellAsString(num++, i); this.maidPoint = basicCsv.GetCellAsInteger(num++, i); string cellAsString = basicCsv.GetCellAsString(num++, i); this.type = ((!(cellAsString == "ヒロイン")) ? ((!(cellAsString == "システム")) ? Trophy.Data.Type.Extra : Trophy.Data.Type.System) : Trophy.Data.Type.Heroine); this.widthType = (basicCsv.GetCellAsString(num++, i) == "〇"); this.miniCardTextureFileName = basicCsv.GetCellAsString(num++, i); this.cardTextureFileName = basicCsv.GetCellAsString(num++, i); this.infoText = basicCsv.GetCellAsString(num++, i); this.bonusText = basicCsv.GetCellAsString(num++, i); if (!string.IsNullOrEmpty(this.bonusText)) { this.infoText = this.infoText + "\n" + this.bonusText; } this.effectDrawItemName = basicCsv.GetCellAsString(num++, i); this.titleMask = (basicCsv.GetCellAsString(num++, i) == "〇"); break; } } } public string trophySpriteName { get { if (this.rarity == 1) { return "cm3d2_trophy_trophymark_bronze"; } if (this.rarity == 2) { return "cm3d2_trophy_trophymark_silver"; } if (this.rarity == 3) { return "cm3d2_trophy_trophymark_gold"; } return "cm3d2_trophy_trophymark_bronze"; } } public string typeDrawText { get { return (this.type != Trophy.Data.Type.Heroine) ? ((this.type != Trophy.Data.Type.System) ? "エクストラ" : "システム") : "ヒロイン"; } } public string nameTerm { get { return "SceneTrophy/" + this.id.ToString() + "/トロフィー名"; } } public string infoTextTerm { get { return "SceneTrophy/" + this.id.ToString() + "/説明"; } } public string miniCardTextureFileNameTerm { get { return "SceneTrophy/" + this.id.ToString() + "/スプライトミニ"; } } public string cardTextureFileNameTerm { get { return "SceneTrophy/" + this.id.ToString() + "/スプライト"; } } public readonly int id; public readonly Trophy.Data.Type type; public readonly bool widthType; public readonly string miniCardTextureFileName; public readonly string cardTextureFileName; public readonly int rarity; public readonly string name; public readonly int maidPoint; public readonly string infoText; public readonly string bonusText; public readonly string effectDrawItemName; public readonly bool titleMask; public readonly int[] lineupIdArray; public enum Type { Heroine, System, Extra } } }