Branch_oumei
zhangjiannan 2025-10-14 15:28:28 +08:00
parent 7591c71e5c
commit 2557f30c3f
5 changed files with 238 additions and 253 deletions

View File

@ -303,7 +303,7 @@ function this.GetBagItemDataByItemType(_itemType)
if v.type == _itemType and v.num > 0 and v.itemConfig.BackpackOrNot then
items[index] = v
index = index + 1
LogError(tostring(_itemType).."背包物品类型:"..tostring(v.type).."/"..tostring(v.itemConfig.ItemType).." id:"..tostring(v.itemConfig.Id))
--LogError(tostring(_itemType).."背包物品类型:"..tostring(v.type).."/"..tostring(v.itemConfig.ItemType).." id:"..tostring(v.itemConfig.Id))
end
end
return items

View File

@ -325,7 +325,11 @@ function this.CheckRoleRedPointById(_id)
end
return false
end
--获取单个英雄装备数据
function this.GetSingleHeroSingleEquipData(_equipid, _heroDid)
--LogError("获取英雄礼物信息:"..tostring(_equipid).."/".._heroDid)
return equipConfig[_equipid]
end
--检测主角红点
function this.CheckPlayerRedPoint()

View File

@ -1417,9 +1417,10 @@ local function CalculateHeroUpEquipsProAddVal(_heroId)
end
end
for i = 1, #curHeroData.giftIds do
local curEquip = EquipManager.GetSingleHeroSingleEquipData(curHeroData.giftIds[i], _heroId)
local curEquip = GiftManager.GetSingleHeroSingleEquipData(curHeroData.giftIds[i], _heroId)
if curEquip then
for index, prop in ipairs(curEquip.mainAttribute) do
local mainAttribute = EquipManager.GetMainProList(curEquip)
for index, prop in ipairs(mainAttribute) do
local id = prop.propertyId
local value = prop.propertyValue
if addAllProVal[id] then

View File

