主角礼物可以卸下提交

(cherry picked from commit 8d8635ce64)
tcx_xiyou_dev hotfix/xiyou/cdn_daShengOnline_and/1.1.14
wangzhenxing 2024-06-17 18:04:34 +08:00
parent 6a3f8748c3
commit 4138510d0c
3 changed files with 163 additions and 21 deletions

View File

@ -74,7 +74,12 @@ function this.SetPlayerGift(list)
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]
@ -199,9 +204,119 @@ function this.GetHeroGiftAddOriginalPro(_id)
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)
@ -209,14 +324,19 @@ function this.CheckRoleRedPointById(_id)
return false
end
local lv,cur,max=this.GetCollectLvAndNum()
--LogError("lv==============="..lv.." cur=="..cur.." max=="..max)
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 then
if CheckListIsContainValue1(list,allEquip[i].id)==false and CheckListIsContainValue1(suitIds,equipConfig[allEquip[i].id].SuiteID)==false then
return true
end
end
@ -233,9 +353,13 @@ function this.CheckPlayerRedPoint()
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 then
if CheckListIsContainValue1(this.playerGifts,allEquip[i].id)==false and CheckListIsContainValue1(suitIds,equipConfig[allEquip[i].id].SuiteID)==false then
return true
end
end
@ -264,7 +388,6 @@ function this.GetHeroPotencyLvById(did)
end
end
--LogError("礼物增加 潜能 lv====================================="..lv)
lv=lv+TianShuMiJuanManger.GetAddPotentialLV()
return lv
end
--获取主角礼物添加的潜能等级
@ -302,6 +425,7 @@ function this.GetPlayerGiftAddPro()
local data={}
for i=1,#this.playerGifts do
local id=this.playerGifts[i]
LogError("id=========================="..id)
local pro = equipConfig[id].PlayerProperty
if pro and #pro>0 then
for k = 1, #pro do

View File

@ -122,11 +122,8 @@ function RewardEquipSingleShowPopup2:BindEvent()
end
end)
--穿戴
Util.AddClick(self.btnWear, function()
local equipIdList={}
local equipDataList={}
table.insert(equipIdList,tostring(self.equipData.id))
table.insert(equipDataList,self.equipData)
Util.AddOnceClick(self.btnWear, function()
if equipConfigData.Position==7 or equipConfigData.Position==8 then
local idList={}
table.insert(idList,self.equipData.id)
@ -147,6 +144,10 @@ function RewardEquipSingleShowPopup2:BindEvent()
self.parent.RefreshWindowData()
end)
else
local equipIdList={}
local equipDataList={}
table.insert(equipIdList,tostring(self.equipData.id))
table.insert(equipDataList,self.equipData)
NetManager.EquipWearRequest(self.curHeroData.dynamicId,equipIdList,1,function ()
self:ClosePanel()
self.parent.UpdateEquipPosHeroData(1,typeToUpdate[self.openType],equipDataList,0,self.position)
@ -156,23 +157,36 @@ function RewardEquipSingleShowPopup2:BindEvent()
end)
--卸下
Util.AddClick(self.btnDown, function()
Util.AddOnceClick(self.btnDown, function()
if equipConfigData.Position==7 or equipConfigData.Position==8 then
local idList={}
local heroId=""
if self.curHeroData then
heroId=self.curHeroData.dynamicId
else
heroId="0"
end
LogError("2222222222222222222222"..heroId)
LogError("self.equipData.id==="..self.equipData.id)
table.insert(idList,self.equipData.id)
--table.insert(idList,5200020)
NetManager.GiftEquipWearRequest(2,heroId,idList,function()
self:ClosePanel()
if heroId=="0" then
GiftManager.RemovePlayerGift(idList)
HeroManager.ChangeAllHeroGiftLV()
else
GiftManager.SetHeroGift(self.curHeroData.dynamicId,idList,2)
end
self.parent.RefreshWindowData()
end)
else
local equipIdList={}
local equipDataList={}
table.insert(equipIdList,tostring(self.equipData.id))
table.insert(equipDataList,self.equipData)
if equipConfigData.Position==7 or equipConfigData.Position==8 then
local idList={}
LogError("2222222222222222222222"..self.curHeroData.dynamicId)
LogError("self.equipData.id==="..self.equipData.id)
table.insert(idList,self.equipData.id)
--table.insert(idList,5200020)
NetManager.GiftEquipWearRequest(2,self.curHeroData.dynamicId,idList,function()
self:ClosePanel()
GiftManager.SetHeroGift(self.curHeroData.dynamicId,idList,2)
self.parent.RefreshWindowData()
end)
else
NetManager.EquipUnLoadOptRequest(self.curHeroData.dynamicId,equipIdList ,1, function ()
self:ClosePanel()
self.parent.UpdateEquipPosHeroData(1,typeToUpdate[self.openType],equipDataList)
@ -297,8 +311,12 @@ function RewardEquipSingleShowPopup2:OnShow()
else
self.powerNum.text=EquipManager.CalculateWarForce(self.equipData.id)
end
if equipConfigData.Position==7 or equipConfigData.Position==8 then
SetHeroStars(self.spLoader,self.star,equipConfigData.Star,1,nil,-15)
else
EquipManager.SetEquipStarShow(self.spLoader, self.star,equipConfigData.Id)
end
self.equipType.text=Language[11089]..GetEquipPosStrByEquipPosNum(equipConfigData.Position)
--摘星阁加持

View File

@ -292,7 +292,7 @@ function this.SingleUpItemShow(_go,data)
SetHeroStars(this.spLoader,starGrid,equipConfig[data.id].Star,1,nil,-15)
Util.AddOnceClick(icon.gameObject,function()
BagManager.isBagPanel=false
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,data,0,false,nil,nil,4)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,data,2,false,nil,nil,4)
end
)
else