Compare commits

...

2 Commits

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,7 +70,7 @@ function RewardEquipSingleShowPopup2:BindEvent()
end)
Util.AddClick(this.btnSure, function()
--装备逻辑
if equipConfigData.Position==9 then
--LogError("fffffffffffff"..equipData.Position)
local idList={}
table.insert(idList,self.equipData.id)
local heroId=""
@ -94,27 +94,15 @@ 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 heroId=""
if self.curHeroData then
@ -122,8 +110,8 @@ function RewardEquipSingleShowPopup2:BindEvent()
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

@ -59,17 +59,21 @@ 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.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")
@ -98,7 +102,6 @@ end
--绑定事件(用于子类重写)
function RoleGiftPanel:BindEvent()
Util.AddClick(this.listCloseBtn, function()
this.listObj:SetActive(false)
end)
@ -171,7 +174,6 @@ function RoleGiftPanel:BindEvent()
this:OnClickTabBtn(indexBtnNum)
end)
end
end
--添加事件监听(用于子类重写)
@ -184,8 +186,6 @@ function RoleGiftPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
end
--界面打开时调用(用于子类重写)
function RoleGiftPanel:OnOpen(...)
local data = { ... }
@ -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
@ -211,8 +212,6 @@ function this:OnSortingOrderChange()
end
function this.RefreshWindowData()
local WarPower = 0
if isDown then
@ -272,7 +271,6 @@ function this.RefreshWindowData()
else
return a.type > b.type
end
end)
--LogError("当前礼物数量:"..#list)
this.UpScrollView:SetData(giftDatas,
@ -300,7 +298,8 @@ function this.RefreshWindowData()
--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)
this.SingleProShowData({ proId = i, proVal = proList[i] },
this.proGrid.transform:GetChild(i - 1).gameObject)
else
this.proGrid.transform:GetChild(i - 1).gameObject:SetActive(false)
end
@ -313,13 +312,15 @@ function this.RefreshWindowData()
--显示下面可赠送的
this:OnClickTabBtn(1)
end
function this.SingleProShowData(data, go)
go:SetActive(true)
for i = 1, 2 do
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 --绝对值
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal)
@ -331,9 +332,9 @@ function this.SingleProShowData(data,go)
else
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
@ -371,7 +372,7 @@ function this.SingleUpItemShow(_go,data,_index)
end
BagManager.isBagPanel = false
--UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this,data,2,false,nil,curHeroData,4)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,data,nil,false,false,true)
UIManager.OpenPanel(UIName.RewardEquipSingleShowPopup2,this, data,curHeroData, nil, false, false, true)
end
)
else
@ -392,7 +393,6 @@ function this.SingleUpItemShow(_go,data,_index)
add:SetActive(true)
red:SetActive(data.isRed)
end
end
Util.AddOnceClick(add, function()
this.listObj:SetActive(true)
@ -426,7 +426,6 @@ function this:OnClickTabBtn(_index)
else
return a.isUp > b.isUp
end
end)
--"装备数量:"
this.itemNumText.text = "礼物种类:" .. count
@ -436,7 +435,6 @@ function this:OnClickTabBtn(_index)
--this.CheckRedTab()
end
function this:SetItemData(_itemDatas)
if LengthOfTable(_itemDatas) == 0 then
this.emptyObj.gameObject:SetActive(true)
@ -452,7 +450,6 @@ function this:SetItemData(_itemDatas)
this.SingleItemDataShow(go, _itemDatas[index])
end
)
end
function this.SingleItemDataShow(_go, _itemData)
@ -465,27 +462,28 @@ function this.SingleItemDataShow(_go, _itemData)
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)
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)
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,6,false,nil,curHeroData,4)
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,_itemData,false,true)
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,6 +502,7 @@ function this.SelectImageSetParent(_objPoint)
this.selsectSkillImage.transform.localScale = Vector3.one
this.selsectSkillImage.transform.localPosition = Vector3.zero
end
--界面关闭时调用(用于子类重写)
function RoleGiftPanel:OnClose()
BagManager.isBagPanel = false
@ -512,5 +512,5 @@ end
function RoleGiftPanel:OnDestroy()
end
return RoleGiftPanel
return RoleGiftPanel