662 lines
32 KiB
Lua
662 lines
32 KiB
Lua
require("Base/BasePanel")
|
||
RewardItemSingleShowPopup = Inherit(BasePanel)
|
||
local this = RewardItemSingleShowPopup
|
||
local JumpConfig = ConfigManager.GetConfig(ConfigName.JumpConfig)
|
||
local RechargeCommodityConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||
local itemSid
|
||
local heroBackData
|
||
local itemConfigData
|
||
local itemNu = 0
|
||
local func
|
||
local armorType = 0
|
||
local lanTuData = {}
|
||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
local isNoShowSureBtn = false--外部界面调用此界面传的参数 ture 时不显示使用按钮 false 或者不传没影响
|
||
local isBagPanel = false
|
||
--初始化组件(用于子类重写)
|
||
function RewardItemSingleShowPopup:InitComponent()
|
||
this.spLoader = SpriteLoader.New()
|
||
|
||
this.BtnBack = Util.GetGameObject(self.transform, "bg/btnBack")
|
||
this.mask = Util.GetGameObject(self.transform, "mask")
|
||
|
||
this.topBar = Util.GetGameObject(self.transform, "bg/topBar")
|
||
this.infoBar = Util.GetGameObject(self.transform, "bg/infoBar")
|
||
this.infoBarTxt = Util.GetGameObject(self.transform, "bg/infoBar/Text"):GetComponent("Text")
|
||
this.itemPos = Util.GetGameObject(self.transform, "bg/topBar/armor/itemPos")
|
||
this.itemView = SubUIManager.Open(SubUIConfig.ItemView,this.itemPos.transform)
|
||
this.pos = Util.GetGameObject(self.transform, "bg/topBar/armor/pos")
|
||
this.posBgImage = Util.GetGameObject(this.pos, "posBg"):GetComponent("Image")
|
||
this.posIcon = Util.GetGameObject(this.pos, "PosImage"):GetComponent("Image")
|
||
this.posText = Util.GetGameObject(this.pos, "PosText"):GetComponent("Text")
|
||
this.armorType = Util.GetGameObject(self.transform, "bg/topBar/armor/info/armorType"):GetComponent("Text")
|
||
this.armorLanTuNum = Util.GetGameObject(self.transform, "bg/topBar/armor/info/armorLanTuNum"):GetComponent("Text")
|
||
this.checkHero = Util.GetGameObject(self.transform, "bg/topBar/armor/info/checkHero")
|
||
this.checkHeroText = Util.GetGameObject(this.checkHero, "Text"):GetComponent("Text")
|
||
|
||
this.info = Util.GetGameObject(self.transform, "bg/topBar/armor/info")
|
||
this.itemName = Util.GetGameObject(this.info, "name"):GetComponent("Text")
|
||
this.armorTitle = Util.GetGameObject(this.info, "armorTitle"):GetComponent("Text")
|
||
this.armorDesc = Util.GetGameObject(this.info, "armorDesc"):GetComponent("Text")
|
||
this.armorLock = Util.GetGameObject(this.info, "armorLock"):GetComponent("Text")
|
||
this.equipQuaText = Util.GetGameObject(self.transform, "bg/topBar/armor/equipQuaText"):GetComponent("Text")
|
||
this.armorInfo = Util.GetGameObject(self.transform, "bg/topBar/armorInfo")
|
||
this.armorInfoText = Util.GetGameObject(self.transform, "bg/topBar/armorInfo"):GetComponent("Text")
|
||
this.scroll = Util.GetGameObject(self.transform, "bg/midBar/scroll")
|
||
this.equipProGrid = Util.GetGameObject(self.transform, "bg/midBar/scroll/grid")
|
||
this.equipProGridCom = Util.GetGameObject(self.transform, "bg/midBar/scroll/grid"):GetComponent("VerticalLayoutGroup")
|
||
this.btnSure = Util.GetGameObject(self.transform, "bg/bottomBar/btnSure")
|
||
this.btnJump = Util.GetGameObject(self.transform, "bg/bottomBar/btnJump")
|
||
this.btnClose = Util.GetGameObject(self.transform, "bg/bottomBar/btnClose")
|
||
this.btnSureText = Util.GetGameObject(this.btnSure.transform, "Text"):GetComponent("Text")
|
||
this.helpBtn = Util.GetGameObject(self.transform, "bg/topBar/helpBtn")
|
||
|
||
end
|
||
|
||
--绑定事件(用于子类重写)
|
||
function RewardItemSingleShowPopup:BindEvent()
|
||
|
||
Util.AddClick(this.BtnBack, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 = false
|
||
self:ClosePanel()
|
||
end)
|
||
|
||
Util.AddClick(this.helpBtn, function()
|
||
UIManager.OpenPanel(UIName.ItemBoxDropPopup,itemConfigData.RewardGroup)
|
||
end)
|
||
Util.AddClick(this.mask, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 = false
|
||
self:ClosePanel()
|
||
end)
|
||
Util.AddClick(this.btnClose, function()
|
||
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
||
PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout2 = false
|
||
self:ClosePanel()
|
||
end)
|
||
Util.AddClick(this.checkHero, function()
|
||
if itemConfigData.ItemType == ItemType.HeroDebris or itemConfigData.ItemType == ItemType.LingShouChip then
|
||
if itemConfigData.RewardGroup then
|
||
local rg = ConfigManager.GetConfigData(ConfigName.RewardGroup, itemConfigData.RewardGroup[1])
|
||
if rg.ShowItem then
|
||
local id = rg.ShowItem[1][1]
|
||
if itemConfigData.ItemType == ItemType.HeroDebris then
|
||
local hero = ConfigManager.GetConfigData(ConfigName.HeroConfig, id)
|
||
local star =hero.MaxRank
|
||
UIManager.OpenPanel(UIName.RoleGetInfoPopup, false, id, star)
|
||
elseif itemConfigData.ItemType == ItemType.LingShouChip then
|
||
UIManager.OpenPanel(UIName.PokemonGetInfoPopup, false,id)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end)
|
||
|
||
Util.AddClick(this.btnSure, function()
|
||
if itemConfigData.UseLevel and itemConfigData.UseLevel > 0 and PlayerManager.level < itemConfigData.UseLevel then
|
||
PopupTipPanel.ShowTip(string.format("等级达%s后可以使用", itemConfigData.UseLevel))
|
||
return
|
||
end
|
||
if itemConfigData.ItemType == ItemType.HeroDebris
|
||
or itemConfigData.ItemType==ItemType.likeabilityItemChip
|
||
or itemConfigData.ItemType==ItemType.EquipChip
|
||
or itemConfigData.ItemType==ItemType.CommonChip then
|
||
local gameSetting = ConfigManager.GetConfigData(ConfigName.GameSetting, 1)
|
||
local endHeroNum=gameSetting.HeroNumlimit-LengthOfTable(HeroManager.GetAllHeroDatas())
|
||
local sum = BagManager.GetItemCountById(itemSid) / BagManager.bagDatas[itemSid].itemConfig.UsePerCount
|
||
if sum >= 2 then
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
if endHeroNum > 0 then
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 3, _itemData, function()
|
||
func()
|
||
end)
|
||
else
|
||
PopupTipPanel.ShowTip(Language[12157])
|
||
end
|
||
elseif sum >= 1 and sum < 2 then
|
||
-- body
|
||
local compoundNum = 1
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
local item={}
|
||
item.itemId= _itemData.id
|
||
item.itemNum=compoundNum*_itemData.itemConfig.UsePerCount
|
||
if endHeroNum > 0 then
|
||
NetManager.HeroComposeRequest(item,function (drop)
|
||
this.SendBackCompoundReCallBack(drop)
|
||
end)
|
||
if compoundNum<=0 then
|
||
PopupTipPanel.ShowTip(Language[10183])
|
||
end
|
||
else
|
||
PopupTipPanel.ShowTip(Language[12157])
|
||
end
|
||
else
|
||
PopupTipPanel.ShowTip(Language[11509])
|
||
end
|
||
elseif itemConfigData.ItemType == ItemType.Blueprint then
|
||
if lanTuData and lanTuData[1] == true then
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 3, _itemData, function()
|
||
func()
|
||
end)
|
||
elseif lanTuData and lanTuData[1] == false and lanTuData[2] > 0 then
|
||
NetManager.GetWorkShopAvtiveLanTuRequest(lanTuData[2], 2, function()
|
||
--刷新工坊解锁蓝图数据
|
||
this.DeleteActiveLanTuData()
|
||
end)
|
||
end
|
||
elseif itemConfigData.ItemType == ItemType.Box
|
||
or itemConfigData.ItemType == ItemType.GMzck
|
||
or itemConfigData.ItemType == ItemType.GMBigZck
|
||
or itemConfigData.ItemType == ItemType.GMzcq
|
||
or itemConfigData.ItemType == ItemType.GMxck
|
||
or itemConfigData.ItemType == ItemType.GMxjk
|
||
or itemConfigData.ItemType == ItemType.GMxsZcq then
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
if itemConfig[itemSid].UseType ~= 2 then
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 4, _itemData, function()
|
||
func()
|
||
end)
|
||
end
|
||
elseif itemConfigData.ItemType == ItemType.ChangeName then
|
||
UIManager.OpenPanel(UIName.CreateNamePopup)
|
||
elseif itemConfigData.ItemType == ItemType.ReplaceCard then
|
||
UIManager.OpenPanel(UIName.HeroReplacePopup,itemConfigData.Id)
|
||
elseif itemConfigData.ItemType == ItemType.Skin then
|
||
local group = ConfigManager.GetConfigData(ConfigName.RewardGroup,tonumber(itemConfig[itemSid].ResolveReward)).ShowItem
|
||
MsgPanel.ShowTwo(string.format(Language[11510],group[1][2],GetLanguageStrById(itemConfig[group[1][1]].Name)),function()
|
||
end, function()
|
||
local curResolveAllItemList = {}
|
||
table.insert(curResolveAllItemList,{itemId = itemSid,itemNum = 1})
|
||
NetManager.UseAndPriceItemRequest(1,curResolveAllItemList,function (drop)
|
||
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1)
|
||
self:ClosePanel()
|
||
end)
|
||
end,Language[10731],Language[10732],Language[11511],false,"")
|
||
elseif itemConfigData.ItemType == ItemType.ZuoQiChip then
|
||
local sum = BagManager.GetItemCountById(itemSid) / BagManager.bagDatas[itemSid].itemConfig.UsePerCount
|
||
sum = math.floor(sum)
|
||
if sum >= 2 then
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 3, _itemData, function()
|
||
func()
|
||
end)
|
||
elseif sum >= 1 then
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
local item={}
|
||
item.itemId= _itemData.id
|
||
item.itemNum= sum * _itemData.itemConfig.UsePerCount
|
||
NetManager.HeroComposeRequest(item,function (drop)
|
||
this.SendBackCompoundReCallBack(drop)
|
||
end)
|
||
else
|
||
PopupTipPanel.ShowTip("碎片不足,无法合成坐骑。")
|
||
end
|
||
elseif itemConfigData.ItemType == ItemType.TimeIsGold then -- 挂机时长奖励
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 4, _itemData, function()
|
||
func()
|
||
end)
|
||
else
|
||
local _itemData = BagManager.bagDatas[itemSid]
|
||
UIManager.OpenPanel(UIName.BagResolveAnCompoundPanel, 3, _itemData, function()
|
||
func()
|
||
end)
|
||
end
|
||
end)
|
||
Util.AddClick(this.btnJump, function()
|
||
if itemConfigData.ItemType == ItemType.Skin then
|
||
local skinConfig = ConfigManager.GetConfigData(ConfigName.HeroSkin,itemSid)
|
||
local have,overtime = HeroSkinManager.IsExist(skinConfig.Type)
|
||
if have then
|
||
if overtime < 0 then
|
||
PopupTipPanel.ShowTip(Language[12169])
|
||
else
|
||
PopupTipPanel.ShowTip(Language[11512])
|
||
end
|
||
else
|
||
local curResolveAllItemList = {}
|
||
table.insert(curResolveAllItemList,{itemId = itemSid,itemNum = 1})
|
||
NetManager.UseAndPriceItemRequest(0,curResolveAllItemList,function (drop)
|
||
self:ClosePanel()
|
||
if HeroManager.GetCurHeroIsHaveBySid(skinConfig.HeroId) then
|
||
MsgPanel.ShowTwo(string.format(Language[11513],GetLanguageStrById(skinConfig.ReadingName)),function() end,function()
|
||
local herodata = HeroManager.GetHeroDataByHeroSIdAndMinSortIdAndSkinId(skinConfig.HeroId,skinConfig.Type)
|
||
--LogGreen("herodata.dynamicId:"..tostring(herodata.dynamicId))
|
||
UIManager.OpenPanel(UIName.RoleInfoPanel,herodata, HeroManager.GetAllHeroDatas(),true,RoleInfoPanelIndex.pifu)
|
||
end,Language[10731],Language[10732],"",false,"")
|
||
else
|
||
PopupTipPanel.ShowTip(string.format(Language[11514],GetLanguageStrById(skinConfig.ReadingName)))
|
||
end
|
||
end)
|
||
end
|
||
elseif itemConfigData.ItemType == ItemType.HeadFrame then
|
||
HeadManager.GetCurFrameId()
|
||
local theFrameData = HeadManager.GetSingleFrame(itemSid)
|
||
if theFrameData then
|
||
MsgPanel.ShowTwo(Language[12170],nil,function()
|
||
NetManager.UseHeadFrameRequestFun(itemSid,function (msg)
|
||
HeadManager.SetSineleHeadFrameAllData(itemSid,msg.validTime)
|
||
self:ClosePanel()
|
||
PopupTipPanel.ShowTip(Language[12171])
|
||
end)
|
||
end)
|
||
else
|
||
NetManager.UseHeadFrameRequestFun(itemSid,function (msg)
|
||
HeadManager.SetSineleHeadFrameAllData(itemSid,msg.validTime)
|
||
self:ClosePanel()
|
||
PopupTipPanel.ShowTip(Language[12171])
|
||
end)
|
||
end
|
||
-- elseif itemConfigData.ItemType == ItemType.Ride then
|
||
-- local oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||
-- if PlayerManager.userMountList[itemConfigData.Id] then
|
||
-- MsgPanel.ShowTwo(Language[12254],nil,function()
|
||
-- NetManager.ActiveUserMountRequest(itemSid,function (msg)
|
||
-- PlayerManager.SetPlayerMountTime(itemSid,msg.validTime)
|
||
-- self:ClosePanel()
|
||
-- PopupTipPanel.ShowTip(Language[12255])
|
||
-- this.WarPowerChange(oldPowerNum,PowerChangeJumpType.ride)
|
||
-- -- 设置新坐骑
|
||
-- PlayerSetTitleRideSkinManager.SetNewRide(itemConfigData.Id)
|
||
-- end)
|
||
-- end)
|
||
-- else
|
||
-- NetManager.ActiveUserMountRequest(itemSid,function (msg)
|
||
-- PlayerManager.SetPlayerMountTime(itemSid,msg.validTime)
|
||
-- self:ClosePanel()
|
||
-- PopupTipPanel.ShowTip(Language[12255])
|
||
-- this.WarPowerChange(oldPowerNum,PowerChangeJumpType.ride)
|
||
-- -- 设置新坐骑
|
||
-- PlayerSetTitleRideSkinManager.SetNewRide(itemConfigData.Id)
|
||
-- end)
|
||
-- end
|
||
elseif itemConfigData.ItemType == ItemType.Title then
|
||
local oldPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||
if PlayerManager.userTitleList[itemConfigData.Id] then
|
||
MsgPanel.ShowTwo(Language[12307],nil,function()
|
||
NetManager.ActiveUserTitleRequest(itemSid,function (msg)
|
||
PlayerManager.SetPlayerTitleTime(itemSid,msg.validTime)
|
||
self:ClosePanel()
|
||
PopupTipPanel.ShowTip(Language[12308])
|
||
this.WarPowerChange(oldPowerNum,PowerChangeJumpType.title)
|
||
end)
|
||
end)
|
||
else
|
||
NetManager.ActiveUserTitleRequest(itemSid,function (msg)
|
||
PlayerManager.SetPlayerTitleTime(itemSid,msg.validTime)
|
||
self:ClosePanel()
|
||
PopupTipPanel.ShowTip(Language[12308])
|
||
this.WarPowerChange(oldPowerNum,PowerChangeJumpType.title)
|
||
end)
|
||
end
|
||
elseif itemConfigData then
|
||
JumpManager.GoJump(itemConfigData.UseJump,function ()
|
||
Log("UseJump:"..tostring(itemConfigData.UseJump))
|
||
this:ClosePanel()
|
||
end)
|
||
end
|
||
end)
|
||
end
|
||
|
||
local callBackFun
|
||
function this.SendBackCompoundReCallBack(drop)
|
||
--this:ClosePanel()
|
||
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function ()
|
||
--UIManager.OpenPanel(UIName.BagPanel)
|
||
-- if callBackFun then
|
||
-- callBackFun()
|
||
func()
|
||
-- end
|
||
end,nil,nil,nil,true)
|
||
--改为后端刷新了
|
||
--BagManager.UpdateItemsNum(itemData.id,compoundNum*itemData.itemConfig.UsePerCount)
|
||
end
|
||
|
||
|
||
--扣除解锁蓝图材料 并数据
|
||
function this.DeleteActiveLanTuData()
|
||
PopupTipPanel.ShowTip(Language[11515] .. GetLanguageStrById(itemConfigData.Name))
|
||
if lanTuData and lanTuData[1] == false and lanTuData[2] > 0 then
|
||
WorkShopManager.UpdataWorkShopLanTuActiveState(2, lanTuData[2], itemConfigData.Id)--
|
||
end
|
||
if func then
|
||
func()
|
||
end
|
||
this:ClosePanel()
|
||
end
|
||
|
||
--添加事件监听(用于子类重写)
|
||
function RewardItemSingleShowPopup:AddListener()
|
||
|
||
end
|
||
|
||
--移除事件监听(用于子类重写)
|
||
function RewardItemSingleShowPopup:RemoveListener()
|
||
|
||
end
|
||
|
||
--界面打开时调用(用于子类重写)
|
||
function RewardItemSingleShowPopup:OnOpen(...)
|
||
|
||
itemNu = 0
|
||
local data = { ... }
|
||
itemSid = data[1]
|
||
itemConfigData = ConfigManager.GetConfigData(ConfigName.ItemConfig, itemSid)
|
||
this.isRewardItemPop=data[3]
|
||
if data[2] then
|
||
func = data[2]
|
||
end
|
||
isNoShowSureBtn = data[4] and data[4] or false
|
||
end
|
||
function RewardItemSingleShowPopup:OnShow()
|
||
isBagPanel = BagManager.isBagPanel
|
||
this.helpBtn.gameObject:SetActive(false)
|
||
this.itemName.text = GetStringByEquipQua(itemConfigData.Quantity, GetLanguageStrById(itemConfigData.Name))
|
||
this.topBar:GetComponent("Image").sprite = self.spLoader:LoadSprite("t_tongyong_di_"..itemConfigData.Quantity)
|
||
--判断自选宝箱界面是否开启
|
||
if itemConfigData.ItemType==ItemType.Incarnation or itemConfigData.ItemType==ItemType.CommonChip then
|
||
local skillId=0
|
||
if itemConfigData.ItemType==ItemType.CommonChip then
|
||
if itemConfigData.RewardGroup then
|
||
local reward=ConfigManager.GetConfigData(ConfigName.RewardGroup,itemConfigData.RewardGroup[1])
|
||
if reward then
|
||
local config=ConfigManager.TryGetConfigDataByKey(ConfigName.ChangingCard,"CardId",reward.ShowItem[1][1])
|
||
if config then
|
||
skillId=config.Id
|
||
end
|
||
end
|
||
end
|
||
elseif itemConfigData.ItemType==ItemType.Incarnation then
|
||
local config=ConfigManager.GetConfigDataByKey(ConfigName.ChangingCard,"CardId",itemConfigData.Id)
|
||
skillId=config.Id
|
||
end
|
||
if skillId~=0 then
|
||
this.infoBar:SetActive(true)
|
||
this.infoBarTxt.text="变身卡技能:"..IncarnationManager.GetSkillDesStr(skillId,5)
|
||
else
|
||
this.infoBar:SetActive(false)
|
||
end
|
||
else
|
||
this.infoBar:SetActive(false)
|
||
end
|
||
local isBoxOpen = UIManager.IsOpen(314)
|
||
if isBagPanel and isBoxOpen then
|
||
this.btnSure:SetActive(false)
|
||
elseif isBagPanel and itemConfigData.IfResolve == 1 and func then--是否可分解
|
||
this.btnSure:SetActive(true)
|
||
this.btnSureText.text = Language[10197]
|
||
elseif isBagPanel and func --是否是碎片可合成
|
||
and (itemConfigData.ItemType == ItemType.HeroDebris
|
||
or itemConfigData.ItemType == ItemType.ZuoQiChip
|
||
or itemConfigData.ItemType == ItemType.likeabilityItemChip
|
||
or itemConfigData.ItemType == ItemType.EquipChip
|
||
or itemConfigData.ItemType == ItemType.CommonChip
|
||
)
|
||
then
|
||
this.btnSureText.text = Language[10193]
|
||
this.btnSure:SetActive(true)
|
||
elseif isBagPanel and func and
|
||
(itemConfigData.ItemType == ItemType.GMzck
|
||
or itemConfigData.ItemType == ItemType.GMBigZck
|
||
or itemConfigData.ItemType == ItemType.GMzcq
|
||
or itemConfigData.ItemType == ItemType.GMxck
|
||
or itemConfigData.ItemType == ItemType.GMxsZcq
|
||
or itemConfigData.ItemType == ItemType.GMxjk
|
||
or itemConfigData.ItemType == ItemType.ReplaceCard)
|
||
then
|
||
this.btnSure:SetActive(true)
|
||
this.btnSureText.text = Language[10195]
|
||
elseif isBagPanel and itemConfigData.ItemType == ItemType.Box and func then
|
||
this.btnSure:SetActive(true)
|
||
this.btnSureText.text = Language[10195]
|
||
if itemConfigData.HeroStar and itemConfigData.HeroStar[1]==1 then
|
||
this.helpBtn.gameObject:SetActive(true)
|
||
end
|
||
elseif isBagPanel and itemConfigData.ItemType == ItemType.ChangeName and func then-- 改名卡
|
||
this.btnSure:SetActive(true)
|
||
this.btnSureText.text = Language[10195]
|
||
elseif isBagPanel and itemConfigData.ItemType == ItemType.TimeIsGold then -- 挂机奖励
|
||
this.btnSure:SetActive(true)
|
||
this.btnSureText.text = Language[10195]
|
||
elseif isBagPanel and itemConfigData.ItemType == ItemType.GodPrint then
|
||
this.btnSure:SetActive(false)
|
||
else
|
||
this.btnSure:SetActive(false)
|
||
this.btnSureText.text = Language[10197]
|
||
end
|
||
this.btnJump:SetActive(itemConfigData.UseJump and itemConfigData.UseJump > 0 and isBagPanel and not isNoShowSureBtn)
|
||
|
||
local creatJumpData = function(jumpDataList)
|
||
local jumpSortData = {}
|
||
if jumpDataList and #jumpDataList > 0 then
|
||
for i = 1, #jumpDataList do--为关卡跳转做的排序数据
|
||
local jumpData = {}
|
||
jumpData.id = jumpDataList[i]
|
||
jumpData.data = JumpConfig[jumpDataList[i]]
|
||
table.insert(jumpSortData,jumpData)
|
||
end
|
||
end
|
||
return jumpSortData
|
||
end
|
||
|
||
if this.jumpViewList and #this.jumpViewList > 0 then
|
||
for i = 1,#this.jumpViewList do
|
||
SubUIManager.Close(this.jumpViewList[i])
|
||
end
|
||
end
|
||
this.jumpViewList = {}
|
||
|
||
if PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout then
|
||
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,itemConfigData.Id)
|
||
this.btnClose:SetActive(true)
|
||
this.btnJump:SetActive(false)
|
||
this.btnSure:SetActive(false)
|
||
this.equipQuaText.gameObject:SetActive(false)
|
||
this.pos.gameObject:SetActive(true)
|
||
this.posBgImage.sprite = this.spLoader:LoadSprite(GetHeroPosBgStr(heroConfig.Profession))
|
||
this.armorInfo.gameObject:SetActive(false)
|
||
this.armorTitle.gameObject:SetActive(true)
|
||
this.armorDesc.gameObject:SetActive(true)
|
||
this.armorTitle.text = string.format("<size=45><color=#FBCC99>%s</color></size>",itemConfigData.Name)
|
||
this.armorDesc.text = string.format("<size=37><color=#FFCC00>%s</color></size>",heroConfig.HeroLocationDesc1)
|
||
this.armorType.gameObject:SetActive(false)
|
||
this.armorLanTuNum.gameObject:SetActive(false)
|
||
this.posIcon.sprite =this.spLoader:LoadSprite(GetHeroPosStr(heroConfig.Profession))
|
||
this.posText.text=GetLanguageStrById(heroConfig.HeroLocation)
|
||
SetTextVerTial(this.posText.gameObject,Vector3.New(64,21,0),"MiddleLeft")
|
||
local jumpDataList = heroConfig.Jump
|
||
for i = 1, #jumpDataList do
|
||
if not RECHARGEABLE and (JumpConfig[jumpDataList[i]].Type == JumpType.firstRecharge or JumpConfig[jumpDataList[i]].Type == JumpType.ZhiZunJiangShi or JumpConfig[jumpDataList[i]].Type == JumpType.recharge) then--(是否开启充值)
|
||
else
|
||
local isShow = true
|
||
if JumpConfig[jumpDataList[i]].Type == JumpType.firstRecharge then
|
||
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FirstRecharge)
|
||
if id and id > 0 then
|
||
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",id)
|
||
for i = 1,#configs do
|
||
if configs[i].Reward[1][1] == heroConfig.Id then
|
||
local mission = ActivityGiftManager.GetActivityInfo(id, configs[i].Id)
|
||
if mission.state ~= 1 then
|
||
isShow = true
|
||
else
|
||
isShow = false
|
||
end
|
||
break
|
||
end
|
||
end
|
||
else
|
||
isShow = false
|
||
end
|
||
elseif JumpConfig[jumpDataList[i]].Type == JumpType.ZhiZunJiangShi then
|
||
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero)
|
||
if id and id > 0 then
|
||
if ActivityGiftManager.CheckSupremeMission(1,true)
|
||
and ActivityGiftManager.CheckSupremeMission(2,true)
|
||
and ActivityGiftManager.CheckSupremeMission(3,true)
|
||
and ActivityGiftManager.CheckSupremeMission(4,true)then
|
||
isShow = false
|
||
else
|
||
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero)
|
||
if endTime - PlayerManager.serverTime > 0 then
|
||
isShow = true
|
||
else
|
||
isShow = false
|
||
end
|
||
end
|
||
else
|
||
isShow = false
|
||
end
|
||
end
|
||
if isShow then
|
||
local tempView = SubUIManager.Open(SubUIConfig.JumpViewNew, this.equipProGrid.transform, jumpDataList[i],heroConfig,self)
|
||
table.insert(this.jumpViewList,tempView)
|
||
end
|
||
end
|
||
end
|
||
this.scroll:GetComponent("RectTransform").sizeDelta = Vector2.New(912.8,717.6)
|
||
-- this.equipProGridCom.spacing = 160
|
||
-- this.equipProGrid:GetComponent("RectTransform").sizeDelta = Vector2.New(807.7,this.equipProGridCom.spacing*(#jumpDataList))
|
||
else
|
||
this.btnClose:SetActive(false)
|
||
this.equipQuaText.gameObject:SetActive(true)
|
||
this.equipQuaText.text = GetStringByEquipQua(itemConfigData.Quantity, GetQuaStringByEquipQua(itemConfigData.Quantity))
|
||
this.pos.gameObject:SetActive(false)
|
||
this.armorInfo.gameObject:SetActive(true)
|
||
this.armorTitle.gameObject:SetActive(false)
|
||
this.armorDesc.gameObject:SetActive(false)
|
||
this.armorType.gameObject:SetActive(true)
|
||
this.armorLanTuNum.gameObject:SetActive(true)
|
||
this.armorType.text = this.getType()--道具类型显示
|
||
this.armorLanTuNum.text = Language[11516] .. BagManager.GetItemCountById(itemSid)
|
||
this.armorInfoText.text = string.gsub(GetLanguageStrById(itemConfigData.ItemDescribe), "\\n", "")
|
||
local jumpDataList = itemConfigData.Jump
|
||
local jumpSortData = creatJumpData(jumpDataList)
|
||
for i = 1, #jumpSortData do
|
||
if jumpSortData[i].id > 0 then
|
||
-- type 大于 10000为活动 直接显示按钮,如果小于1000 为功能 开启才显示
|
||
if JumpConfig[jumpSortData[i].id].Type >= 10000 or ActTimeCtrlManager.SingleFuncState(JumpConfig[jumpSortData[i].id].Type) then
|
||
local tempView = nil
|
||
-- if not ActTimeCtrlManager.SingleFuncState(JumpConfig[jumpSortData[i].id].Type) then break end
|
||
if not RECHARGEABLE then--(是否开启充值)
|
||
if this.isRewardItemPop == true or itemConfigData.Id == 61 or itemConfigData.Id == 19 or itemConfigData.ItemType == 17 then
|
||
tempView = SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false,self)
|
||
else
|
||
tempView = SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true,self)
|
||
end
|
||
else
|
||
if this.isRewardItemPop == true or itemConfigData.ItemType == 17 then
|
||
tempView = SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,false,self)
|
||
else
|
||
tempView = SubUIManager.Open(SubUIConfig.JumpView, this.equipProGrid.transform, jumpSortData[i].id,true,self)
|
||
end
|
||
end
|
||
if tempView then
|
||
table.insert(this.jumpViewList,tempView)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
this.scroll:GetComponent("RectTransform").sizeDelta = Vector2.New(912.8,600)
|
||
-- if jumpDataList and #jumpDataList then
|
||
-- this.equipProGrid:GetComponent("RectTransform").sizeDelta = Vector2.New(807.7,this.equipProGridCom.spacing*(#jumpDataList))
|
||
-- end
|
||
end
|
||
this.itemView:OnOpen(false, {itemConfigData.Id,0}, 1.1, false, false, false, self.sortingOrder)
|
||
|
||
if itemConfigData.RewardGroup then
|
||
local rg = ConfigManager.TryGetConfigData(ConfigName.RewardGroup, itemConfigData.RewardGroup[1])
|
||
if rg and rg.ShowItem and itemConfigData.ItemType == ItemType.HeroDebris then
|
||
this.checkHero:SetActive(true)
|
||
this.checkHeroText.text = "查看神将"
|
||
elseif rg and rg.ShowItem and itemConfigData.ItemType == ItemType.LingShouChip then
|
||
this.checkHero:SetActive(true)
|
||
this.checkHeroText.text = "查看灵兽"
|
||
else
|
||
this.checkHero:SetActive(false)
|
||
end
|
||
else
|
||
this.checkHero:SetActive(false)
|
||
end
|
||
-- 判断是否要显示等级限制
|
||
this.armorLock.gameObject:SetActive(false)
|
||
if itemConfigData.UseLevel and itemConfigData.UseLevel > 0 and PlayerManager.level < itemConfigData.UseLevel then
|
||
this.armorLock.gameObject:SetActive(true)
|
||
this.armorLock.text = string.format("<color=%s>等级达%s后可以使用</color>", UIColorStr.RED, itemConfigData.UseLevel)
|
||
end
|
||
ForceRebuildLayout(this.equipProGrid.transform)
|
||
end
|
||
|
||
--获取道具种类
|
||
function this.getType()
|
||
local type = itemConfig[itemSid].ItemBaseType
|
||
if type == 1 then
|
||
return Language[11089]..Language[11517]
|
||
elseif type == 2 then
|
||
return Language[11089]..Language[10201]
|
||
elseif type == 4 then
|
||
return Language[11089]..Language[11518]
|
||
elseif type == 5 then
|
||
return Language[11089]..Language[11519]
|
||
elseif type == 6 then
|
||
return Language[11089]..Language[11520]
|
||
elseif type == 7 then
|
||
return Language[11089]..Language[11521]
|
||
end
|
||
end
|
||
--为关卡跳转做的排序
|
||
function this.JumpSort(jumps)
|
||
table.sort(jumps, function(a, b)
|
||
if a.state == b.state then
|
||
if a.state == 2 and b.state == 2 then
|
||
return a.data.SortId > b.data.SortId
|
||
end
|
||
else
|
||
return a.state > b.state
|
||
end
|
||
end)
|
||
end
|
||
--道具 和 装备分解 发送请求后 回调
|
||
function this.SendBackResolveReCallBack(drop, curResolveAllItemList)
|
||
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1)
|
||
if func then
|
||
func()
|
||
end
|
||
this:ClosePanel()
|
||
end
|
||
--界面关闭时调用(用于子类重写)
|
||
function RewardItemSingleShowPopup:OnClose()
|
||
isBagPanel=false
|
||
PlayerManager.RewardItemSingleShowPopupIsRoleUpStarLayout = false
|
||
if this.jumpViewList and #this.jumpViewList > 0 then
|
||
for i = 1,#this.jumpViewList do
|
||
SubUIManager.Close(this.jumpViewList[i])
|
||
end
|
||
end
|
||
this.jumpViewList = {}
|
||
end
|
||
|
||
--界面销毁时调用(用于子类重写)
|
||
function RewardItemSingleShowPopup:OnDestroy()
|
||
SubUIManager.Close(this.itemView)
|
||
if this.jumpViewList and #this.jumpViewList > 0 then
|
||
for i = 1,#this.jumpViewList do
|
||
SubUIManager.Close(this.jumpViewList[i])
|
||
end
|
||
end
|
||
this.jumpViewList = {}
|
||
this.spLoader:Destroy()
|
||
|
||
end
|
||
function this.WarPowerChange(oldPowerNum,type)
|
||
-- 设置脏数据
|
||
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.PlayerExtra)
|
||
--
|
||
Game.GlobalEvent:DispatchEvent(GameEvent.Bag.OnBagShowWarPowerChange,oldPowerNum,type)
|
||
local newPowerNum = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
||
if oldPowerNum ~= newPowerNum then
|
||
UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldPowerNum,newValue = newPowerNum})
|
||
end
|
||
end
|
||
return RewardItemSingleShowPopup |