private void HandleParty(XElement el, ECulture culture) { string name = ""; if (el.Name == "Party") { foreach (var att in el.Attributes()) { name = att.Value.ToString(); } if (!PartyTable.Instance.Table[culture].ContainsKey(name)) { PartyTable.Instance.Table[culture].Add(name, new List <Pair <string, double> >()); } } foreach (var att in el.Attributes()) { foreach (var ele in el.Elements()) { if (ele.Name == "SubParty") { var csv = ele.Value.Split(','); if (csv.Length > 1) { var subParty = new Pair <string, double>(csv[0], double.Parse(csv[1])); PartyTable.Instance.Table[culture][name].Add(subParty); } } } } }
public override void ReadFromFile() { foreach (var path in this._paths) { var doc = XDocument.Load(path); foreach (var el in doc.Root.Elements()) { ECulture culture = ECulture.None; foreach (var att in el.Attributes()) { if (EnumUtil <ECulture> .TryGetEnumValue(att.Value.ToString(), ref culture)) { var dict = new Dictionary <string, List <SubPartyParam> >(); SubpartyTable.Instance.Table.Add(culture, dict); foreach (var ele in el.Elements()) { this.HandleSubParty(ele, culture); } } } } } }
private void HandleSubParty(XElement el, ECulture culture) { string name = ""; if (el.Name == "SubParty") { foreach (var att in el.Attributes()) { name = att.Value.ToString(); } } foreach (var att in el.Attributes()) { foreach (var ele in el.Elements()) { if (ele.Name == "Character") { if (!SubpartyTable.Instance.Table[culture].ContainsKey(name)) { SubpartyTable.Instance.Table[culture].Add((name), new List <SubPartyParam>()); } var csv = ele.Value.Split(','); var values = new List <string>(); for (int i = 0; i < csv.Length; i++) { values.Add(csv[i]); } if (values.Count > 2) { var param = new SubPartyParam(); double difficulty = 0; EStartCol row = EStartCol.None; if (double.TryParse(values[SubPartiesXMLIndexes.DIFFICULTY], out difficulty)) { param.Difficulty = difficulty; } param.Name = values[SubPartiesXMLIndexes.NAME]; if (EnumUtil <EStartCol> .TryGetEnumValue(values[SubPartiesXMLIndexes.ROW], ref row)) { param.Row = row; } SubpartyTable.Instance.Table[culture][name].Add(param); } } } } }
public override void ReadFromFile() { foreach (var path in this._paths) { var doc = XDocument.Load(path); EClass baseClass = EClass.None; ECharType type = ECharType.None; ECulture culture = ECulture.None; ERace race = ERace.None; foreach (var el in doc.Root.Elements()) { foreach (var att in el.Attributes()) { if (EnumUtil <ECulture> .TryGetEnumValue(att.Value, ref culture)) { foreach (var ele in el.Elements()) { foreach (var attr in ele.Attributes()) { string key = ""; if (!table.Table.ContainsKey(attr.Value.ToString())) { key = attr.Value.ToString(); table.Table.Add(key, new PreCharParams()); table.Table[key].Name = key; table.Table[key].Culture = culture; } foreach (var elem in ele.Elements()) { switch (elem.Name.ToString()) { case (PredefinedReaderParams.ABILITIES): { this.HandleAbilities(elem, key); } break; case (PredefinedReaderParams.AGENT_ROLE): { this.HandleAgentRole(key, elem.Value); } break; case (PredefinedReaderParams.ATTACK_SPRITE_INDEX): { this.HandleCritterAttackSpriteIndex(key, elem.Value.ToString()); } break; case (PredefinedReaderParams.CLASS): { this.HandleClassType(key, elem.Value.ToString(), ref baseClass); } break; case (PredefinedReaderParams.DEAD_SPRITE_INDEX): { this.HandleCritterDeadSpriteIndex(key, elem.Value.ToString()); } break; case (PredefinedReaderParams.FLINCH_SPRITE_INDEX): { this.HandleCritterFlinchSpriteIndex(key, elem.Value.ToString()); } break; case (PredefinedReaderParams.MOUNT): { this.HandleMount(key, elem.Value); } break; case (PredefinedReaderParams.PERKS): { this.HandlePerks(elem, key); } break; case (PredefinedReaderParams.POTENTIAL_ARMORS): { this.HandleEquipment(elem, key); } break; case (PredefinedReaderParams.POTENTIAL_WEAPONS): { this.HandleEquipment(elem, key); } break; case (PredefinedReaderParams.RACE): { this.HandleRace(key, elem.Value.ToString(), ref race); } break; case (PredefinedReaderParams.STATS): { this.HandleStats(elem, key); } break; case (PredefinedReaderParams.TYPE): { this.HandleCharacterType(key, elem.Value.ToString(), ref type); } break; } } } } } } } } }