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