装备
This commit is contained in:
parent
d0362beb78
commit
00f30b9ab3
@ -683,6 +683,8 @@ local LocalizationGlobalConst =
|
|||||||
BAG_DESC_1 = "BAG_DESC_1",
|
BAG_DESC_1 = "BAG_DESC_1",
|
||||||
EQUIP_DESC_29 = "EQUIP_DESC_29",
|
EQUIP_DESC_29 = "EQUIP_DESC_29",
|
||||||
EQUIP_DESC_30 = "EQUIP_DESC_30",
|
EQUIP_DESC_30 = "EQUIP_DESC_30",
|
||||||
|
EQUIP_DESC_31 = "EQUIP_DESC_31",
|
||||||
|
EQUIP_DESC_32 = "EQUIP_DESC_32",
|
||||||
}
|
}
|
||||||
|
|
||||||
return LocalizationGlobalConst
|
return LocalizationGlobalConst
|
||||||
@ -683,6 +683,8 @@ local localization_global =
|
|||||||
["BAG_DESC_1"] = "背包",
|
["BAG_DESC_1"] = "背包",
|
||||||
["EQUIP_DESC_29"] = "只有上阵的英雄才能穿戴装备",
|
["EQUIP_DESC_29"] = "只有上阵的英雄才能穿戴装备",
|
||||||
["EQUIP_DESC_30"] = "穿戴",
|
["EQUIP_DESC_30"] = "穿戴",
|
||||||
|
["EQUIP_DESC_31"] = "一键穿戴",
|
||||||
|
["EQUIP_DESC_32"] = "装备培养",
|
||||||
}
|
}
|
||||||
|
|
||||||
return localization_global
|
return localization_global
|
||||||
@ -7,7 +7,7 @@ EquipConst.PART_TYPE = {
|
|||||||
EQUIP_3 = 3,
|
EQUIP_3 = 3,
|
||||||
EQUIP_4 = 4,
|
EQUIP_4 = 4,
|
||||||
EQUIP_5 = 5,
|
EQUIP_5 = 5,
|
||||||
EQUIP_6 = 5,
|
EQUIP_6 = 6,
|
||||||
}
|
}
|
||||||
|
|
||||||
return EquipConst
|
return EquipConst
|
||||||
@ -89,8 +89,9 @@ 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
|
||||||
DataManager.HeroData:setHeroLv(result.hero.id, result.hero.level)
|
DataManager.EquipData:onWearSuccess(result.reqData.slot, result.reqData.ids)
|
||||||
DataManager.HeroData:setDirty()
|
DataManager.HeroData:setDirty()
|
||||||
|
DataManager.HeroData:calcPower()
|
||||||
|
|
||||||
AudioManager:playEffect(AudioManager.EFFECT_ID.HERO_UP)
|
AudioManager:playEffect(AudioManager.EFFECT_ID.HERO_UP)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,17 +10,19 @@ function EquipListCell:init()
|
|||||||
self.wearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_30))
|
self.wearBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_30))
|
||||||
|
|
||||||
self.wearBtn:addClickListener(function()
|
self.wearBtn:addClickListener(function()
|
||||||
-- if DataManager.DailyTaskData:canClaimTask(self.taskId) then
|
-- local ids = {}
|
||||||
-- ModuleManager.TaskManager:claimDailyTask(self.taskId)
|
-- for i = 1, GConst.EquipConst.PART_TYPE.EQUIP_6 do
|
||||||
-- else
|
-- ids[i] = DataManager.EquipData:getPartEquipUid(self.slotId, i)
|
||||||
-- ModuleManager.TaskManager:taskGoto(self.taskType)
|
|
||||||
-- end
|
-- end
|
||||||
|
-- ids[self.equipPart] = self.entity:getUid()
|
||||||
|
ModuleManager.EquipManager:onEquipWearReq(self.slotId, {self.entity:getUid()})
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipListCell:refresh(entity, slotId)
|
function EquipListCell:refresh(entity, slotId, equipPart)
|
||||||
self.entity = entity
|
self.entity = entity
|
||||||
self.slotId = slotId
|
self.slotId = slotId
|
||||||
|
self.equipPart = equipPart
|
||||||
self.nameTx:setText(entity:getName())
|
self.nameTx:setText(entity:getName())
|
||||||
self.powerTx:setText(entity:getPower())
|
self.powerTx:setText(entity:getPower())
|
||||||
self.equipCell:refresh(entity, slotId)
|
self.equipCell:refresh(entity, slotId)
|
||||||
|
|||||||
@ -36,9 +36,13 @@ function EquipListUI:onLoadRootComplete()
|
|||||||
return EQUIP_LIST_CELL
|
return EQUIP_LIST_CELL
|
||||||
end)
|
end)
|
||||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||||
cell:refresh(self.equipList[index], self.slotId)
|
cell:refresh(self.equipList[index], self.slotId, self.equipPart)
|
||||||
end)
|
end)
|
||||||
self.scrollRectComp:clearCells()
|
self.scrollRectComp:clearCells()
|
||||||
|
|
||||||
|
self:bind(DataManager.HeroData, "isDirty", function()
|
||||||
|
self:closeUI()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function EquipListUI:onRefresh()
|
function EquipListUI:onRefresh()
|
||||||
@ -50,10 +54,10 @@ function EquipListUI:onRefresh()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function EquipListUI:refreshEquipCell()
|
function EquipListUI:refreshEquipCell()
|
||||||
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), 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)
|
local equipEntity = DataManager.EquipData:getEquipByUid(eid)
|
||||||
self.equipCell:refresh(equipEntity, false, true)
|
self.equipCell:refresh(equipEntity, self.equipPart)
|
||||||
else
|
else
|
||||||
self.equipCell:refreshEmpty(self.equipPart)
|
self.equipCell:refreshEmpty(self.equipPart)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -21,6 +21,8 @@ function EquipInfoComp:init()
|
|||||||
self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
|
self.hpNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2))
|
||||||
self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
|
self.atkNameTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3))
|
||||||
self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_29))
|
self.emptyTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_29))
|
||||||
|
self.upBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_32))
|
||||||
|
self.autoWaerBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_31))
|
||||||
|
|
||||||
self.equipCells = {}
|
self.equipCells = {}
|
||||||
self.suitTxs = {}
|
self.suitTxs = {}
|
||||||
@ -32,9 +34,21 @@ function EquipInfoComp:init()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- self.txAttr:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_6))
|
self.autoWaerBtn:addClickListener(function()
|
||||||
-- self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_16))
|
local soltId = self.heroEntity:getMatchType()
|
||||||
-- self.txUp:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_3))
|
local listUids = {}
|
||||||
|
for i = 1, 6 do
|
||||||
|
local equip = DataManager.EquipData:getEquipMaxScore(soltId, i)
|
||||||
|
if equip ~= nil then
|
||||||
|
table.insert(listUids, equip:getUid())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
ModuleManager.EquipManager:onEquipWearReq(soltId, listUids)
|
||||||
|
end)
|
||||||
|
self.upBtn:addClickListener(function()
|
||||||
|
-- UIManager:showUI("app/ui/hero/hero_attr_ui", {heroEntity = self.heroEntity})
|
||||||
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_32))
|
||||||
|
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)
|
||||||
@ -97,7 +111,7 @@ function EquipInfoComp:refreshEquip()
|
|||||||
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), part)
|
local eid = DataManager.EquipData:getPartEquipUid(self.heroEntity:getMatchType(), 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, false, true)
|
self.equipCells[part]:refresh(equipEntity, part)
|
||||||
else
|
else
|
||||||
-- self.equipCells[part]:refreshByCustom(nil, part)
|
-- self.equipCells[part]:refreshByCustom(nil, part)
|
||||||
self.equipCells[part]:refreshEmpty(part)
|
self.equipCells[part]:refreshEmpty(part)
|
||||||
|
|||||||
@ -96,6 +96,9 @@ function HeroDetailUI:onLoadRootComplete()
|
|||||||
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
||||||
self:refreshPageBtn()
|
self:refreshPageBtn()
|
||||||
end)
|
end)
|
||||||
|
self:bind(DataManager.HeroData, "isDirty", function()
|
||||||
|
self:onRefresh()
|
||||||
|
end)
|
||||||
self:addEventListener(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, function(id)
|
self:addEventListener(EventManager.CUSTOM_EVENT.HERO_UPGRADE_SUCCESS, function(id)
|
||||||
self:refreshPageBtn()
|
self:refreshPageBtn()
|
||||||
end)
|
end)
|
||||||
|
|||||||
@ -156,7 +156,7 @@ end
|
|||||||
--@region 穿戴
|
--@region 穿戴
|
||||||
--装备穿戴
|
--装备穿戴
|
||||||
function EquipData:onWearSuccess(soltId, uids)
|
function EquipData:onWearSuccess(soltId, uids)
|
||||||
for i,uid in ipairs(uids) do
|
for _, uid in ipairs(uids) do
|
||||||
local equip = self:getEquipByUid(uid)
|
local equip = self:getEquipByUid(uid)
|
||||||
local part = equip:getPart()
|
local part = equip:getPart()
|
||||||
if part then
|
if part then
|
||||||
@ -172,7 +172,35 @@ function EquipData:onWearSuccess(soltId, uids)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
self:setDirty()
|
self:setDirty()
|
||||||
-- DataManager.ForceData:updateTeamPower()
|
end
|
||||||
|
|
||||||
|
function EquipData:getEquipMaxScore(soltId, part)
|
||||||
|
local equip = nil
|
||||||
|
local maxScore = 0
|
||||||
|
local useUid = self:getPartEquipUid(soltId, part)
|
||||||
|
if useUid ~= 0 then
|
||||||
|
local useEquip = self:getEquipByUid(useUid)
|
||||||
|
maxScore = useEquip:getPower()
|
||||||
|
end
|
||||||
|
for i, v in pairs(self.allEquips) do
|
||||||
|
if v:getPart() == part then
|
||||||
|
local isEquip = false
|
||||||
|
for k2, info in ipairs(self.slots) do
|
||||||
|
if info.parts[part] and info.parts[part].equip_uid == v:getUid() then
|
||||||
|
isEquip = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not isEquip then
|
||||||
|
local score = v:getPower()
|
||||||
|
if score > maxScore then
|
||||||
|
equip = v
|
||||||
|
maxScore = score
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return equip
|
||||||
end
|
end
|
||||||
--@endregion
|
--@endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user