123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229 |
- 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<Trophy.Data> GetAllDatas(bool onlyEnabled)
- {
- Trophy.CreateData();
- List<Trophy.Data> list = new List<Trophy.Data>();
- foreach (KeyValuePair<int, KeyValuePair<string, string>> 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<int, Trophy.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 = "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>(afileBase, csvParser);
- }
- foreach (KeyValuePair<int, KeyValuePair<string, string>> 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<AFileBase, CsvParser> 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<int, Trophy.Data> 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 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
- }
- }
- }
|