装备
This commit is contained in:
parent
2960713f83
commit
6347ed6f9c
@ -183,6 +183,12 @@ BIReport.ITEM_GET_TYPE = {
|
|||||||
|
|
||||||
TASK_ACHIEVEMENT = "task_achievement",
|
TASK_ACHIEVEMENT = "task_achievement",
|
||||||
|
|
||||||
|
-- 装备相关
|
||||||
|
EQUIP_WEAR = "equip_wear",
|
||||||
|
EQUIP_LV_UP = "equip_lv_up",
|
||||||
|
EQUIP_REFINE = "equip_refine",
|
||||||
|
EQUIP_RESOLVE = "equip_resolve",
|
||||||
|
|
||||||
-- 召唤
|
-- 召唤
|
||||||
FORCE_SUMMON = "force_summon",
|
FORCE_SUMMON = "force_summon",
|
||||||
FORCE_SUMMON_WISH_HREO_ID = "force_summon_wish_hero_id",
|
FORCE_SUMMON_WISH_HREO_ID = "force_summon_wish_hero_id",
|
||||||
|
|||||||
@ -734,6 +734,24 @@ local LocalizationGlobalConst =
|
|||||||
EQUIP_HERO_DESC_34 = "EQUIP_HERO_DESC_34",
|
EQUIP_HERO_DESC_34 = "EQUIP_HERO_DESC_34",
|
||||||
EQUIP_HERO_ACTIVATION_1 = "EQUIP_HERO_ACTIVATION_1",
|
EQUIP_HERO_ACTIVATION_1 = "EQUIP_HERO_ACTIVATION_1",
|
||||||
EQUIP_HERO_ACTIVATION_2 = "EQUIP_HERO_ACTIVATION_2",
|
EQUIP_HERO_ACTIVATION_2 = "EQUIP_HERO_ACTIVATION_2",
|
||||||
|
EQUIP_HERO_M_1 = "EQUIP_HERO_M_1",
|
||||||
|
EQUIP_HERO_M_2 = "EQUIP_HERO_M_2",
|
||||||
|
EQUIP_HERO_M_3 = "EQUIP_HERO_M_3",
|
||||||
|
EQUIP_QLT_DESC_1 = "EQUIP_QLT_DESC_1",
|
||||||
|
EQUIP_QLT_DESC_2 = "EQUIP_QLT_DESC_2",
|
||||||
|
EQUIP_QLT_DESC_3 = "EQUIP_QLT_DESC_3",
|
||||||
|
EQUIP_QLT_DESC_4 = "EQUIP_QLT_DESC_4",
|
||||||
|
EQUIP_QLT_DESC_5 = "EQUIP_QLT_DESC_5",
|
||||||
|
LV_POINT = "LV_POINT",
|
||||||
|
EQUIP_HERO_1 = "EQUIP_HERO_1",
|
||||||
|
EQUIP_HERO_2 = "EQUIP_HERO_2",
|
||||||
|
EQUIP_HERO_3 = "EQUIP_HERO_3",
|
||||||
|
EQUIP_DESC_40 = "EQUIP_DESC_40",
|
||||||
|
EQUIP_DESC_48 = "EQUIP_DESC_48",
|
||||||
|
EQUIP_QLT_SELECT = "EQUIP_QLT_SELECT",
|
||||||
|
EQUIP_QLT_SELECT_ALL_1 = "EQUIP_QLT_SELECT_ALL_1",
|
||||||
|
EQUIP_QLT_SELECT_ALL_2 = "EQUIP_QLT_SELECT_ALL_2",
|
||||||
|
REBACK_MATERIAL_DESC = "REBACK_MATERIAL_DESC",
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalizationGlobalConst
|
return LocalizationGlobalConst
|
||||||
@ -734,6 +734,24 @@ local localization_global =
|
|||||||
["EQUIP_HERO_DESC_34"] = "强化至<color=#00FF15>{0}</color>级可继续精炼",
|
["EQUIP_HERO_DESC_34"] = "强化至<color=#00FF15>{0}</color>级可继续精炼",
|
||||||
["EQUIP_HERO_ACTIVATION_1"] = "已激活:强化共鸣Lv{0}",
|
["EQUIP_HERO_ACTIVATION_1"] = "已激活:强化共鸣Lv{0}",
|
||||||
["EQUIP_HERO_ACTIVATION_2"] = "已激活:精炼共鸣Lv{0}",
|
["EQUIP_HERO_ACTIVATION_2"] = "已激活:精炼共鸣Lv{0}",
|
||||||
|
["EQUIP_HERO_M_1"] = "所有装备强化{0}可激活下个等级",
|
||||||
|
["EQUIP_HERO_M_2"] = "所有装备品质达到{0}可激活下个等级",
|
||||||
|
["EQUIP_HERO_M_3"] = "所有装备精炼{0}级可激活下个等级",
|
||||||
|
["EQUIP_QLT_DESC_1"] = "<color=#5bff5f>绿{0}星</color>",
|
||||||
|
["EQUIP_QLT_DESC_2"] = "<color=#4adbff>蓝{0}星</color>",
|
||||||
|
["EQUIP_QLT_DESC_3"] = "<color=#df70ff>紫{0}星</color>",
|
||||||
|
["EQUIP_QLT_DESC_4"] = "<color=#ff9b59>橙{0}星</color>",
|
||||||
|
["EQUIP_QLT_DESC_5"] = "<color=#ff5d5d>红{0}星</color>",
|
||||||
|
["LV_POINT"] = "LV.",
|
||||||
|
["EQUIP_HERO_1"] = "强化共鸣",
|
||||||
|
["EQUIP_HERO_2"] = "品质共鸣",
|
||||||
|
["EQUIP_HERO_3"] = "精炼共鸣",
|
||||||
|
["EQUIP_DESC_40"] = "没有可分解的装备",
|
||||||
|
["EQUIP_DESC_48"] = "分解后所选装备会消失,确定分解吗?",
|
||||||
|
["EQUIP_QLT_SELECT"] = "{0}\n及以下",
|
||||||
|
["EQUIP_QLT_SELECT_ALL_1"] = "所有品质",
|
||||||
|
["EQUIP_QLT_SELECT_ALL_2"] = "所有部位",
|
||||||
|
["REBACK_MATERIAL_DESC"] = "分解获得",
|
||||||
}
|
}
|
||||||
|
|
||||||
return localization_global
|
return localization_global
|
||||||
@ -18,91 +18,120 @@ function EquipManager:showEquipInfoUI(params)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 请求触发装备升级礼包
|
-- 共鸣
|
||||||
function EquipManager:reqEquipUpgradeGift(heroId, part)
|
function EquipManager:showEquipResonateUI(slotId, page)
|
||||||
if DataManager.EquipData:getCanShowGiftId(heroId, part) ~= nil then
|
UIManager:showUI("app/ui/equip/equip_resonate_ui", {slotId = slotId, page = page})
|
||||||
return
|
|
||||||
end
|
end
|
||||||
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.TriggerWeaponArmorGiftReq, {hero_id = heroId, equip_position = part}, {}, self.rspEquipUpgradeGift, nil)
|
-- 分解弹窗(批量分解)
|
||||||
|
function EquipManager:showEquipResolveUI()
|
||||||
|
UIManager:showUI("app/ui/equip/equip_resolve_ui")
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipManager:rspEquipUpgradeGift(result)
|
-- 套装效果弹窗
|
||||||
DataManager.EquipData:initGifts(result.info)
|
function EquipManager:showEquipGetResonateUI(type, lvNew, attrNum, attrNextNum)
|
||||||
|
local params = {
|
||||||
|
type = type,
|
||||||
|
lvNew = lvNew,
|
||||||
|
attrNum = attrNum,
|
||||||
|
attrNextNum = attrNextNum,
|
||||||
|
}
|
||||||
|
UIManager:showUI("app/ui/equip/equip_get_resonate_ui", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 升级装备
|
--@region 协议
|
||||||
function EquipManager:reqUpgrade(id, part)
|
-- 装备穿戴
|
||||||
local entity = DataManager.EquipData:getEquip(id, part)
|
|
||||||
if not entity then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local heroEntity = DataManager.HeroData:getHeroById(id)
|
|
||||||
if heroEntity == nil or not heroEntity:isUnlock() then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for index, cost in ipairs(entity:getUpgradeMaterials()) do
|
|
||||||
if cost.num > DataManager.BagData.ItemData:getItemNumById(cost.id) then
|
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_8))
|
|
||||||
self:showItemGetPop(id, part, cost.id, cost.num)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if not entity:isEnoughGold() then
|
|
||||||
if not ModuleManager.ShopManager:tryTriggerCoinGift() then
|
|
||||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_GOLD)
|
|
||||||
end
|
|
||||||
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
|
|
||||||
|
|
||||||
local itemGetType = BIReport.ITEM_GET_TYPE.EQUIP_UPGRADE
|
|
||||||
if part ~= GConst.EquipConst.PART_TYPE.WEAPON then
|
|
||||||
itemGetType = BIReport.ITEM_GET_TYPE.ARMOR_UPGRADE
|
|
||||||
end
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, {hero_id = id, position = part}, {}, self.rspUpgrade, itemGetType)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipManager:rspUpgrade(result)
|
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
|
||||||
DataManager.EquipData:onUpgradeEquip(result.reqData.hero_id, result.reqData.position)
|
|
||||||
|
|
||||||
if result.reqData.position == GConst.EquipConst.PART_TYPE.WEAPON then
|
|
||||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_WEAPON)
|
|
||||||
else
|
|
||||||
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_UPGRADE_ARMOR)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--@region
|
|
||||||
function EquipManager:onEquipWearReq(slotId, ids)
|
function EquipManager:onEquipWearReq(slotId, ids)
|
||||||
local params = {}
|
local params = {}
|
||||||
params.slot = slotId
|
params.slot = slotId
|
||||||
params.ids = ids
|
params.ids = ids
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipWearReq, params, {}, self.onEquipWearRsp, BIReport.ITEM_GET_TYPE.UPGRADE_HERO)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipWearReq, params, {}, self.onEquipWearRsp, BIReport.ITEM_GET_TYPE.EQUIP_WEAR)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipManager:onEquipWearRsp(result)
|
function EquipManager:onEquipWearRsp(result)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
local lvOld, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.QLT, result.reqData.slot)
|
||||||
DataManager.EquipData:onWearSuccess(result.reqData.slot, result.reqData.ids)
|
DataManager.EquipData:onWearSuccess(result.reqData.slot, result.reqData.ids)
|
||||||
DataManager.HeroData:setDirty()
|
DataManager.HeroData:setDirty()
|
||||||
DataManager.HeroData:calcPower()
|
DataManager.HeroData:calcPower()
|
||||||
|
local lvNew = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.QLT, result.reqData.slot)
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.HERO_UP)
|
if lvOld < lvNew then
|
||||||
|
self:showEquipGetResonateUI(GConst.EquipConst.RESONATE_PAGE.QLT, lvNew, attrNum, attrNextNum)
|
||||||
|
-- DataManager.GiftPopData:activeEquipResonancePopGift(GConst.EquipConst.RESONATE_PAGE.QLT, lvNew)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 装备升级
|
||||||
|
function EquipManager:onEquipUpgradeReq(slotId, part)
|
||||||
|
local lv = DataManager.EquipData:getPartLv(slotId, part)
|
||||||
|
local itemCost = DataManager.EquipData:getLevelCost(lv + 1)
|
||||||
|
if not GFunc.checkCost(itemCost.id, itemCost.num, true) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local params = {}
|
||||||
|
params.slot = slotId
|
||||||
|
params.part = part
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipUpgradeReq, params, {}, self.onEquipUpgradeRsp, BIReport.ITEM_GET_TYPE.EQUIP_LV_UP)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipManager:onEquipUpgradeRsp(result)
|
||||||
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
local lvOld, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, result.reqData.slot)
|
||||||
|
DataManager.EquipData:onUpgradeSuccess(result.reqData.slot, result.upgraded)
|
||||||
|
DataManager.HeroData:setDirty()
|
||||||
|
DataManager.HeroData:calcPower()
|
||||||
|
local lvNew = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, result.reqData.slot)
|
||||||
|
if lvOld < lvNew then
|
||||||
|
self:showGetResonateUI(GConst.EquipConst.RESONATE_PAGE.LV_UP, lvNew, attrNum, attrNextNum)
|
||||||
|
-- DataManager.GiftPopData:activeEquipResonancePopGift(GConst.EquipConst.RESONATE_PAGE.LV_UP, lvNew)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 装备精炼
|
||||||
|
function EquipManager:onEquipRefineReq(slotId, part)
|
||||||
|
local refine = DataManager.EquipData:getPartRefine(slotId, part)
|
||||||
|
local itemCost = DataManager.EquipData:getRefineCost(refine + 1)
|
||||||
|
if not GFunc.checkCost(itemCost.id, itemCost.num, true) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local params = {}
|
||||||
|
params.slot = slotId
|
||||||
|
params.part = part
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipRefineReq, params, {}, self.onEquipRefineRsp, BIReport.ITEM_GET_TYPE.EQUIP_REFINE)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipManager:onEquipRefineRsp(result)
|
||||||
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
|
local lvOld, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.REFINE, result.reqData.slot)
|
||||||
|
DataManager.EquipData:onRefineSuccess(result.reqData.slot, result.reqData.part, result.part)
|
||||||
|
DataManager.HeroData:setDirty()
|
||||||
|
DataManager.HeroData:calcPower()
|
||||||
|
local lvNew = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.REFINE, result.reqData.slot)
|
||||||
|
if lvOld < lvNew then
|
||||||
|
self:showGetResonateUI(GConst.EquipConst.RESONATE_PAGE.REFINE, lvNew, attrNum, attrNextNum)
|
||||||
|
-- DataManager.GiftPopData:activeEquipResonancePopGift(GConst.EquipConst.RESONATE_PAGE.REFINE, lvNew)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 装备分解
|
||||||
|
function EquipManager:onEquipDecomposeReq(ids)
|
||||||
|
self:sendMessage(ProtoMsgType.FromMsgEnum.EquipDecomposeReq, {ids = ids}, {}, self.onEquipDecomposeRsp, BIReport.ITEM_GET_TYPE.EQUIP_RESOLVE)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipManager:onEquipDecomposeRsp(result)
|
||||||
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
GFunc.showRewardBox(result.rewards, {customTitleStr = I18N:getGlobalText(I18N.GlobalConst.REBACK_MATERIAL_DESC)})
|
||||||
|
|
||||||
|
DataManager.EquipData:onResolveSuccess(result.reqData.ids)
|
||||||
|
|
||||||
|
-- ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.EQUIP_RESOLVE_NUM, #result.reqData.ids)
|
||||||
|
|
||||||
|
-- BIReport:postEquipResolveOpt(BIReport.EQUIP_OP_TYPE.RESOLVE, result.reqData.ids, result.rewards)
|
||||||
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
return EquipManager
|
return EquipManager
|
||||||
@ -2,19 +2,22 @@ local EquipCell = class("EquipCell", BaseCell)
|
|||||||
|
|
||||||
function EquipCell:init()
|
function EquipCell:init()
|
||||||
local uiMap = self:getUIMap()
|
local uiMap = self:getUIMap()
|
||||||
self.imgQlt = uiMap["equip_cell.content.img_qlt"]
|
self.qltImg = uiMap["equip_cell.content.qlt_img"]
|
||||||
self.imgIcon = uiMap["equip_cell.content.img_icon"]
|
self.iconImg = uiMap["equip_cell.content.icon_img"]
|
||||||
self.rankNode = uiMap["equip_cell.content.rank"]
|
self.lvTx = uiMap["equip_cell.content.lv_tx"]
|
||||||
self.txRank = uiMap["equip_cell.content.rank.tx_rank"]
|
|
||||||
self.levelNode = uiMap["equip_cell.content.level"]
|
|
||||||
self.txLv = uiMap["equip_cell.content.level.tx_lv"]
|
|
||||||
self.imgUp = uiMap["equip_cell.content.img_up"]
|
|
||||||
self.mask = uiMap["equip_cell.mask"]
|
self.mask = uiMap["equip_cell.mask"]
|
||||||
self.check = uiMap["equip_cell.check"]
|
self.check = uiMap["equip_cell.check"]
|
||||||
self.lock = uiMap["equip_cell.lock"]
|
self.lock = uiMap["equip_cell.lock"]
|
||||||
self.select = uiMap["equip_cell.select"]
|
self.select = uiMap["equip_cell.select"]
|
||||||
self.light = uiMap["equip_cell.light"]
|
self.light = uiMap["equip_cell.light"]
|
||||||
self.levelNode:setActive(false)
|
self.refineBg = uiMap["equip_cell.content.refine_bg"]
|
||||||
|
self.refineBgTx = uiMap["equip_cell.content.refine_bg.refine_tx"]
|
||||||
|
|
||||||
|
self.starNode = uiMap["equip_cell.content.star_cell"]
|
||||||
|
self.starImgs = {}
|
||||||
|
for i = 1, 5 do
|
||||||
|
self.starImgs[i] = uiMap["equip_cell.content.star_cell.star_img_" .. i]
|
||||||
|
end
|
||||||
|
|
||||||
-- self:hideEffectUp()
|
-- self:hideEffectUp()
|
||||||
end
|
end
|
||||||
@ -27,58 +30,73 @@ function EquipCell:refresh(entity, slotId, showMask, showCheck, showLock)
|
|||||||
if entity == nil then
|
if entity == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self:_refreshShow(entity:getQlt(), entity:getIconRes(), entity:getPartLv(slotId), showMask, showCheck, showLock)
|
|
||||||
|
self:_refresh(entity, showMask, showCheck, showLock)
|
||||||
|
local lv = entity:getPartLv(slotId)
|
||||||
|
if lv then
|
||||||
|
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.LV_POINT) .. lv)
|
||||||
|
else
|
||||||
|
self.lvTx:setText("")
|
||||||
|
end
|
||||||
|
local part = entity:getPart()
|
||||||
|
local uid = entity:getUid()
|
||||||
|
if uid and uid > 0 then
|
||||||
|
local equipUid = DataManager.EquipData:getPartEquipUid(slotId, part)
|
||||||
|
if equipUid and equipUid == uid then
|
||||||
|
self.refineBg:setActive(true)
|
||||||
|
self.refineBgTx:setText(DataManager.EquipData:getPartRefine(slotId, part))
|
||||||
|
else
|
||||||
|
self.refineBg:setActive(false)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.refineBg:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipCell:refreshByCfg(id, showMask, showCheck, showLock)
|
||||||
|
if id == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local entity = DataManager.EquipData:getEquipByCfgId(id)
|
||||||
|
self:_refresh(entity, showMask, showCheck, showLock)
|
||||||
|
self.lvTx:setText("")
|
||||||
|
self.refineBg:setActive(false)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipCell:_refresh(entity, showMask, showCheck, showLock)
|
||||||
local qlt = entity:getQlt()
|
local qlt = entity:getQlt()
|
||||||
local icon = entity:getIconRes()
|
local icon = entity:getIconRes()
|
||||||
local lv = entity:getPartLv(slotId)
|
local star = entity:getStar()
|
||||||
self.imgQlt:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. qlt)
|
|
||||||
self.imgIcon:setActive(true)
|
|
||||||
self.imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, icon)
|
|
||||||
|
|
||||||
-- if lv then
|
self.qltImg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. qlt)
|
||||||
-- self.levelNode:setActive(true)
|
self.iconImg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, icon)
|
||||||
-- self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_2, lv))
|
for i, v in ipairs(self.starImgs) do
|
||||||
-- else
|
if i <= star then
|
||||||
-- self.levelNode:setActive(false)
|
v:setActive(true)
|
||||||
-- end
|
v:setSprite(GConst.ATLAS_PATH.COMMON, "common_star_1")
|
||||||
|
else
|
||||||
|
v:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self.starNode:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
|
||||||
|
|
||||||
self:showMask(showMask)
|
self:showMask(showMask)
|
||||||
self:showCheck(showCheck)
|
self:showCheck(showCheck)
|
||||||
self:showLock(showLock)
|
self:showLock(showLock)
|
||||||
self:showSelect(false)
|
self:showSelect(false)
|
||||||
self:showLight(false)
|
self:showLight(false)
|
||||||
self:setShowUp(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipCell:refreshByCfg(id, showMask, showCheck, showLock)
|
|
||||||
self:_refreshShow(DataManager.EquipData:getQlt(id), DataManager.EquipData:getIconRes(id), nil, showMask, showCheck, showLock)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipCell:refreshByCustom(qlt, icon, lv, showMask, showCheck, showLock)
|
|
||||||
self:_refreshShow(qlt, icon, lv, showMask, showCheck, showLock)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipCell:_refreshShow(qlt, icon, lv, showMask, showCheck, showLock)
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipCell:refreshEmpty(part, showSelect)
|
function EquipCell:refreshEmpty(part, showSelect)
|
||||||
self.imgQlt:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_0")
|
self.qltImg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_0")
|
||||||
-- self.imgIcon:setActive(true)
|
-- self.iconImg:setActive(true)
|
||||||
self.imgIcon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "101")
|
self.iconImg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "101")
|
||||||
self.rankNode:setActive(false)
|
|
||||||
self.levelNode:setActive(false)
|
|
||||||
|
|
||||||
self:showMask(false)
|
self:showMask(false)
|
||||||
self:showCheck(false)
|
self:showCheck(false)
|
||||||
self:showLock(false)
|
self:showLock(false)
|
||||||
self:showSelect(showSelect or false)
|
self:showSelect(showSelect or false)
|
||||||
self:showLight(false)
|
self:showLight(false)
|
||||||
self:setShowUp(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipCell:setShowUp(show)
|
|
||||||
self.imgUp:setActive(show)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipCell:setShowLv(show)
|
function EquipCell:setShowLv(show)
|
||||||
|
|||||||
43
lua/app/ui/equip/equip_get_resonate_ui.lua
Executable file
43
lua/app/ui/equip/equip_get_resonate_ui.lua
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
local BaseTips = require "app/ui/tips/base_tips"
|
||||||
|
local EquipGetEesonateUI = class("EquipGetEesonateUI", BaseTips)
|
||||||
|
|
||||||
|
function EquipGetEesonateUI:ctor(params)
|
||||||
|
self.type = params.type
|
||||||
|
self.lvNew = params.lvNew
|
||||||
|
self.attrNum = params.attrNum
|
||||||
|
self.attrNextNum = params.attrNextNum
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipGetEesonateUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/equip/equip_get_resonate_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipGetEesonateUI:setRootUI(ui)
|
||||||
|
self.parentUI = ui
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipGetEesonateUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
self.root:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
self.layout = uiMap["equip_get_resonate_ui.attr_bg.layout"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
|
self.attrNextValueTx = uiMap["equip_get_resonate_ui.attr_bg.layout.attr_next_value_tx"]
|
||||||
|
-- self.effect = uiMap["equip_get_resonate_ui.vfx_b13_ui_equip_gongmin_b01"]
|
||||||
|
uiMap["equip_get_resonate_ui.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_33))
|
||||||
|
-- self.spineTitle:playAnimComplete("born", false, true, function()
|
||||||
|
-- self.spineTitle:playAnim("idle", true, true)
|
||||||
|
-- end)
|
||||||
|
uiMap["equip_get_resonate_ui.name_tx"]:setText(I18N:getGlobalText("EQUIP_HERO_LV_" .. self.type, self.lvNew))
|
||||||
|
-- self.effect:play()
|
||||||
|
uiMap["equip_get_resonate_ui.attr_bg.attr_name_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TAG_4_1))
|
||||||
|
uiMap["equip_get_resonate_ui.attr_bg.layout.attr_curr_value_tx"]:setText(self.attrNum)
|
||||||
|
self.attrNextValueTx:setText(self.attrNextNum)
|
||||||
|
local meshProCompNext = self.attrNextValueTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||||
|
local nowTipsNextX = meshProCompNext.preferredWidth
|
||||||
|
self.attrNextValueTx:setSizeDeltaX(nowTipsNextX)
|
||||||
|
self.layout:RefreshLayout()
|
||||||
|
end
|
||||||
|
|
||||||
|
return EquipGetEesonateUI
|
||||||
10
lua/app/ui/equip/equip_get_resonate_ui.lua.meta
Normal file
10
lua/app/ui/equip/equip_get_resonate_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 7cd78d812d92144a4818e2a894b2fa0a
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -29,9 +29,6 @@ function EquipGrowthUI:onLoadRootComplete()
|
|||||||
uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
|
uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.bg.info_btn"]:addClickListener(function()
|
|
||||||
self:closeUI()
|
|
||||||
end)
|
|
||||||
-- uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
|
-- uiMap["equip_growth_ui.bg.close_btn"]:addClickListener(function()
|
||||||
-- self:closeUI()
|
-- self:closeUI()
|
||||||
-- end)
|
-- end)
|
||||||
@ -57,13 +54,18 @@ function EquipGrowthUI:onLoadRootComplete()
|
|||||||
-- self.upAutoBtnTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]
|
-- self.upAutoBtnTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]
|
||||||
self.upMaxDescTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.max_desc_tx"]
|
self.upMaxDescTx = uiMap["equip_growth_ui.bg.page_info_1.attr_bg.max_desc_tx"]
|
||||||
self.upUpBtn:addClickListener(function()
|
self.upUpBtn:addClickListener(function()
|
||||||
self:closeUI()
|
ModuleManager.EquipManager:onEquipUpgradeReq(self.slotId, self.equipPart)
|
||||||
end)
|
end)
|
||||||
self.upAutoBtn:addClickListener(function()
|
self.upAutoBtn:addClickListener(function()
|
||||||
self:closeUI()
|
ModuleManager.EquipManager:onEquipUpgradeReq(self.slotId, 0)
|
||||||
|
end)
|
||||||
|
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.bg.info_btn"]:addClickListener(function()
|
||||||
|
ModuleManager.EquipManager:showEquipResonateUI(self.slotId, GConst.EquipConst.RESONATE_PAGE.LV_UP)
|
||||||
end)
|
end)
|
||||||
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.up_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3))
|
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.up_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3))
|
||||||
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_23))
|
uiMap["equip_growth_ui.bg.page_info_1.attr_bg.auto_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_23))
|
||||||
|
uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_20))
|
||||||
|
uiMap["equip_growth_ui.bg.resolve_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_24))
|
||||||
self.upMaxDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_27))
|
self.upMaxDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_27))
|
||||||
|
|
||||||
-- 精炼
|
-- 精炼
|
||||||
@ -72,43 +74,24 @@ function EquipGrowthUI:onLoadRootComplete()
|
|||||||
-- self.refineNextBg = uiMap["equip_growth_ui.bg.page_info_2.next_bg"]
|
-- self.refineNextBg = uiMap["equip_growth_ui.bg.page_info_2.next_bg"]
|
||||||
self.refineNextLvTx = uiMap["equip_growth_ui.bg.page_info_2.next_bg.lv_tx"]
|
self.refineNextLvTx = uiMap["equip_growth_ui.bg.page_info_2.next_bg.lv_tx"]
|
||||||
self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx"]
|
self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx"]
|
||||||
-- self.list = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list"]
|
-- self.refineInfoBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]
|
||||||
-- self.attrExtraCell1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1"]
|
self.refineDescTx1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.desc_tx"]
|
||||||
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.point"]
|
|
||||||
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_name_tx"]
|
|
||||||
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_curr_tx"]
|
|
||||||
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.img_arrow"]
|
|
||||||
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_1.attr_next_tx"]
|
|
||||||
-- self.attrExtraCell2 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2"]
|
|
||||||
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.point"]
|
|
||||||
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_name_tx"]
|
|
||||||
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_curr_tx"]
|
|
||||||
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.img_arrow"]
|
|
||||||
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_2.attr_next_tx"]
|
|
||||||
-- self.attrExtraCell3 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3"]
|
|
||||||
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.point"]
|
|
||||||
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_name_tx"]
|
|
||||||
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_curr_tx"]
|
|
||||||
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.img_arrow"]
|
|
||||||
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_3.attr_next_tx"]
|
|
||||||
-- self.attrExtraCell4 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4"]
|
|
||||||
-- self.point = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.point"]
|
|
||||||
-- self.attrNameTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_name_tx"]
|
|
||||||
-- self.attrCurrTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_curr_tx"]
|
|
||||||
-- self.imgArrow = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.img_arrow"]
|
|
||||||
-- self.attrNextTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.list.attr_extra_cell_4.attr_next_tx"]
|
|
||||||
-- self.bg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg"]
|
|
||||||
self.refineInfoBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]
|
|
||||||
self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.desc_tx"]
|
|
||||||
self.refineCostBg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg"]
|
self.refineCostBg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg"]
|
||||||
self.refineCostIcon = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_icon"]
|
self.refineCostIcon = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_icon"]
|
||||||
self.refineCostTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_tx"]
|
self.refineCostTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_tx"]
|
||||||
self.refineUpBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn"]
|
self.refineUpBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn"]
|
||||||
self.refineUpBtnTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn.text"]
|
|
||||||
self.refineRateTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.rate_tx"]
|
self.refineRateTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.rate_tx"]
|
||||||
self.refineDescTx1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx_1"]
|
self.refineDescTx2 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx_1"]
|
||||||
self.refineResolveBtn = uiMap["equip_growth_ui.bg.resolve_btn"]
|
self.refineResolveBtn = uiMap["equip_growth_ui.bg.resolve_btn"]
|
||||||
self.refineResolveBtnTx = uiMap["equip_growth_ui.bg.resolve_btn.text"]
|
self.refineUpBtn:addClickListener(function()
|
||||||
|
ModuleManager.EquipManager:onEquipRefineReq(self.slotId, self.equipPart)
|
||||||
|
end)
|
||||||
|
self.refineResolveBtn:addClickListener(function()
|
||||||
|
ModuleManager.EquipManager:showEquipResolveUI()
|
||||||
|
end)
|
||||||
|
uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]:addClickListener(function()
|
||||||
|
ModuleManager.EquipManager:showEquipResonateUI(self.slotId, GConst.EquipConst.RESONATE_PAGE.REFINE)
|
||||||
|
end)
|
||||||
|
|
||||||
self.refineAttrCells = {}
|
self.refineAttrCells = {}
|
||||||
self.refineAttrNameTxs = {}
|
self.refineAttrNameTxs = {}
|
||||||
@ -125,12 +108,11 @@ function EquipGrowthUI:onLoadRootComplete()
|
|||||||
for i = 1, 6 do
|
for i = 1, 6 do
|
||||||
self.equipCells[i] = uiMap["equip_growth_ui.bg.equip_list.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
|
self.equipCells[i] = uiMap["equip_growth_ui.bg.equip_list.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
|
||||||
self.equipCells[i]:addClickListener(function()
|
self.equipCells[i]:addClickListener(function()
|
||||||
if self.page == i then
|
if self.equipPart == i then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.page = i
|
self.equipPart = i
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
-- ModuleManager.EquipManager:showEquipListUI(self.heroEntity, i)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -143,33 +125,38 @@ function EquipGrowthUI:onLoadRootComplete()
|
|||||||
self.pageBtns[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i]
|
self.pageBtns[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i]
|
||||||
self.pageBtnTxs[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i .. ".text"]
|
self.pageBtnTxs[i] = uiMap["equip_growth_ui.bg.page_btn_" .. i .. ".text"]
|
||||||
self.pageBtns[i] :addClickListener(function()
|
self.pageBtns[i] :addClickListener(function()
|
||||||
if self.equipPart == i then
|
if self.page == i then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
self.equipPart = i
|
self.page = i
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
uiMap["equip_growth_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1))
|
uiMap["equip_growth_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BAG_DESC_1))
|
||||||
|
|
||||||
-- self:bind(DataManager.HeroData, "isDirty", function()
|
self:bind(DataManager.HeroData, "isDirty", function()
|
||||||
-- self:closeUI()
|
self:onRefresh()
|
||||||
-- end)
|
end)
|
||||||
|
self:bind(DataManager.EquipData, "isDirtyRefineSuccess", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.EquipData, "isDirtyRefineFail", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipGrowthUI:onRefresh()
|
function EquipGrowthUI:onRefresh()
|
||||||
-- self:initList()
|
self:refreshEquipCell()
|
||||||
self:refreshPageBtn()
|
self:refreshPageBtn()
|
||||||
self:refreshPageInfo()
|
self:refreshPageInfo()
|
||||||
self:refreshEquipCell()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipGrowthUI:refreshEquipCell()
|
function EquipGrowthUI:refreshEquipCell()
|
||||||
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, self.equipPart)
|
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, self.equipPart)
|
||||||
if eid and eid > 0 then
|
if eid and eid > 0 then
|
||||||
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
self.equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
self.equipCell:refresh(equipEntity, self.equipPart)
|
self.equipCell:refresh(self.equipEntity, self.equipPart)
|
||||||
else
|
else
|
||||||
self.equipCell:refreshEmpty(self.equipPart)
|
self.equipCell:refreshEmpty(self.equipPart)
|
||||||
end
|
end
|
||||||
@ -178,7 +165,7 @@ function EquipGrowthUI:refreshEquipCell()
|
|||||||
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, part)
|
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, part)
|
||||||
if eid and eid > 0 then
|
if eid and eid > 0 then
|
||||||
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
self.equipCells[part]:refresh(equipEntity, part)
|
self.equipCells[part]:refresh(equipEntity, self.slotId)
|
||||||
else
|
else
|
||||||
self.equipCells[part]:refreshEmpty(part)
|
self.equipCells[part]:refreshEmpty(part)
|
||||||
end
|
end
|
||||||
@ -220,10 +207,10 @@ function EquipGrowthUI:refreshPageUp()
|
|||||||
-- self.equipCell:refreshEmpty(self.equipPart)
|
-- self.equipCell:refreshEmpty(self.equipPart)
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
self.upCurrLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv))
|
self.upCurrLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_DESC_12) .. lv)
|
||||||
self.upDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
|
self.upDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
|
||||||
local lv = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, self.equipPart)
|
local lv1 = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, self.equipPart)
|
||||||
self.upDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_ACTIVATION_1, lv))
|
self.upDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_ACTIVATION_1, lv1))
|
||||||
self.upMaxDescTx:setActive(isLvMax)
|
self.upMaxDescTx:setActive(isLvMax)
|
||||||
|
|
||||||
local _, _, resonateAttrNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, self.equipPart)
|
local _, _, resonateAttrNum = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.LV_UP, self.equipPart)
|
||||||
@ -232,7 +219,7 @@ function EquipGrowthUI:refreshPageUp()
|
|||||||
local currAttrNum = GFunc.getFinalAttrValue(currAttr.type, currAttr.num + resonateAttrNum)
|
local currAttrNum = GFunc.getFinalAttrValue(currAttr.type, currAttr.num + resonateAttrNum)
|
||||||
self.upAttrCurrTx:setText(currAttrNum)
|
self.upAttrCurrTx:setText(currAttrNum)
|
||||||
if not isLvMax then
|
if not isLvMax then
|
||||||
self.upNextLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, lv + 1))
|
self.upNextLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_DESC_12) .. (lv + 1))
|
||||||
local nextAttr = equipEntity:getBaseAttrWithLv(lv + 1)
|
local nextAttr = equipEntity:getBaseAttrWithLv(lv + 1)
|
||||||
local nextAttrNum = GFunc.getFinalAttrValue(nextAttr.type, nextAttr.num + resonateAttrNum)
|
local nextAttrNum = GFunc.getFinalAttrValue(nextAttr.type, nextAttr.num + resonateAttrNum)
|
||||||
self.upAttrNextTx:setText(nextAttrNum)
|
self.upAttrNextTx:setText(nextAttrNum)
|
||||||
@ -252,19 +239,64 @@ end
|
|||||||
|
|
||||||
--@region 精炼
|
--@region 精炼
|
||||||
function EquipGrowthUI:refreshPageRefine()
|
function EquipGrowthUI:refreshPageRefine()
|
||||||
|
local refine = DataManager.EquipData:getPartRefine(self.slotId, self.equipPart)
|
||||||
|
local isMaxRefine = DataManager.EquipData:isRefineLvMax(self.slotId, self.equipPart)
|
||||||
|
local attrs = self.equipEntity:getExtraList()
|
||||||
|
local count = #attrs
|
||||||
|
for i, cell in ipairs(self.refineAttrCells) do
|
||||||
|
if count >= i then
|
||||||
|
cell:setActive(true)
|
||||||
|
local extraAttr = attrs[i]
|
||||||
|
local nowAttr = DataManager.EquipData:getRefineAttrAdd(refine, extraAttr.type)
|
||||||
|
self.refineAttrNameTxs[i]:setText(GFunc.getAttrNameByType(extraAttr.type))
|
||||||
|
self.refineAttrCurrTxs[i]:setText(GFunc.getFinalAttrValue(extraAttr.type, extraAttr.num + nowAttr.num))
|
||||||
|
if not isMaxRefine then
|
||||||
|
local nextAttr = DataManager.EquipData:getRefineAttrAdd(refine + 1, extraAttr.type)
|
||||||
|
self.refineAttrNextTxs[i]:setText(GFunc.getFinalAttrValue(nextAttr.type, extraAttr.num + nextAttr.num))
|
||||||
|
-- if isGrowthUp and self.effectNameResult then
|
||||||
|
-- self:playEffect(cell.txAttrBaseEffect)
|
||||||
|
-- end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
cell:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.refineCurrLvTx:setText(refine)
|
||||||
|
self.refineNextLvTx:setText(refine + 1)
|
||||||
|
self.refineDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_12))
|
||||||
|
local lv1 = DataManager.EquipData:getResonateLevel(GConst.EquipConst.RESONATE_PAGE.REFINE, self.equipPart)
|
||||||
|
self.refineDescTx1:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_ACTIVATION_2, lv1))
|
||||||
|
if isMaxRefine then
|
||||||
|
self.refineRateTx:setActive(false)
|
||||||
|
self.refineUpBtn:setActive(false)
|
||||||
|
self.refineCostBg:setActive(false)
|
||||||
|
self.refineDescTx2:setActive(true)
|
||||||
|
self.refineDescTx2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_26))
|
||||||
|
else
|
||||||
|
local lv = DataManager.EquipData:getPartLv(self.slotId, self.equipPart)
|
||||||
|
local needLevel = DataManager.EquipData:getRefineNeedLevel(refine + 1)
|
||||||
|
self.refineDescTx2:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_34, needLevel))
|
||||||
|
local showLimit = lv < needLevel
|
||||||
|
self.refineDescTx2:setActive(showLimit)
|
||||||
|
|
||||||
-- self.refineInfoBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.info_btn"]
|
self.refineRateTx:setActive(not showLimit)
|
||||||
-- self.refineDescTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.bg.desc_tx"]
|
self.refineUpBtn:setActive(not showLimit)
|
||||||
-- self.refineCostBg = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg"]
|
self.refineCostBg:setActive(not showLimit)
|
||||||
-- self.refineCostIcon = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_icon"]
|
local pro = DataManager.EquipData:getPartRefineFailPro(self.slotId, self.equipPart)
|
||||||
-- self.refineCostTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.cost_bg.cost_tx"]
|
self.refineRateTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_25, pro))
|
||||||
-- self.refineUpBtn = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn"]
|
|
||||||
-- self.refineUpBtnTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.up_btn.text"]
|
local itemCost = DataManager.EquipData:getRefineCost(refine + 1)
|
||||||
-- self.refineRateTx = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.rate_tx"]
|
local costId = GFunc.getRewardId(itemCost)
|
||||||
-- self.refineDescTx1 = uiMap["equip_growth_ui.bg.page_info_2.attr_bg.desc_tx_1"]
|
local costNum = GFunc.getRewardNum(itemCost)
|
||||||
-- self.refineResolveBtn = uiMap["equip_growth_ui.bg.resolve_btn"]
|
local count = DataManager.BagData.ItemData:getItemNumById(costId)
|
||||||
-- self.refineResolveBtnTx = uiMap["equip_growth_ui.bg.resolve_btn.text"]
|
self.refineCostIcon:setSprite(ModuleManager.ItemManager:getItemIcon(costId))
|
||||||
|
if costNum > count then
|
||||||
|
self.refineCostTx:setText("<color=#FF0000>" .. count .. "</color>/".. costNum)
|
||||||
|
else
|
||||||
|
self.refineCostTx:setText(count .. "/" .. costNum)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|||||||
345
lua/app/ui/equip/equip_resolve_ui.lua
Executable file
345
lua/app/ui/equip/equip_resolve_ui.lua
Executable file
@ -0,0 +1,345 @@
|
|||||||
|
local EquipResolveUI = class("EquipResolveUI", BaseUI)
|
||||||
|
|
||||||
|
|
||||||
|
function EquipResolveUI:onClose()
|
||||||
|
end
|
||||||
|
function EquipResolveUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
function EquipResolveUI:ctor()
|
||||||
|
self.isOpenPartSelect = false
|
||||||
|
self.isOpenQltSelect = false
|
||||||
|
|
||||||
|
self.selectedPart = 0
|
||||||
|
self.selectedQlt = 0
|
||||||
|
self.selectEquips = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/equip/equip_resolve_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
uiMap["equip_resolve_ui.mask"]:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
uiMap["equip_resolve_ui.bg.close_btn"]:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
self.titleTx = uiMap["equip_resolve_ui.bg.title_tx"]
|
||||||
|
self.bg1 = uiMap["equip_resolve_ui.bg.bg_1"]
|
||||||
|
self.bg2 = uiMap["equip_resolve_ui.bg.bg_2"]
|
||||||
|
self.scrollrect = uiMap["equip_resolve_ui.bg.scrollrect"]
|
||||||
|
self.listPart = uiMap["equip_resolve_ui.bg.list_part"]
|
||||||
|
self.listPartBtns = {}
|
||||||
|
for i = 0, 6 do
|
||||||
|
local partBtn = uiMap["equip_resolve_ui.bg.list_part.scrollrect.viewport.content.part_btn_" .. i]
|
||||||
|
partBtn:addClickListener(function()
|
||||||
|
self:selectPart(i)
|
||||||
|
end)
|
||||||
|
local partTx = uiMap["equip_resolve_ui.bg.list_part.scrollrect.viewport.content.part_btn_" .. i .. ".text"]
|
||||||
|
if i == 0 then
|
||||||
|
partTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_QLT_SELECT_ALL_2))
|
||||||
|
else
|
||||||
|
partTx:setText(I18N:getGlobalText(GConst.EquipConst.EQUIP_PART_NAME[i]))
|
||||||
|
end
|
||||||
|
table.insert(self.listPartBtns, {partBtn = partBtn, partTx = partTx})
|
||||||
|
end
|
||||||
|
self.partBtn = uiMap["equip_resolve_ui.bg.part_btn"]
|
||||||
|
self.partTx = uiMap["equip_resolve_ui.bg.part_btn.text"]
|
||||||
|
self.listQlt = uiMap["equip_resolve_ui.bg.list_qlt"]
|
||||||
|
self.listBtnQlts = {}
|
||||||
|
for i = 0, 5 do
|
||||||
|
local qltBtn = uiMap["equip_resolve_ui.bg.list_qlt.scrollrect.viewport.content.qlt_btn_" .. i]
|
||||||
|
qltBtn:addClickListener(function()
|
||||||
|
self:selectQlt(i)
|
||||||
|
end)
|
||||||
|
local qltBtnTx = uiMap["equip_resolve_ui.bg.list_qlt.scrollrect.viewport.content.qlt_btn_" .. i .. ".text"]
|
||||||
|
self.listBtnQlts[i] = {qltBtn = qltBtn, qltBtnTx = qltBtnTx}
|
||||||
|
end
|
||||||
|
self.qltBtn = uiMap["equip_resolve_ui.bg.qlt_btn"]
|
||||||
|
self.qltBtnTx = uiMap["equip_resolve_ui.bg.qlt_btn.text"]
|
||||||
|
self.cost = uiMap["equip_resolve_ui.bg.cost"]
|
||||||
|
self.costTx = uiMap["equip_resolve_ui.bg.cost.cost_tx"]
|
||||||
|
self.selectAllBtn = uiMap["equip_resolve_ui.bg.select_all_btn"]
|
||||||
|
self.selectAllBtnTx = uiMap["equip_resolve_ui.bg.select_all_btn.text"]
|
||||||
|
self.resolveBtn = uiMap["equip_resolve_ui.bg.resolve_btn"]
|
||||||
|
self.emptyTx = uiMap["equip_resolve_ui.bg.empty_tx"]
|
||||||
|
|
||||||
|
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_24))
|
||||||
|
uiMap["equip_resolve_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_28))
|
||||||
|
uiMap["equip_resolve_ui.bg.resolve_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_30))
|
||||||
|
uiMap["equip_resolve_ui.bg.empty_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_40))
|
||||||
|
|
||||||
|
self.partBtn:addClickListener(function()
|
||||||
|
self:openPartSelect()
|
||||||
|
end)
|
||||||
|
self.qltBtn:addClickListener(function()
|
||||||
|
self:openQltSelect()
|
||||||
|
end)
|
||||||
|
self.selectAllBtn:addClickListener(function()
|
||||||
|
if table.nums(self.selectEquips) < table.nums(self.listEquip) then
|
||||||
|
for i,v in ipairs(self.listEquip) do
|
||||||
|
self.selectEquips[v:getUid()] = v:getUid()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.selectEquips = {}
|
||||||
|
end
|
||||||
|
self:refreshScrollRect()
|
||||||
|
end)
|
||||||
|
self.resolveBtn:addClickListener(function()
|
||||||
|
if table.nums(self.selectEquips) == 0 then
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_31))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local params = {}
|
||||||
|
params.boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL_CLOSE
|
||||||
|
params.content = I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_48)
|
||||||
|
params.okFunc = function()
|
||||||
|
local listUid = {}
|
||||||
|
for i,uid in pairs(self.selectEquips) do
|
||||||
|
table.insert(listUid, uid)
|
||||||
|
end
|
||||||
|
ModuleManager.EquipManager:onEquipDecomposeReq(listUid)
|
||||||
|
end
|
||||||
|
GFunc.showMessageBox(params)
|
||||||
|
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.EquipData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
self:bind(DataManager.EquipData, "isDirtyResolve", function()
|
||||||
|
self.selectEquips = {}
|
||||||
|
self.selectedPart = 0
|
||||||
|
self.selectedQlt = 0
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:onRefresh()
|
||||||
|
self.lowestFiveGrades, self.lowestFiveEquips = DataManager.EquipData:getLowestFiveGradeEquips()
|
||||||
|
for i = 0, 5 do
|
||||||
|
if i == 0 then
|
||||||
|
self.listBtnQlts[i].qltBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_QLT_SELECT_ALL_1))
|
||||||
|
else
|
||||||
|
if self.lowestFiveGrades[i] then
|
||||||
|
self.listBtnQlts[i].qltBtn:setActive(true)
|
||||||
|
self.listBtnQlts[i].qltBtnTx:setText(I18N:getGlobalText("EQUIP_QLT_SELECT", I18N:getGlobalText("EQUIP_QLT_DESC_" .. self.lowestFiveGrades[i].qlt, self.lowestFiveGrades[i].star)))
|
||||||
|
else
|
||||||
|
self.listBtnQlts[i].qltBtn:setActive(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self:refreshScrollRect()
|
||||||
|
self:refreshText()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:refreshSelectEquip()
|
||||||
|
for i,uid in pairs(self.selectEquips) do
|
||||||
|
local shouldRemove = false
|
||||||
|
local equip = DataManager.EquipData:getEquipByUid(uid)
|
||||||
|
if self.selectedPart ~= 0 then
|
||||||
|
if equip:getPart() ~= self.selectedPart then
|
||||||
|
shouldRemove = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not shouldRemove and self.selectedQlt ~= 0 then
|
||||||
|
if equip:getQlt() > self.lowestFiveGrades[self.selectedQlt].qlt then
|
||||||
|
-- 品质高于要求
|
||||||
|
shouldRemove = true
|
||||||
|
elseif equip:getQlt() == self.lowestFiveGrades[self.selectedQlt].qlt then
|
||||||
|
-- 同品质时检查星级
|
||||||
|
if equip:getStar() > self.lowestFiveGrades[self.selectedQlt].star then
|
||||||
|
shouldRemove = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if shouldRemove then
|
||||||
|
self.selectEquips[uid] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:openPartSelect()
|
||||||
|
if self.isOpenPartSelect then
|
||||||
|
self.isOpenPartSelect = false
|
||||||
|
else
|
||||||
|
self.isOpenPartSelect = true
|
||||||
|
self.listPart:setActive(true)
|
||||||
|
if self.isOpenQltSelect then
|
||||||
|
self:openQltSelect()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.partSeq then
|
||||||
|
self.partSeq:Kill()
|
||||||
|
self.partSeq = nil
|
||||||
|
end
|
||||||
|
self.partSeq = DOTweenManager:createSeqWithIntId()
|
||||||
|
local startSize = self.listPart:getSizeDeltaY()
|
||||||
|
local endSize = self.isOpenPartSelect and 485 or 0
|
||||||
|
local tween = CS.DG.Tweening.DOTween.To(
|
||||||
|
function()
|
||||||
|
return startSize
|
||||||
|
end,
|
||||||
|
function(y)
|
||||||
|
self.listPart:setSizeDeltaY(y)
|
||||||
|
end,
|
||||||
|
endSize, 0.3)
|
||||||
|
tween:SetEase(CS.DG.Tweening.Ease.InOutCirc)
|
||||||
|
self.partSeq:Append(tween)
|
||||||
|
self.partSeq:AppendCallback(function()
|
||||||
|
if self.partSeq then
|
||||||
|
self.partSeq:Kill()
|
||||||
|
self.partSeq = nil
|
||||||
|
end
|
||||||
|
if not self.isOpenPartSelect then
|
||||||
|
self.listPart:setActive(false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:openQltSelect()
|
||||||
|
if self.isOpenQltSelect then
|
||||||
|
self.isOpenQltSelect = false
|
||||||
|
else
|
||||||
|
self.isOpenQltSelect = true
|
||||||
|
self.listQlt:setActive(true)
|
||||||
|
if self.isOpenPartSelect then
|
||||||
|
self:openPartSelect()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if self.qltSeq then
|
||||||
|
self.qltSeq:Kill()
|
||||||
|
self.qltSeq = nil
|
||||||
|
end
|
||||||
|
self.qltSeq = DOTweenManager:createSeqWithIntId()
|
||||||
|
local startSize = self.listQlt:getSizeDeltaY()
|
||||||
|
local endSize = self.isOpenQltSelect and 355 or 0
|
||||||
|
local tween = CS.DG.Tweening.DOTween.To(
|
||||||
|
function()
|
||||||
|
return startSize
|
||||||
|
end,
|
||||||
|
function(y)
|
||||||
|
self.listQlt:setSizeDeltaY(y)
|
||||||
|
end,
|
||||||
|
endSize, 0.3)
|
||||||
|
tween:SetEase(CS.DG.Tweening.Ease.InOutCirc)
|
||||||
|
self.qltSeq:Append(tween)
|
||||||
|
self.qltSeq:AppendCallback(function()
|
||||||
|
if self.qltSeq then
|
||||||
|
self.qltSeq:Kill()
|
||||||
|
self.qltSeq = nil
|
||||||
|
end
|
||||||
|
if not self.isOpenQltSelect then
|
||||||
|
self.listQlt:setActive(false)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:selectPart(part)
|
||||||
|
if self.isOpenPartSelect then
|
||||||
|
self:openPartSelect()
|
||||||
|
end
|
||||||
|
self.selectedPart = part
|
||||||
|
self:refreshScrollRect()
|
||||||
|
self:refreshText()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:selectQlt(qlt)
|
||||||
|
if self.isOpenQltSelect then
|
||||||
|
self:openQltSelect()
|
||||||
|
end
|
||||||
|
self.selectedQlt = qlt
|
||||||
|
self:refreshScrollRect()
|
||||||
|
self:refreshText()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:refreshText()
|
||||||
|
if self.selectedPart == 0 then
|
||||||
|
self.partTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_QLT_SELECT_ALL_2))
|
||||||
|
else
|
||||||
|
self.partTx:setText(I18N:getGlobalText(GConst.EquipConst.EQUIP_PART_NAME[self.selectedPart]))
|
||||||
|
end
|
||||||
|
if self.selectedQlt == 0 then
|
||||||
|
self.qltBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_QLT_SELECT_ALL_1))
|
||||||
|
else
|
||||||
|
self.qltBtnTx:setText(I18N:getGlobalText("EQUIP_QLT_SELECT", I18N:getGlobalText("EQUIP_QLT_DESC_" .. self.lowestFiveGrades[self.selectedQlt].qlt, self.lowestFiveGrades[self.selectedQlt].star)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 新增方法:根据选中的品质+星级,获取该等级及更低的所有装备
|
||||||
|
function EquipResolveUI:getEquipsByGradeAndBelow(selectedPart, selectedQlt, selectedStar)
|
||||||
|
-- 2. 筛选符合条件的装备
|
||||||
|
local resultEquips = {}
|
||||||
|
for _, group in ipairs(self.lowestFiveEquips) do
|
||||||
|
-- 判断是否低于或等于选中等级
|
||||||
|
if group:getQlt() < selectedQlt or (group:getQlt() == selectedQlt and group:getStar() <= selectedStar) then
|
||||||
|
if selectedPart == 0 or (selectedPart > 0 and group:getPart() == selectedPart) then
|
||||||
|
table.insert(resultEquips, group)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return resultEquips
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:refreshScrollRect()
|
||||||
|
if self.selectedQlt == 0 then
|
||||||
|
self.listEquip = DataManager.EquipData:getAllEquipsSortInverted(self.selectedPart, nil, nil, false)
|
||||||
|
else
|
||||||
|
self.listEquip = self:getEquipsByGradeAndBelow(self.selectedPart, self.lowestFiveGrades[self.selectedQlt].qlt, self.lowestFiveGrades[self.selectedQlt].star)
|
||||||
|
end
|
||||||
|
self.emptyTx:setActive(#self.listEquip <= 0)
|
||||||
|
if self.scrollRect == nil then
|
||||||
|
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||||
|
self.scrollRect:addInitCallback(function()
|
||||||
|
return GConst.TYPEOF_LUA_CLASS.EQUIP_CELL
|
||||||
|
end)
|
||||||
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
|
local isSelect = self.selectEquips[self.listEquip[index]:getUid()] ~= nil
|
||||||
|
cell:refresh(self.listEquip[index])
|
||||||
|
cell:showMask(isSelect)
|
||||||
|
cell:showCheck(isSelect)
|
||||||
|
cell:addClickListener(function()
|
||||||
|
if self.selectEquips[self.listEquip[index]:getUid()] then
|
||||||
|
self.selectEquips[self.listEquip[index]:getUid()] = nil
|
||||||
|
cell:showCheck(false)
|
||||||
|
cell:showMask(false)
|
||||||
|
else
|
||||||
|
self.selectEquips[self.listEquip[index]:getUid()] = self.listEquip[index]:getUid()
|
||||||
|
cell:showCheck(true)
|
||||||
|
cell:showMask(true)
|
||||||
|
end
|
||||||
|
self:refreshReward()
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
|
||||||
|
self.scrollRect:refillCells(#self.listEquip)
|
||||||
|
elseif self.scrollRect:getTotalCount() ~= #self.listEquip then
|
||||||
|
self.scrollRect:clearCells()
|
||||||
|
self.scrollRect:refillCells(#self.listEquip)
|
||||||
|
else
|
||||||
|
self.scrollRect:updateAllCell()
|
||||||
|
end
|
||||||
|
self:refreshReward()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResolveUI:refreshReward()
|
||||||
|
self:refreshSelectEquip()
|
||||||
|
if table.nums(self.selectEquips) < table.nums(self.listEquip) then
|
||||||
|
self.selectAllBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_29))
|
||||||
|
else
|
||||||
|
self.selectAllBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_21))
|
||||||
|
end
|
||||||
|
local count = 0
|
||||||
|
for i,uid in pairs(self.selectEquips) do
|
||||||
|
local equip = DataManager.EquipData:getEquipByUid(uid)
|
||||||
|
local decompose = DataManager.EquipData:getResolveReward(equip:getId())
|
||||||
|
count = count + decompose.num
|
||||||
|
end
|
||||||
|
self.costTx:setText(count)
|
||||||
|
end
|
||||||
|
|
||||||
|
return EquipResolveUI
|
||||||
10
lua/app/ui/equip/equip_resolve_ui.lua.meta
Normal file
10
lua/app/ui/equip/equip_resolve_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 88b03c4a3b93b44aaaef9fd1af2f53ad
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
164
lua/app/ui/equip/equip_resonate_ui.lua
Executable file
164
lua/app/ui/equip/equip_resonate_ui.lua
Executable file
@ -0,0 +1,164 @@
|
|||||||
|
local EquipResonateUI = class("EquipResonateUI", BaseUI)
|
||||||
|
|
||||||
|
function EquipResonateUI:onClose()
|
||||||
|
end
|
||||||
|
function EquipResonateUI:isFullScreen()
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
function EquipResonateUI:ctor(params)
|
||||||
|
params = params or {}
|
||||||
|
self.page = params.page or GConst.EquipConst.RESONATE_PAGE.LV_UP
|
||||||
|
self.slotId = params and params.slotId
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:getPrefabPath()
|
||||||
|
return "assets/prefabs/ui/equip/equip_resonate_ui.prefab"
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:onLoadRootComplete()
|
||||||
|
local uiMap = self.root:genAllChildren()
|
||||||
|
|
||||||
|
uiMap["equip_resonate_ui.mask"]:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
uiMap["equip_resonate_ui.bg.close_btn"]:addClickListener(function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
|
|
||||||
|
if not self.equipCells then
|
||||||
|
self.equipCells = {}
|
||||||
|
for i = 1, 6 do
|
||||||
|
local cell = uiMap["equip_resonate_ui.bg.equip_list.equip_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.EQUIP_CELL)
|
||||||
|
cell:addClickListener(function()
|
||||||
|
local uid = DataManager.EquipData:getPartEquipUid(self.slotId, self.part)
|
||||||
|
if uid ~= 0 then
|
||||||
|
self.part = i
|
||||||
|
self:onRefresh()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
table.insert(self.equipCells, cell)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.lvTx = uiMap["equip_resonate_ui.bg.page_info.lv_tx"]
|
||||||
|
self.tipsTx = uiMap["equip_resonate_ui.bg.page_info.tips_tx"]
|
||||||
|
self.attrNameTxe = uiMap["equip_resonate_ui.bg.page_info.attr_bg.attr_name_tx"]
|
||||||
|
self.attrCurrValueTx = uiMap["equip_resonate_ui.bg.page_info.attr_bg.layout.attr_curr_value_tx"]
|
||||||
|
self.arrowImg = uiMap["equip_resonate_ui.bg.page_info.attr_bg.layout.arrow_img"]
|
||||||
|
self.attrNextValueTx = uiMap["equip_resonate_ui.bg.page_info.attr_bg.layout.attr_next_value_tx"]
|
||||||
|
self.layout = uiMap["equip_resonate_ui.bg.page_info.attr_bg.layout"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
||||||
|
|
||||||
|
uiMap["equip_resonate_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_4))
|
||||||
|
uiMap["equip_resonate_ui.bg.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_6))
|
||||||
|
|
||||||
|
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_1), I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_2), I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_3)}
|
||||||
|
self.pageBtns = {}
|
||||||
|
self.pageBtnTxs = {}
|
||||||
|
for i = 1, 3 do
|
||||||
|
self.pageBtns[i] = uiMap["equip_resonate_ui.bg.page_btn_" .. i]
|
||||||
|
self.pageBtnTxs[i] = uiMap["equip_resonate_ui.bg.page_btn_" .. i .. ".text"]
|
||||||
|
self.pageBtns[i]:addClickListener(function()
|
||||||
|
if self.page == i then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.page = i
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
self:bind(DataManager.EquipData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:onRefresh()
|
||||||
|
self:refreshEquipCell()
|
||||||
|
self:refreshPageBtn()
|
||||||
|
self:refreshPage()
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshEquipCell()
|
||||||
|
for part = 1, 6 do
|
||||||
|
local eid = DataManager.EquipData:getPartEquipUid(self.slotId, part)
|
||||||
|
if eid and eid > 0 then
|
||||||
|
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
|
self.equipCells[part]:refresh(equipEntity, self.slotId)
|
||||||
|
else
|
||||||
|
self.equipCells[part]:refreshEmpty(part)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshPageBtn()
|
||||||
|
for i = 1, 3 do
|
||||||
|
if self.page == i then
|
||||||
|
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_1")
|
||||||
|
self.pageBtnTxs[i]:setText(self.btnTxs[i])
|
||||||
|
else
|
||||||
|
self.pageBtns[i]:setSprite(GConst.ATLAS_PATH.COMMON, "common_tab_2")
|
||||||
|
self.pageBtnTxs[i]:setText("<color=#72778C>" .. self.btnTxs[i] .. "</color>")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshPage()
|
||||||
|
if self.page == GConst.EquipConst.RESONATE_PAGE.LV_UP then
|
||||||
|
self:refreshPageLv()
|
||||||
|
elseif self.page == GConst.EquipConst.RESONATE_PAGE.QLT then
|
||||||
|
self:refreshPageQlt()
|
||||||
|
elseif self.page == GConst.EquipConst.RESONATE_PAGE.REFINE then
|
||||||
|
self:refreshPageRefine()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshPageLv()
|
||||||
|
local lv, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(self.page, self.slotId)
|
||||||
|
self:refreshUI(lv, nextLv, attrNum, attrNextNum, DataManager.EquipData:getResonateMaxLevel(1))
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshPageQlt()
|
||||||
|
local lv, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(self.page, self.slotId, self.part)
|
||||||
|
self:refreshUI(lv, nextLv, attrNum, attrNextNum, DataManager.EquipData:getResonateMaxLevel(2))
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshPageRefine()
|
||||||
|
local lv, nextLv, attrNum, attrNextNum = DataManager.EquipData:getResonateLevel(self.page, self.slotId)
|
||||||
|
self:refreshUI(lv, nextLv, attrNum, attrNextNum, DataManager.EquipData:getResonateMaxLevel(3))
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipResonateUI:refreshUI(lv, nextLv, attrNum, attrNextNum, maxLevel)
|
||||||
|
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.LV_POINT) .. lv)
|
||||||
|
self.attrNameTxe:setText(GFunc.getAttrNameByType("attr_atk"))
|
||||||
|
self.attrCurrValueTx:setText(attrNum)
|
||||||
|
local meshProCompNow = self.attrCurrValueTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||||
|
local nowTipsNowX = meshProCompNow.preferredWidth
|
||||||
|
self.attrCurrValueTx:setSizeDeltaX(nowTipsNowX)
|
||||||
|
|
||||||
|
if maxLevel ~= nil and lv >= maxLevel then
|
||||||
|
self.arrowImg:setActive(false)
|
||||||
|
self.attrNextValueTx:setActive(false)
|
||||||
|
self.tipsTx:setText(I18N:getGlobalText(I18N.GlobalConst.PET_DESC_15))
|
||||||
|
else
|
||||||
|
if nextLv == nil then
|
||||||
|
self.tipsTx:setText(I18N:getGlobalText(I18N.GlobalConst.PET_DESC_15))
|
||||||
|
else
|
||||||
|
if self.page == GConst.EquipConst.RESONATE_PAGE.QLT then
|
||||||
|
self.tipsTx:setText(I18N:getGlobalText("EQUIP_HERO_M_" .. self.page, I18N:getGlobalText("EQUIP_QLT_DESC_" .. nextLv[1], nextLv[2])))
|
||||||
|
else
|
||||||
|
self.tipsTx:setText(I18N:getGlobalText("EQUIP_HERO_M_" .. self.page, nextLv[1]))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
self.attrNextValueTx:setText(attrNextNum)
|
||||||
|
self.arrowImg:setActive(true)
|
||||||
|
self.attrNextValueTx:setActive(true)
|
||||||
|
|
||||||
|
local meshProCompNext = self.attrNextValueTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO)
|
||||||
|
local nowTipsNextX = meshProCompNext.preferredWidth
|
||||||
|
self.attrNextValueTx:setSizeDeltaX(nowTipsNextX)
|
||||||
|
end
|
||||||
|
self.layout:RefreshLayout()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
return EquipResonateUI
|
||||||
10
lua/app/ui/equip/equip_resonate_ui.lua.meta
Normal file
10
lua/app/ui/equip/equip_resonate_ui.lua.meta
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2ed28da349724427e8aaedd4a32fc8ce
|
||||||
|
ScriptedImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||||
@ -33,8 +33,6 @@ function EquipInfoComp:init()
|
|||||||
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), i)
|
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), i)
|
||||||
if eid and eid > 0 then
|
if eid and eid > 0 then
|
||||||
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
-- self.equipCells[part]:refresh(equipEntity, part)
|
|
||||||
-- EquipManager:showEquipGrowthUI(slotId)
|
|
||||||
local parmas = {}
|
local parmas = {}
|
||||||
parmas.heroEntity = self.heroEntity
|
parmas.heroEntity = self.heroEntity
|
||||||
parmas.slotId = self.heroEntity:getMatchType()
|
parmas.slotId = self.heroEntity:getMatchType()
|
||||||
@ -63,12 +61,14 @@ function EquipInfoComp:init()
|
|||||||
ModuleManager.EquipManager:onEquipWearReq(soltId, listUids)
|
ModuleManager.EquipManager:onEquipWearReq(soltId, listUids)
|
||||||
end)
|
end)
|
||||||
self.upBtn:addClickListener(function()
|
self.upBtn:addClickListener(function()
|
||||||
-- UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
|
ModuleManager.EquipManager:showEquipGrowthUI(self.heroEntity:getMatchType(), 1)
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_HERO_DESC_3))
|
|
||||||
end)
|
end)
|
||||||
self.attrBtn:addClickListener(function()
|
self.attrBtn:addClickListener(function()
|
||||||
UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
|
UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
|
||||||
end)
|
end)
|
||||||
|
self.infoBtn:addClickListener(function()
|
||||||
|
ModuleManager.EquipManager:showEquipResonateUI(self.heroEntity:getMatchType(), 1)
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipInfoComp:setParentUI(ui)
|
function EquipInfoComp:setParentUI(ui)
|
||||||
@ -77,7 +77,6 @@ end
|
|||||||
|
|
||||||
function EquipInfoComp:setHeroData(heroEntity)
|
function EquipInfoComp:setHeroData(heroEntity)
|
||||||
self.heroEntity = heroEntity
|
self.heroEntity = heroEntity
|
||||||
self.selectPart = self.selectPart or GConst.EquipConst.PART_TYPE.EQUIP_1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipInfoComp:refresh()
|
function EquipInfoComp:refresh()
|
||||||
@ -117,8 +116,9 @@ function EquipInfoComp:refreshAttr()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EquipInfoComp:refreshEquip()
|
function EquipInfoComp:refreshEquip()
|
||||||
|
local slotId = self.heroEntity:getMatchType()
|
||||||
self.curFormation = DataManager.FormationData:getStageFormation()
|
self.curFormation = DataManager.FormationData:getStageFormation()
|
||||||
if self.curFormation[self.heroEntity:getMatchType()] ~= self.heroEntity:getCfgId() then
|
if self.curFormation[slotId] ~= self.heroEntity:getCfgId() then
|
||||||
self.emptyTx:setActive(true)
|
self.emptyTx:setActive(true)
|
||||||
self.equipNode:setActive(false)
|
self.equipNode:setActive(false)
|
||||||
return
|
return
|
||||||
@ -126,10 +126,10 @@ function EquipInfoComp:refreshEquip()
|
|||||||
self.emptyTx:setActive(false)
|
self.emptyTx:setActive(false)
|
||||||
self.equipNode:setActive(true)
|
self.equipNode:setActive(true)
|
||||||
for part = 1, 6 do
|
for part = 1, 6 do
|
||||||
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), part)
|
local eid = DataManager.EquipData:getPartEquipUid(slotId, part)
|
||||||
if eid and eid > 0 then
|
if eid and eid > 0 then
|
||||||
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
self.equipCells[part]:refresh(equipEntity, part)
|
self.equipCells[part]:refresh(equipEntity, slotId)
|
||||||
else
|
else
|
||||||
self.equipCells[part]:refreshEmpty(part)
|
self.equipCells[part]:refreshEmpty(part)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -35,6 +35,9 @@ function HeroDetailUI:onLoadRootComplete()
|
|||||||
self.root:addClickListener(function()
|
self.root:addClickListener(function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
|
-- uiMap["hero_detail_ui.mask"]:addClickListener(function()
|
||||||
|
-- self:closeUI()
|
||||||
|
-- end)
|
||||||
uiMap["hero_detail_ui.common.close_btn"]:addClickListener(function()
|
uiMap["hero_detail_ui.common.close_btn"]:addClickListener(function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
@ -56,8 +59,6 @@ function HeroDetailUI:onLoadRootComplete()
|
|||||||
self.qltBg = uiMap["hero_detail_ui.common.qlt_bg"]
|
self.qltBg = uiMap["hero_detail_ui.common.qlt_bg"]
|
||||||
self.qltBgTx = uiMap["hero_detail_ui.common.qlt_bg.qlt_tx"]
|
self.qltBgTx = uiMap["hero_detail_ui.common.qlt_bg.qlt_tx"]
|
||||||
self.starComp = uiMap["hero_detail_ui.common.hero_node.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
|
self.starComp = uiMap["hero_detail_ui.common.hero_node.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
|
||||||
self.btnsLayout = uiMap["hero_detail_ui.common.btns"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
|
||||||
self.redNodeLayout = uiMap["hero_detail_ui.red_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
|
|
||||||
|
|
||||||
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16), I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1)}
|
self.btnTxs = {I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_4), I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_16), I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_1)}
|
||||||
self.pageBtns = {}
|
self.pageBtns = {}
|
||||||
|
|||||||
@ -6,8 +6,26 @@ local EquipLevelCfg = ConfigManager:getConfig("equip_level")
|
|||||||
local EquipRefineCfg = ConfigManager:getConfig("equip_refine")
|
local EquipRefineCfg = ConfigManager:getConfig("equip_refine")
|
||||||
local EquipResonateCfg = ConfigManager:getConfig("equip_resonate")
|
local EquipResonateCfg = ConfigManager:getConfig("equip_resonate")
|
||||||
|
|
||||||
|
function EquipData:setDirty()
|
||||||
|
self.data.isDirty = not self.data.isDirty
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipData:setDirtyRefineSuccess()
|
||||||
|
self.data.isDirtyRefineSuccess = not self.data.isDirtyRefineSuccess
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipData:setDirtyRefineFail()
|
||||||
|
self.data.isDirtyRefineFail = not self.data.isDirtyRefineFail
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipData:setDirtyResolve()
|
||||||
|
self.data.isDirtyResolve = not self.data.isDirtyResolve
|
||||||
|
end
|
||||||
|
|
||||||
function EquipData:ctor()
|
function EquipData:ctor()
|
||||||
self.data.isDirty = false
|
self.data.isDirty = false
|
||||||
|
self.data.isDirtyRefineSuccess = false
|
||||||
|
self.data.isDirtyRefineFail = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipData:clear()
|
function EquipData:clear()
|
||||||
@ -36,10 +54,6 @@ function EquipData:init(data)
|
|||||||
self.slots = data.slots or {}
|
self.slots = data.slots or {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipData:setDirty()
|
|
||||||
self.data.isDirty = not self.data.isDirty
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 武器功能是否开启
|
-- 武器功能是否开启
|
||||||
function EquipData:isWeaponOpen(showToast)
|
function EquipData:isWeaponOpen(showToast)
|
||||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.EQUIP_WEAPON, not showToast) then
|
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.EQUIP_WEAPON, not showToast) then
|
||||||
@ -121,15 +135,12 @@ function EquipData:getExtraAttr(id, index)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--精炼额外数值总和
|
--精炼额外数值总和
|
||||||
function EquipData:getRefineAttrAdd(refine, attrId)
|
function EquipData:getRefineAttrAdd(refine, attrName)
|
||||||
local attrName = GFunc.getAttrNameById(attrId)
|
|
||||||
local attrAll = {type = attrName, num = 0}
|
local attrAll = {type = attrName, num = 0}
|
||||||
for i = 1, refine do
|
for i = 1, refine do
|
||||||
if i <= refine then
|
if i <= refine then
|
||||||
local attr = self:getRefineAttr(i, attrName)
|
local value = self:getRefineAttr(i, attrName)
|
||||||
if attr then
|
attrAll.num = attrAll.num + (value or 0)
|
||||||
attrAll.num = attrAll.num + attr.num
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return attrAll
|
return attrAll
|
||||||
@ -138,13 +149,13 @@ end
|
|||||||
--对应精炼等级的额外数值
|
--对应精炼等级的额外数值
|
||||||
function EquipData:getRefineAttr(refine, attrName)
|
function EquipData:getRefineAttr(refine, attrName)
|
||||||
local cfg = self:getRefineConfig(refine)
|
local cfg = self:getRefineConfig(refine)
|
||||||
if attrName == "attr_atk_private" then
|
if attrName == "attr_atk" then
|
||||||
return cfg.extra_attr_add_1
|
return cfg.extra_attr_add_1
|
||||||
elseif attrName == "def_dec_private" then
|
elseif attrName == "attr_hp" then
|
||||||
return cfg.extra_attr_add_2
|
return cfg.extra_attr_add_2
|
||||||
elseif attrName == "crit_private" then
|
elseif attrName == "attr_normal_hurt" then
|
||||||
return cfg.extra_attr_add_3
|
return cfg.extra_attr_add_3
|
||||||
elseif attrName == "crit_time_private" then
|
elseif attrName == "attr_skill_hurt" then
|
||||||
return cfg.extra_attr_add_4
|
return cfg.extra_attr_add_4
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -230,7 +241,15 @@ function EquipData:getEquipByUid(uid)
|
|||||||
return self.allEquips[uid]
|
return self.allEquips[uid]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--@endregion
|
|
||||||
|
function EquipData:getEquipByCfgId(equipId)
|
||||||
|
if equipId == nil then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local entity = EquipEntity:create({cfg_id = equipId, extra_attrs = {}})
|
||||||
|
return entity
|
||||||
|
end
|
||||||
|
--endregion
|
||||||
|
|
||||||
--@region 穿戴
|
--@region 穿戴
|
||||||
--装备穿戴
|
--装备穿戴
|
||||||
@ -281,9 +300,32 @@ function EquipData:getEquipMaxScore(soltId, part)
|
|||||||
end
|
end
|
||||||
return equip
|
return equip
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--获取对应位置的装备Id
|
||||||
|
function EquipData:getPartEquipUid(slotId, part)
|
||||||
|
local parts = self.slots[slotId].parts
|
||||||
|
if parts then
|
||||||
|
if part == nil then
|
||||||
|
return parts
|
||||||
|
else
|
||||||
|
local partInfo = parts[part]
|
||||||
|
if partInfo then
|
||||||
|
return partInfo.equip_uid
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return 0
|
||||||
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
--@region 装备强化
|
--@region 装备强化
|
||||||
|
function EquipData:getLevelCost(refine)
|
||||||
|
local cfg = self:getLevelConfig(refine)
|
||||||
|
if cfg then
|
||||||
|
return cfg.cost
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-----获取强化等级
|
-----获取强化等级
|
||||||
function EquipData:getPartLv(slotId, part)
|
function EquipData:getPartLv(slotId, part)
|
||||||
local parts = self.slots[slotId].parts
|
local parts = self.slots[slotId].parts
|
||||||
@ -314,23 +356,32 @@ function EquipData:getBaseAttrLvAdd(attrType, lv)
|
|||||||
return baseAttrAdd
|
return baseAttrAdd
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:onUpgradeSuccess(soltId, upgraded)
|
||||||
|
upgraded = upgraded or {}
|
||||||
|
for part, lv in pairs(upgraded) do
|
||||||
|
if self.slots[soltId].parts[part] then
|
||||||
|
self.slots[soltId].parts[part].level = lv
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:setDirty()
|
||||||
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
--@region 六个部位装备的强化与精炼
|
|
||||||
--获取对应位置的装备Id
|
--@region 精炼
|
||||||
function EquipData:getPartEquipUid(slotId, part)
|
function EquipData:getRefineCost(refine)
|
||||||
local parts = self.slots[slotId].parts
|
local cfg = self:getRefineConfig(refine)
|
||||||
if parts then
|
if cfg then
|
||||||
if part == nil then
|
return cfg.cost
|
||||||
return parts
|
|
||||||
else
|
|
||||||
local partInfo = parts[part]
|
|
||||||
if partInfo then
|
|
||||||
return partInfo.equip_uid
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:getRefineNeedLevel(refine)
|
||||||
|
local cfg = self:getRefineConfig(refine)
|
||||||
|
if cfg then
|
||||||
|
return cfg.equip_level
|
||||||
end
|
end
|
||||||
return 0
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--获取精炼等级
|
--获取精炼等级
|
||||||
function EquipData:getPartRefine(slotId, part)
|
function EquipData:getPartRefine(slotId, part)
|
||||||
local parts = self.slots[slotId].parts
|
local parts = self.slots[slotId].parts
|
||||||
@ -343,6 +394,11 @@ function EquipData:getPartRefine(slotId, part)
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:isRefineLvMax(slotId, part)
|
||||||
|
local lv = self:getPartRefine(slotId, part)
|
||||||
|
return lv >= #self:getRefineConfig()
|
||||||
|
end
|
||||||
|
|
||||||
-- 精炼成功概率
|
-- 精炼成功概率
|
||||||
function EquipData:getPartRefineFailPro(slotId, part)
|
function EquipData:getPartRefineFailPro(slotId, part)
|
||||||
local parts = self.slots[slotId].parts
|
local parts = self.slots[slotId].parts
|
||||||
@ -351,13 +407,45 @@ function EquipData:getPartRefineFailPro(slotId, part)
|
|||||||
if partInfo then
|
if partInfo then
|
||||||
local cfgRefine = self:getRefineConfig(partInfo.refine + 1)
|
local cfgRefine = self:getRefineConfig(partInfo.refine + 1)
|
||||||
if cfgRefine then
|
if cfgRefine then
|
||||||
return (cfgRefine.base_chance + partInfo.refine_fail * cfgRefine.chance_fail) / GConst.DEFAULT_FACTOR
|
return (cfgRefine.base_chance + partInfo.refine_fail * cfgRefine.chance_fail) / 100
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:onRefineSuccess(soltId, part, info)
|
||||||
|
local offset = 0
|
||||||
|
local refine = self:getPartRefine(soltId, part)
|
||||||
|
if refine < info.refine then
|
||||||
|
local refine = self.slots[soltId].parts[part].refine
|
||||||
|
self.slots[soltId].parts[part].refine = refine + 1
|
||||||
|
self.slots[soltId].parts[part].refine_fail = 0
|
||||||
|
offset = offset + 1
|
||||||
|
-- self:addPlayEffectParts(part)
|
||||||
|
self:setDirtyRefineSuccess()
|
||||||
|
else
|
||||||
|
local fail = self.slots[soltId].parts[part].refine_fail
|
||||||
|
self.slots[soltId].parts[part].refine_fail = fail + 1
|
||||||
|
self:setDirtyRefineFail()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- function EquipData:addPlayEffectParts(part)
|
||||||
|
-- if self.lvUpSuccess == nil then
|
||||||
|
-- self.lvUpSuccess = {}
|
||||||
|
-- end
|
||||||
|
-- table.insert(self.lvUpSuccess, part)
|
||||||
|
-- end
|
||||||
|
-- function EquipData:getPlayEffectParts()
|
||||||
|
-- return table.refCopy(self.lvUpSuccess or {})
|
||||||
|
-- end
|
||||||
|
-- function EquipData:clearPlayEffectParts()
|
||||||
|
-- self.lvUpSuccess = {}
|
||||||
|
-- end
|
||||||
|
--@endregion
|
||||||
|
|
||||||
|
--@region 套装 共鸣
|
||||||
function EquipData:getResonateList(type)
|
function EquipData:getResonateList(type)
|
||||||
if self.listResonate == nil then
|
if self.listResonate == nil then
|
||||||
self.listResonate = {}
|
self.listResonate = {}
|
||||||
@ -463,6 +551,11 @@ function EquipData:getSlotAllAttr(slotId)
|
|||||||
return attr
|
return attr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:getResonateMaxLevel(type)
|
||||||
|
local list = self:getResonateList(type)
|
||||||
|
return list and #list or 0
|
||||||
|
end
|
||||||
|
|
||||||
function EquipData:getResonateLevelValue(type, value, value2)
|
function EquipData:getResonateLevelValue(type, value, value2)
|
||||||
local list = self:getResonateList(type)
|
local list = self:getResonateList(type)
|
||||||
local lv = 0
|
local lv = 0
|
||||||
@ -545,25 +638,6 @@ function EquipData:getResonateLevel(type, slotId)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipData:getLevelCost(refine)
|
|
||||||
local cfg = self:getLevelConfig(refine)
|
|
||||||
if cfg then
|
|
||||||
return cfg.cost
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function EquipData:getRefineCost(refine)
|
|
||||||
local cfg = self:getRefineConfig(refine)
|
|
||||||
if cfg then
|
|
||||||
return cfg.cost
|
|
||||||
end
|
|
||||||
end
|
|
||||||
function EquipData:getRefineNeedLevel(refine)
|
|
||||||
local cfg = self:getRefineConfig(refine)
|
|
||||||
if cfg then
|
|
||||||
return cfg.equip_level
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function EquipData:getEquipUseHero(uid)
|
function EquipData:getEquipUseHero(uid)
|
||||||
local equip = self:getEquipByUid(uid)
|
local equip = self:getEquipByUid(uid)
|
||||||
local formation = DataManager.FormationData:getStageFormation()
|
local formation = DataManager.FormationData:getStageFormation()
|
||||||
@ -582,18 +656,92 @@ function EquipData:getResolveReward(id)
|
|||||||
return self:getConfig(id).decompose
|
return self:getConfig(id).decompose
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 装备分解成功
|
function EquipData:getAllEquipsSortInverted(part, qlt, star, use)
|
||||||
function EquipData:onResolveSuccess(uids)
|
local list = self:getAllEquips(part, qlt, star, use)
|
||||||
if EDITOR_MODE then
|
return self:reverseTableInPlace(self:sortEquipsList(list))
|
||||||
Logger.logHighlight("装备分解")
|
|
||||||
Logger.printTable(uids)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for i, id in pairs(uids) do
|
function EquipData:reverseTableInPlace(t)
|
||||||
self.allEquips[id] = nil
|
local i, j = 1, #t
|
||||||
|
while i < j do
|
||||||
|
t[i], t[j] = t[j], t[i] -- 交换元素
|
||||||
|
i = i + 1
|
||||||
|
j = j - 1
|
||||||
end
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
function EquipData:onResolveSuccess(uids)
|
||||||
|
for i, uid in ipairs(uids) do
|
||||||
|
if self.allEquips[uid] then
|
||||||
|
self.allEquips[uid] = nil
|
||||||
|
-- self.allEquipsCount = self.allEquipsCount - 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
self:setDirtyResolve()
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function EquipData:getLowestFiveGradeEquips()
|
||||||
|
-- 1. 使用三重结构避免重复
|
||||||
|
local gradeMap = {} -- { [qlt] = { [star] = {equips} } }
|
||||||
|
local gradeSet = {} -- 用于去重 { ["qlt-star"] = true }
|
||||||
|
local gradeList = {} -- 最终排序列表
|
||||||
|
|
||||||
|
for _, equip in pairs(self.allEquips) do
|
||||||
|
local qlt = equip:getQlt()
|
||||||
|
local star = equip:getStar()
|
||||||
|
local key = qlt.."-"..star -- 去重key
|
||||||
|
|
||||||
|
-- 初始化数据结构
|
||||||
|
if not gradeMap[qlt] then
|
||||||
|
gradeMap[qlt] = {}
|
||||||
|
end
|
||||||
|
if not gradeMap[qlt][star] then
|
||||||
|
gradeMap[qlt][star] = {equips = {}}
|
||||||
|
|
||||||
|
-- 只有首次遇到该组合时才加入排序列表
|
||||||
|
if not gradeSet[key] then
|
||||||
|
gradeSet[key] = true
|
||||||
|
table.insert(gradeList, {qlt = qlt, star = star})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
table.insert(gradeMap[qlt][star].equips, equip)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 2. 排序(保持不变)
|
||||||
|
table.sort(gradeList, function(a, b)
|
||||||
|
return a.qlt < b.qlt or (a.qlt == b.qlt and a.star < b.star)
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- 3. 构建结果
|
||||||
|
local gradeGroups = {}
|
||||||
|
local allEquips = {}
|
||||||
|
for i = 1, math.min(5, #gradeList) do
|
||||||
|
local qlt = gradeList[i].qlt
|
||||||
|
local star = gradeList[i].star
|
||||||
|
local validEquips = {}
|
||||||
|
|
||||||
|
-- 筛选未使用的装备
|
||||||
|
for _, equip in ipairs(gradeMap[qlt][star].equips) do
|
||||||
|
if not self:getEquipUseHero(equip:getUid()) then
|
||||||
|
table.insert(validEquips, equip)
|
||||||
|
table.insert(allEquips, equip)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- 只有存在有效装备时才加入结果
|
||||||
|
if #validEquips > 0 then
|
||||||
|
table.insert(gradeGroups, {
|
||||||
|
qlt = qlt,
|
||||||
|
star = star,
|
||||||
|
equips = validEquips
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return gradeGroups, allEquips
|
||||||
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
return EquipData
|
return EquipData
|
||||||
@ -184,6 +184,9 @@ end
|
|||||||
|
|
||||||
--@region 数据
|
--@region 数据
|
||||||
function EquipEntity:getPartLv(slotId)
|
function EquipEntity:getPartLv(slotId)
|
||||||
|
if not slotId then
|
||||||
|
return 0
|
||||||
|
end
|
||||||
return DataManager.EquipData:getPartLv(slotId, self:getPart())
|
return DataManager.EquipData:getPartLv(slotId, self:getPart())
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user