@ -70,8 +70,8 @@ function RewardEquipSingleShowPopup2:BindEvent()
end)
Util.AddClick(this.btnSure, function()
--装备逻辑
if equipConfigData.Position==9 then
local idList={}
--LogError("fffffffffffff"..equipData.Position)
local idList={}
table.insert(idList,self.equipData.id)
local heroId=""
if self.curHeroData then
@ -94,36 +94,24 @@ function RewardEquipSingleShowPopup2:BindEvent()
self:ClosePanel()
if heroId=="0" then
GiftManager.SetPlayerGift(idList)
HeroManager.ChangeAllHeroGiftLV()
--HeroManager.ChangeAllHeroGiftLV()
else
GiftManager.SetHeroGift(self.curHeroData.dynamicId,idList,1)
end
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)
end)
end
end)
Util.AddClick(this.btnDown, function()
--卸下逻辑
if equipConfigData.Position==9 then
local idList={}
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)
--LogError("2222222222222222222222"..heroId)
--LogError("self.equipData.id==="..self.equipData.id)
table.insert(idList,self.equipData.id)
--table.insert(idList,5200020)
@ -137,16 +125,6 @@ function RewardEquipSingleShowPopup2:BindEvent()
end
self.parent.RefreshWindowData()
end)
else
local equipIdList={}
local equipDataList={}
table.insert(equipIdList,tostring(self.equipData.id))
table.insert(equipDataList,self.equipData)
NetManager.EquipUnLoadOptRequest(self.curHeroData.dynamicId,equipIdList ,1, function ()
self:ClosePanel()
self.parent.UpdateEquipPosHeroData(1,typeToUpdate[self.openType],equipDataList)
end)
end
end)
Util.AddClick(this.btnLock, function()
self:OnLockClickEvent()
@ -162,20 +140,22 @@ function RewardEquipSingleShowPopup2:RemoveListener()
end
--界面打开时调用(用于子类重写)
function RewardEquipSingleShowPopup2:OnOpen(_equipData, _func,_isRewardItemPop,_isShowfenjie,_isDown)
function RewardEquipSingleShowPopup2:OnOpen(parent,_equipData,curHeroData, _func,_isRewardItemPop,_isShowfenjie,_isDown)
if not _equipData then
return
end
equipData = _equipData
self.curHeroData = curHeroData
self.equipData = _equipData
func = _func
isRewardItemPop = _isRewardItemPop and _isRewardItemPop or false
isShowfenjie = not not (_isShowfenjie or false)
isDown = _isDown and _isDown or false
self.parent = parent
end
function RewardEquipSingleShowPopup2:OnShow()
--装备基础信息
local equipConfigData = ConfigManager.GetConfigData(ConfigName.EquipConfig, tonumber(equipData.id))
local itemConfigData = ConfigManager.GetConfigData(ConfigName.ItemConfig, tonumber(equipData.id))
local equipConfigData = ConfigManager.GetConfigData(ConfigName.EquipConfig, tonumber(self.equipData.id))
local itemConfigData = ConfigManager.GetConfigData(ConfigName.ItemConfig, tonumber(self.equipData.id))
this.btnSure:SetActive(isShowfenjie)
this.btnDown:SetActive(isDown)
--local curEquipData = {}
@ -202,16 +182,16 @@ function RewardEquipSingleShowPopup2:OnShow()
this.icon.sprite = Util.LoadSprite(GetResourcePath(itemConfigData.ResourceID))
this.equipInfoText.text = GetLanguageStrById(itemConfigData.ItemDescribe)
this.powerNum.text = EquipManager.CalculateWarForce(equipData.id)
this.powerNum.text = EquipManager.CalculateWarForce(self.equipData.id)
EquipManager.SetEquipStarShow(this.star,equipConfigData.Id)
this.btnJump:SetActive(itemConfigData.UseJump and itemConfigData.UseJump > 0 and BagManager.isBagPanel)
local passiveCfg = {}
if equipData.skillId and equipData.skillId > 0 then
passiveCfg = ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, equipData.skillId)
if self.equipData.skillId and self.equipData.skillId > 0 then
passiveCfg = ConfigManager.GetConfigData(ConfigName.PassiveSkillConfig, self.equipData.skillId)
end
if passiveCfg and equipData.skillId and equipData.skillId > 0 then
if passiveCfg and self.equipData.skillId and self.equipData.skillId > 0 then
this.skillObject:SetActive(true)
this.skillInfo.text = GetLanguageStrById(passiveCfg.Desc)
else
@ -275,7 +255,7 @@ function RewardEquipSingleShowPopup2:OnShow()
end
--装备获得途径
Util.ClearChild(this.getTuGrid.transform)
local curitemData = itemConfig[tonumber(equipData.id)]
local curitemData = itemConfig[tonumber(self.equipData.id)]
if curitemData and curitemData.Jump then
if curitemData.Jump and #curitemData.Jump > 0 then
for i = 1, #curitemData.Jump do

View File

