[礼物]====================礼物修改提交

TCX_dev_realOne_master
PC-202302260912\Administrator 2023-12-18 19:12:02 +08:00
parent 24cc12ddc8
commit 7904ac0594
5 changed files with 2817 additions and 249 deletions

View File

@ -210,9 +210,33 @@ function this.GetHeroPotencyLvById(did)
--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()
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
--获取主角礼物增加的属性

View File

@ -37,17 +37,16 @@ function PlayerGiftPanel:InitComponent()
this.titleTxt.text="主角礼物"
this.selectBtn = Util.GetGameObject(self.gameObject, "selectBtn")
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
this.btnPrant:SetActive(false)
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.ScrollBar = Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar")
this.ScrollBar = Util.GetGameObject(self.gameObject, "listObj/bg/Scrollbar"):GetComponent("Scrollbar")
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform,
this.equipPre, this.ScrollBar,Vector2.New(v2.width, v2.height),1 , 5, Vector2.New(40, 15))
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, 15))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
@ -61,7 +60,7 @@ function PlayerGiftPanel:InitComponent()
this.itemNumText = Util.GetGameObject(self.transform, "itemNumText"):GetComponent("Text")
this.upLvEffect = Util.GetGameObject(self.transform, "powerBtn/effect")
this.emptyObj = Util.GetGameObject(self.transform, "emptyObj")
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)
@ -71,23 +70,40 @@ function PlayerGiftPanel:InitComponent()
this.barImg=Util.GetGameObject(self.gameObject, "progressbar/progress1"):GetComponent("Image")
this.barNum=Util.GetGameObject(self.gameObject, "progressbar/num"):GetComponent("Text")
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 PlayerGiftPanel: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.GetPlayerGiftAddPro(),"00FF00")
singData.tip ="" --"总加成包括化身之力提供的属性"
table.insert(data,singData)
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes,data)
-- local data = {}
-- local singData = {}
-- singData.title = "当前礼物总加成"
-- singData.pro = IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(),"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)
@ -132,6 +148,7 @@ end
--界面打开时调用(用于子类重写)
function PlayerGiftPanel:OnOpen(...)
local data = {...}
this.listObj:SetActive(false)
end
function PlayerGiftPanel:OnShow()
teamHero = FormationManager.GetAllMainFormationHeroId()
@ -156,6 +173,7 @@ function this.RefreshWindowData()
this.ChangePowerValue()
--显示上面赠送的
local list=GiftManager.GetPlayerGifts()
LogError("#list============================="..#list)
local maxNum=16
if #list>maxNum then
maxNum=#list+4
@ -167,6 +185,7 @@ function this.RefreshWindowData()
data.type=1
data.qua=0
data.id=0
data.isRed=false
if i<=#list then
data.id=list[i]
data.type=2
@ -176,7 +195,9 @@ function this.RefreshWindowData()
LogError("equipConfig[data.id].Gift=="..equipConfig[data.id].Gift)
end
table.insert(allUpIds,data.id)
end
else
data.isRed=GiftManager.CheckPlayerRedPoint()
end
table.insert(giftDatas,data)
end
table.sort(giftDatas,function(a,b)
@ -215,6 +236,32 @@ function this.RefreshWindowData()
this.barImg.fillAmount=collectNum/maxValue
--显示下面可赠送的
this:OnClickTabBtn(1)
local proList=IncarnationManager.GetproDesLst(GiftManager.GetPlayerGiftAddPro(),"00FF00")
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 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.GetPlayerGiftAddPotencyLv())
end
@ -226,6 +273,8 @@ function this.SingleUpItemShow(_go,data)
local icon=Util.GetGameObject(_go,"icon"):GetComponent("Image")
local name=Util.GetGameObject(_go,"name"):GetComponent("Text")
local add=Util.GetGameObject(_go,"add")
local red=Util.GetGameObject(_go,"red")
red:SetActive(data.isRed)
if data.id and data.id~=0 then
frame.sprite=this.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[data.id].Quantity))
icon.gameObject:SetActive(true)
@ -244,6 +293,9 @@ function this.SingleUpItemShow(_go,data)
name.gameObject:SetActive(false)
add:SetActive(true)
end
Util.AddOnceClick(add,function()
this.listObj:SetActive(true)
end)
end

View File

@ -55,10 +55,10 @@ function RoleGiftPanel:InitComponent()
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, "Scrollbar"):GetComponent("Scrollbar")
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform,
this.equipPre, this.ScrollBar,Vector2.New(v2.width, v2.height),1 , 5, Vector2.New(40, 15))
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, 15))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
@ -72,7 +72,7 @@ function RoleGiftPanel:InitComponent()
this.itemNumText = Util.GetGameObject(self.transform, "itemNumText"):GetComponent("Text")
this.upLvEffect = Util.GetGameObject(self.transform, "powerBtn/effect")
this.emptyObj = Util.GetGameObject(self.transform, "emptyObj")
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)
@ -81,24 +81,38 @@ function RoleGiftPanel:InitComponent()
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)
-- 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)
@ -176,6 +190,7 @@ function RoleGiftPanel:OnOpen(...)
else
heroListData = HeroManager.GetAllHeroDatas()
end
this.listObj:SetActive(false)
end
function RoleGiftPanel:OnShow()
for i = 1, #heroListData do
@ -218,11 +233,14 @@ function this.RefreshWindowData()
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)
else
data.isRed=GiftManager.CheckRoleRedPointById(curHeroData.dynamicId)
end
table.insert(giftDatas,data)
end
@ -244,6 +262,32 @@ function this.RefreshWindowData()
this.SingleUpItemShow(go, giftDatas[index],index)
end
)
local proList=IncarnationManager.GetproDesLst(GiftManager.GetHeroGiftAddPro(curHeroData.dynamicId),"00FF00")
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 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())
--显示下面可赠送的
this:OnClickTabBtn(1)
end
@ -259,7 +303,10 @@ function this.SingleUpItemShow(_go,data,_index)
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")
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)
@ -283,16 +330,20 @@ function this.SingleUpItemShow(_go,data,_index)
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
--点击装备按钮
@ -325,7 +376,7 @@ function this:OnClickTabBtn(_index)
--"装备数量:"
this.itemNumText.text = "礼物种类:" .. count
this:SetItemData(allEquip)
--this.CheckRedTab()
end