礼物合成提交

dev_one_discount
wangzhenxing 2023-09-18 17:41:06 +08:00
parent fd5cd6836c
commit 1556e5c6a9
13 changed files with 53946 additions and 8 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d3daac60f5aaa12488f3d4dbd55c0385
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1777,6 +1777,7 @@ FUNCTION_OPEN_TYPE = {
EquipWish=142,--法宝心愿
GemNew=144, --命格
SuperGem=145,--高级命格
Gift=146, --礼物
Number_Game=149,--数字游戏
}

View File

@ -702,7 +702,7 @@ function SetHeroStars(spLoader, starGrid, star, type,_starSize,_scale,_pivot,rot
starPre:GetComponent("LayoutGroup").spacing = scale
starPre:GetComponent("RectTransform").pivot = pivot
starPre.transform:GetChild(0).gameObject:SetActive(false)
LogError("star============="..star.." type=========="..type)
--LogError("star============="..star.." type=========="..type)
if star < 7 and type and type == 3 then
starPre.transform:GetChild(0).gameObject:SetActive(true)
for i = 2, 24 do

View File

@ -503,6 +503,7 @@ UIName = {
GemBoxLvUpPopup=511, --命石宝箱升级提示
RoleGiftPanel=512, --英雄礼包界面
PlayerGiftPanel=513, --主角礼包界面
SelectGiftListPopup = 514,--选择礼物列表
}
SubUIConfig = {

View File

@ -6,6 +6,8 @@ local _TabData={ [1] = { default = "r_hero_xuanze_002", lock = "r_hero_xuanze_00
--[2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "宝器锻造" },
[2] = { default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002",select = "r_hero_xuanze_001", name = Language[10387] , funcType = FUNCTION_OPEN_TYPE.hunyin},
[3] = { default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002",select = "r_hero_xuanze_001", name = Language[10386], funcType = FUNCTION_OPEN_TYPE.Treasure },
[4] = { default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002",select = "r_hero_xuanze_001", name = "将礼合成", funcType = FUNCTION_OPEN_TYPE.Gift },
[5] = { default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002",select = "r_hero_xuanze_001", name = "主礼合成", funcType = FUNCTION_OPEN_TYPE.Gift },
}
local _TabFontColor = { default = Color.New(130 / 255, 128 / 255, 120 / 255, 1),
select = Color.New(243 / 255, 235 / 255, 202 / 255, 1),
@ -18,6 +20,8 @@ this.contents = {
--[2] = {view = require("Modules/Compound/view/CompoundPanel_Talisman"), panelName = "CompoundPanel_Talisman"},
[2] = {view = require("Modules/Compound/view/CompoundPanel_SoulPrint"), panelName = "CompoundPanel_SoulPrint"},
[3] = {view = require("Modules/Compound/view/CompoundPanel_Treasure"), panelName = "CompoundPanel_Treasure"},
[4] = {view = require("Modules/Compound/view/CompoundPanel_Gift"), panelName = "CompoundPanel_Gift"},
[5] = {view = require("Modules/Compound/view/CompoundPanel_PlayerGift"), panelName = "CompoundPanel_PlayerGift"},
}
--初始化组件(用于子类重写)
function CompoundPanel:InitComponent()

View File

@ -0,0 +1,158 @@
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 bagData[i].quality == targetSoulPrintSData.Formula[1][1] then
table.insert(list,bagData[i])
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")
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,259 @@
----- 魂印合成 -----
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
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,20))
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].id,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
curSelectSoulPrint = soulPrintDatas[1]
LogError("#soulPrintDatas============"..#soulPrintDatas)
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
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
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)
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)
-- 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)
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))
--Util.GetGameObject(_go.transform,"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"):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 choosed =Util.GetGameObject(_go.transform, "choosed")
choosed:SetActive(curSelectSoulPrint.Id == curequipSign.Id)
--local redPoint = Util.GetGameObject(_go.transform,"redPoint")
Util.GetGameObject(_go.transform,"redPoint"):SetActive(false)
if curSelectSoulPrint.Id == curequipSign.Id then
curSelectGO = _go
end
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)
this.ShowGoldNum(curequipSign)
if isClearSelect then
materialState = {}
for i = 1, 3 do
this.ShowTitleEquipData(needSoulPrint[i],0,i)
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<3 then
PopupTipPanel.ShowTip(Language[10395])
return
end
if not materidaIsCan then
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Gold })
return
end
NetManager.ComplexSoulPrintRequest(curSelectSoulPrint.Id,list,function(msg)
-- SoundManager.PlaySound(SoundConfig.UI_Duanzao)
SoundManager.PlaySound(SoundConfig.UI_Baoqi)
--删除魂印
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
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 equipSign[datas[i].id].Quality == curSelectSoulPrint.Formula[1][1] then
for j=1,datas[i].num do
if maxNum==3 then
break
end
table.insert(curBagSoulPrintDatas,datas[i])
maxNum=maxNum+1
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 = {}
end
return this

View File

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

View File

@ -0,0 +1,259 @@
----- 魂印合成 -----
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
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
allGo = {}
for i = 1, 3 do
selectUpList[i]=0
needSoulPrint[i] = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/titleGo/needEquip"..i)
end
this.compoundSoulPrint = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/titleGo/compoundEquip")
this.compoundSoulPrintBtn = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/titleGo/compoundEquip/frame")
for i = 1, 2 do
needGold[i] = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/compoundBtn/GameObject/needGoldText ("..i..")")
end
--this.needGoldText = Util.GetGameObject(gameObject, "CompoundPanel_SoulPrint/compoundBtn/needGoldText"):GetComponent("Text")
this.compoundBtn = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/compoundBtn")
this.autoSelectBtn = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/autoCompoundBtn")
this.equipPre = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/equipPre")
this.ScrollBar=Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/Scrollbar"):GetComponent("Scrollbar")
local v2 = Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/scroll"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(gameObject, "CompoundPanel_PlayerGift/scroll").transform,
this.equipPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2), 1, 5, Vector2.New(40,20))
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].id,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.PlayerGift
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==7 and v.Formula and #v.Formula>0 and tonumber(v.Formula[1][1])~=nil then
table.insert(soulPrintDatas,v)
end
end
curSelectSoulPrint = soulPrintDatas[1]
LogError("#soulPrintDatas============"..#soulPrintDatas)
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
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
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)
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)
-- 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)
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))
--Util.GetGameObject(_go.transform,"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"):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 choosed =Util.GetGameObject(_go.transform, "choosed")
choosed:SetActive(curSelectSoulPrint.Id == curequipSign.Id)
--local redPoint = Util.GetGameObject(_go.transform,"redPoint")
Util.GetGameObject(_go.transform,"redPoint"):SetActive(false)
if curSelectSoulPrint.Id == curequipSign.Id then
curSelectGO = _go
end
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)
this.ShowGoldNum(curequipSign)
if isClearSelect then
materialState = {}
for i = 1, 3 do
this.ShowTitleEquipData(needSoulPrint[i],0,i)
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<3 then
PopupTipPanel.ShowTip(Language[10395])
return
end
if not materidaIsCan then
UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.Gold })
return
end
NetManager.ComplexSoulPrintRequest(curSelectSoulPrint.Id,list,function(msg)
-- SoundManager.PlaySound(SoundConfig.UI_Duanzao)
SoundManager.PlaySound(SoundConfig.UI_Baoqi)
--删除魂印
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function()
this.StartCompoundSoulPrint(curSelectSoulPrint, true)
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 equipSign[datas[i].id].Quality == curSelectSoulPrint.Formula[1][1] then
for j=1,datas[i].num do
if maxNum==3 then
break
end
table.insert(curBagSoulPrintDatas,datas[i])
maxNum=maxNum+1
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 = {}
end
return this

View File

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