【自选宝箱】itemview点击自选宝箱展示奖励
parent
136f640f60
commit
166f47f658
|
@ -387,7 +387,7 @@ function this.SingleItemDataShow(_go, _itemData)
|
|||
this.OnClickTabBtn(sortIndex, sortIndexBtnGo)
|
||||
end,nil,true)
|
||||
elseif _itemData.itemConfig.ItemType == ItemType.SelfBox then--自选宝箱
|
||||
UIManager.OpenPanel(UIName.RewardBoxPanel, _itemData, function()
|
||||
UIManager.OpenPanel(UIName.RewardBoxPanel,true, _itemData.id, function()
|
||||
this.OnClickTabBtn(sortIndex, sortIndexBtnGo)
|
||||
UIManager.ClosePanel(UIName.RewardBoxPanel)
|
||||
end)
|
||||
|
|
|
@ -8,7 +8,9 @@ local gameSetting = ConfigManager.GetConfig(ConfigName.GameSetting)
|
|||
|
||||
local orginLayer = 0
|
||||
|
||||
local itemData--当前物品数据
|
||||
local itemId--当前物品数据id
|
||||
local rewards={}
|
||||
local isGet = false--是否获得该道具
|
||||
local curId = nil--当前已选择的物品的Id
|
||||
local curNum = 1--当前数量
|
||||
local maxOwnNum = 0--拥有的数量
|
||||
|
@ -27,6 +29,7 @@ function RewardBoxPanel:InitComponent()
|
|||
this.scroll = Util.GetGameObject(this.gameObject,"bg/scroll")
|
||||
this.itemPre = Util.GetGameObject(this.gameObject,"bg/scroll/itemPre2")
|
||||
this.selectBar = Util.GetGameObject(this.gameObject,"bg/topBar/selectBar")
|
||||
this.tip = Util.GetGameObject(this.gameObject,"bg/topBar/tip"):GetComponent("Text")
|
||||
this.selectBtn = Util.GetGameObject(this.gameObject,"bg/di/selectBtn")
|
||||
this.di = Util.GetGameObject(this.gameObject,"bg/di")
|
||||
this.slider = Util.GetGameObject(this.gameObject,"bg/bottomBar/slider")
|
||||
|
@ -90,7 +93,8 @@ end
|
|||
--界面打开时调用(用于子类重写)
|
||||
function RewardBoxPanel:OnOpen(...)
|
||||
local data={...}
|
||||
itemData = data[1]
|
||||
isGet = data[1]
|
||||
itemId = data[2]
|
||||
-- callBackFun = data[2]
|
||||
end
|
||||
|
||||
|
@ -103,16 +107,18 @@ function RewardBoxPanel:OnShow()
|
|||
end
|
||||
|
||||
function RewardBoxPanel:RefreshData()
|
||||
rewards = itemConfig[itemId].RewardGroup
|
||||
RewardBoxPanel:SetTopBar()
|
||||
RewardBoxPanel:SetGiftData(tagNum)
|
||||
RewardBoxPanel:SetBottom()
|
||||
if isGet then
|
||||
RewardBoxPanel:SetBottom()
|
||||
end
|
||||
end
|
||||
|
||||
--刷新奖励信息
|
||||
function RewardBoxPanel:SetGiftData(tagNum)--设置奖励列表
|
||||
local RewardGroupList = {}
|
||||
|
||||
for index, value in pairs(itemData.itemConfig.RewardGroup) do
|
||||
for index, value in pairs(rewards) do
|
||||
RewardGroupList[index] = value
|
||||
end
|
||||
|
||||
|
@ -131,7 +137,7 @@ function RewardBoxPanel:SetSingleGiftData(index,item,boxId,tagNum)
|
|||
local go = Util.GetGameObject(item,"select/Go")
|
||||
|
||||
goList[index] = go
|
||||
|
||||
select:SetActive(isGet)
|
||||
item:SetActive(true)
|
||||
if not itemIconList[item] then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView, icon.transform)
|
||||
|
@ -168,8 +174,9 @@ end
|
|||
|
||||
--设置头部属性标签显示
|
||||
function RewardBoxPanel:SetTopBar()
|
||||
this.selectBar:SetActive(#itemData.itemConfig.RewardGroup ~= 1)--设置顶部属性条
|
||||
this.di:SetActive(#itemData.itemConfig.RewardGroup ~= 1)
|
||||
this.tip.text = isGet and "请在以下道具中选择一种" or " "
|
||||
this.selectBar:SetActive(#rewards ~= 1)--设置顶部属性条
|
||||
this.di:SetActive(#rewards ~= 1)
|
||||
|
||||
for n = 0, this.selectBar.transform.childCount-1 do--设置当前页签
|
||||
Util.AddClick(this.selectBar.transform:GetChild(n).gameObject,function()
|
||||
|
@ -186,7 +193,7 @@ function RewardBoxPanel:SetBottom()--设置底部滑动条
|
|||
this.num.text = 1
|
||||
this.slider:SetActive(BagManager.isBagPanel)
|
||||
this.btnOk:SetActive(not BagManager.isBagPanel)
|
||||
maxOwnNum = BagManager.GetItemCountById(itemData.id)--拥有的最大数量
|
||||
maxOwnNum = BagManager.GetItemCountById(itemId)--拥有的最大数量
|
||||
maxNum = gameSetting[1].OpenBoxLimits--最大领取数量(配表)
|
||||
this.Slider:GetComponent("Slider").value=1
|
||||
this.Slider:GetComponent("Slider").minValue = 1
|
||||
|
@ -203,7 +210,7 @@ end
|
|||
|
||||
function RewardBoxPanel:OnBtnSureClick()
|
||||
if curId then
|
||||
local data = {itemData.id,curId,curNum}
|
||||
local data = {itemId,curId,curNum}
|
||||
if curNum <= 0 then
|
||||
PopupTipPanel.ShowTip("宝箱开启数量不能为0")
|
||||
return
|
||||
|
|
|
@ -569,6 +569,12 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage)
|
|||
Util.AddOnceClick(self.frameBtn, function()
|
||||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,itemSId,nil,self.isRewardItemPop)
|
||||
end)
|
||||
elseif itemDataConFig.ItemType == ItemType.SelfBox then
|
||||
self.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))
|
||||
self.icon.sprite = Util.LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID))
|
||||
Util.AddOnceClick(self.frameBtn, function()
|
||||
UIManager.OpenPanel(UIName.RewardBoxPanel,false,itemSId)
|
||||
end)
|
||||
else
|
||||
--,5随机道具,6符文
|
||||
self.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))
|
||||
|
|
Loading…
Reference in New Issue