/// <summary> /// JSONテキストからキャラクター属性を作成する。 /// </summary> /// <param name="jtext">JSONテキスト</param> /// <param name="charAttributeFile">キャラクター属性ファイル</param> private static void CreateAttributeEntry(string jtext, MieCharacterAttributeFile charAttributeFile) { //// デシリアライズ var oeCharacters = JsonConvert.DeserializeObject <MieOECharacters>(jtext); foreach (var gameDataObject in oeCharacters.GameDataObjects) { var tag = GetGameDataTypeTag(gameDataObject.MieGameDataTypeTag); switch (tag) { case "CharacterStatsGameData": var component = gameDataObject.Components[0]; //// キャラクター属性 MieCharacterAttributeEntry characterAttrEntry = new MieCharacterAttributeEntry( new Guid(gameDataObject.ID), gameDataObject.DebugName, GetGenderType(component.Gender), new Guid(component.SpeakerID), new Guid(component.RaceID)); charAttributeFile.AddCharacterAttributeEntry(characterAttrEntry); break; case "RaceGameData": //// 種族属性 MieRaceAttributeEntry entry = new MieRaceAttributeEntry( new Guid(gameDataObject.ID), gameDataObject.DebugName); charAttributeFile.AddRaceEntry(entry); break; default: continue; } } }
public static void LoadFromSystemDB(MieSystemDB systemDB, MieCharacterAttributeFile raceAttr) { SQLiteCommand command = systemDB.Connection.CreateCommand(); command.CommandText = @"SELECT * FROM RaceAttributes"; using (SQLiteDataReader sdr = command.ExecuteReader()) { while (sdr.Read() == true) { var byteRaceID = (byte[])sdr["RaceID"]; var name = (string)sdr["Name"]; Guid raceID = new Guid(byteRaceID); MieRaceAttributeEntry raceEntry = new MieRaceAttributeEntry(raceID, name); raceAttr.AddRaceEntry(raceEntry); } } }