/// <summary> /// 构造函数 /// </summary> public Equipment(ItemModel itemModel, int itemCount, FuseStone fuseStone = null) { this.itemType = ItemType.Equipment; this.itemCount = itemCount; // 初始化物品基本属性 InitBaseProperties(itemModel); // 初始化装备属性 this.attackGain = itemModel.attackGain; this.hitGain = itemModel.hitGain; this.critGain = itemModel.critGain; this.armorGain = itemModel.armorGain; this.magicResistGain = itemModel.magicResistGain; this.dodgeGain = itemModel.dodgeGain; this.healthGain = itemModel.healthGain; this.manaGain = itemModel.manaGain; this.wholePropertyGain = itemModel.wholePropertyGain; this.attachedSkillInfos = itemModel.attachedSkillInfos; this.itemInfosForProduce = itemModel.itemInfosForProduce; this.price = itemModel.price; // #warning 这里耐久度现都设为100; // this.maxDurability = 100; // this.durability = 100; if (fuseStone != null) { this.itemName = string.Format("{0}{1}", fuseStone.itemName.Replace("之石", "的"), itemName); } }
public static FuseStone CreateFuseStoneIfExist(string spell) { /************从单词数据库中获取物品名称**************/ MySQLiteHelper sql = MySQLiteHelper.Instance; sql.GetConnectionWith(CommonData.dataBaseName); IDataReader reader = sql.ReadSpecificRowsOfTable("AllWordsData", "*", new string[] { string.Format("Spell='{0}'", spell) }, true); if (!reader.Read()) { Debug.Log("不存在"); return(null); } bool valid = reader.GetBoolean(4); if (!valid) { Debug.Log("已使用"); return(null); } int id = reader.GetInt32(0); string explaination = reader.GetString(2); string firstExplaination = explaination.Split(new string[] { ";" }, System.StringSplitOptions.RemoveEmptyEntries)[0]; string[] strings = firstExplaination.Split(new string[] { ".", "," }, System.StringSplitOptions.RemoveEmptyEntries); string fuseStoneName = strings [strings.Length - 1]; // string fuseStoneName = explaination.Split (new string[]{ ".", "," ,";"}, // System.StringSplitOptions.RemoveEmptyEntries)[1]; fuseStoneName = fuseStoneName.Replace(" ", string.Empty); fuseStoneName = fuseStoneName.Replace("的", string.Empty); fuseStoneName = string.Format("{0}之石", fuseStoneName); sql.UpdateValues("AllWordsData", new string[] { "Valid" }, new string[] { "0" }, new string[] { string.Format("Id={0}", id) }, true); sql.CloseConnection(CommonData.dataBaseName); FuseStone fuseStone = new FuseStone(fuseStoneName, spell); Debug.Log(fuseStone); return(fuseStone); }