public static void Postfix(UnitManager __instance) { try { String filePath = FindOverridenFile("Characters"); if (filePath is null) { Log.Warning($"[{nameof(UnitManager_ReadCSV_CharactorData)}] File not found: Characters.json"); return; } Int32 language = StWorkProxy.CurrentLanguage; CharactorData[] charList = __instance.charaData; foreach (Reference <TransifexEntry> pair in PrepareTexts(filePath).Enumerate()) { CharacterDataId reference = CharacterDataId.Parse(pair.Key); CharactorData character = charList.First(ch => ch.charactorID == reference.Id); character.name[language] = pair.Value.Text; } Log.Message($"[{nameof(UnitManager_ReadCSV_CharactorData)}] Loaded: Characters.json"); } catch (Exception ex) { Log.Error(ex, $"[{nameof(UnitManager_ReadCSV_CharactorData)}] Failed to load Characters.json"); } }
public static CharactorData Instance() { if (null == _instance) { _instance = new CharactorData(); } return(_instance); }
public List <CharactorData> GetRoleData() { List <CharactorData> result = new List <CharactorData>(); for (int i = 0; i < 3; i++) { CharactorData data = new CharactorData(); data.roleType = BattleRoleType.Self; if (i == 0) { data.isSelf = true; } result.Add(data); } for (int i = 0; i < 3; i++) { CharactorData data = new CharactorData(); data.roleType = BattleRoleType.Rival; result.Add(data); } return(result); }