@ -2,25 +2,25 @@
RoleGiftPanel = Inherit(BasePanel)
local spcialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
RoleGiftPanel = Inherit(BasePanel)
local isGonming = 0
local tableName={ "礼物","碎片"}
local tableName = { "礼物", "碎片" }
local isUpZhen = false
local this = RoleGiftPanel
local indexBtnNum=0
local tabs={}
local redTabs={}
local curHeroData=nil
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 allUpIds = {}
local upSuitId = {}
local allEquip = {}
local index = 0
local lv, curNum, maxNum
local heroListData
local isDown=false
local isDown = false
--初始化组件用于子类重写RoleEquipChangePopup
function RoleGiftPanel:InitComponent()
--this.spLoader = SpriteLoader.New()
@ -31,17 +31,17 @@ function RoleGiftPanel:InitComponent()
for i = 1, 2 do
tabs[i] = Util.GetGameObject(self.transform, "Tabs/Btn" .. i)
local nameTxt=Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
local nameTxt = Util.GetGameObject(tabs[i], "Text"):GetComponent("Text")
nameTxt.fontSize = GetCurLanguage() == 0 and 48 or 40
nameTxt.text=tableName[i]
nameTxt.text = tableName[i]
redTabs[i] = Util.GetGameObject(tabs[i], "red")
if i==2 then
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.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 = {}
@ -59,54 +59,57 @@ function RoleGiftPanel:InitComponent()
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 = 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 = 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 = Util.LoadSprite("UI_hz_shenjiang_15_zh")
Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = Util.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 = Util.GetGameObject(self.gameObject, "collectImg"):GetComponent("Image")
this.lvTxt = Util.GetGameObject(self.gameObject, "lvTxt"):GetComponent("Text")
--this.collectImg.sprite=Util.LoadSprite("gh_tt_8")
this.btn_help=Util.GetGameObject(self.gameObject, "btn_help")
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="神将礼物"
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.proTitle.text = "当前礼物加成"
this.proGrid = Util.GetGameObject(self.transform, "pro")
this.proPre=Util.GetGameObject(self.transform, "pro/name")
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/Text"):GetComponent("Text").text="暂无加成属性"
Util.GetGameObject(self.transform, "proEmptyObj/Text"):GetComponent("Text").text = "暂无加成属性"
end
--绑定事件(用于子类重写)
function RoleGiftPanel:BindEvent()
Util.AddClick(this.listCloseBtn,function()
Util.AddClick(this.listCloseBtn, function()
this.listObj:SetActive(false)
end)
Util.AddClick(this.btn_help,function()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Gift,-150,0)
Util.AddClick(this.btn_help, function()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Gift, -150, 0)
end)
Util.AddClick(this.collectImg.gameObject,function()
Util.AddClick(this.collectImg.gameObject, function()
-- local data = {}
-- local singData = {}
-- singData.title = "当前礼物总加成"
@ -115,54 +118,54 @@ function RoleGiftPanel:BindEvent()
-- table.insert(data,singData)
-- UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.IncarnationDes,data)
end)
Util.AddClick(this.btnBack,function()
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
Util.AddClick(this.leftBtn,function()
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()
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].Quality>equipConfig[b.id].Quality
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].Quality > equipConfig[b.id].Quality
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)
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)
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)
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()
Util.AddClick(tabs[i], function()
-- isPlayAnim = true
if i == indexBtnNum then
return
@ -171,7 +174,6 @@ function RoleGiftPanel:BindEvent()
this:OnClickTabBtn(indexBtnNum)
end)
end
end
--添加事件监听(用于子类重写)
@ -184,12 +186,10 @@ function RoleGiftPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
end
--界面打开时调用(用于子类重写)
function RoleGiftPanel:OnOpen(...)
local data = {...}
curHeroData=data[1]
local data = { ... }
curHeroData = data[1]
if data[2] then
heroListData = data[2]
else
@ -197,6 +197,7 @@ function RoleGiftPanel:OnOpen(...)
end
this.listObj:SetActive(false)
end
function RoleGiftPanel:OnShow()
for i = 1, #heroListData do
if curHeroData == heroListData[i] then
@ -208,17 +209,15 @@ function RoleGiftPanel:OnShow()
end
function this:OnSortingOrderChange()
end
function this.RefreshWindowData()
local WarPower = 0
if isDown then
return
end
isUpZhen=teamHero[curHeroData.dynamicId]
isUpZhen = teamHero[curHeroData.dynamicId]
--[[
if isUpZhen then
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
@ -229,80 +228,80 @@ function this.RefreshWindowData()
]]
this.force.text = ""
--显示上面赠送的
local list=GiftManager.GetHeroGifts(curHeroData.dynamicId)
lv,curNum,maxNum=GiftManager.GetCollectLvAndNum()
--if #list>=50 then
--curNum=#list+6
--maxNum=#list+6
--显示上面赠送的
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
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
return a.qua > b.qua
end
else
return a.type>b.type
return a.type > b.type
end
end)
--LogError("当前礼物数量:"..#list)
this.UpScrollView:SetData(giftDatas,
end)
--LogError("当前礼物数量:"..#list)
this.UpScrollView:SetData(giftDatas,
function(index, go)
this.SingleUpItemShow(go, giftDatas[index],index)
this.SingleUpItemShow(go, giftDatas[index], index)
end
)
local proList=GiftManager.GetHeroGiftAddPro(curHeroData.dynamicId)
table.insert(proList,string.format("英雄潜能等级+%s",GiftManager.GetHeroGiftAddPotencyLv(curHeroData.dynamicId)))
local originalList=GiftManager.GetHeroGiftAddOriginalPro(curHeroData.dynamicId)
if proList and #proList>0 then
local proList = GiftManager.GetHeroGiftAddPro(curHeroData.dynamicId)
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)
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)
--LogError("originalList[i]======================"..originalList[i])
--this.proGrid.transform:GetChild(i-1):GetComponent("Text").text=proList[i]
this.SingleProShowData({proId=i,proVal=proList[i]},this.proGrid.transform:GetChild(i-1).gameObject)
len = this.proGrid.transform.childCount
for i = 1, len do
if i <= #proList 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]
this.SingleProShowData({ proId = i, proVal = proList[i] },
this.proGrid.transform:GetChild(i - 1).gameObject)
else
this.proGrid.transform:GetChild(i-1).gameObject:SetActive(false)
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
end
end
else
@ -313,27 +312,29 @@ function this.RefreshWindowData()
--显示下面可赠送的
this:OnClickTabBtn(1)
end
function this.SingleProShowData(data,go)
function this.SingleProShowData(data, go)
go:SetActive(true)
for i = 1, 2 do
local curGo = go .transform:GetChild(i-1).gameObject
local curGo = go.transform:GetChild(i - 1).gameObject
if #data > 1 then
curGo:SetActive(true)
Util.GetGameObject(curGo, "proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[data[i].proId].Info)..":"
Util.GetGameObject(curGo, "proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig
[data[i].proId].Info) .. ":"
local proVale = Util.GetGameObject(curGo, "proVale"):GetComponent("Text")
if propertyConfig[data[i].proId].Style == 1 then--绝对值
if propertyConfig[data[i].proId].Style == 1 then --绝对值
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal)
elseif propertyConfig[data[i].proId].Style == 2 then--百分百
-- 暴击默认 10% 前端加显示
elseif propertyConfig[data[i].proId].Style == 2 then --百分百
-- 暴击默认 10% 前端加显示
-- LogError("str:"..data[i].proId.." ".. GetLanguageStrById(propertyConfig[data[i].proId].Info))
if data[i].proId == 55 then
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal*100 + 1000)
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal * 100 + 1000)
else
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal*100)
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal * 100)
end
end
Util.GetGameObject(curGo, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(propertyConfig[data[i].proId].Icon)
Util.GetGameObject(curGo, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(propertyConfig
[data[i].proId].Icon)
else
curGo:SetActive(false)
end
@ -341,60 +342,59 @@ function this.SingleProShowData(data,go)
end
--显示上面几个
function this.SingleUpItemShow(_go,data,_index)
function this.SingleUpItemShow(_go, data, _index)
_go:SetActive(true)
_go.transform:SetAsFirstSibling()
--local frame=_go:GetComponent("Image")
local frame=Util.GetGameObject(_go,"Image"):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
local frame = Util.GetGameObject(_go, "Image"):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=Util.LoadSprite(GetQuantityImageByquality(itemConfig[data.id].Quantity))
frame.sprite = Util.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= GetLanguageStrById(itemConfig[data.id].Name)
icon.sprite=Util.LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
SetHeroStars(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)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,data,nil,false,false,true)
name.text = GetLanguageStrById(itemConfig[data.id].Name)
icon.sprite = Util.LoadSprite(GetResourcePath(itemConfig[data.id].ResourceID))
SetHeroStars(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)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this, data,curHeroData, nil, false, false, true)
end
)
else
frame.sprite=Util.LoadSprite("X1_tongyong_daojukuang_07")
frame.sprite = Util.LoadSprite("X1_tongyong_daojukuang_07")
--frame.gameObject:SetActive(false)
icon.gameObject:SetActive(false)
name.gameObject:SetActive(false)
starGrid:SetActive(false)
if _index>curNum then
if _index > curNum then
lockObj:SetActive(true)
add:SetActive(false)
red:SetActive(false)
lockText.gameObject:SetActive(true)
lockText.text="收集度"..lv+1 .."级解锁"
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()
Util.AddOnceClick(add, function()
this.listObj:SetActive(true)
end)
end
@ -405,45 +405,43 @@ function this:OnClickTabBtn(_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
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
--LogError("rrrrrrrrrrrrrrrr:"..tostring(allEquip[i].id).."/"..tostring(equipConfig[allEquip[i].id].SuiteID))
else
allEquip[i].isUp=2
else
allEquip[i].isUp = 2
--LogError("bbbbbbbbbbbbbbbb:"..tostring(allEquip[i].id).."/"..tostring(equipConfig[allEquip[i].id].SuiteID))
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
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
return a.quality > b.quality
end
else
return a.isUp > b.isUp
end
end)
--"装备数量:"
this.itemNumText.text = "礼物种类:" .. count
--LogError("xxxxxxxxxxxxxxxxxxxx"..#allEquip)
this:SetItemData(allEquip)
end)
--"装备数量:"
this.itemNumText.text = "礼物种类:" .. count
--LogError("xxxxxxxxxxxxxxxxxxxx"..#allEquip)
this:SetItemData(allEquip)
--this.CheckRedTab()
end
function this:SetItemData(_itemDatas)
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
for k, v in pairs(this.equipPreList) do
v.gameObject:SetActive(false)
end
this.ScrollView:SetData(
@ -452,7 +450,6 @@ function this:SetItemData(_itemDatas)
this.SingleItemDataShow(go, _itemDatas[index])
end
)
end
function this.SingleItemDataShow(_go, _itemData)
@ -460,32 +457,33 @@ function this.SingleItemDataShow(_go, _itemData)
return
end
if not this.equipPreList[_go] then
this.equipPreList[_go] = SubUIManager.Open(SubUIConfig.ItemView,_go.transform)
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)
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))
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)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,_itemData,false,true)
end
end
)
this.equipPreList[_go]:OnOpen(false, { _itemData.id, _itemData.num }, 1.1, false, 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,curHeroData, nil, false, false, true)
else
--UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,_itemData,3,false,nil,curHeroData,4)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this, _itemData,curHeroData, nil, false, true, false)
end
end
)
--end
end
function this:SetSelectBtn()
@ -493,7 +491,8 @@ function this:SetSelectBtn()
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]
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == 0 and
tableName[indexBtnNum] or "<size=40>" .. tableName[indexBtnNum] .. "</size>" --typeTab[indexBtnNum]
end
--选择图片设置父级
@ -503,14 +502,15 @@ function this.SelectImageSetParent(_objPoint)
this.selsectSkillImage.transform.localScale = Vector3.one
this.selsectSkillImage.transform.localPosition = Vector3.zero
end
--界面关闭时调用(用于子类重写)
function RoleGiftPanel:OnClose()
BagManager.isBagPanel=false
BagManager.isBagPanel = false
end
--界面销毁时调用(用于子类重写)
function RoleGiftPanel:OnDestroy()
end
return RoleGiftPanel
end
return RoleGiftPanel