local EquipManager = class("EquipManager", BaseModule) -- 升级装备 function EquipManager:reqUpgrade(id, part) local entity = DataManager.EquipData:getEquip(id, part) if not entity then return end if not entity:isEnoughMaterial() then GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8)) -- 打开副本界面 return end if not entity:isEnoughGold() then GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD) ModuleManager.ShopManager:tryTriggerCoinGift() return end if entity:isMaxLevel() then if entity:getPart() == GConst.EquipConst.PART_TYPE.WEAPON then GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_7, DataManager.PlayerData:getLv() + 1)) else GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_9, entity:getLevel() + 1)) end return end self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE) end function EquipManager:rspUpgrade(result) if result.err_code == GConst.ERROR_STR.SUCCESS then DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position) end end return EquipManager