miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemPopup.lua

605 lines
25 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
RewardItemPopup = Inherit(BasePanel)
local this = RewardItemPopup
local userLevelData = ConfigManager.GetConfig(ConfigName.PlayerLevelConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local HardStageCondition = ConfigManager.GetConfig(ConfigName.HardStageCondition)
2021-04-27 20:48:45 +08:00
local itemListPrefab = {}
2021-04-25 17:40:49 +08:00
-- local itemListPrefabMax
2020-05-09 13:31:21 +08:00
local func
2020-05-15 16:52:35 +08:00
local bagType=0 --1 正常背包 2 临时背包 3 公会车迟显示
2020-05-09 13:31:21 +08:00
--需要显示的小组件类型
-- 1 -- > 界面显示升级
-- 2 -- > 显示地图自由探索按钮
local compShowType = 0
2021-05-27 20:17:53 +08:00
local sortingOrder = 0
2020-05-09 13:31:21 +08:00
local callList = Stack.New()
local isPopGetSSR = false
local isOpenGeiSSRAvtivity = 0--五星成长礼拍脸
local isOpenGeiSSRAvtivityTime
local isPlayerAniEnd = true
local itemDataList
2020-07-16 10:49:01 +08:00
local showHero = 1
2021-01-06 16:12:54 +08:00
local isBackBattle = false
local conditionGo = {}
2021-05-27 20:17:53 +08:00
local starListEffect = {}
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
--此界面无奈做了两套显示逻辑一个是掉落小于等于25时背景根据元素数量做拉伸状态 另一个是元素大于25做界面做可滑动
function RewardItemPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
this.btnBack = Util.GetGameObject(self.gameObject, "btnBack")
this.dropPrefab = Util.GetGameObject(self.gameObject, "frame")
--第一种显示
this.ScrollView = Util.GetGameObject(self.gameObject, "ScrollView")
2021-04-25 17:40:49 +08:00
this.dropGrid= Util.GetGameObject(self.gameObject, "ScrollView/Content/grid")
2021-04-27 13:48:17 +08:00
this.dropGridArena= Util.GetGameObject(self.gameObject, "ScrollView/Content/grid2")
this.dropGrid2= Util.GetGameObject(self.gameObject, "ScrollView/Content/grid2/scorll/grid")
2020-05-09 13:31:21 +08:00
--关卡等级经验
2021-09-17 14:38:05 +08:00
this.lvAndExpGo=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/lvAndExpGo")
this.lv=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/lvAndExpGo/lv"):GetComponent("Text")
this.exp=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/lvAndExpGo/exp"):GetComponent("Slider")
this.expText=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/lvAndExpGo/exp/Text"):GetComponent("Text")
this.lvUpImage=Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/lvAndExpGo/lvUpImage")
2020-05-09 13:31:21 +08:00
-- 战斗结果按钮
2021-09-17 14:38:05 +08:00
this.btnResult = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/Btns/btnResult")
this.btnBattleBack = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/Btns/btnBattleBack")
2020-12-30 18:08:44 +08:00
-- 战斗回放按钮
2020-05-09 13:31:21 +08:00
2020-05-15 16:52:35 +08:00
--车迟斗法 显示
2021-04-25 17:40:49 +08:00
this.guildCarDelay = Util.GetGameObject(self.gameObject, "ScrollView/Content/Show/guildCarDelay")
2020-05-15 16:52:35 +08:00
this.guildCarDelaysoreNum = Util.GetGameObject(this.guildCarDelay.gameObject, "soreNum"):GetComponent("Text")
this.guildCarDelayhurtNum = Util.GetGameObject(this.guildCarDelay.gameObject, "hurtNum"):GetComponent("Text")
--公会十绝阵显示
2021-04-25 17:40:49 +08:00
this.guildDeathPos=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/guildDeathPos")
2020-05-15 16:52:35 +08:00
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")
2020-06-18 20:39:29 +08:00
--大闹天功显示
2021-04-25 17:40:49 +08:00
this.expeditionGo=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/expeditionGo")
2020-08-20 20:05:38 +08:00
--公会副本
2021-04-25 17:40:49 +08:00
this.guildTranscript=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/guildTranscript")
2020-08-20 20:05:38 +08:00
this.guildTranscript_CurScore=Util.GetGameObject(this.guildTranscript,"curScore/num"):GetComponent("Text")
2021-02-22 18:42:26 +08:00
2021-02-26 17:44:13 +08:00
this.shenying = Util.GetGameObject(self.gameObject, "shenying")
this.shenying.gameObject:SetActive(false)
this.shenyingTxt = Util.GetGameObject(this.shenying , "Content/bg/Text"):GetComponent("Text")
2021-04-25 17:40:49 +08:00
--踏碎凌霄
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")
2021-04-27 21:28:48 +08:00
this.noRewardText = Util.GetGameObject(this.tasuilingxiao,"Text")
2021-05-13 20:30:10 +08:00
--山河社稷图主
2021-05-13 09:56:11 +08:00
this.GXHD=Util.GetGameObject(self.gameObject,"ScrollView/Content/bg/Image")
2021-05-13 20:30:10 +08:00
this.FightLevel2=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/FightLevel")
this.FightLevel3=Util.GetGameObject(self.gameObject,"FightLevel3")
2021-05-13 20:30:10 +08:00
--山河社稷图副关卡
this.FightLevelAssistant=Util.GetGameObject(self.gameObject,"ScrollView/Content/Show/FightLevelAssistant")
2021-05-27 20:17:53 +08:00
starListEffect = {}
this.Root=Util.GetGameObject(self.gameObject,"FightLevel3/Root")
for i = 1, 3 do
conditionGo[i] = Util.GetGameObject(this.FightLevel3, "Root/item (" .. i ..")")
2021-05-27 20:17:53 +08:00
starListEffect[i] = Util.GetGameObject(this.FightLevel3, "isFirst/Fx_star_looping (" .. i ..")")
end
2021-05-27 20:17:53 +08:00
this.isFirstEffect = Util.GetGameObject(this.FightLevel3,"isFirst")
2021-09-10 18:36:39 +08:00
--七界试炼挑战条件信息
2021-09-17 14:38:05 +08:00
this.qiJieCondition = Util.GetGameObject(self.gameObject, "ScrollView/Content/bottom/grid/qiJieInfo")
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function RewardItemPopup:BindEvent()
Util.AddClick(this.btnBack, function()
if isPlayerAniEnd then
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
if PlayerManager.IsGetFiveStarHero then--and OperatingManager.IsShowFiveStarPatch then
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend, FacePanelType.GrowGift, 5)
PlayerManager.IsGetFiveStarHero = false
end
2020-05-09 13:31:21 +08:00
end
end)
Util.AddClick(this.btnResult, function ()
UIManager.OpenPanel(UIName.DamageResultPanel, 1)
end)
2020-12-30 18:08:44 +08:00
Util.AddClick(this.btnBattleBack, function ()
2021-01-06 16:12:54 +08:00
isBackBattle = true
2020-12-30 18:08:44 +08:00
BattleManager.BattleBackFun()
end)
2020-05-09 13:31:21 +08:00
end
--界面打开时调用(用于子类重写)
--bagType 1 正常背包 2 地图临时背包
--drop 后端掉落原始数据
--func 回调
2020-07-16 10:49:01 +08:00
2020-05-09 13:31:21 +08:00
function RewardItemPopup:OnOpen(...)
2021-04-27 20:48:45 +08:00
if #itemListPrefab > 0 then
for i = 1, #itemListPrefab do
destroy(itemListPrefab[i].gameObject)
end
end
itemListPrefab = {}
itemDataList = {}
2021-01-06 16:12:54 +08:00
isBackBattle = false
2020-05-09 13:31:21 +08:00
isPlayerAniEnd = true
isOpenGeiSSRAvtivity = 0
local args = {...}
local drop = args[1]
bagType=args[2]
func = args[3]
2021-03-10 17:31:40 +08:00
2020-05-09 13:31:21 +08:00
if args[4] then
2021-03-11 17:06:08 +08:00
compShowType = args[4] or 0
end
2020-07-16 10:49:01 +08:00
if args[7] then
showHero = false
else
showHero = true
end
2021-03-10 17:31:40 +08:00
this.shenying.gameObject:SetActive(false)
--如果没有compShowType和Drop--背包已满
if not args[4] and (not drop or (#drop.itemlist < 1 and #drop.equipId < 1 and #drop.Hero < 1 and #drop.soulEquip < 1 and #drop.pokemon < 1)) then
2021-05-25 16:20:56 +08:00
LogGreen("掉落为空")
self:ClosePanel()
return
end
2020-05-09 13:31:21 +08:00
local haveRecord = BattleRecordManager.isHaveRecord()
this.btnResult:SetActive(haveRecord and args[5])
2021-04-26 17:12:39 +08:00
this.btnBattleBack:SetActive(haveRecord and args[5] and BattleManager.GetLastBattleType() ~= BATTLE_TYPE.MAP_FIGHT and not GuideManager.IsInMainGuide() and not MapManager.Mapping and BattleManager.GetLastBattleType() ~= BATTLE_TYPE.TASUILINGXIAO)
2021-01-18 15:11:27 +08:00
this.expeditionGo:SetActive(compShowType == 5)
2021-04-25 17:40:49 +08:00
this.guildDeathPos:SetActive(compShowType == 4)--十绝阵
2021-01-18 15:11:27 +08:00
this.guildTranscript:SetActive(compShowType == 6)
this.guildCarDelay:SetActive(compShowType == 3)
2021-02-26 17:44:13 +08:00
this.expeditionGo:SetActive(compShowType == 5)
this.shenying:SetActive(compShowType == CompShowType.fourElement)
2021-04-25 17:40:49 +08:00
this.tasuilingxiao:SetActive(compShowType == 7)--踏碎凌霄
this.FightLevel3:SetActive(compShowType == 8)--山河社稷图
this.FightLevel2:SetActive(compShowType == 8 and (not drop or (#drop.itemlist < 1 and #drop.equipId < 1 and #drop.Hero < 1 and #drop.soulEquip < 1 and #drop.pokemon < 1)))--山河社稷图
this.FightLevelAssistant:SetActive(compShowType == 9)--山河社稷图
2022-04-25 18:20:53 +08:00
this.qiJieCondition:SetActive(compShowType == 10 or compShowType == 12)--七界试炼
2021-04-27 21:28:48 +08:00
this.dropGrid:SetActive(false)
this.dropGridArena:SetActive(false)
this.lvAndExpGo:SetActive(compShowType == 1)
2020-05-09 13:31:21 +08:00
-- 设置背景遮罩的显隐
2020-06-13 11:47:13 +08:00
local isHideBG = args[6]
2020-05-09 13:31:21 +08:00
this.btnBack:GetComponent("Image").color = Color.New(0, 0, 0, isHideBG and 0 or 0.8)
2021-04-27 13:48:17 +08:00
if compShowType == 3 then
2020-05-15 16:52:35 +08:00
this.GuildCarDelayShow()
this.guildCarDelay:SetActive(compShowType == 3)
2021-04-27 13:48:17 +08:00
elseif compShowType == 4 then
2020-05-15 16:52:35 +08:00
this.GuildDeathPosShow()
2021-04-27 13:48:17 +08:00
elseif compShowType == 6 then
2020-08-20 20:05:38 +08:00
this.GuildTranscriptShow()
2021-04-27 13:48:17 +08:00
elseif compShowType == 7 then--踏碎凌霄
this.TaSuiLingXiaoShow()
2021-05-13 09:56:11 +08:00
elseif compShowType == 8 then--山河社稷图
this.FightLevelShow()
2021-09-10 18:36:39 +08:00
elseif compShowType == 10 then--七界试炼
this.QiJieShow()
2022-04-25 18:20:53 +08:00
elseif compShowType==12 then --挑战副本
this.ChallengeCopyShow()
elseif compShowType == CompShowType.fourElement then
this.ShengYingShow(args[8])
2020-08-20 20:05:38 +08:00
end
--如果没有掉落就return
if not drop or (#drop.itemlist < 1 and #drop.equipId < 1 and #drop.Hero < 1 and #drop.soulEquip < 1 and #drop.pokemon < 1) then
2021-04-27 13:48:17 +08:00
return
2021-04-25 15:07:36 +08:00
end
2021-03-11 17:35:04 +08:00
2020-05-09 13:31:21 +08:00
local starItemDataList=BagManager.GetItemListFromTempBag(drop)
2020-05-15 16:52:35 +08:00
-- LogError("获取宝物的数量:".. LengthOfTable(starItemDataList))
2020-05-09 13:31:21 +08:00
--做装备叠加特殊组拼数据
local equips = {}
for i = 1, #starItemDataList do
this.SetItemData2(starItemDataList[i])
if starItemDataList[i].itemType == 2 then--装备叠加
if equips[starItemDataList[i].sId] then
equips[starItemDataList[i].sId].num = equips[starItemDataList[i].sId].num + 1
else
equips[starItemDataList[i].sId] = starItemDataList[i]
equips[starItemDataList[i].sId].num = 1
end
end
end
CheckRedPointStatus(RedPointType.Huaxutan_CompoundHero)
2020-05-09 13:31:21 +08:00
itemDataList = {}
for i, v in pairs(equips) do
table.insert(itemDataList, v)
end
for i, v in pairs(starItemDataList) do
if starItemDataList[i].itemType ~= 2 then
table.insert(itemDataList, v)
end
end
2021-04-27 13:48:17 +08:00
this.InitGrid()
2020-05-09 13:31:21 +08:00
if #itemDataList < 1 then
self:ClosePanel()
self:SelectCanPopUpBagMaxMessage()
2021-04-25 17:40:49 +08:00
else
2020-05-09 13:31:21 +08:00
self:SetItemShow(drop)
end
2021-04-27 13:48:17 +08:00
this.SetComPShowState(compShowType)--一些特殊显隐
2020-05-09 13:31:21 +08:00
SoundManager.PlaySound(SoundConfig.Sound_Reward)
this.ShowLvAndExp()
self:SelectCanPopUpBagMaxMessage()
end
2021-04-27 13:48:17 +08:00
function this.InitGrid()
2021-04-27 20:48:45 +08:00
this.dropGrid:SetActive(#itemDataList <= 25 )
this.dropGridArena:SetActive(#itemDataList > 25 )
for i = 1, #itemListPrefab do
itemListPrefab[i].gameObject:SetActive(false)
end
if #itemDataList <= 25 then
2021-04-27 13:48:17 +08:00
for i = 1, #itemDataList do --初始缓存<= 20
2021-04-27 20:48:45 +08:00
if not itemListPrefab[i] then
local view = SubUIManager.Open(SubUIConfig.ItemView, this.dropGrid.transform)
view.gameObject.name = "frame"..i
itemListPrefab[i] = view
end
2021-04-27 13:48:17 +08:00
end
else
for i = 1, #itemDataList do --初始缓存> 20
2021-04-27 20:48:45 +08:00
if not itemListPrefab[i] then
local view = SubUIManager.Open(SubUIConfig.ItemView, this.dropGrid2.transform)
view.gameObject.name = "frame"..i
itemListPrefab[i] = view
end
2021-04-27 13:48:17 +08:00
end
end
end
2020-05-09 13:31:21 +08:00
--一些元素的显隐
function this.SetComPShowState(type)
this.btnBack:GetComponent("Button").enabled = type ~= 2
2021-04-25 17:40:49 +08:00
this.ScrollView:SetActive(#itemDataList >= 1 )
2020-05-09 13:31:21 +08:00
this.lvAndExpGo:SetActive(type == 1)
2020-05-15 16:52:35 +08:00
this.guildCarDelay:SetActive(type == 3)
this.guildDeathPos:SetActive(type == 4)
2020-08-20 20:05:38 +08:00
this.guildTranscript:SetActive(type == 6)
2021-04-25 17:40:49 +08:00
this.tasuilingxiao:SetActive(type == 7)
2021-04-27 21:28:48 +08:00
if type == 7 then
this.noRewardText:SetActive(#itemDataList < 1)
end
2020-05-15 16:52:35 +08:00
end
2021-02-26 17:44:13 +08:00
function this.ShengYingShow(propertyId)
this.ScrollView.gameObject:SetActive(false)
this.dropPrefab.gameObject:SetActive(false)
this.shenying.gameObject:SetActive(true)
2021-03-10 17:31:40 +08:00
LogGreen("propertyId:"..propertyId)
2021-02-26 17:44:13 +08:00
this.shenyingTxt.text = ConfigManager.GetConfigData(ConfigName.PropertyConfig,propertyId).Info
end
2020-05-15 16:52:35 +08:00
function this.GuildCarDelayShow()
if GuildCarDelayManager.score and GuildCarDelayManager.hurt then
2022-03-10 18:17:44 +08:00
this.guildCarDelaysoreNum.text = PrintWanNum3(GuildCarDelayManager.score)
2022-03-10 18:20:35 +08:00
this.guildCarDelayhurtNum.text = PrintWanNum3(GuildCarDelayManager.hurt)
2020-05-15 16:52:35 +08:00
end
2020-05-09 13:31:21 +08:00
end
2020-05-15 16:52:35 +08:00
--十绝阵 挑战奖励掉落弹窗表现
function this.GuildDeathPosShow()
if DeathPosManager.damage and DeathPosManager.historyMax then
this.guildDeathPos_CurScore.text =DeathPosManager.damage
this.guildDeathPos_MaxScore.text = DeathPosManager.historyMax
2020-05-09 13:31:21 +08:00
2020-05-15 16:52:35 +08:00
local b=DeathPosManager.damage>DeathPosManager.historyMax or DeathPosManager.damage<DeathPosManager.historyMax
this.guildDeathPos_State.gameObject:SetActive(b)
if DeathPosManager.damage>DeathPosManager.historyMax then
2021-04-21 13:12:04 +08:00
this.guildDeathPos_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlishangsheng_png")
2020-05-15 16:52:35 +08:00
elseif DeathPosManager.damage<DeathPosManager.historyMax then
2021-04-21 13:12:04 +08:00
this.guildDeathPos_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlixiajiang_png")
2021-04-25 15:07:36 +08:00
end
end
end
--踏碎凌霄 挑战奖励掉落弹窗表现
2021-04-27 13:48:17 +08:00
function this.TaSuiLingXiaoShow()
2021-04-25 15:07:36 +08:00
if CommonActPageManager.TaSuiLingXiaoMsg then
local curDmg = CommonActPageManager.TaSuiLingXiaoMsg.damageVal
2021-04-26 16:46:03 +08:00
local maxDmg = CommonActPageManager.TaSuiLingXiaoHistoryDmg
2021-04-25 17:40:49 +08:00
this.tasuilingxiao_CurScore.text = curDmg
this.tasuilingxiao_MaxScore.text = maxDmg
2021-04-27 21:28:48 +08:00
this.noRewardText:SetActive(true)
2021-04-25 15:07:36 +08:00
local b = curDmg > maxDmg or curDmg < maxDmg
2021-04-25 17:40:49 +08:00
this.tasuilingxiao_State.gameObject:SetActive(b)
2021-04-25 15:07:36 +08:00
if curDmg > maxDmg then
this.tasuilingxiao_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlishangsheng_png")
2021-04-25 15:07:36 +08:00
elseif curDmg < maxDmg then
this.tasuilingxiao_State.sprite=this.spLoader:LoadSprite("r_hero_zhanlixiajiang_png")
2020-05-15 16:52:35 +08:00
end
end
end
2021-05-13 09:56:11 +08:00
--山河社稷图
function this.FightLevelShow()
2021-09-17 14:38:05 +08:00
2021-05-28 13:48:43 +08:00
local HardStageFightResponseMsg = FightLevelManager.GetHardStageFightResponseMsg()
local oldBattlefightLevelData = FightLevelManager.GetcurBattlefightLevelData()
local curBattlefightLevelData = FightLevelManager.GetChapterLevelData(oldBattlefightLevelData.config.Chapter,oldBattlefightLevelData.nodeId)
local condition = curBattlefightLevelData.config.ConditionValue or {}
2021-05-28 13:48:43 +08:00
this.isFirstEffect:SetActive(HardStageFightResponseMsg.currentIsHonour)
2021-05-27 20:17:53 +08:00
if starListEffect and #starListEffect > 0 then
for i=1,#starListEffect do
Util.SetParticleSortLayer(starListEffect[i], this.sortingOrder + 1)
2021-05-27 20:17:53 +08:00
end
end
for i = 1, math.max(#condition, #conditionGo) do
local go = conditionGo[i]
if not go then
go = newObject(this.conditionGo[1])
go.transform:SetParent(this.Root.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
conditionGo[i] = go
end
go.gameObject:SetActive(false)
end
for i, v in pairs(condition) do
conditionGo[i]:SetActive(true)
local noStarImage = Util.GetGameObject(conditionGo[i], "noStarImage")
local getStarImage = Util.GetGameObject(conditionGo[i], "getStarImage")
local isShowStar = FightLevelManager.GetCurLevelStarState(curBattlefightLevelData.state,i)
noStarImage:SetActive(not isShowStar)
getStarImage:SetActive(isShowStar)
Util.GetGameObject(conditionGo[i], "Text"):GetComponent("Text").text = i
if isShowStar then
Util.GetGameObject(conditionGo[i], "infolText"):GetComponent("Text").text = string.format("<color=#00FF06>%s</color>",HardStageCondition[v].Describe)
else
Util.GetGameObject(conditionGo[i], "infolText"):GetComponent("Text").text = string.format("<color=#FDEBC2>%s</color>",HardStageCondition[v].Describe)
end
2021-05-13 09:56:11 +08:00
end
end
2020-08-20 20:05:38 +08:00
--公会副本
function this.GuildTranscriptShow()
if GuildTranscriptManager.damage then
this.guildTranscript_CurScore.text = GuildTranscriptManager.damage
end
end
2021-09-10 18:36:39 +08:00
--七界试炼挑战条件信息
function this.QiJieShow()
local data = QiJieShiLianManager.GetBattleResult()
for i = 1, 3 do
Util.GetGameObject(this.qiJieCondition,"Text ("..i..")"):GetComponent("Text").text = data[i]
end
end
2022-04-25 18:20:53 +08:00
--挑战副本显示信息
function this.ChallengeCopyShow()
local data = CarbonManager.GetBattleResult()
for i = 1, 3 do
Util.GetGameObject(this.qiJieCondition,"Text ("..i..")"):GetComponent("Text").text = data[i]
end
end
2020-05-09 13:31:21 +08:00
--当前背包是否已满
function RewardItemPopup:SelectCanPopUpBagMaxMessage()
if(IndicationManager.canPopUpBagMaxMessage) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11507])
2020-05-09 13:31:21 +08:00
IndicationManager.canPopUpBagMaxMessage=false
elseif(IndicationManager.getRewardFromMailMessage)then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11508])
2020-05-09 13:31:21 +08:00
IndicationManager.getRewardFromMailMessage=false
end
end
function RewardItemPopup:OnSortingOrderChange()
2021-04-27 17:50:26 +08:00
if not itemDataList or #itemDataList < 0 then
2020-05-09 13:31:21 +08:00
return
end
2021-04-27 16:46:39 +08:00
if #itemListPrefab > 0 then
for i = 1, #itemListPrefab do
2021-04-27 17:50:26 +08:00
if itemListPrefab[i] and itemDataList[i] then
2021-04-27 16:46:39 +08:00
local view = itemListPrefab[i]
local curItemData=itemDataList[i]
2021-04-27 20:48:45 +08:00
view:SetEffectLayer(self.sortingOrder)
2021-04-27 16:46:39 +08:00
end
end
2020-05-09 13:31:21 +08:00
end
2021-05-27 20:17:53 +08:00
if starListEffect and #starListEffect > 0 then
for i=1,#starListEffect do
Util.SetParticleSortLayer(starListEffect[i], self.sortingOrder + 1)
2021-05-27 20:17:53 +08:00
end
sortingOrder = self.sortingOrder
end
2020-05-09 13:31:21 +08:00
end
-- 根据物品列表数据显示物品
function RewardItemPopup:SetItemShow(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)
2021-09-17 14:38:05 +08:00
2021-04-27 20:48:45 +08:00
if #itemDataList <= 25 then
callList:Clear()
2020-05-09 13:31:21 +08:00
callList:Push(function ()
2021-04-27 20:48:45 +08:00
if isOpenGeiSSRAvtivityTime then
isOpenGeiSSRAvtivityTime:Stop()
isOpenGeiSSRAvtivityTime = nil
2020-05-09 13:31:21 +08:00
end
2021-04-27 20:48:45 +08:00
isOpenGeiSSRAvtivityTime = Timer.New(function ()
isPlayerAniEnd = true
if isOpenGeiSSRAvtivity > 0 then
HeroManager.DetectionOpenFiveStarActivity(isOpenGeiSSRAvtivity)
end
end, 0.5):Start()
--在关卡界面获得装备 刷新下btview成员红点
2020-05-09 13:31:21 +08:00
end)
2021-04-27 20:48:45 +08:00
for i = #itemDataList, 1, -1 do
isPlayerAniEnd = false
local view = itemListPrefab[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)
--改为后端更新
Timer.New(function ()
isPopGetSSR = false
callList:Pop()()
end, 0.05):Start()
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--皮肤 坐骑
func()
else
func()
end
end)
end
callList:Pop()()
else
for i = 1, #itemDataList do
local view = itemListPrefab[i]
local curItemData=itemDataList[i]
view:OnOpen(true,curItemData,1.15,true,true,false,self.sortingOrder)
view.gameObject:SetActive(true)
end
2020-05-09 13:31:21 +08:00
end
2021-04-27 20:48:45 +08:00
2020-05-09 13:31:21 +08:00
end
--存储本地
function this.SetItemData2(itemdata)
if itemdata.itemType==1 then
--后端更新
elseif itemdata.itemType==2 then
if bagType==1 then
EquipManager.UpdateEquipData(itemdata.backData)
elseif bagType==2 then
EquipManager.InitMapShotTimeEquipBagData(itemdata.backData)
end
elseif itemdata.itemType==3 then
if bagType==1 then
HeroManager.UpdateHeroDatas(itemdata.backData)
elseif bagType==2 then
HeroManager.InitMapShotTimeHeroBagData(itemdata.backData)
end
elseif itemdata.itemType==4 then
if bagType==1 then
TalismanManager.InitUpdateSingleTalismanData(itemdata.backData)
elseif bagType==2 then
TalismanManager.InitMapShotTimeTalismanBagData(itemdata.backData)
end
elseif itemdata.itemType==5 then
if bagType==1 then
EquipTreasureManager.InitSingleTreasureData(itemdata.backData)
elseif bagType==2 then
end
elseif itemdata.itemType==6 then
if bagType==1 then
PokemonManager.UpdatePokemonDatas(itemdata.backData,true)
elseif bagType==2 then
end
2020-05-09 13:31:21 +08:00
end
end
--关卡通关掉落时展示经验等级信息
function this.ShowLvAndExp()
if compShowType == 1 then
2021-04-27 13:48:17 +08:00
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)
2020-05-09 13:31:21 +08:00
end
end
--掉落物品排序
function RewardItemPopup:ItemDataListSort(itemDataList)
table.sort(itemDataList, function(a, b)
if a.itemConfig.Quantity == b.itemConfig.Quantity then
if a.itemConfig.ItemType == b.itemConfig.ItemType then
return a.itemConfig.Id < b.itemConfig.Id
else
return a.itemConfig.ItemType < b.itemConfig.ItemType
end
else
return a.itemConfig.Quantity > b.itemConfig.Quantity
end
end)
end
--界面关闭时调用(用于子类重写)
function RewardItemPopup:OnClose()
2021-02-26 17:44:13 +08:00
if compShowType == CompShowType.fourElement then
2021-03-15 15:21:28 +08:00
compShowType = 0
2021-02-26 17:44:13 +08:00
return
end
BagManager.SetDropIsSHowEquipPrint(true)
2020-05-09 13:31:21 +08:00
local fightConFigData = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, FightPointPassManager.curOpenFight)
if compShowType == 1 then
compShowType = 0
if FightPointPassManager.oldLevel<PlayerManager.level then
if fightConFigData and fightConFigData.PicShow == 1 and FightPointPassManager.isOpenNewChapter then
UIManager.OpenPanel(UIName.FightEndLvUpPanel,FightPointPassManager.oldLevel,PlayerManager.level,function ()
2021-01-06 16:12:54 +08:00
func(isBackBattle)
2020-05-09 13:31:21 +08:00
end)
else
UIManager.OpenPanel(UIName.FightEndLvUpPanel,FightPointPassManager.oldLevel,PlayerManager.level,func)
end
return
end
end
2021-03-15 15:21:28 +08:00
2020-05-09 13:31:21 +08:00
compShowType = 0
if func and not isPopGetSSR then
if fightConFigData and fightConFigData.PicShow == 1 and FightPointPassManager.isOpenNewChapter then
2021-01-06 16:12:54 +08:00
func(isBackBattle)
2020-05-09 13:31:21 +08:00
else
2021-01-06 16:12:54 +08:00
func(isBackBattle)
2020-05-09 13:31:21 +08:00
end
end
-- 展示完以后结束章节解锁状态
FightPointPassManager.isOpenNewChapter = false
if isOpenGeiSSRAvtivityTime then
isOpenGeiSSRAvtivityTime:Stop()
isOpenGeiSSRAvtivityTime = nil
end
self:RedCheckFuns()
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData)
end
--一些等到物品后的红点检测
function RewardItemPopup:RedCheckFuns()
2020-06-13 11:47:13 +08:00
--检测是否需要弹每日任务飘窗
TaskManager.RefreshShowDailyMissionTipPanel()
-- 检测月卡激活是否需要拍脸
MonthCardManager.CheckMonthCardPatFace()
--寻宝迷踪红点检测
2021-09-16 16:52:22 +08:00
CheckRedPointStatus(RedPointType.XunBaoMiZong)
CheckRedPointStatus(RedPointType.Gem)
CheckRedPointStatus(RedPointType.HomeLand)
2022-01-17 10:53:06 +08:00
CheckRedPointStatus(RedPointType.Practice_upgrade)
2021-04-27 20:48:45 +08:00
end
2021-04-27 20:48:45 +08:00
--界面销毁时调用(用于子类重写)
function RewardItemPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2021-04-27 16:37:03 +08:00
if #itemListPrefab > 0 then
for i = 1, #itemListPrefab do
destroy(itemListPrefab[i].gameObject)
end
2021-04-27 13:48:17 +08:00
end
itemListPrefab = {}
2021-04-27 16:37:03 +08:00
itemDataList = {}
2020-05-09 13:31:21 +08:00
end
2021-08-26 17:25:02 +08:00
2020-06-23 18:36:24 +08:00
return RewardItemPopup