装备副本材料获取界面排序
This commit is contained in:
parent
4bc9f441a5
commit
d79e24d01f
@ -12,13 +12,6 @@ function DungeonTargetCell:init()
|
||||
self.powerObj = uiMap["dungeon_target_cell.right.power"]
|
||||
self.imgPowerIcon = uiMap["dungeon_target_cell.right.power.img_icon"]
|
||||
self.txPowerNum = uiMap["dungeon_target_cell.right.power.tx_num"]
|
||||
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON), "isDirty", function()
|
||||
self:refresh()
|
||||
end)
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR), "isDirty", function()
|
||||
self:refresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function DungeonTargetCell:refresh(target, getWay, id)
|
||||
|
||||
@ -29,50 +29,6 @@ function ItemGetUI:onLoadRootComplete()
|
||||
self.txGet = uiMap["item_get_ui.content.tx_get"]
|
||||
self.scrollRectComp = uiMap["item_get_ui.content.scroll_view"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
|
||||
|
||||
self.txTitle:setText(I18N:getText("item", self.target.id, "name"))
|
||||
self.txDesc:setText(I18N:getText("item", self.target.id, "desc"))
|
||||
self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_23))
|
||||
self.rewardCell:refreshItemById(self.target.id)
|
||||
|
||||
local itemCfg = ConfigManager:getConfig("item")[self.target.id]
|
||||
if itemCfg == nil or itemCfg.get_way_type == nil or itemCfg.get_way == nil or #itemCfg.get_way == 0 then
|
||||
self:closeUI()
|
||||
return
|
||||
end
|
||||
|
||||
self.wayType = itemCfg.get_way_type
|
||||
self.wayList = {}
|
||||
|
||||
if self.wayType == GConst.DungeonConst.TYPE.WEAPON then
|
||||
local weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON)
|
||||
local unlock = {}
|
||||
local lock = {}
|
||||
for index, id in ipairs(itemCfg.get_way) do
|
||||
if weaponData:canFightChapter(id) then
|
||||
table.insert(unlock, id)
|
||||
else
|
||||
table.insert(lock, id)
|
||||
end
|
||||
end
|
||||
table.sort(unlock, function(a, b) return a > b end)
|
||||
table.sort(lock, function(a, b) return a > b end)
|
||||
self.wayList = table.addArray(unlock, lock)
|
||||
elseif self.wayType == GConst.DungeonConst.TYPE.ARMOR then
|
||||
local weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR)
|
||||
local unlock = {}
|
||||
local lock = {}
|
||||
for index, id in ipairs(itemCfg.get_way) do
|
||||
if weaponData:canFightChapter(id) then
|
||||
table.insert(unlock, id)
|
||||
else
|
||||
table.insert(lock, id)
|
||||
end
|
||||
end
|
||||
table.sort(unlock, function(a, b) return a > b end)
|
||||
table.sort(lock, function(a, b) return a > b end)
|
||||
self.wayList = table.addArray(unlock, lock)
|
||||
end
|
||||
|
||||
self.scrollRectComp:addInitCallback(function()
|
||||
return "app/ui/dungeon/cell/dungeon_target_cell"
|
||||
end)
|
||||
@ -86,9 +42,52 @@ function ItemGetUI:onLoadRootComplete()
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.GO_DUNGEON_UI, function()
|
||||
self:closeUI()
|
||||
end)
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON), "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
self:bind(DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR), "isDirty", function()
|
||||
self:onRefresh()
|
||||
end)
|
||||
end
|
||||
|
||||
function ItemGetUI:onRefresh()
|
||||
self.txTitle:setText(I18N:getText("item", self.target.id, "name"))
|
||||
self.txDesc:setText(I18N:getText("item", self.target.id, "desc"))
|
||||
self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_23))
|
||||
self.rewardCell:refreshItemById(self.target.id)
|
||||
|
||||
local itemCfg = ConfigManager:getConfig("item")[self.target.id]
|
||||
if itemCfg == nil or itemCfg.get_way_type == nil or itemCfg.get_way == nil or #itemCfg.get_way == 0 then
|
||||
self:closeUI()
|
||||
return
|
||||
end
|
||||
|
||||
self.wayType = itemCfg.get_way_type
|
||||
|
||||
local weaponData
|
||||
if self.wayType == GConst.DungeonConst.TYPE.WEAPON then
|
||||
weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_WEAPON)
|
||||
elseif self.wayType == GConst.DungeonConst.TYPE.ARMOR then
|
||||
weaponData = DataManager.DungeonData:getDungeonDataByType(ModuleManager.MODULE_KEY.DUNGEON_ARMOR)
|
||||
end
|
||||
local farm = {}
|
||||
local unlock = {}
|
||||
local lock = {}
|
||||
for index, id in ipairs(itemCfg.get_way) do
|
||||
if weaponData:canFarmChapter(id) and weaponData:getRemianFarmCount(id) > 0 then
|
||||
table.insert(farm, id)
|
||||
elseif weaponData:canFightChapter(id) then
|
||||
table.insert(unlock, id)
|
||||
else
|
||||
table.insert(lock, id)
|
||||
end
|
||||
end
|
||||
table.sort(farm, function(a, b) return a > b end)
|
||||
table.sort(unlock, function(a, b) return a > b end)
|
||||
table.sort(lock, function(a, b) return a > b end)
|
||||
unlock = table.addArray(farm, unlock)
|
||||
self.wayList = table.addArray(unlock, lock)
|
||||
|
||||
self.scrollRectComp:clearCells()
|
||||
self.scrollRectComp:refillCells(#self.wayList)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user