} // end EnoughWithIDAndCount public void UseItemWithGid(int gid) { if (gid < 0 || gid >= idList.Length) { return; } // end if string itemID = idList[gid]; IEquipInfo info = Configs.itemConfig.GetItemInfo(itemID) as IEquipInfo; if (null == info || (info.role != ConstConfig.ALLROLE && info.role != roleType)) { return; // 检测是否是装备,是否符合当前角色类型 } // end if string type = info.type; if (!wearDict.ContainsKey(type)) { return; // 检测装备类型是否存在 } // end if if (null == wearDict[type]) { idList[gid] = "0"; } else { idList[gid] = wearDict[type].id; } // end if wearDict[type] = info; WriteGridInfo(gid, idList[gid], 0); SqliteManager.SetWearInfoWithID(username, roleindex, type, info.id); if (null == center) { return; } // end if center.Broadcast(Character.CenterEvent.ReloadEquip); } // end UseItemWithGid
} // end DiscardItem public void TakeOffEquip(string type) { if (!wearDict.ContainsKey(type) || null == wearDict[type]) { return; } // end if if (IsFull) { return; } // end if PackItem(wearDict[type].id, 0); wearDict[type] = null; SqliteManager.SetWearInfoWithID(username, roleindex, type, "0"); if (null == center) { return; } // end if center.Broadcast(Character.CenterEvent.ReloadEquip); } // end TakeOffEquip