Branch_DNA
zhangjiannan 2025-08-21 19:26:08 +08:00
parent 919bb964b0
commit e654bc929a
10 changed files with 1568 additions and 0 deletions

View File

@ -0,0 +1,167 @@
require("Base/BasePanel")
SelectGiftListPopup = Inherit(BasePanel)
local this = SelectGiftListPopup
local curSelectSoulPrint = {}
local curSelectAllSoulPrintIds = {}
local curUpList={}
local targetSoulPrintSData = {}
local curIndex = 0
local openThisPanel
local equipSign = ConfigManager.GetConfig(ConfigName.EquipConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local curSelectGO
local isShowGou = false
local curSelectId=0
local itemType=0
--初始化组件(用于子类重写)
function SelectGiftListPopup:InitComponent()
this.spLoader = SpriteLoader.New()
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
this.BtnSure = Util.GetGameObject(self.transform, "btnSure")
this.btnSelect = Util.GetGameObject(self.transform, "btnSelect")
Util.GetGameObject(self.transform, "toggleGrid"):SetActive(false)
this.btnSelectImage = Util.GetGameObject(self.transform, "btnSelect/SelectImage")
this.cardPre = Util.GetGameObject(self.gameObject, "equipPre")
this.Scrollbar= Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar")
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,Util.GetGameObject(self.gameObject, "scroll").transform,
this.cardPre, this.Scrollbar, Vector2.New(927.5, 1010), 1, 5, Vector2.New(19.32,15))
this.ScrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(6.78, 27)
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
end
--绑定事件(用于子类重写)
function SelectGiftListPopup:BindEvent()
Util.AddClick(this.BtnBack, function()
self:ClosePanel()
end)
Util.AddClick(this.BtnSure, function()
self:ClosePanel()
openThisPanel.ShowTitleEquipData(nil,curSelectId,curIndex)
end)
end
--添加事件监听(用于子类重写)
function SelectGiftListPopup:AddListener()
end
--移除事件监听(用于子类重写)
function SelectGiftListPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
function SelectGiftListPopup:OnOpen(_openThisPanel,_curUpList,_curIndex,_targetSoulPrintSData,_itemType)
openThisPanel = _openThisPanel
itemType=_itemType
LogError("_curindex==========".._curIndex)
curSelectId = _curUpList[_curIndex]
curUpList = _curUpList
curIndex = _curIndex
targetSoulPrintSData = _targetSoulPrintSData
isShowGou = false
curSelectGO = nil
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function SelectGiftListPopup:OnShow()
this.OnShowData()
end
--检测list里面含有的id数量
function this.CheckListHaveNum(_list,_id)
local num=0
for i=1,#_list do
if _list[i]==_id then
num=num+1
end
end
return num
end
function this.OnShowData()
local bagData = BagManager.GetBagItemDataByItemType(itemType)
local list = {}
for i=1,#bagData do
--如果当前的物品已经全部上到英雄身上的就不显示
LogError("curSelectId=="..curSelectId.." bagData[i].id=="..bagData[i].id)
if curSelectId~=bagData[i].id and this.CheckListHaveNum(curUpList,bagData[i].id)>=bagData[i].num then
else
if targetSoulPrintSData.Star>0 then
if bagData[i].id == targetSoulPrintSData.Formula[1][1] then
table.insert(list,bagData[i])
end
else
if bagData[i].quality == targetSoulPrintSData.Formula[1][1] then
table.insert(list,bagData[i])
end
end
end
end
table.sort(list, function(a,b) return a.id < b.id end)
this.ScrollView:SetData(list, function (index, go)
this.SingleItemDataShow(go,list[index])
end)
this.ShowSUreBtnState()
end
function this.SingleItemDataShow(_go,curBagSoulPrintData)
local curequipSign = equipSign[curBagSoulPrintData.id]
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(curequipSign.Quality))
local icon=Util.GetGameObject(_go.transform,"icon"):GetComponent("Image")
icon.sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[curBagSoulPrintData.id].ResourceID))
icon.gameObject:SetActive(true)
Util.GetGameObject(_go.transform,"circleFrameBg"):SetActive(false)
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text = SubString2(string.gsub(GetLanguageStrById(curequipSign.Name),Language[11520],"",1), 10)
local numTxt=Util.GetGameObject(_go.transform,"num"):GetComponent("Text")
numTxt.text=curBagSoulPrintData.num
Util.GetGameObject(_go.transform, "Hero"):SetActive(false)
local curheroData = {}
local choosed =Util.GetGameObject(_go.transform, "choosed")
local starPar =Util.GetGameObject(_go.transform, "star")
SetHeroStars(this.spLoader,starPar,curequipSign.Star,1,nil,-15)
choosed:SetActive(curSelectId == curBagSoulPrintData.id and not isShowGou)
--local redPoint = Util.GetGameObject(_go.transform,"redPoint")
if curSelectId == curBagSoulPrintData.id and not isShowGou then
curSelectGO = _go
isShowGou = true
end
Util.AddLongPressClick(Util.GetGameObject(_go.transform,"frame"), function()
UIManager.OpenPanel(UIName.SoulPrintPopUp,0,nil,curBagSoulPrintData.id,nil,nil)
end, 0.5)
Util.AddOnceClick(Util.GetGameObject(_go.transform,"frame"), function()
this.SoulPrintClickShow(curequipSign,choosed,_go)
end)
end
function this.SoulPrintClickShow(curequipSign,choosed,_go)
if curSelectGO then
Util.GetGameObject(curSelectGO.transform, "choosed"):SetActive(false)
end
curSelectId = curequipSign.Id
choosed:SetActive(true)
curSelectGO = _go
this.ShowSUreBtnState()
end
function this.ShowSUreBtnState()
if curSelectId and curSelectId~=0 then
Util.SetGray(this.BtnSure,false)
this.BtnSure:GetComponent("Button").enabled = true
else
Util.SetGray(this.BtnSure,true)
this.BtnSure:GetComponent("Button").enabled = false
end
end
--界面关闭时调用(用于子类重写)
function SelectGiftListPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function SelectGiftListPopup:OnDestroy()
this.spLoader:Destroy()
end
return SelectGiftListPopup

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2292f5ff48ea8dc4fad9d897874fec7c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,379 @@
----- 魂印合成 -----
local this = {}
local soulPrintDatas = {}--所有可合成数据
local materidaIsCan = false--合成是材料是否满足
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local equipSign = ConfigManager.GetConfig(ConfigName.EquipConfig)
local curSelectSoulPrint = {}--当前选择的合成魂印
local curSelectGO--当前选择的合成列表中对象
local needSoulPrint = {}--三个魂印消耗材料对象
local materialState = {}--材料数据
local openThisPanel
local needGold = {}
local allGo = {}
local selectUpList={}
local itemType=0
local funcList={}
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
allGo = {}
for i = 1, 3 do
selectUpList[i]=0
needSoulPrint[i] = Util.GetGameObject(gameObject, "CompoundPanel_Gift/titleGo/needEquip"..i)
end
this.compoundSoulPrint = Util.GetGameObject(gameObject, "CompoundPanel_Gift/titleGo/compoundEquip")
this.compoundSoulPrintBtn = Util.GetGameObject(gameObject, "CompoundPanel_Gift/titleGo/compoundEquip/frame")
for i = 1, 2 do
needGold[i] = Util.GetGameObject(gameObject, "CompoundPanel_Gift/compoundBtn/GameObject/needGoldText ("..i..")")
end
--this.needGoldText = Util.GetGameObject(gameObject, "CompoundPanel_SoulPrint/compoundBtn/needGoldText"):GetComponent("Text")
this.compoundBtn = Util.GetGameObject(gameObject, "CompoundPanel_Gift/compoundBtn")
this.autoSelectBtn = Util.GetGameObject(gameObject, "CompoundPanel_Gift/autoCompoundBtn")
this.equipPre = Util.GetGameObject(gameObject, "CompoundPanel_Gift/equipPre")
this.ScrollBar=Util.GetGameObject(gameObject, "CompoundPanel_Gift/Scrollbar"):GetComponent("Scrollbar")
local v2 = Util.GetGameObject(gameObject, "CompoundPanel_Gift/scroll"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(gameObject, "CompoundPanel_Gift/scroll").transform,
this.equipPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2), 1, 5, Vector2.New(40,30))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
end
function this:BindEvent()
Util.AddClick(this.compoundBtn, function()
this.Compound()
end)
--
Util.AddClick(this.autoSelectBtn, function()
this.AutoSelectSoulPrint()
end)
for i = 1, 3 do
Util.AddClick(needSoulPrint[i], function()
--materialState[index] = {state = true,equipSignConFig = equipSign}
UIManager.OpenPanel(UIName.SelectGiftListPopup,openThisPanel,selectUpList,i,curSelectSoulPrint,itemType)
end)
Util.AddLongPressClick(needSoulPrint[i], function()
if selectUpList[i]~=0 then
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,{id=selectUpList[i],num=0},0,false,nil,nil,4)
end
end, 0.5)
end
Util.AddClick(this.compoundSoulPrintBtn, function()
--UIManager.OpenPanel(UIName.SoulPrintPopUp,0,nil,curSelectSoulPrint.Id,nil,nil)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,{id=curSelectSoulPrint.Id,num=0},0,false,nil,nil,4)
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
local sortingOrder = 0
function this:OnSortingOrderChange(_sortingOrder)
sortingOrder = _sortingOrder
for i, v in pairs(allGo) do
Util.AddParticleSortLayer(v, _sortingOrder - sortingOrder )
end
end
function this:OnShow(_openThisPanel)
curSelectSoulPrint = {}
this.OnShowData()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
openThisPanel = this
itemType=ItemBaseType.HeroGift
end
function this.OnShowData()
soulPrintDatas = {}
--local allDatas = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.EquipConfig,"Position",5,"Quality",7)
for i,v in ConfigPairs(equipSign) do
if v.Position==8 and v.Formula and #v.Formula>0 and tonumber(v.Formula[1][1])~=nil then
table.insert(soulPrintDatas,v)
end
end
table.sort(soulPrintDatas,function(a,b)
if a.Quality==b.Quality then
return a.Id < b.Id
else
return a.Quality < b.Quality
end
end)
curSelectSoulPrint = soulPrintDatas[1]
this.ScrollView:SetData(soulPrintDatas, function (index, go)
this.SingleItemDataShow(go, soulPrintDatas[index])
end)
end
function this.ShowGoldNum(equipSign)
for i = 1, #needGold do
needGold[i]:SetActive(false)
end
if equipSign.Resource then
for i = 1, #equipSign.Resource do
if needGold[i] then
needGold[i]:SetActive(true)
Util.GetGameObject(needGold[i],"Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,equipSign.Resource[i][1]).ResourceID))
if equipSign.Resource[1][2] > BagManager.GetItemCountById(equipSign.Resource[1][1]) then
materidaIsCan = false
needGold[i]:GetComponent("Text").text = PrintWanNum2(equipSign.Resource[i][2])--string.format("<color=#FF0011>%s</color>", equipSign.Resource[i][2])
else
materidaIsCan = true
needGold[i]:GetComponent("Text").text =PrintWanNum2(equipSign.Resource[i][2])--string.format("<color=#FCF5D3FF>%s</color>", equipSign.Resource[i][2])
end
end
end
end
end
function this.ShowTitleEquipData(_go,_id,index)
if not _go and index then
_go = needSoulPrint[index]
end
local ishaveData = false
if _id and _id~=0 then
ishaveData = true
end
Util.GetGameObject(_go.transform,"frame"):SetActive(ishaveData)
Util.GetGameObject(_go.transform,"icon"):SetActive(ishaveData)
Util.GetGameObject(_go.transform,"circleFrameBg"):SetActive(false)
Util.GetGameObject(_go.transform,"name"):SetActive(false)
local starpar=Util.GetGameObject(_go.transform,"star")
if equipSign and _id and _id~=0 then
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(equipSign[_id].Quality))
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[_id].ResourceID))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text = GetLanguageStrById(equipSign.Name)
starpar:SetActive(true)
SetHeroStars(this.spLoader,starpar,equipSign[_id].Star,1,nil,-15)
-- if index then
-- materialState[index] = {state = true,equipSignConFig = equipSign}
-- end
if index then
selectUpList[index]=_id
end
else
if index then
Util.GetGameObject(_go.transform,"addImage"):SetActive(not ishaveData)
Util.GetGameObject(_go.transform,"frame"):SetActive(false)
Util.GetGameObject(_go.transform,"icon"):SetActive(false)
starpar:SetActive(false)
end
end
end
function this.SingleItemDataShow(_go,_curequipSign)
if not allGo[_go] then
allGo[_go] = _go
Util.AddParticleSortLayer(_go, sortingOrder)
end
local curequipSign = _curequipSign
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(curequipSign.Quality))
local icon=Util.GetGameObject(_go.transform,"icon")
icon:SetActive(true)
icon:GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[curequipSign.Id].ResourceID))
Util.GetGameObject(_go.transform,"circleFrameBg/Icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[curequipSign.Id].ResourceID))
Util.GetGameObject(_go.transform,"circleFrameBg/circleFrame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[curequipSign.Id].Quantity].circle)
Util.GetGameObject(_go.transform,"circleFrameBg"):SetActive(false) --:GetComponent("Image").sprite=this.spLoader:LoadSprite(SoulPrintSpriteByQuantity[itemConfig[curequipSign.Id].Quantity].circleBg2)
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text= SubString2(string.gsub(GetLanguageStrById(curequipSign.Name),Language[11520],""),6);--curequipSign.Name
Util.GetGameObject(_go.transform, "UI_effect_WuCai_Kuang"):SetActive(curequipSign.Quality == 7)
local starPar=Util.GetGameObject(_go.transform,"star")
local choosed =Util.GetGameObject(_go.transform, "choosed")
choosed:SetActive(curSelectSoulPrint.Id == curequipSign.Id)
SetHeroStars(this.spLoader,starPar,curequipSign.Star,1,nil,-15)
local redPoint = Util.GetGameObject(_go.transform,"redPoint")
redPoint:SetActive(false)
--Util.GetGameObject(_go.transform,"redPoint"):SetActive(false)
if curSelectSoulPrint.Id == curequipSign.Id then
curSelectGO = _go
end
local checkFunc=function()
local isMatEnough=false
if curequipSign.Formula and #curequipSign.Formula>0 and type(curequipSign.Formula[1][1])~="userdata" then
local key=curequipSign.Formula[1][1]
local value=curequipSign.Formula[1][2]
--LogError("itemtype================="..itemType)
local datas = BagManager.GetBagItemDataByItemType(ItemBaseType.HeroGift)
local curBagSoulPrintDatas = {}
local maxNum=0
for i = 1, #datas do
if curequipSign.Star>0 then
if datas[i].id == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
else
--LogError("key=================="..key)
--LogError("datas[i].id=============="..datas[i].id)
if equipSign[datas[i].id].Quality == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
end
end
if maxNum>=value then
isMatEnough=true
end
local resource=curequipSign.Resource
local isGoldEough=true
if resource and #resource>0 and type(resource[1][1])~="userdata" then
for i=1,#resource do
if BagManager.GetItemCountById(resource[i][1]) <resource[i][2] then
isGoldEough=false
end
end
end
if isMatEnough and isGoldEough then
--LogError("curequipSign.name=================================="..curequipSign.Name)
redPoint:SetActive(true)
else
redPoint:SetActive(false)
end
end
end
checkFunc()
funcList[_go]=checkFunc
Util.AddOnceClick(Util.GetGameObject(_go.transform,"frame"), function()
if curSelectSoulPrint.Id == curequipSign.Id then
return
else
curSelectSoulPrint = curequipSign
choosed:SetActive(true)
if curSelectGO then
Util.GetGameObject(curSelectGO.transform, "choosed"):SetActive(false)
curSelectGO = _go
end
this.StartCompoundSoulPrint(curequipSign,true)
end
end)
end
function this.StartCompoundSoulPrint(curequipSign, isClearSelect)
this.ShowTitleEquipData(this.compoundSoulPrint, curequipSign.Id)
for i = 1, 3 do
selectUpList[i]=0
end
this.ShowGoldNum(curequipSign)
if isClearSelect then
materialState = {}
local needNum=curequipSign.Formula[1][2]
for i = 1, 3 do
if i>needNum then
needSoulPrint[i]:SetActive(false)
else
needSoulPrint[i]:SetActive(true)
this.ShowTitleEquipData(needSoulPrint[i],0,i)
end
end
end
end
function this.Compound()
--LogError(" `````````````````` "..curIndex.." "..curSelectEquip.Star.." "..compoundNum)
local list={}
for i=1, #selectUpList do
if selectUpList[i]~=0 then
table.insert(list,selectUpList[i])
end
end
if #list<curSelectSoulPrint.Formula[1][2] then
PopupTipPanel.ShowTip(Language[10395])
return
end
if not materidaIsCan then
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Gold })
return
end
if curSelectSoulPrint.Star>0 then
NetManager.GiftEquipUpStarRequest(curSelectSoulPrint.Id,function (msg)
SoundManager.PlaySound(SoundConfig.UI_Baoqi)
--删除魂印
--this.OnShowData()
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
for k, v in pairs(funcList) do
v()
end
CheckRedPointStatus(RedPointType.HeroGiftCompound)
end)
end)
else
NetManager.ComplexSoulPrintRequest(curSelectSoulPrint.Id,list,function(msg)
-- SoundManager.PlaySound(SoundConfig.UI_Duanzao)
SoundManager.PlaySound(SoundConfig.UI_Baoqi)
--删除魂印
--this.OnShowData()
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
for k, v in pairs(funcList) do
v()
end
CheckRedPointStatus(RedPointType.HeroGiftCompound)
end)
end)
end
end
function this.AutoSelectSoulPrint()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
--local isShowUpHero = SoulPrintManager.GetIsShowUpHeroSoulPrintPlayerPrefs()
local datas = BagManager.GetBagItemDataByItemType(itemType)
local curBagSoulPrintDatas = {}
local maxNum=0
for i = 1, #datas do
if curSelectSoulPrint.Star>0 then
if datas[i].id == curSelectSoulPrint.Formula[1][1] then
for j=1,datas[i].num do
if maxNum==curSelectSoulPrint.Formula[1][2] then
break
end
table.insert(curBagSoulPrintDatas,datas[i])
maxNum=maxNum+1
end
end
else
if equipSign[datas[i].id].Quality == curSelectSoulPrint.Formula[1][1] then
for j=1,datas[i].num do
if maxNum==curSelectSoulPrint.Formula[1][2] then
break
end
table.insert(curBagSoulPrintDatas,datas[i])
maxNum=maxNum+1
end
end
end
end
table.sort(curBagSoulPrintDatas, function(a,b) return equipSign[a.id].Quality < equipSign[b.id].Quality end)
for i = 1, 3 do
if curBagSoulPrintDatas[i] then
this.ShowTitleEquipData(needSoulPrint[i],curBagSoulPrintDatas[i].id,i)
end
end
end
function this:OnClose()
end
function this:OnDestroy()
this.spLoader:Destroy()
allGo = {}
funcList={}
end
return this

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3f053e73028f5d147ae8f4b59093cd38
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cd9e8fc9f96b33d40b3b47ea46e62311
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,493 @@
--新的命格管理
GiftManager = {}
local this = GiftManager
local giftConfig=ConfigManager.GetConfig(ConfigName.GiftConfig)
local equipConfig=ConfigManager.GetConfig(ConfigName.EquipConfig)
function this.Initialize()
this.allHeroGifts={}
this.playerGifts={}
end
--初始化命石
function this.InitGemsInfo(msg)
end
--初始化英雄礼物
function this.InitHeroGift(id,list)
this.allHeroGifts[id]=list
end
--初始化主角礼物
function this.InitPlayerGift(list)
this.playerGifts=list
end
--获取收取等级和最大数量
function this.GetCollectLvAndNum()
local lv=0
local maxNum=0
local collect=0
local curNum=0
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] then
collect=collect+equipConfig[id].Gift
end
end
if CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then
collect=collect+HeroManager.ReturnGiftCount()
end
for k, v in ConfigPairs(giftConfig) do
if collect>=v.Gift then
lv=v.Id
curNum=v.Box
else
maxNum=v.Box
break
end
end
if maxNum==0 then
maxNum=curNum
end
return lv,curNum,maxNum
end
--设置英雄礼物 type 1穿 2
function this.SetHeroGift(id,list,type)
if this.allHeroGifts[id]==nil then
this.allHeroGifts[id]={}
end
for i=1,#list do
if type==1 then
table.insert(this.allHeroGifts[id],list[i])
elseif type==2 then
table.removebyvalue(this.allHeroGifts[id],list[i])
end
end
HeroManager.ChangeHeroGift(id,this.allHeroGifts[id])
end
--设置主角礼物
function this.SetPlayerGift(list)
for i=1,#list do
table.insert(this.playerGifts,list[i])
end
end
--移除主角礼物
function this.RemovePlayerGift(list)
for i=1,#list do
table.removebyvalue(this.playerGifts,list[i])
end
end
function this.GetHeroGifts(_id)
if this.allHeroGifts[_id] then
return this.allHeroGifts[_id]
end
return {}
end
function this.GetPlayerGifts()
return this.playerGifts
end
function this.changeGiftsByType(_type,_list)
end
--获取英雄礼物增加的属性
function this.GetHeroGiftAddPro(_id)
local data={}
if not this.allHeroGifts[_id] then
LogError("英雄gift======================nil")
return data
end
local addPro=0
if this.playerGifts and #this.playerGifts>0 then
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] and equipConfig[id].HeroGitUp and equipConfig[id].HeroGitUp>0 then
addPro=addPro + equipConfig[id].HeroGitUp
end
end
end
--HeroGitUp
local list=this.allHeroGifts[_id]
for i=1,#list do
local id=list[i]
local pro = equipConfig[id].Property
if pro and #pro>0 then
for k = 1, #pro do
local key=pro[k][1]
local value=pro[k][2]
if tonumber(key)~=0 and tonumber(key)~=nil then
if not data[key] then
data[key] = 0
end
data[key] = data[key] + value
end
end
end
--英雄礼物不会加成主角属性
-- local pro2 = equipConfig[id].PlayerProperty
-- if pro2 and #pro2>0 then
-- for k = 1, #pro2 do
-- if not data[pro2[k][1]] then
-- data[pro2[k][1]] = 0
-- end
-- data[pro2[k][1]] = data[pro2[k][1]] + pro2[k][2]
-- end
-- end
end
local trainAdd=0
if CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) then
trainAdd=HeroManager.ReturnGiftAtt()
-- for k, v in ipairs(data) do
-- data[k]=data[k]*(1+t)
-- end
end
if addPro>0 then
for k, v in pairs(data) do
data[k]=math.floor(v*(1+addPro/10000+trainAdd)+0.5)
end
end
return data
end
--获取英雄礼物增加的白板属性属性(表里配置的属性)
function this.GetHeroGiftAddOriginalPro(_id)
local data={}
if not this.allHeroGifts[_id] then
LogError("英雄gift======================nil")
return data
end
local addPro=0
if this.playerGifts and #this.playerGifts>0 then
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] and equipConfig[id].HeroGitUp and equipConfig[id].HeroGitUp>0 then
addPro=addPro + equipConfig[id].HeroGitUp
end
end
end
--HeroGitUp
local list=this.allHeroGifts[_id]
for i=1,#list do
local id=list[i]
local pro = equipConfig[id].Property
if pro and #pro>0 then
for k = 1, #pro do
local key=pro[k][1]
local value=pro[k][2]
if tonumber(key)~=0 and tonumber(key)~=nil then
if not data[key] then
data[key] = 0
end
data[key] = data[key] + value
end
end
end
--英雄礼物不会加成主角属性
-- local pro2 = equipConfig[id].PlayerProperty
-- if pro2 and #pro2>0 then
-- for k = 1, #pro2 do
-- if not data[pro2[k][1]] then
-- data[pro2[k][1]] = 0
-- end
-- data[pro2[k][1]] = data[pro2[k][1]] + pro2[k][2]
-- end
-- end
end
return data
end
--检测英雄礼物合成红点
function this.CheckHeroGiftComRed()
local giftList=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.EquipConfig,"Position",8)
if giftList then
for i=1,#giftList do
local curequipSign=giftList[i]
if curequipSign.Formula and #curequipSign.Formula>0 and type(curequipSign.Formula[1][1])~="userdata" then
local key=curequipSign.Formula[1][1]
local value=curequipSign.Formula[1][2]
local isMatEnough=false
local datas = BagManager.GetBagItemDataByItemType(ItemBaseType.HeroGift)
local curBagSoulPrintDatas = {}
local maxNum=0
for i = 1, #datas do
if curequipSign.Star>0 then
if datas[i].id == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
else
if equipConfig[datas[i].id].Quality == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
end
end
if maxNum>=value then
isMatEnough=true
end
local resource=curequipSign.Resource
local isGoldEough=true
if resource and #resource>0 and type(resource[1][1])~="userdata" then
for i=1,#resource do
if BagManager.GetItemCountById(resource[i][1]) <resource[i][2] then
isGoldEough=false
end
end
end
if isMatEnough and isGoldEough then
return true
end
end
end
end
return false
end
--检测主角礼物合成红点
function this.CheckPlayerGiftComRed()
local giftList=ConfigManager.TryGetAllConfigsDataByKey(ConfigName.EquipConfig,"Position",7)
if giftList then
for i=1,#giftList do
local curequipSign=giftList[i]
if curequipSign.Formula and #curequipSign.Formula>0 and type(curequipSign.Formula[1][1])~="userdata" then
local key=curequipSign.Formula[1][1]
local value=curequipSign.Formula[1][2]
local isMatEnough=false
local datas = BagManager.GetBagItemDataByItemType(ItemBaseType.PlayerGift)
local curBagSoulPrintDatas = {}
local maxNum=0
for i = 1, #datas do
if curequipSign.Star>0 then
if datas[i].id == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
else
if equipConfig[datas[i].id].Quality == key then
for j=1,datas[i].num do
if maxNum==value then
break
end
maxNum=maxNum+1
end
end
end
end
if maxNum>=value then
isMatEnough=true
end
local resource=curequipSign.Resource
local isGoldEough=true
if resource and #resource>0 and type(resource[1][1])~="userdata" then
for i=1,#resource do
if BagManager.GetItemCountById(resource[i][1]) <resource[i][2] then
isGoldEough=false
end
end
end
if isMatEnough and isGoldEough then
return true
end
end
end
end
return false
end
--检测英雄红点
function this.CheckRoleRedPointById(_id)
local isOpen=CheckFunctionOpen(FUNCTION_OPEN_TYPE.Gift)
if isOpen==false then
return false
end
local lv,cur,max=this.GetCollectLvAndNum()
if this.allHeroGifts[_id] then
local list=this.allHeroGifts[_id]
if #list>=cur then
return false
end
local suitIds={}
for i=1,#list do
table.insert(suitIds,equipConfig[list[i]].SuiteID)
end
local allEquip = BagManager.GetBagItemDataByItemType(ItemBaseType.HeroGift)
for i=1,#allEquip do
if CheckListIsContainValue1(list,allEquip[i].id)==false and CheckListIsContainValue1(suitIds,equipConfig[allEquip[i].id].SuiteID)==false then
return true
end
end
else
return false
end
return false
end
--检测主角红点
function this.CheckPlayerRedPoint()
local isOpen=CheckFunctionOpen(FUNCTION_OPEN_TYPE.Gift)
if isOpen==false then
return false
end
local suitIds={}
for i=1,#this.playerGifts do
table.insert(suitIds,equipConfig[this.playerGifts[i]].SuiteID)
end
local allEquip = BagManager.GetBagItemDataByItemType(ItemBaseType.PlayerGift)
for i=1,#allEquip do
if CheckListIsContainValue1(this.playerGifts,allEquip[i].id)==false and CheckListIsContainValue1(suitIds,equipConfig[allEquip[i].id].SuiteID)==false then
return true
end
end
return false
end
--获取英雄潜能等级
function this.GetHeroPotencyLvById(did)
local lv=0
if this.playerGifts and #this.playerGifts>0 then
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] and equipConfig[id].PotentialNew and #equipConfig[id].PotentialNew>0 and type(equipConfig[id].PotentialNew[1])~="userdata" then
lv=lv+equipConfig[id].PotentialNew[2]
end
end
end
if this.allHeroGifts and this.allHeroGifts[did] then
local list=this.allHeroGifts[did]
for i=1,#list do
local id=list[i]
if equipConfig[id] and equipConfig[id].PotentialNew and #equipConfig[id].PotentialNew>0 and type(equipConfig[id].PotentialNew[1])~="userdata" then
lv=lv+equipConfig[id].PotentialNew[2]
end
end
end
--LogError("礼物增加 潜能 lv====================================="..lv)
return lv
end
--获取主角礼物添加的潜能等级
function this.GetPlayerGiftAddPotencyLv()
local lv=0
if this.playerGifts and #this.playerGifts>0 then
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] and equipConfig[id].PotentialNew and #equipConfig[id].PotentialNew>0 and type(equipConfig[id].PotentialNew[1])~="userdata" then
lv=lv+equipConfig[id].PotentialNew[2]
end
end
end
return lv
end
--获取英雄礼物添加的潜能等级
function this.GetHeroGiftAddPotencyLv(did)
local lv=0
if this.allHeroGifts and this.allHeroGifts[did] then
local list=this.allHeroGifts[did]
for i=1,#list do
local id=list[i]
if equipConfig[id] and equipConfig[id].PotentialNew and #equipConfig[id].PotentialNew>0 and type(equipConfig[id].PotentialNew[1])~="userdata" then
lv=lv+equipConfig[id].PotentialNew[2]
end
end
end
return lv
end
--获取主角礼物增加的属性
function this.GetPlayerGiftAddPro()
local data={}
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
local pro = equipConfig[id].PlayerProperty
if pro and #pro>0 then
for k = 1, #pro do
local key=pro[k][1]
local value= pro[k][2]
if tonumber(key) ~=nil and tonumber(key)~=0 then
if key~=0 and key~=nil then
if not data[key] then
data[key] = 0
end
data[key] = data[key] + value
end
end
end
end
local pro2 = equipConfig[id].Property
if pro2 and #pro2>0 and pro2[1][1]~=0 and pro2[1][1]~=nil then
for k = 1, #pro2 do
local key=pro2[k][1]
local value=pro2[k][2]
if tonumber(key) ~=nil and tonumber(key)~=0 then
if not data[key] then
data[key] = 0
end
if value and value~=0 then
LogError("pro2[k][1]==="..key.." value=="..value)
data[key] = data[key] + value
end
end
end
end
end
return data
end
function this.CheckGemRed()
return false
end
function this.CheckSuperGemRed()
return false
end
function this.GetPlayerGiftAdd()
local addPro=0
if this.playerGifts and #this.playerGifts>0 then
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
if equipConfig[id] and equipConfig[id].HeroGitUp and equipConfig[id].HeroGitUp>0 then
addPro=addPro + equipConfig[id].HeroGitUp
end
end
end
return addPro/100
end
return this

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 3a256485d70a58e4cb3d1ab62c98abe1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,484 @@
require("Base/BasePanel")
local spcialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
RoleGiftPanel = Inherit(BasePanel)
local isGonming = 0
local tableName={ "礼物","碎片"}
local isUpZhen = false
local this = RoleGiftPanel
local indexBtnNum=0
local tabs={}
local redTabs={}
local curHeroData=nil
local teamHero
local v1
local allUpIds={}
local upSuitId={}
local allEquip={}
local index=0
local lv,curNum,maxNum
local heroListData
local isDown=false
--初始化组件用于子类重写RoleEquipChangePopup
function RoleGiftPanel:InitComponent()
this.spLoader = SpriteLoader.New()
this.bg2 = Util.GetGameObject(self.transform, "bg2")
screenAdapte(this.bg2)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, {showType = UpViewOpenType.ShowLeft})
this.btnBack = Util.GetGameObject(self.transform, "btnBack/btnBack")
for i = 1, 2 do
tabs[i] = Util.GetGameObject(self.transform, "Tabs/Btn" .. i)
local nameTxt=Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
nameTxt.fontSize = GetCurLanguage() == 0 and 48 or 40
nameTxt.text=tableName[i]
redTabs[i] = Util.GetGameObject(tabs[i], "red")
if i==2 then
tabs[i]:SetActive(false)
end
--effectList[i] = Util.GetGameObject(self.transform, "bg/equipInfo/equip" .. i .. "/effect")
end
this.titleTxt=Util.GetGameObject(self.gameObject, "title"):GetComponent("Text")
this.titleTxt.text="英雄礼物"
this.selectBtn = Util.GetGameObject(self.gameObject, "selectBtn")
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
this.equipPreList2 = {}
this.equipPreList = {}
this.equipPre = Util.GetGameObject(self.gameObject, "equipPre")
this.upItemPre = Util.GetGameObject(self.gameObject, "upItemPre")
this.grid = Util.GetGameObject(self.gameObject, "scroll/grid")
this.selsectSkillImage = Util.GetGameObject(self.gameObject, "selsectSkillImage")
this.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject")
this.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject")
this.allEquipUp = Util.GetGameObject(self.transform, "allEquipUp")
this.allEquipDown = Util.GetGameObject(self.transform, "allEquipDown")
this.allEquipUpRedPoint = Util.GetGameObject(self.transform, "allEquipUp/redPoint")
this.allEquipUpRedPoint:SetActive(false)
this.ScrollBar = Util.GetGameObject(self.gameObject, "listObj/bg/Scrollbar"):GetComponent("Scrollbar")
local v2 = Util.GetGameObject(self.gameObject, "listObj/bg/scroll"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "listObj/bg/scroll").transform,
this.equipPre, this.ScrollBar,Vector2.New(v2.width, v2.height),1 , 4, Vector2.New(40, 25))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
v1 = Util.GetGameObject(self.gameObject, "upScroll"):GetComponent("RectTransform").rect
this.UpScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "upScroll").transform,this.upItemPre, nil,Vector2.New(v1.width,v1.height),1 ,4, Vector2.New(50,65))
this.UpScrollView.moveTween.MomentumAmount = 1
this.UpScrollView.moveTween.Strength = 1
Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("UI_hz_shenjiang_15_zh")
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
this.itemNumText = Util.GetGameObject(self.transform, "itemNumText"):GetComponent("Text")
this.upLvEffect = Util.GetGameObject(self.transform, "powerBtn/effect")
this.emptyObj = Util.GetGameObject(self.transform, "listObj/bg/emptyObj")
this.emptyObj.gameObject:SetActive(false)
this.mask = Util.GetGameObject(self.gameObject, "mask")
this.mask:SetActive(false)
this.collectImg=Util.GetGameObject(self.gameObject, "collectImg"):GetComponent("Image")
this.lvTxt=Util.GetGameObject(self.gameObject, "lvTxt"):GetComponent("Text")
--this.collectImg.sprite=this.spLoader:LoadSprite("gh_tt_8")
this.btn_help=Util.GetGameObject(self.gameObject, "btn_help")
this.listObj = Util.GetGameObject(self.transform, "listObj")
this.listCloseBtn = Util.GetGameObject(self.transform, "listObj/bg/btn_close")
Util.GetGameObject(self.transform, "listObj/bg/title (1)"):GetComponent("Text").text="神将礼物"
this.proTitle = Util.GetGameObject(self.transform, "proTitle/name/text"):GetComponent("Text")
this.proTitle.text="当前礼物加成"
this.proGrid = Util.GetGameObject(self.transform, "pro")
this.proPre=Util.GetGameObject(self.transform, "pro/name")
--this.tipInfo = Util.GetGameObject(self.transform, "tipInfo"):GetComponent("Text")
this.proEmptyObj = Util.GetGameObject(self.transform, "proEmptyObj")
Util.GetGameObject(self.transform, "proEmptyObj/TextImage/Text"):GetComponent("Text").text="暂无加成属性"
end
--绑定事件(用于子类重写)
function RoleGiftPanel:BindEvent()
Util.AddClick(this.listCloseBtn,function()
this.listObj:SetActive(false)
end)
Util.AddClick(this.btn_help,function()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Gift,0,0)
end)
Util.AddClick(this.collectImg.gameObject,function()
-- local data = {}
-- local singData = {}
-- singData.title = "当前礼物总加成"
-- singData.pro = IncarnationManager.GetproDesLst(GiftManager.GetHeroGiftAddPro(curHeroData.dynamicId),"00FF00")
-- singData.tip ="" --"总加成包括化身之力提供的属性"
-- table.insert(data,singData)
-- UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes,data)
end)
Util.AddClick(this.btnBack,function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
Util.AddClick(this.leftBtn,function()
index = (index - 1 > 0 and index - 1 or #heroListData)
curHeroData = heroListData[index]
this.RefreshWindowData()
end)
Util.AddClick(this.rightBtn,function()
index = (index + 1 <= #heroListData and index + 1 or 1)
curHeroData = heroListData[index]
this.RefreshWindowData()
end)
Util.AddOnceClick(this.allEquipUp,function()
local canNum=curNum-#allUpIds
if canNum>0 then
local list={}
table.sort(allEquip,function(a,b)
return equipConfig[a.id].ExhibitionScore>equipConfig[b.id].ExhibitionScore
end)
for i=1,#allEquip do
if i<=canNum then
if CheckListIsContainValue1(allUpIds,allEquip[i].id)==false and CheckListIsContainValue1(upSuitId,equipConfig[allEquip[i].id].SuiteID)==false then
table.insert(list,allEquip[i].id)
table.insert(upSuitId,equipConfig[allEquip[i].id].SuiteID)
end
end
end
NetManager.GiftEquipWearRequest(1,curHeroData.dynamicId,list,function()
GiftManager.SetHeroGift(curHeroData.dynamicId,list,1)
this.RefreshWindowData()
end)
end
end)
Util.AddOnceClick(this.allEquipDown,function()
isDown=true
NetManager.GiftEquipWearRequest(2,curHeroData.dynamicId,allUpIds,function()
isDown=false
GiftManager.SetHeroGift(curHeroData.dynamicId,allUpIds,2)
this.RefreshWindowData()
end)
end)
for i = 1, 2 do
Util.AddClick(tabs[i],function()
-- isPlayAnim = true
if i == indexBtnNum then
return
end
indexBtnNum = i
this:OnClickTabBtn(indexBtnNum)
end)
end
end
--添加事件监听(用于子类重写)
function RoleGiftPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
end
--移除事件监听(用于子类重写)
function RoleGiftPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
end
--界面打开时调用(用于子类重写)
function RoleGiftPanel:OnOpen(...)
local data = {...}
curHeroData=data[1]
if data[2] then
heroListData = data[2]
else
heroListData = HeroManager.GetAllHeroDatas()
end
this.listObj:SetActive(false)
end
function RoleGiftPanel:OnShow()
for i = 1, #heroListData do
if curHeroData == heroListData[i] then
index = i
end
end
teamHero = FormationManager.GetAllMainFormationHeroId()
this.RefreshWindowData()
end
function this:OnSortingOrderChange()
end
function this.RefreshWindowData()
local WarPower = 0
if isDown then
return
end
isUpZhen=teamHero[curHeroData.dynamicId]
if isUpZhen then
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
this.force.text = WarPower
--显示上面赠送的
local list=GiftManager.GetHeroGifts(curHeroData.dynamicId)
lv,curNum,maxNum=GiftManager.GetCollectLvAndNum()
--if #list>=50 then
--curNum=#list+6
--maxNum=#list+6
--else
curNum=12
maxNum=12
--end
this.lvTxt.text="收集度"..lv..""
LogError("lv========="..lv.." curnum=="..curNum.." maxNum=="..maxNum)
--maxNum=0
local giftDatas={}
allUpIds={}
upSuitId={}
for i=1,maxNum do
local data={}
data.type=1
data.qua=0
data.id=0
data.isRed=false
if i<=#list then
data.type=2
data.id=list[i]
data.qua=itemConfig[list[i]].Quantity
table.insert(allUpIds,data.id)
table.insert(upSuitId,equipConfig[data.id].SuiteID)
else
data.isRed=GiftManager.CheckRoleRedPointById(curHeroData.dynamicId)
end
table.insert(giftDatas,data)
end
table.sort(giftDatas,function(a,b)
if a.type==b.type then
if a.qua and a.qua==b.qua then
return a.id<b.id
else
return a.qua>b.qua
end
else
return a.type>b.type
end
end)
this.UpScrollView:SetData(giftDatas,
function(index, go)
this.SingleUpItemShow(go, giftDatas[index],index)
end
)
local proList=IncarnationManager.GetproDesLst(GiftManager.GetHeroGiftAddPro(curHeroData.dynamicId),"00FF00")
table.insert(proList,string.format("英雄潜能等级+%s",GiftManager.GetHeroGiftAddPotencyLv(curHeroData.dynamicId)))
local originalList=GiftManager.GetHeroGiftAddOriginalPro(curHeroData.dynamicId)
if proList and #proList>0 then
this.proGrid:SetActive(true)
this.proEmptyObj:SetActive(false)
local len=this.proGrid.transform.childCount
local create=#proList-len
if create>0 then
for i=1,create do
newObjToParent(this.proPre,this.proGrid)
end
end
len=this.proGrid.transform.childCount
for i=1,len do
if i<=#proList-1 then
this.proGrid.transform:GetChild(i-1).gameObject:SetActive(true)
LogError("originalList[i]======================"..originalList[i])
this.proGrid.transform:GetChild(i-1):GetComponent("Text").text=proList[i]--..
--string.format(" 命格加成+%s (%s%%)",math.floor(originalList[i]*GiftManager.GetPlayerGiftAdd()/100), GiftManager.GetPlayerGiftAdd())
--..string.format(" 特训加成+%s (%s%%)",math.floor(originalList[i]*HeroManager.ReturnGiftAtt()),HeroManager.ReturnGiftAtt())
elseif i==#proList then
this.proGrid.transform:GetChild(i-1).gameObject:SetActive(true)
this.proGrid.transform:GetChild(i-1):GetComponent("Text").text=proList[i]
else
this.proGrid.transform:GetChild(i-1).gameObject:SetActive(false)
end
end
else
this.proGrid:SetActive(false)
this.proEmptyObj:SetActive(true)
end
--this.tipInfo.text=string.format("神将潜能等级+%s",GiftManager.GetHeroGiftAddPotencyLv(curHeroData.dynamicId))
--显示下面可赠送的
this:OnClickTabBtn(1)
end
--显示上面几个
function this.SingleUpItemShow(_go,data,_index)
_go:SetActive(true)
_go.transform:SetAsFirstSibling()
local frame=_go:GetComponent("Image")
local icon=Util.GetGameObject(_go,"icon"):GetComponent("Image")
local name=Util.GetGameObject(_go,"name"):GetComponent("Text")
local lockObj=Util.GetGameObject(_go,"lock")
local lockText=Util.GetGameObject(_go,"Text"):GetComponent("Text")
local add=Util.GetGameObject(_go,"add")
local red=Util.GetGameObject(_go,"red")
local starGrid=Util.GetGameObject(_go,"starGrid")
if data.id and data.id~=0 then
red:SetActive(false)
frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[data.id].Quantity))
icon.gameObject:SetActive(true)
name.gameObject:SetActive(true)
lockObj:SetActive(false)
starGrid:SetActive(true)
lockText.gameObject:SetActive(false)
add:SetActive(false)
name.text=itemConfig[data.id].Name
icon.sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
SetHeroStars(this.spLoader,starGrid,equipConfig[data.id].Star,1,nil,-15)
Util.AddOnceClick(icon.gameObject,function()
if curHeroData==nil then
return
end
BagManager.isBagPanel=false
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,data,2,false,nil,curHeroData,4)
end
)
else
frame.sprite=this.spLoader:LoadSprite("UI_hz_beibao_duigoudi")
icon.gameObject:SetActive(false)
name.gameObject:SetActive(false)
starGrid:SetActive(false)
if _index>curNum then
lockObj:SetActive(true)
add:SetActive(false)
red:SetActive(false)
lockText.gameObject:SetActive(true)
lockText.text="收集度"..lv+1 .."级解锁"
else
lockObj:SetActive(false)
lockText.gameObject:SetActive(false)
add:SetActive(true)
red:SetActive(data.isRed)
end
end
Util.AddOnceClick(add,function()
this.listObj:SetActive(true)
end)
end
--点击装备按钮
function this:OnClickTabBtn(_index)
indexBtnNum = _index
this:SetSelectBtn()
allEquip = BagManager.GetBagItemDataByItemType(ItemBaseType.HeroGift)
-- this:SortEquipDatas(allEquip)
local count = 0
for i=1,#allEquip do
count = count + 1
if CheckListIsContainValue1(allUpIds,allEquip[i].id) or CheckListIsContainValue1(upSuitId,equipConfig[allEquip[i].id].SuiteID) then
allEquip[i].isUp=1
else
allEquip[i].isUp=2
end
end
table.sort(allEquip,function(a,b)
if a.isUp==b.isUp then
if a.quality==b.quality then
return a.id<b.id
else
return a.quality>b.quality
end
else
return a.isUp > b.isUp
end
end)
--"装备数量:"
this.itemNumText.text = "礼物种类:" .. count
this:SetItemData(allEquip)
--this.CheckRedTab()
end
function this:SetItemData(_itemDatas)
if LengthOfTable(_itemDatas) == 0 then
this.emptyObj.gameObject:SetActive(true)
else
this.emptyObj.gameObject:SetActive(false)
end
for k,v in pairs(this.equipPreList) do
v.gameObject:SetActive(false)
end
this.ScrollView:SetData(
_itemDatas,
function(index, go)
this.SingleItemDataShow(go, _itemDatas[index])
end
)
end
function this.SingleItemDataShow(_go, _itemData)
if not itemConfig[_itemData.id] then
return
end
if not this.equipPreList[_go] then
this.equipPreList[_go] = SubUIManager.Open(SubUIConfig.ItemView,_go.transform)
end
local redPoint = Util.GetGameObject(_go.transform, "redPoint")
local tip=Util.GetGameObject(_go.transform, "tip")
tip:SetActive(_itemData.isUp==1)
local isHave=CheckListIsContainValue1(allUpIds,_itemData.id) or CheckListIsContainValue1(upSuitId,equipConfig[_itemData.id].SuiteID)
redPoint:SetActive(isHave==false and curNum>#allUpIds)
this.equipPreList[_go].gameObject:SetActive(true)
this.equipPreList[_go].transform:SetAsFirstSibling()
this.equipPreList[_go]:ResetNameColor(Color.New(178/255,85/255,55/255,1))
--if itemConfig[_itemData.id].ItemType == ItemType.Equip then
this.equipPreList[_go]:OnOpen(false,{_itemData.id,_itemData.num}, 1.1, true, false, false, this.sortingOrder+1,_itemData.idDyn)
-- 0.查看属性 1.穿戴 2.卸下 3.交换
--宝物界面
Util.AddOnceClick(Util.GetGameObject(_go.transform, "mask"),function()
BagManager.isBagPanel=true
if isHave then
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,_itemData,6,false,nil,curHeroData,4)
else
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,_itemData,3,false,nil,curHeroData,4)
end
end
)
--end
end
function this:SetSelectBtn()
this.selectBtn:SetActive(true)
this.selectBtn.transform:SetParent(tabs[indexBtnNum].transform)
this.selectBtn:GetComponent("RectTransform").anchoredPosition3D = Vector3(-12.28, 1.08, 0)
this.selectBtn.transform:SetSiblingIndex(1)
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == 0 and tableName[indexBtnNum] or "<size=40>"..tableName[indexBtnNum].."</size>"--typeTab[indexBtnNum]
end
--选择图片设置父级
function this.SelectImageSetParent(_objPoint)
this.selsectSkillImage:SetActive(false)
this.selsectSkillImage.transform:SetParent(_objPoint.transform)
this.selsectSkillImage.transform.localScale = Vector3.one
this.selsectSkillImage.transform.localPosition = Vector3.zero
end
--界面关闭时调用(用于子类重写)
function RoleGiftPanel:OnClose()
BagManager.isBagPanel=false
end
--界面销毁时调用(用于子类重写)
function RoleGiftPanel:OnDestroy()
end
return RoleGiftPanel

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 7ebc5dfb3564ac5429ce0f17e6075998
timeCreated: 1552897446
licenseType: Pro
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -162,6 +162,9 @@ function RoleInfoPanel:InitComponent()
this.roleAbilityLayout = Util.GetGameObject(this.layout, "roleAbilityLayout")
this.roleChipLayout = Util.GetGameObject(this.layout, "roleChipLayout")
--礼物
this.giftBtn=Util.GetGameObject(self.transform,"roleInfoLayout/giftBtn")
--属性
this.info = Util.GetGameObject(self.transform, "rolePanel/info")
this.starGrid = Util.GetGameObject(this.info, "starGrid")
@ -428,6 +431,10 @@ function RoleInfoPanel:BindEvent()
Util.AddClick(this.btnAbility, function()
this.OnClick(btnType.Ability)
end)
--礼物
Util.AddClick(this.giftBtn, function()
UIManager.OpenPanel(UIName.RoleGiftPanel,curHeroData,heroDatas)
end)
--芯片
Util.AddClick(this.btnChip, function()
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.MEDAL) then