新增道具宝箱显示

This commit is contained in:
xiekaidong 2023-07-24 11:18:21 +08:00
parent d7ed50ab8c
commit dc84eb073d
5 changed files with 125 additions and 0 deletions

View File

@ -457,6 +457,7 @@ local item = {
["icon"]="27"
},
[28]={
["type"]=7,
["qlt"]=1,
["icon"]="28",
["item_drop"]={
@ -487,6 +488,7 @@ local item = {
}
},
[29]={
["type"]=7,
["qlt"]=1,
["icon"]="29",
["item_drop"]={
@ -541,6 +543,7 @@ local item = {
}
},
[30]={
["type"]=7,
["qlt"]=2,
["icon"]="30",
["item_drop"]={
@ -619,6 +622,7 @@ local item = {
}
},
[31]={
["type"]=7,
["qlt"]=2,
["icon"]="31",
["item_drop"]={
@ -697,6 +701,7 @@ local item = {
}
},
[32]={
["type"]=7,
["qlt"]=3,
["icon"]="32",
["item_drop"]={
@ -775,6 +780,7 @@ local item = {
}
},
[33]={
["type"]=7,
["qlt"]=3,
["icon"]="33",
["item_drop"]={
@ -853,6 +859,7 @@ local item = {
}
},
[34]={
["type"]=7,
["qlt"]=4,
["icon"]="34",
["item_drop"]={
@ -931,6 +938,7 @@ local item = {
}
},
[35]={
["type"]=7,
["qlt"]=4,
["icon"]="35",
["item_drop"]={
@ -1009,6 +1017,7 @@ local item = {
}
},
[36]={
["type"]=7,
["qlt"]=5,
["icon"]="36",
["item_drop"]={
@ -1087,6 +1096,7 @@ local item = {
}
},
[37]={
["type"]=7,
["qlt"]=5,
["icon"]="37",
["item_drop"]={
@ -1165,6 +1175,7 @@ local item = {
}
},
[38]={
["type"]=4,
["qlt"]=1,
["icon"]="38",
["reward"]={
@ -1203,6 +1214,7 @@ local item = {
}
},
[39]={
["type"]=4,
["qlt"]=2,
["icon"]="39",
["reward"]={
@ -1241,6 +1253,7 @@ local item = {
}
},
[40]={
["type"]=4,
["qlt"]=3,
["icon"]="40",
["reward"]={
@ -1279,6 +1292,7 @@ local item = {
}
},
[41]={
["type"]=4,
["qlt"]=4,
["icon"]="41",
["reward"]={
@ -1317,6 +1331,7 @@ local item = {
}
},
[42]={
["type"]=4,
["qlt"]=5,
["icon"]="42",
["reward"]={
@ -1355,6 +1370,7 @@ local item = {
}
},
[43]={
["type"]=4,
["qlt"]=5,
["icon"]="43",
["reward"]={

View File

@ -24,6 +24,8 @@ ItemConst.ITEM_TYPE = {
BOX = 4,
HERO_FRAGMENT = 5,
WEIGHT_FRAGMENT = 6,
RANDOM_BOX_ITEM = 7,
FIXED_BOX_ITEM = 8,
}
return ItemConst

View File

@ -44,6 +44,9 @@ function TipsManager:showRewardTips(rewardId, rewardType, tarPrefabObj, alignTyp
-- 英雄碎片
ModuleManager.HeroManager:showHeroDetailUI(info.parameter, true)
return
elseif info.type == GConst.ItemConst.ITEM_TYPE.RANDOM_BOX_ITEM or info.type == GConst.ItemConst.ITEM_TYPE.FIXED_BOX_ITEM then
self:showBoxItemTips(rewardId)
return
end
end
end
@ -108,6 +111,13 @@ function TipsManager:showHeroFragmentTips(itemId)
UIManager:showUI("app/ui/tips/hero_fragment_tips", params)
end
function TipsManager:showBoxItemTips(itemId)
local params = {
itemId = itemId
}
UIManager:showUI("app/ui/tips/box_item_tips", params)
end
-- formation = {heroEntity, ...}
function TipsManager:showHeroFormation(targetObj, formation)
local tarCornerScreenPos, location = self:getCornerScreenPosition(targetObj, TipsManager.ALIGN_TYPE.BOTTOM_CENTER)

View File

@ -0,0 +1,87 @@
local BoxItemTips = class("BoxItemTips", BaseUI)
function BoxItemTips:ctor(params)
self.itemId = params.itemId
end
function BoxItemTips:onPressBackspace()
self:closeUI()
end
function BoxItemTips:getPrefabPath()
return "assets/prefabs/ui/tips/box_item_tips.prefab"
end
function BoxItemTips:isFullScreen()
return false
end
function BoxItemTips:onLoadRootComplete()
local cfg = ConfigManager:getConfig("item")[self.itemId]
if cfg == nil then
return self:closeUI()
end
local drop = nil
local titleTx = I18N:getGlobalText(I18N.GlobalConst.BOX_ITEM_TIPS_DESC_1)
self.isFixed = false
if cfg.item_drop then
drop = cfg.item_drop
else
drop = cfg.reward
self.isFixed = true
titleTx = I18N:getText("item", self.itemId, "desc")
end
if drop == nil then
return self:closeUI()
end
self.itemList = {}
for _, v in ipairs(drop) do
local itemCfg = ConfigManager:getConfig("item")[v.id]
local unit = {
reward = v,
sort = itemCfg.qlt * 10000 + v.id
}
table.insert(self.itemList, unit)
end
table.sort(self.itemList, function(a, b)
return a.sort > b.sort
end)
local uiMap = self.root:genAllChildren()
self.uiMap = uiMap
local itemQlt = cfg.qlt
if itemQlt < 1 then
itemQlt = 1
elseif itemQlt > 4 then
itemQlt = 4
end
local bgQlt = uiMap["box_item_tips.title_bg_img.bg_qlt"]
bgQlt:setVisible(false)
bgQlt:setTexture("assets/arts/textures/background/shop/shop_card_bg_" .. itemQlt .. ".png", function()
bgQlt:setVisible(true)
end)
uiMap["box_item_tips.title_bg_img.card"]:setSprite(GConst.ATLAS_PATH.ICON_ITEM, cfg.icon)
uiMap["box_item_tips.title_bg_img.desc"]:setText(titleTx)
uiMap["box_item_tips.title_bg_img.title_text"]:setText(I18N:getText("item", self.itemId, "name"))
uiMap["box_item_tips.title_bg_img.close_btn"]:addClickListener(function()
self:closeUI()
end)
self:initScrollRect()
end
function BoxItemTips:initScrollRect()
local scrollRectComp = self.uiMap["box_item_tips.title_bg_img.scroll_rect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
scrollRectComp:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end)
scrollRectComp:addRefreshCallback(function(index, cell)
cell:refreshByConfig(self.itemList[index].reward)
if not self.isFixed then
cell:hideCountTx()
end
end)
scrollRectComp:clearCells()
scrollRectComp:refillCells(#self.itemList)
end
return BoxItemTips

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 134c3a84c0e95ba48a713bc7331dbec9
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}