public bool MergeShipPartsDatabase(ShipPartsDataBase db) { if (db == null) { return(false); } foreach (ShipPartsDataBase.ShipPart i in db.PartsList) { ItemDatabase.Data data = GetValue(i.Name); if (data != null) { data.MergeShipPartsDatabase(i); } } return(true); }
internal static ShipPartsDataBase.ShipPart FromXml(XmlNode n) { if (n == null) { return((ShipPartsDataBase.ShipPart)null); } if (n.ChildNodes == null) { return((ShipPartsDataBase.ShipPart)null); } if (n.Name != "ship_part") { return((ShipPartsDataBase.ShipPart)null); } if (n.Attributes["name"] == null) { return((ShipPartsDataBase.ShipPart)null); } ShipPartsDataBase.ShipPart shipPart = new ShipPartsDataBase.ShipPart(); shipPart.m_name = Useful.XmlGetAttribute(n, "name", shipPart.m_name); shipPart.m_type = ShipPartsDataBase.ToPartsType(Useful.XmlGetAttribute(n, "PartsType", ShipPartsDataBase.ToString(shipPart.m_type))); shipPart.m_ship_size_type = ShipPartsDataBase.ToShipSizeType(Useful.XmlGetAttribute(n, "ShipSizeType", ShipPartsDataBase.ToString(shipPart.m_ship_size_type))); shipPart.m_is_general_purpose = Useful.ToBool(Useful.XmlGetAttribute(n, "IsGeneralPurpose", shipPart.m_is_general_purpose.ToString()), shipPart.m_is_general_purpose); for (int index = 0; index < Enum.GetValues(typeof(ShipPartsDataBase.BuildTargetType)).Length; ++index) { XmlNode element = Useful.XmlGetElement(n, "data_values", ShipPartsDataBase.ToString(ShipPartsDataBase.ToBuildTargetType(index))); if (element != null) { int min = Useful.ToInt32(Useful.XmlGetAttribute(element, "Min", shipPart.m_value_tbl[index].Min.ToString()), shipPart.m_value_tbl[index].Min); int max = Useful.ToInt32(Useful.XmlGetAttribute(element, "Max", shipPart.m_value_tbl[index].Max.ToString()), shipPart.m_value_tbl[index].Max); shipPart.m_value_tbl[index].SetData(min, max, max - (max - min) / 2); } } XmlNode node = (XmlNode)n["detail"]; if (node != null) { shipPart.Skill = Useful.XmlGetAttribute(node, "Skill", shipPart.Skill); shipPart.Citys = Useful.XmlGetAttribute(node, "Citys", shipPart.Citys); shipPart.NPC = Useful.XmlGetAttribute(node, "NPC", shipPart.NPC); shipPart.Materials = Useful.XmlGetAttribute(node, "Materials", shipPart.Materials); shipPart.ShipType = Useful.XmlGetAttribute(node, "ShipType", shipPart.ShipType); shipPart.Price = Useful.XmlGetAttribute(node, "Price", shipPart.Price); } shipPart.optimize(); return(shipPart); }
internal void WriteXml(XmlNode p_node) { XmlNode xmlNode = Useful.XmlAddNode(p_node, "ship_part", this.Name); Useful.XmlAddAttribute(xmlNode, "PartsType", ShipPartsDataBase.ToString(this.m_type)); Useful.XmlAddAttribute(xmlNode, "ShipSizeType", ShipPartsDataBase.ToString(this.m_ship_size_type)); Useful.XmlAddAttribute(xmlNode, "IsGeneralPurpose", this.m_is_general_purpose.ToString()); for (int index = 0; index < Enum.GetValues(typeof(ShipPartsDataBase.BuildTargetType)).Length; ++index) { XmlNode node = Useful.XmlAddNode(xmlNode, "data_values", ShipPartsDataBase.ToString(ShipPartsDataBase.ToBuildTargetType(index))); Useful.XmlAddAttribute(node, "Min", this.m_value_tbl[index].Min.ToString()); Useful.XmlAddAttribute(node, "Max", this.m_value_tbl[index].Max.ToString()); } XmlNode node1 = Useful.XmlAddNode(xmlNode, "detail"); Useful.XmlAddAttribute(node1, "Skill", this.Skill); Useful.XmlAddAttribute(node1, "Citys", this.Citys); Useful.XmlAddAttribute(node1, "NPC", this.NPC); Useful.XmlAddAttribute(node1, "Materials", this.Materials); Useful.XmlAddAttribute(node1, "ShipType", this.ShipType); Useful.XmlAddAttribute(node1, "Price", this.Price); }
public string ToStringParamsOnly() { string str1 = "強化値:\n"; for (int index = 0; index < this.m_value_tbl.Length; ++index) { string str2 = this.m_value_tbl[index].ToStringSimple(); if (!string.IsNullOrEmpty(str2)) { str1 = str1 + ShipPartsDataBase.ToString(ShipPartsDataBase.ToBuildTargetType(index)) + ":" + str2 + "\n"; } } string str3 = str1 + "船タイプ:" + this.ShipType + "\n" + "船サイズ:" + ShipPartsDataBase.ToString(this.ShipSizeType) + "\n"; if (this.IsGeneralPurpose) { str3 = str3 + "販売港:" + this.Citys + "\n" + "値段:" + this.Price; } else { if (!string.IsNullOrEmpty(this.Citys)) { str3 = str3 + "作成港:" + this.Citys + "\n"; } if (!string.IsNullOrEmpty(this.NPC)) { str3 = str3 + "NPC:" + this.NPC + "\n"; } if (!string.IsNullOrEmpty(this.Skill)) { str3 = str3 + "スキル:" + this.Skill + "\n"; } if (!string.IsNullOrEmpty(this.Materials)) { str3 = str3 + "素材:" + this.Materials + "\n"; } } return(str3); }
public static ShipPartsDataBase.ShipSizeType ToShipSizeType(int index) { return(ShipPartsDataBase.ToShipSizeType(index.ToString())); }
public static ShipPartsDataBase.BuildShipType ToBuildShipType(int index) { return(ShipPartsDataBase.ToBuildShipType(index.ToString())); }
public List <ShipPartsDataBase.ShipPart> GetPartsList(ShipPartsDataBase.PartsType type, ShipPartsDataBase.BuildShipType type2) { return(this.GetPartsList(type, ShipPartsDataBase.ToShipSizeType(type2))); }