界面调整

This commit is contained in:
CloudJ 2023-06-06 10:16:13 +08:00
parent 2df5f6a66c
commit 8b0a3dd24a
8 changed files with 64 additions and 5 deletions

View File

@ -173,6 +173,7 @@ GConst.TYPEOF_LUA_CLASS = {
LARGE_HERO_CELL = "app/ui/common/cell/large_hero_cell",
POP_HERO_CELL = "app/ui/shop/cell/pop_hero_cell",
POP_REWARD_CELL = "app/ui/shop/cell/pop_reward_cell",
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
}
GConst.ATLAS_PATH = {

View File

@ -22,7 +22,7 @@ function BeginnerSellCell:init()
if not self.rewardCellList then
self.rewardCellList = {}
for i = 1, MAX_REWARD_COUNT do
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
end
end

View File

@ -23,7 +23,7 @@ function ChapterCell:init()
if not self.rewardCellList then
self.rewardCellList = {}
for i = 1, MAX_REWARD_COUNT do
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
end
end

View File

@ -22,7 +22,7 @@ function CoinSellCell:init()
if not self.rewardCellList then
self.rewardCellList = {}
for i = 1, MAX_REWARD_COUNT do
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
end
end
self.priceText = uiMap["gift_cell.bg.price"]

View File

@ -0,0 +1,48 @@
local GiftRewardCell = class("GiftRewardCell", BaseCell)
function GiftRewardCell:init()
local uiMap = self.baseObject:genAllChildren()
self.bg = uiMap["gift_reward_cell.bg"]
self.icon = uiMap["gift_reward_cell.icon"]
self.fragmenImg = uiMap["gift_reward_cell.fragment"]
self.numTx = uiMap["gift_reward_cell.num"]
self.baseObject:addClickListener(function()
if self.clickCallback then
self.clickCallback()
end
end)
end
function GiftRewardCell:refreshByConfig(reward)
Logger.logHighlight("refreshByConfig")
Logger.printTable(reward)
local id = reward.id
local num = reward.num
local heroCfgInfo = ConfigManager:getConfig("hero")[id]
if heroCfgInfo then
local qlt = heroCfgInfo.qlt
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg_" .. qlt)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, tostring(heroCfgInfo.icon))
self.fragmenImg:setVisible(true)
self.numTx:setText("X" .. tostring(num))
else
local itemCfgInfo = ConfigManager:getConfig("item")[id]
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg")
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(itemCfgInfo.icon))
self.fragmenImg:setVisible(false)
self.numTx:setText(num)
end
end
function GiftRewardCell:addClickListener(callback)
self.clickCallback = callback
end
function GiftRewardCell:setVisible(visible, scale)
self.baseObject:setVisible(visible, scale)
end
return GiftRewardCell

View File

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

View File

@ -21,7 +21,7 @@ function GrowCell:init()
if not self.rewardCellList then
self.rewardCellList = {}
for i = 1, MAX_REWARD_COUNT do
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
end
end

View File

@ -21,7 +21,7 @@ function LevelCell:init()
if not self.rewardCellList then
self.rewardCellList = {}
for i = 1, MAX_REWARD_COUNT do
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
end
end