99 lines
3.6 KiB
Lua
99 lines
3.6 KiB
Lua
require("Base/BasePanel")
|
|
AdventureExploreRewardPanel = Inherit(BasePanel)
|
|
local this=AdventureExploreRewardPanel
|
|
local baseDrop={}
|
|
local randomDrop={}
|
|
local baseContentList={}
|
|
local randomList = {}
|
|
local gameSetting = ConfigManager.GetConfig(ConfigName.GameSetting)
|
|
this.selfsortingOrder = 0
|
|
--初始化组件(用于子类重写)
|
|
function AdventureExploreRewardPanel:InitComponent()
|
|
baseContentList = {}
|
|
this.btnBack = Util.GetGameObject(self.gameObject, "maskImage")
|
|
this.rewardGrid = Util.GetGameObject(self.gameObject, "top/grid")
|
|
this.randomDropGrid = Util.GetGameObject(self.gameObject, "Bg/scroll/grid")
|
|
this.vipAddShow1 = Util.GetGameObject(self.gameObject, "Bg/top/vipAddShow1")
|
|
this.vipAddShow2 = Util.GetGameObject(self.gameObject, "Bg/top/vipAddShow2")
|
|
this.vipAddShowText1=Util.GetGameObject(self.gameObject, "Bg/top/vipAddShow1/vipAddShow1Text"):GetComponent("Text")
|
|
this.vipAddShowText2=Util.GetGameObject(self.gameObject, "Bg/top/vipAddShow2/vipAddShow2Text"):GetComponent("Text")
|
|
this.hangOnTime = Util.GetGameObject(self.gameObject, "Bg/hangOnTime"):GetComponent("Text")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function AdventureExploreRewardPanel:BindEvent()
|
|
Util.AddClick(this.btnBack, function()
|
|
self:ClosePanel()
|
|
end)
|
|
end
|
|
--添加事件监听(用于子类重写)
|
|
function AdventureExploreRewardPanel:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function AdventureExploreRewardPanel:RemoveListener()
|
|
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function AdventureExploreRewardPanel:OnOpen(...)
|
|
Log("挂机时长是 --- " .. TimeToHMS(AdventureManager.stateTime))
|
|
this.selfsortingOrder = self.sortingOrder
|
|
local args = {...}
|
|
baseDrop=args[1]
|
|
randomDrop = args[2]
|
|
local itemDataList={}
|
|
itemDataList=BagManager.GetTableByBackDropData(baseDrop)
|
|
BagManager.GoIntoBackData(baseDrop)
|
|
for i = 1, #itemDataList do
|
|
local view
|
|
if not baseContentList[i] then
|
|
view = SubUIManager.Open(SubUIConfig.ItemView,this.rewardGrid.transform)
|
|
baseContentList[i] = view
|
|
end
|
|
baseContentList[i]:OnOpen(true,itemDataList[i],1,true,false,false,this.selfsortingOrder)
|
|
end
|
|
|
|
if(randomDrop~=nil) then
|
|
local itemDataList={}
|
|
itemDataList=BagManager.GetTableByBackDropData(randomDrop)
|
|
|
|
-- 按品质排序
|
|
if #itemDataList > 1 then
|
|
table.sort(itemDataList, function(a, b)
|
|
return a.configData.Quantity > b.configData.Quantity
|
|
end)
|
|
end
|
|
|
|
BagManager.GoIntoBackData(randomDrop)
|
|
for i = 1, #itemDataList do
|
|
if not randomList[i] then
|
|
local view = SubUIManager.Open(SubUIConfig.ItemView,this.randomDropGrid.transform)
|
|
randomList[i] = view
|
|
end
|
|
randomList[i]:OnOpen(true,itemDataList[i], 1.1, true)
|
|
end
|
|
end
|
|
local hours = gameSetting[1].AdventureOffline
|
|
local time = AdventureManager.stateTime >= hours * 60 * 60 and hours * 60 * 60 or AdventureManager.stateTime
|
|
this.hangOnTime.text = "探索时长:" .. TimeToHMS(time)
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function AdventureExploreRewardPanel:OnClose()
|
|
FightPointPassManager.isBeginFight = false
|
|
if FightPointPassManager.oldLevel<PlayerManager.level then
|
|
UIManager.OpenPanel(UIName.FightEndLvUpPanel,FightPointPassManager.oldLevel,PlayerManager.level)
|
|
end
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function AdventureExploreRewardPanel:OnDestroy()
|
|
|
|
randomList = {}
|
|
baseContentList = {}
|
|
end
|
|
|
|
return AdventureExploreRewardPanel
|