【恭喜获得】界面结构调整

dev_chengFeng
ZhangBiao 2021-04-25 17:40:49 +08:00
parent 39329ce5cc
commit 072b7713c2
2 changed files with 4855 additions and 185 deletions

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ local this = RewardItemPopup
local userLevelData = ConfigManager.GetConfig(ConfigName.PlayerLevelConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local itemListPrefab
local itemListPrefabMax
-- local itemListPrefabMax
local func
local bagType=0 --1 正常背包 2 临时背包 3 公会车迟显示
--需要显示的小组件类型
@ -28,63 +28,68 @@ function RewardItemPopup:InitComponent()
this.dropPrefab = Util.GetGameObject(self.gameObject, "frame")
--第一种显示
this.ScrollView = Util.GetGameObject(self.gameObject, "ScrollView")
this.dropGrid= Util.GetGameObject(self.gameObject, "ScrollView/Content")
this.dropGrid= Util.GetGameObject(self.gameObject, "ScrollView/Content/grid")
itemListPrefab = {}
for i = 1, 10 do --初始缓存10个
for i = 1, 25 do --初始缓存10个
local view = SubUIManager.Open(SubUIConfig.ItemView, this.dropGrid.transform)
view.gameObject.name = "frame"..i
itemListPrefab[i] = view
end
--关卡等级经验
this.lvAndExpGo=Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/lvAndExpGo")
this.lv=Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/lvAndExpGo/lv"):GetComponent("Text")
this.exp=Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/lvAndExpGo/exp"):GetComponent("Slider")
this.expText=Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/lvAndExpGo/exp/Text"):GetComponent("Text")
this.lvUpImage=Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/lvAndExpGo/lvUpImage")
this.lvAndExpGo=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/lvAndExpGo")
this.lv=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/lvAndExpGo/lv"):GetComponent("Text")
this.exp=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/lvAndExpGo/exp"):GetComponent("Slider")
this.expText=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/lvAndExpGo/exp/Text"):GetComponent("Text")
this.lvUpImage=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/lvAndExpGo/lvUpImage")
-- 地图探索按钮
this.btnMapBack = Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/btnBack")
this.btnMapBack = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/btnBack")
-- 战斗结果按钮
this.btnResult = Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/btnResult")
this.btnBattleBack = Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/btnBattleBack")
this.btnResult = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/btnResult")
this.btnBattleBack = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/btnBattleBack")
-- 战斗回放按钮
-- 任意位置继续
this.btnGoOn = Util.GetGameObject(self.gameObject, "btnBack/Image")
--第二种显示当超过25个元素时
this.ScrollView2 = Util.GetGameObject(self.gameObject, "bg")
this.dropGridMax= Util.GetGameObject(self.gameObject, "bg/ScrollView2/ScrollView2/Content")
-- --第二种显示当超过25个元素时
-- this.ScrollView2 = Util.GetGameObject(self.gameObject, "bg")
-- this.dropGridMax= Util.GetGameObject(self.gameObject, "bg/ScrollView2/ScrollView2/Content")
itemListPrefabMax = {}
for i = 1, 25 do --初始缓存10个
local view = SubUIManager.Open(SubUIConfig.ItemView, this.dropGridMax.transform)
view.gameObject.name = "frame"..i
itemListPrefabMax[i] = view
end
this.lvAndExpGoMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo")
this.lvMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/lv"):GetComponent("Text")
this.expMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/exp"):GetComponent("Slider")
this.expTextMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/exp/Text"):GetComponent("Text")
this.lvUpImageMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/lvUpImage")
-- 战斗结果按钮
this.btnResultMax = Util.GetGameObject(self.gameObject, "bg/btnResult")
this.btnMapBackMax = Util.GetGameObject(self.gameObject, "bg/btnBack")
-- itemListPrefabMax = {}
-- for i = 1, 25 do --初始缓存10个
-- local view = SubUIManager.Open(SubUIConfig.ItemView, this.dropGridMax.transform)
-- view.gameObject.name = "frame"..i
-- itemListPrefabMax[i] = view
-- end
-- this.lvAndExpGoMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo")
-- this.lvMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/lv"):GetComponent("Text")
-- this.expMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/exp"):GetComponent("Slider")
-- this.expTextMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/exp/Text"):GetComponent("Text")
-- this.lvUpImageMax=Util.GetGameObject(self.gameObject, "bg/lvAndExpGo/lvUpImage")
-- -- 战斗结果按钮
-- this.btnResultMax = Util.GetGameObject(self.gameObject, "bg/btnResult")
-- this.btnMapBackMax = Util.GetGameObject(self.gameObject, "bg/btnBack")
-- this.btnBattleBackMax = Util.GetGameObject(self.gameObject, "bg/btnBattleBack")
--车迟斗法 显示
this.guildCarDelay = Util.GetGameObject(self.gameObject, "ScrollView/Content/bg/guildCarDelay")
this.guildCarDelay = Util.GetGameObject(self.gameObject, "ScrollView/Content/Show/guildCarDelay")
this.guildCarDelaysoreNum = Util.GetGameObject(this.guildCarDelay.gameObject, "soreNum"):GetComponent("Text")
this.guildCarDelayhurtNum = Util.GetGameObject(this.guildCarDelay.gameObject, "hurtNum"):GetComponent("Text")
--公会十绝阵显示
this.guildDeathPos=Util.GetGameObject(self.gameObject,"ScrollView/Content/bg/guildDeathPos")
this.guildDeathPos=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/guildDeathPos")
this.guildDeathPos_CurScore=Util.GetGameObject(this.guildDeathPos,"curScore/num"):GetComponent("Text")
this.guildDeathPos_State=Util.GetGameObject(this.guildDeathPos,"curScore/state"):GetComponent("Image")
this.guildDeathPos_MaxScore=Util.GetGameObject(this.guildDeathPos,"maxScore/num"):GetComponent("Text")
--大闹天功显示
this.expeditionGo=Util.GetGameObject(self.gameObject,"ScrollView/Content/bg/expeditionGo")
this.expeditionGo=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/expeditionGo")
--公会副本
this.guildTranscript=Util.GetGameObject(self.gameObject,"ScrollView/Content/bg/guildTranscript")
this.guildTranscript=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/guildTranscript")
this.guildTranscript_CurScore=Util.GetGameObject(this.guildTranscript,"curScore/num"):GetComponent("Text")
--踏碎凌霄
this.tasuilingxiao=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/tasuilingxiao")
this.tasuilingxiao_CurScore=Util.GetGameObject(this.tasuilingxiao,"curScore/num"):GetComponent("Text")
this.tasuilingxiao_State=Util.GetGameObject(this.tasuilingxiao,"curScore/state"):GetComponent("Image")
this.tasuilingxiao_MaxScore=Util.GetGameObject(this.tasuilingxiao,"maxScore/num"):GetComponent("Text")
end
--绑定事件(用于子类重写)
@ -103,15 +108,15 @@ function RewardItemPopup:BindEvent()
Util.AddClick(this.btnMapBack, function ()
self:ClosePanel()
end)
Util.AddClick(this.btnMapBackMax, function ()
self:ClosePanel()
end)
-- Util.AddClick(this.btnMapBackMax, function ()
-- self:ClosePanel()
-- end)
Util.AddClick(this.btnResult, function ()
UIManager.OpenPanel(UIName.DamageResultPanel, 1)
end)
Util.AddClick(this.btnResultMax, function ()
UIManager.OpenPanel(UIName.DamageResultPanel, 1)
end)
-- Util.AddClick(this.btnResultMax, function ()
-- UIManager.OpenPanel(UIName.DamageResultPanel, 1)
-- end)
Util.AddClick(this.btnBattleBack, function ()
--LogGreen("isBackBattle = true")
isBackBattle = true
@ -145,11 +150,12 @@ function RewardItemPopup:OnOpen(...)
local haveRecord = BattleRecordManager.isHaveRecord()
this.btnResult:SetActive(haveRecord and args[5])
this.btnBattleBack:SetActive(haveRecord and args[5] and BattleManager.GetLastBattleType() ~= BATTLE_TYPE.MAP_FIGHT and not GuideManager.IsInMainGuide() and not MapManager.Mapping)
this.btnResultMax:SetActive(haveRecord and args[5])
-- this.btnResultMax:SetActive(haveRecord and args[5])
this.expeditionGo:SetActive(compShowType == 5)
this.guildDeathPos:SetActive((compShowType == 4) or (compShowType == 7))--十绝阵和踏碎凌霄
this.guildDeathPos:SetActive(compShowType == 4)--十绝阵
this.guildTranscript:SetActive(compShowType == 6)
this.guildCarDelay:SetActive(compShowType == 3)
this.tasuilingxiao:SetActive(compShowType == 7)--踏碎凌霄
-- 设置背景遮罩的显隐
local isHideBG = args[6]
this.btnBack:GetComponent("Image").color = Color.New(0, 0, 0, isHideBG and 0 or 0.8)
@ -170,7 +176,7 @@ function RewardItemPopup:OnOpen(...)
this.GuildTranscriptShow()
end
if compShowType == 7 then--踏碎凌霄
this.TaSuiLingXiaoShow()
this.TaSuiLingXiaoShow(#drop.itemlist)
if #drop.itemlist < 1 then
for i = 1, #itemListPrefab do
itemListPrefab[i].gameObject:SetActive(false)
@ -207,10 +213,12 @@ function RewardItemPopup:OnOpen(...)
if #itemDataList < 1 then
self:ClosePanel()
self:SelectCanPopUpBagMaxMessage()
elseif #itemDataList <= 25 then
-- elseif #itemDataList <= 25 then
-- self:SetItemShow(drop)
-- elseif #itemDataList > 25 then
-- self:SetItemShowMax(drop)
else
self:SetItemShow(drop)
elseif #itemDataList > 25 then
self:SetItemShowMax(drop)
end
SoundManager.PlaySound(SoundConfig.Sound_Reward)
this.ShowLvAndExp()
@ -220,17 +228,18 @@ end
function this.SetComPShowState(type)
this.btnBack:GetComponent("Button").enabled = type ~= 2
this.ScrollView:SetActive(#itemDataList <= 25 )
this.ScrollView2:SetActive(#itemDataList > 25 )
this.ScrollView:SetActive(#itemDataList >= 1 )
-- this.ScrollView:SetActive(#itemDataList <= 25 )
-- this.ScrollView2:SetActive(#itemDataList > 25 )
this.lvAndExpGo:SetActive(type == 1)
this.btnMapBack:SetActive(type == 2)
this.lvAndExpGoMax:SetActive(type == 1)
this.btnMapBackMax:SetActive(type == 2)
this.btnMapBackMax:SetActive(type == 2)
-- this.lvAndExpGoMax:SetActive(type == 1)
-- this.btnMapBackMax:SetActive(type == 2)
-- this.btnMapBackMax:SetActive(type == 2)
this.guildCarDelay:SetActive(type == 3)
this.guildDeathPos:SetActive(type == 4)
this.guildTranscript:SetActive(type == 6)
this.tasuilingxiao:SetActive(type == 7)
end
function this.GuildCarDelayShow()
if GuildCarDelayManager.score and GuildCarDelayManager.hurt then
@ -254,20 +263,20 @@ function this.GuildDeathPosShow()
end
end
--踏碎凌霄 挑战奖励掉落弹窗表现
function this.TaSuiLingXiaoShow()
function this.TaSuiLingXiaoShow(num)
if CommonActPageManager.TaSuiLingXiaoMsg then
local curDmg = CommonActPageManager.TaSuiLingXiaoMsg.damageVal
local maxDmg = CommonActPageManager.GetData(ActivityTypeDef.TaSuiLingXiao).value
this.guildDeathPos_CurScore.text = curDmg
this.guildDeathPos_MaxScore.text = maxDmg
this.tasuilingxiao_CurScore.text = curDmg
this.tasuilingxiao_MaxScore.text = maxDmg
local b = curDmg > maxDmg or curDmg < maxDmg
this.guildDeathPos_State.gameObject:SetActive(b)
this.guildDeathPos:GetComponent("RectTransform").localPosition = Vector3.zero
this.tasuilingxiao_State.gameObject:SetActive(b)
-- this.tasuilingxiao:GetComponent("RectTransform").localPosition = Vector3.New(0,110*(math.floor(num/5)),0)
if curDmg > maxDmg then
this.guildDeathPos_State.sprite=Util.LoadSprite("r_hero_zhanlishangsheng_png")
this.tasuilingxiao_State.sprite=Util.LoadSprite("r_hero_zhanlishangsheng_png")
elseif curDmg < maxDmg then
this.guildDeathPos_State.sprite=Util.LoadSprite("r_hero_zhanlixiajiang_png")
this.tasuilingxiao_State.sprite=Util.LoadSprite("r_hero_zhanlixiajiang_png")
end
end
end
@ -297,11 +306,11 @@ function RewardItemPopup:OnSortingOrderChange()
local curItemData=itemDataList[i]
view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
end
for i = 1, #itemListPrefabMax do
local view = itemListPrefabMax[i]
local curItemData=itemDataList[i]
view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
end
-- for i = 1, #itemListPrefabMax do
-- local view = itemListPrefabMax[i]
-- local curItemData=itemDataList[i]
-- view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
-- end
end
-- 根据物品列表数据显示物品
function RewardItemPopup:SetItemShow(drop)
@ -377,87 +386,87 @@ function RewardItemPopup:SetItemShow(drop)
callList:Pop()()
end
-- 根据物品列表数据显示物品
function RewardItemPopup:SetItemShowMax(drop)
BagManager.OnShowTipDropNumZero(drop)
if drop==nil then return end
for i = 1, #itemDataList do
itemDataList[i].itemConfig = itemConfig[itemDataList[i].sId]
end
self:ItemDataListSort(itemDataList)
for i = 1, math.max(#itemDataList, #itemListPrefabMax) do
local go = itemListPrefabMax[i]
if not go then
go = SubUIManager.Open(SubUIConfig.ItemView, this.dropGridMax.transform)
go.gameObject.name = "frame"..i
itemListPrefabMax[i] = go
end
go.gameObject:SetActive(false)
end
-- function RewardItemPopup:SetItemShowMax(drop)
-- BagManager.OnShowTipDropNumZero(drop)
-- if drop==nil then return end
-- for i = 1, #itemDataList do
-- itemDataList[i].itemConfig = itemConfig[itemDataList[i].sId]
-- end
-- self:ItemDataListSort(itemDataList)
-- for i = 1, math.max(#itemDataList, #itemListPrefabMax) do
-- local go = itemListPrefabMax[i]
-- if not go then
-- go = SubUIManager.Open(SubUIConfig.ItemView, this.dropGridMax.transform)
-- go.gameObject.name = "frame"..i
-- itemListPrefabMax[i] = go
-- end
-- go.gameObject:SetActive(false)
-- end
callList:Clear()
callList:Push(function ()
if isOpenGeiSSRAvtivityTime then
isOpenGeiSSRAvtivityTime:Stop()
isOpenGeiSSRAvtivityTime = nil
end
isOpenGeiSSRAvtivityTime = Timer.New(function ()
isPlayerAniEnd = true
if isOpenGeiSSRAvtivity > 0 then
HeroManager.DetectionOpenFiveStarActivity(isOpenGeiSSRAvtivity)
end
end, 0.5):Start()
isPlayerAniEnd = true
if isOpenGeiSSRAvtivity > 0 then
HeroManager.DetectionOpenFiveStarActivity(isOpenGeiSSRAvtivity)
end
--在关卡界面获得装备 刷新下btview成员红点
-- Game.GlobalEvent:DispatchEvent(GameEvent.Equip.EquipChange)
end)
for i = #itemDataList, 1, -1 do
isPlayerAniEnd = false
local view = itemListPrefabMax[i]
local curItemData=itemDataList[i]
view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
--view.gameObject:SetActive(false)
callList:Push(function ()
local func = function()
view.gameObject:SetActive(true)
local btn = Util.GetGameObject(view.gameObject, "item/frame"):GetComponent("Button")
btn.enabled = false
PlayUIAnim(view.gameObject, function()
btn.enabled = true
end)
--改为后端更新
--this.SetItemData2(itemDataList[i])
if i <= 25 then
Timer.New(function ()
isPopGetSSR = false
callList:Pop()()
end, 0.05):Start()
else
isPopGetSSR = false
callList:Pop()()
end
end
if curItemData.configData and curItemData.itemType==3 and curItemData.configData.Quality == 5 then
HeroManager.DetectionOpenFiveStarActivity(curItemData.configData.Star)
end
if curItemData.configData and curItemData.itemType==3 and curItemData.configData.Quality == 5 and showHero then--五星英雄
isPopGetSSR = true
isOpenGeiSSRAvtivity = curItemData.configData.Star
UIManager.OpenPanel(UIName.DropGetSSRHeroShopPanel,curItemData.backData, func)
elseif curItemData.configData and curItemData.itemType==1 and
(curItemData.configData.ItemType == ItemType.Title or curItemData.configData.ItemType == ItemType.Ride) then--皮肤 坐骑
-- isPopGetSSR = true
-- UIManager.OpenPanel(UIName.DropGetPlayerDecorateShopPanel,curItemData.backData, func)
func()
else
func()
end
end)
end
callList:Pop()()
end
-- callList:Clear()
-- callList:Push(function ()
-- if isOpenGeiSSRAvtivityTime then
-- isOpenGeiSSRAvtivityTime:Stop()
-- isOpenGeiSSRAvtivityTime = nil
-- end
-- isOpenGeiSSRAvtivityTime = Timer.New(function ()
-- isPlayerAniEnd = true
-- if isOpenGeiSSRAvtivity > 0 then
-- HeroManager.DetectionOpenFiveStarActivity(isOpenGeiSSRAvtivity)
-- end
-- end, 0.5):Start()
-- isPlayerAniEnd = true
-- if isOpenGeiSSRAvtivity > 0 then
-- HeroManager.DetectionOpenFiveStarActivity(isOpenGeiSSRAvtivity)
-- end
-- --在关卡界面获得装备 刷新下btview成员红点
-- -- Game.GlobalEvent:DispatchEvent(GameEvent.Equip.EquipChange)
-- end)
-- for i = #itemDataList, 1, -1 do
-- isPlayerAniEnd = false
-- local view = itemListPrefabMax[i]
-- local curItemData=itemDataList[i]
-- view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
-- --view.gameObject:SetActive(false)
-- callList:Push(function ()
-- local func = function()
-- view.gameObject:SetActive(true)
-- local btn = Util.GetGameObject(view.gameObject, "item/frame"):GetComponent("Button")
-- btn.enabled = false
-- PlayUIAnim(view.gameObject, function()
-- btn.enabled = true
-- end)
-- --改为后端更新
-- --this.SetItemData2(itemDataList[i])
-- if i <= 25 then
-- Timer.New(function ()
-- isPopGetSSR = false
-- callList:Pop()()
-- end, 0.05):Start()
-- else
-- isPopGetSSR = false
-- callList:Pop()()
-- end
-- end
-- if curItemData.configData and curItemData.itemType==3 and curItemData.configData.Quality == 5 then
-- HeroManager.DetectionOpenFiveStarActivity(curItemData.configData.Star)
-- end
-- if curItemData.configData and curItemData.itemType==3 and curItemData.configData.Quality == 5 and showHero then--五星英雄
-- isPopGetSSR = true
-- isOpenGeiSSRAvtivity = curItemData.configData.Star
-- UIManager.OpenPanel(UIName.DropGetSSRHeroShopPanel,curItemData.backData, func)
-- elseif curItemData.configData and curItemData.itemType==1 and
-- (curItemData.configData.ItemType == ItemType.Title or curItemData.configData.ItemType == ItemType.Ride) then--皮肤 坐骑
-- -- isPopGetSSR = true
-- -- UIManager.OpenPanel(UIName.DropGetPlayerDecorateShopPanel,curItemData.backData, func)
-- func()
-- else
-- func()
-- end
-- end)
-- end
-- callList:Pop()()
-- end
--存储本地
function this.SetItemData2(itemdata)
if itemdata.itemType==1 then
@ -499,17 +508,17 @@ end
function this.ShowLvAndExp()
--this.lvAndExpGo:SetActive(compShowType == 1)
if compShowType == 1 then
if #itemDataList <= 25 then
-- if #itemDataList <= 25 then
this.exp.value=PlayerManager.exp/userLevelData[PlayerManager.level].Exp
this.expText.text=PlayerManager.exp.."/"..userLevelData[PlayerManager.level].Exp
this.lv.text= PlayerManager.level
this.lvUpImage:SetActive(FightPointPassManager.oldLevel<PlayerManager.level)
elseif #itemDataList > 25 then
this.expMax.value=PlayerManager.exp/userLevelData[PlayerManager.level].Exp
this.expTextMax.text=PlayerManager.exp.."/"..userLevelData[PlayerManager.level].Exp
this.lvMax.text= PlayerManager.level
this.lvUpImageMax:SetActive(FightPointPassManager.oldLevel<PlayerManager.level)
end
-- elseif #itemDataList > 25 then
-- this.expMax.value=PlayerManager.exp/userLevelData[PlayerManager.level].Exp
-- this.expTextMax.text=PlayerManager.exp.."/"..userLevelData[PlayerManager.level].Exp
-- this.lvMax.text= PlayerManager.level
-- this.lvUpImageMax:SetActive(FightPointPassManager.oldLevel<PlayerManager.level)
-- end
end
end
--掉落物品排序