diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 20d1905e16..75a05e64e6 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -921,6 +921,7 @@ ItemType = { SelfBox = 20,--自选宝箱 LingShou =21,--灵兽 LingShouChip =22,--灵兽碎片 + heroDogFood =25,--英雄狗粮 } JumpType = { Lottery = 1, --招募 @@ -2424,4 +2425,8 @@ IndexValueDef = { [1] = 1,--首充1美元 [15] = 2, --首充15美元 }, -} \ No newline at end of file +} +RoleUpStarMatType = { + item = 2,--万能狗粮 + hero = 1,--英雄 +} diff --git a/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua b/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua index 202afa5365..a4d505c704 100644 --- a/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua +++ b/Assets/ManagedResources/~Lua/Message/HeroInfoProto_pb.lua @@ -29,6 +29,9 @@ UPHEROLEVELREQUEST_TARGETLEVEL_FIELD = protobuf.FieldDescriptor(); UPHEROLEVELRESPONSE = protobuf.Descriptor(); UPHEROLEVELRESPONSE_HEROID_FIELD = protobuf.FieldDescriptor(); UPHEROLEVELRESPONSE_TARGETLEVEL_FIELD = protobuf.FieldDescriptor(); +CONSUMEITEM = protobuf.Descriptor(); +CONSUMEITEM_TYPE_FIELD = protobuf.FieldDescriptor(); +CONSUMEITEM_ITEMID_FIELD = protobuf.FieldDescriptor(); CONSUMEMATERIAL = protobuf.Descriptor(); CONSUMEMATERIAL_POSITION_FIELD = protobuf.FieldDescriptor(); CONSUMEMATERIAL_HEROIDS_FIELD = protobuf.FieldDescriptor(); @@ -421,6 +424,33 @@ UPHEROLEVELRESPONSE.enum_types = {} UPHEROLEVELRESPONSE.fields = {UPHEROLEVELRESPONSE_HEROID_FIELD, UPHEROLEVELRESPONSE_TARGETLEVEL_FIELD} UPHEROLEVELRESPONSE.is_extendable = false UPHEROLEVELRESPONSE.extensions = {} +CONSUMEITEM_TYPE_FIELD.name = "type" +CONSUMEITEM_TYPE_FIELD.full_name = ".rpc.protocols.ConsumeItem.type" +CONSUMEITEM_TYPE_FIELD.number = 1 +CONSUMEITEM_TYPE_FIELD.index = 0 +CONSUMEITEM_TYPE_FIELD.label = 1 +CONSUMEITEM_TYPE_FIELD.has_default_value = false +CONSUMEITEM_TYPE_FIELD.default_value = 0 +CONSUMEITEM_TYPE_FIELD.type = 5 +CONSUMEITEM_TYPE_FIELD.cpp_type = 1 + +CONSUMEITEM_ITEMID_FIELD.name = "itemId" +CONSUMEITEM_ITEMID_FIELD.full_name = ".rpc.protocols.ConsumeItem.itemId" +CONSUMEITEM_ITEMID_FIELD.number = 2 +CONSUMEITEM_ITEMID_FIELD.index = 1 +CONSUMEITEM_ITEMID_FIELD.label = 1 +CONSUMEITEM_ITEMID_FIELD.has_default_value = false +CONSUMEITEM_ITEMID_FIELD.default_value = "" +CONSUMEITEM_ITEMID_FIELD.type = 9 +CONSUMEITEM_ITEMID_FIELD.cpp_type = 9 + +CONSUMEITEM.name = "ConsumeItem" +CONSUMEITEM.full_name = ".rpc.protocols.ConsumeItem" +CONSUMEITEM.nested_types = {} +CONSUMEITEM.enum_types = {} +CONSUMEITEM.fields = {CONSUMEITEM_TYPE_FIELD, CONSUMEITEM_ITEMID_FIELD} +CONSUMEITEM.is_extendable = false +CONSUMEITEM.extensions = {} CONSUMEMATERIAL_POSITION_FIELD.name = "position" CONSUMEMATERIAL_POSITION_FIELD.full_name = ".rpc.protocols.ConsumeMaterial.position" CONSUMEMATERIAL_POSITION_FIELD.number = 1 @@ -438,8 +468,9 @@ CONSUMEMATERIAL_HEROIDS_FIELD.index = 1 CONSUMEMATERIAL_HEROIDS_FIELD.label = 3 CONSUMEMATERIAL_HEROIDS_FIELD.has_default_value = false CONSUMEMATERIAL_HEROIDS_FIELD.default_value = {} -CONSUMEMATERIAL_HEROIDS_FIELD.type = 9 -CONSUMEMATERIAL_HEROIDS_FIELD.cpp_type = 9 +CONSUMEMATERIAL_HEROIDS_FIELD.message_type = CONSUMEITEM +CONSUMEMATERIAL_HEROIDS_FIELD.type = 11 +CONSUMEMATERIAL_HEROIDS_FIELD.cpp_type = 10 CONSUMEMATERIAL.name = "ConsumeMaterial" CONSUMEMATERIAL.full_name = ".rpc.protocols.ConsumeMaterial" @@ -1926,6 +1957,7 @@ ComplexEquipRequest = protobuf.Message(COMPLEXEQUIPREQUEST) ComplexEquipResponse = protobuf.Message(COMPLEXEQUIPRESPONSE) ComplexJewelEquipRequest = protobuf.Message(COMPLEXJEWELEQUIPREQUEST) ComplexJewelEquipResponse = protobuf.Message(COMPLEXJEWELEQUIPRESPONSE) +ConsumeItem = protobuf.Message(CONSUMEITEM) ConsumeMaterial = protobuf.Message(CONSUMEMATERIAL) DoHeroChangeRequest = protobuf.Message(DOHEROCHANGEREQUEST) DoHeroChangeResponse = protobuf.Message(DOHEROCHANGERESPONSE) diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua index 4eebf46004..88793610c6 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagPanel.lua @@ -360,6 +360,15 @@ function this.SingleItemDataShow(_go, _itemData) Util.GetGameObject(_go.gameObject,"GameObject/item/circleFrameBg/Icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon) Util.GetGameObject(_go.gameObject,"GameObject/item/circleFrameBg/circleFrame"):GetComponent("Image").sprite=Util.LoadSprite(SoulPrintSpriteByQuantity[itemConfig[_itemData.itemConfig.Id].Quantity].circle) num:SetActive(false) + elseif _itemData.itemConfig.ItemType == ItemType.heroDogFood then + num:SetActive(true) + num:GetComponent("Text").text = _itemData.num + frameMask:GetComponent("Image").sprite = Util.LoadSprite(GetHeroChipQuantityImageByquality(_itemData.itemConfig.Quantity)) + local propertyName = itemConfig[_itemData.itemConfig.Id].PropertyName + if (propertyName ~= 0) then + Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):SetActive(true) + Util.GetGameObject(_go.transform, "GameObject/item/fragmentIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) + end end end local redPoint = Util.GetGameObject(_go.gameObject, "GameObject/redPoint") diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 231ba32071..adb4c46f12 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -683,9 +683,8 @@ end --检测卡库中的英雄是否有满足当前升星条件 function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) local needHeroListData = {} - needHeroListData.state = 0 --0 没有 1 有满足条件单位英雄 - needHeroListData.heroList = {} + needHeroListData = {} local heroRankUpGroup = heroRankUpGroup[heroRankUpGroupId] for i, v in pairs(heroDatas) do if v.dynamicId == heroData.dynamicId then --自己筛掉 @@ -698,19 +697,19 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) if v.property == heroData.property then if heroRankUpGroup.IsId > 0 then if v.id == heroRankUpGroup.IsId then - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end else - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end end else if heroRankUpGroup.IsId > 0 then if v.id == heroRankUpGroup.IsId then - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end else - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end end end @@ -721,19 +720,19 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) if v.property == heroData.property then if heroRankUpGroup.IsId > 0 then if v.id == heroRankUpGroup.IsId then - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end else - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end end else if heroRankUpGroup.IsId > 0 then if v.id == heroRankUpGroup.IsId then - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end else - table.insert(needHeroListData.heroList, v) + table.insert(needHeroListData, v) end end end @@ -741,8 +740,8 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) end end --删除编队上的英雄 - if needHeroListData.heroList and LengthOfTable(needHeroListData.heroList) > 0 then - for i, v in pairs(needHeroListData.heroList) do + if needHeroListData and LengthOfTable(needHeroListData) > 0 then + for i, v in pairs(needHeroListData) do for n, w in pairs(FormationManager.formationList) do if this.heroResolveLicence[n] then for m = 1, #w.teamHeroInfos do @@ -755,31 +754,7 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) end end end - --删除冒险上的英雄 - --if needHeroListData.heroList and LengthOfTable(needHeroListData.heroList)>0 then - -- for i, v in pairs(needHeroListData.heroList) do - -- for n,w in pairs(AdventureManager.heroList) do - -- for m = 1, #w do - -- if v.dynamicId==w[m] then - -- needHeroListData.heroList[i] = nil - -- end - -- end - -- end - -- end - --end - local needHeroListData2 = {} - needHeroListData2.state = 0 - --0 没有 1 有满足条件单位英雄 - needHeroListData2.heroList = {} - for i, v in pairs(needHeroListData.heroList) do - table.insert(needHeroListData2.heroList, v) - end - if #needHeroListData2.heroList > 0 then - needHeroListData2.state = 1 - end - table.sort( - needHeroListData2, - function(a, b) + table.sort(needHeroListData,function(a, b) if a.id == b.id then if a.lv == b.lv then return a.id > b.id @@ -791,6 +766,47 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) end end ) + local canSeleItemIds = {} + --前边以前添加英雄代码不动 + if heroRankUpGroup.Items and #heroRankUpGroup.Items > 0 then + for i = 1, #heroRankUpGroup.Items do + local itemId = heroRankUpGroup.Items[i] + LogYellow("itemId "..itemId) + local haveNum = BagManager.GetItemCountById(itemId) + if haveNum > 0 then + for i = 1, haveNum do + local v = {} + v.id = itemId + table.insert(canSeleItemIds,itemId) + end + end + end + end + local needHeroListData2 = {} + needHeroListData2.state = 0 + --0 没有 1 有满足条件单位英雄 + needHeroListData2.heroList = {} + if #needHeroListData > 0 or #canSeleItemIds > 0 then + needHeroListData2.state = 1 + end + --道具靠前 + if #canSeleItemIds > 0 then + for i, v in ipairs(canSeleItemIds) do + local vData = {} + vData.id = v + vData.type = RoleUpStarMatType.item--1道具 2 英雄 需要传给后端 + vData.index = i--用于祭品选择界面 查看是否选中 + table.insert(needHeroListData2.heroList, vData) + end + end + --英雄靠后 + if #needHeroListData > 0 then + for i, v in ipairs(needHeroListData) do + v.type = RoleUpStarMatType.hero--1道具 2 英雄 需要传给后端 + table.insert(needHeroListData2.heroList, v) + end + end + return needHeroListData2 end --计算每个星级的英雄等级最终上限 diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 61657f8fbd..252c4d1a4b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -744,7 +744,14 @@ function this.HeroUpStarEvent(heroId, consumeMaterials, func) local c = data.consumeMaterials:add() c.position = i for j = 1, #consumeMaterials[i] do - c.heroIds:append(consumeMaterials[i][j]) + local e = c.heroIds:add() + e.type = consumeMaterials[i][j].type + if consumeMaterials[i][j].type == RoleUpStarMatType.hero then + e.itemId = consumeMaterials[i][j].dynamicId + elseif consumeMaterials[i][j].type == RoleUpStarMatType.item then + e.itemId = tostring(consumeMaterials[i][j].id) + end + -- c.heroIds:append(consumeMaterials[i][j]) end end --for j = 1, #data.ConsumeMaterial do diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua index 2b415f3d1d..43b636ef82 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemSingleShowPopup.lua @@ -238,7 +238,6 @@ end --界面打开时调用(用于子类重写) function RewardItemSingleShowPopup:OnOpen(...) - isBagPanel = BagManager.isBagPanel itemNu = 0 local data = { ... } @@ -302,6 +301,13 @@ function RewardItemSingleShowPopup:OnShow() this.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) end end + if itemConfigData.ItemType == ItemType.heroDogFood then + local propertyName=itemConfig[itemConfigData.Id].PropertyName + if(propertyName~=0) then + this.fragmentIcon:SetActive(true) + this.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) + end + end if itemConfigData.ItemType == 9 then if itemConfigData.RingLevel > 0 then this.innateImage:SetActive(true) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleAwakeLayout.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleAwakeLayout.lua index 136512b3b8..f82478defe 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleAwakeLayout.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleAwakeLayout.lua @@ -253,7 +253,7 @@ function this.AutoSelectUpStarHeroList(_curUpStarData) and curHeroData.heroConfig.Qualiy ~= 3) then if LengthOfTable(upStarHeroListData.heroList) >= curUpStarData[i].upStarData[4] then for i = 1, curUpStarData[i].upStarData[4] do - if upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" then + if upStarHeroListData.heroList[i].type == RoleUpStarMatType.item or upStarHeroListData.heroList[i].type == RoleUpStarMatType.hero and upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" then table.insert(curSelectHeroList,upStarHeroListData.heroList[i]) end end @@ -286,17 +286,9 @@ function this.UpdateUpStarPosHeroData(curSelectHeroList) end local curUpStarConsumeMaterial={} for i, v in pairs(curSelectHeroList) do - table.insert(curUpStarConsumeMaterial,v.dynamicId) + table.insert(curUpStarConsumeMaterial,v) end upStarConsumeMaterial[curSelectUpStarData.upStarData[2]]=curUpStarConsumeMaterial - -- for i = 1, #upStarConsumeMaterial do - -- Log("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i]) - -- if #upStarConsumeMaterial[i]>0 then - -- for j = 1, #upStarConsumeMaterial[i] do - -- Log("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j]) - -- end - -- end - -- end end --分析设置升星界面显示的英雄list数据 如果当前升星材料的坑位的英雄数据与 以其他坑位有重合并且选择上的英雄不显示 如果是当前坑位显示的英雄显示对勾 function this.SetShowHeroListData(upStarConsumeMaterial,curHeroList)--1 消耗的总消耗组 2 当前坑位可选择的所有英雄 @@ -315,13 +307,17 @@ function this.SetShowHeroListData(upStarConsumeMaterial,curHeroList)--1 消耗 for k = 1, #upStarConsumeMaterial[j] do if j==curSelectUpStarData.upStarData[2] then--curSelectUpStarData 当前坑位选择的英雄信息 for _, v in pairs(curEndShowHeroListData) do - if v.dynamicId==upStarConsumeMaterial[j][k] then + if v.type == RoleUpStarMatType.hero and v.dynamicId==upStarConsumeMaterial[j][k].dynamicId then + v.isSelect=1 + elseif v.type == RoleUpStarMatType.item and v.index==upStarConsumeMaterial[j][k].index then v.isSelect=1 end end else for i, v in pairs(curEndShowHeroListData) do - if v.dynamicId==upStarConsumeMaterial[j][k] then + if v.type == RoleUpStarMatType.hero and v.dynamicId==upStarConsumeMaterial[j][k].dynamicId then + curEndShowHeroListData[i] = nil + elseif v.type == RoleUpStarMatType.item and v.index==upStarConsumeMaterial[j][k].index then curEndShowHeroListData[i] = nil end end @@ -382,20 +378,16 @@ function this.DeleteUpStarMaterials() end end --本地数据删除材料英雄 - - - -- for i = 1, #upStarConsumeMaterial do - -- Log("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i]) - -- if #upStarConsumeMaterial[i]>0 then - -- for j = 1, #upStarConsumeMaterial[i] do - -- Log("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j]) - -- end - -- end - -- end - - + local curDelHeroDids = {} for i = 1, #upStarConsumeMaterial do - HeroManager.DeleteHeroDatas(upStarConsumeMaterial[i]) + for j = 1, #upStarConsumeMaterial[i] do + if upStarConsumeMaterial[i][j].type == RoleUpStarMatType.hero then + table.insert(curDelHeroDids,upStarConsumeMaterial[i][j].dynamicId) + end + end + end + if curDelHeroDids and #curDelHeroDids > 0 then + HeroManager.DeleteHeroDatas(curDelHeroDids) end if HeroManager.heroListPanelProID ~= ProIdConst.All then heroDatas = HeroManager.GetHeroDataByProperty(HeroManager.heroListPanelProID) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua index 78060b86be..3e00ac1778 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarLayout.lua @@ -302,7 +302,7 @@ function RoleUpStarLayout:AutoSelectUpStarHeroList(_curUpStarData) and curHeroData.heroConfig.Qualiy ~= 3) then if LengthOfTable(upStarHeroListData.heroList) >= curUpStarData[i].upStarData[4] then for i = 1, curUpStarData[i].upStarData[4] do - if upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" + if upStarHeroListData.heroList[i].type == RoleUpStarMatType.item or upStarHeroListData.heroList[i].type == RoleUpStarMatType.hero and upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" and (not HarmonyManager.IsChangeColor(upStarHeroListData.heroList[i].dynamicId)) and (not HarmonyManager:IsEnvoy(upStarHeroListData.heroList[i].dynamicId)) then table.insert(curSelectHeroList,upStarHeroListData.heroList[i]) end @@ -336,17 +336,9 @@ function RoleUpStarLayout:UpdateUpStarPosHeroData(curSelectHeroList) end local curUpStarConsumeMaterial={} for i, v in pairs(curSelectHeroList) do - table.insert(curUpStarConsumeMaterial,v.dynamicId) + table.insert(curUpStarConsumeMaterial,v) end upStarConsumeMaterial[curSelectUpStarData.upStarData[2]]=curUpStarConsumeMaterial - for i = 1, #upStarConsumeMaterial do - --Log("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i]) - if #upStarConsumeMaterial[i]>0 then - for j = 1, #upStarConsumeMaterial[i] do - --Log("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j]) - end - end - end end --分析设置升星界面显示的英雄list数据 如果当前升星材料的坑位的英雄数据与 以其他坑位有重合并且选择上的英雄不显示 如果是当前坑位显示的英雄显示对勾 function RoleUpStarLayout:SetShowHeroListData(upStarConsumeMaterial,curHeroList)--1 消耗的总消耗组 2 当前坑位可选择的所有英雄 @@ -365,13 +357,17 @@ function RoleUpStarLayout:SetShowHeroListData(upStarConsumeMaterial,curHeroList) for k = 1, #upStarConsumeMaterial[j] do if j==curSelectUpStarData.upStarData[2] then--curSelectUpStarData 当前坑位选择的英雄信息 for _, v in pairs(curEndShowHeroListData) do - if v.dynamicId==upStarConsumeMaterial[j][k] then + if v.type == RoleUpStarMatType.hero and v.dynamicId==upStarConsumeMaterial[j][k].dynamicId then + v.isSelect=1 + elseif v.type == RoleUpStarMatType.item and v.index==upStarConsumeMaterial[j][k].index then v.isSelect=1 end end else for i, v in pairs(curEndShowHeroListData) do - if v.dynamicId==upStarConsumeMaterial[j][k] then + if v.type == RoleUpStarMatType.hero and v.dynamicId==upStarConsumeMaterial[j][k].dynamicId then + curEndShowHeroListData[i] = nil + elseif v.type == RoleUpStarMatType.item and v.index==upStarConsumeMaterial[j][k].index then curEndShowHeroListData[i] = nil end end @@ -446,8 +442,16 @@ function RoleUpStarLayout:DeleteUpStarMaterials() end end --本地数据删除材料英雄 + local curDelHeroDids = {} for i = 1, #upStarConsumeMaterial do - HeroManager.DeleteHeroDatas(upStarConsumeMaterial[i]) + for j = 1, #upStarConsumeMaterial[i] do + if upStarConsumeMaterial[i][j].type == RoleUpStarMatType.hero then + table.insert(curDelHeroDids,upStarConsumeMaterial[i][j].dynamicId) + end + end + end + if curDelHeroDids and #curDelHeroDids > 0 then + HeroManager.DeleteHeroDatas(curDelHeroDids) end if HeroManager.heroListPanelProID ~= ProIdConst.All then heroDatas = HeroManager.GetHeroDataByProperty(HeroManager.heroListPanelProID) diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarListPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarListPanel.lua index 33e62a53f2..71855106c4 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleUpStarListPanel.lua @@ -42,9 +42,6 @@ function RoleUpStarListPanel:BindEvent() Util.AddClick(this.BtnSure, function() self:ClosePanel() Log("curSelectHeroList "..LengthOfTable(curSelectHeroList)) - for i, v in pairs(curSelectHeroList) do - LogPink("v.dynamicId "..v.dynamicId) - end openThisPanel:UpdateUpStarPosHeroData(curSelectHeroList) end) Util.AddClick(this.btnAutoSelect, function() @@ -68,7 +65,8 @@ function RoleUpStarListPanel:OnOpen(heroData,HeroRankupGroupData,RankupConsumeMa curSelectHeroList={} print(#_curSelectHeroList) for i = 1, #_curSelectHeroList do - curSelectHeroList[_curSelectHeroList[i]]=_curSelectHeroList[i] + -- curSelectHeroList[_curSelectHeroList[i]]=_curSelectHeroList[i] + table.insert(curSelectHeroList,_curSelectHeroList[i]) end curHeroData = _curHeroData @@ -80,7 +78,7 @@ function RoleUpStarListPanel:OnOpen(heroData,HeroRankupGroupData,RankupConsumeMa for n,w in pairs(FormationManager.formationList) do if HeroManager.heroResolveLicence[n] then for m = 1, #w.teamHeroInfos do - if v.dynamicId==w.teamHeroInfos[m].heroId then + if v.type == RoleUpStarMatType.hero and v.dynamicId==w.teamHeroInfos[m].heroId then local isFormationStr = HeroManager.GetHeroFormationStr2(n) if isFormationStr ~= "" then if not text or text == "" then @@ -139,7 +137,7 @@ function this.OnClickEnterHero(go,heroData,type) end elseif type==2 then for i = 1, #curSelectHeroList do - if heroData.dynamicId==curSelectHeroList[i].dynamicId then + if heroData.type == RoleUpStarMatType.hero and heroData.dynamicId==curSelectHeroList[i].dynamicId then table.remove(curSelectHeroList,i) break end @@ -152,49 +150,134 @@ end function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 local choosed = Util.GetGameObject(go.transform, "choosed") choosed:SetActive(false) - if curSelectHeroList[heroData.dynamicId] then - curSelectHeroList[heroData.dynamicId]=heroData - choosed:SetActive(true) - end - Util.GetGameObject(go.transform, "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star)) - Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = heroData.lv - Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.icon) - Util.GetGameObject(go.transform, "posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) - Util.GetGameObject(go.transform, "proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName)) - --Util.GetGameObject(go.transform, "heroStage"):GetComponent("Image").sprite = Util.LoadSprite(HeroStageSprite[heroData.heroConfig.HeroStage]) - local formationMask = Util.GetGameObject(go.transform, "formationMask") - --LogError("heroData.isFormation "..heroData.isFormation) - formationMask:SetActive((heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) or heroData.lockState == 1) - Util.GetGameObject(formationMask.transform, "formationImage"):SetActive(heroData.isFormation ~= "" ) - Util.GetGameObject(formationMask.transform, "lockImage"):SetActive( heroData.lockState == 1) - Util.GetGameObject(go.transform, "noumenon"):SetActive( heroData.id == curHeroData.id ) - Util.GetGameObject(go.transform, "name"):GetComponent("Text").text = SubString2(GetLanguageStrById(heroData.heroConfig.ReadingName),8) - local starGrid = Util.GetGameObject(go.transform, "star") - SetHeroStars(starGrid, heroData.star,1,nil,nil,Vector2.New(0,1)) - local cardBtn = Util.GetGameObject(go.transform, "icon") - local GongMingMask = Util.GetGameObject(go.transform, "GongMingMask") - GongMingMask:SetActive(false)--最后检测是否共鸣 - if heroData.lockState == 1 or (heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) then - else - if HarmonyManager.IsChangeColor(heroData.dynamicId) then - Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" - GongMingMask:SetActive(true) - elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) then - if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then - -- body - Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" - GongMingMask:SetActive(true) + -- if curSelectHeroList[heroData.dynamicId] then + -- curSelectHeroList[heroData.dynamicId]=heroData + -- choosed:SetActive(true) + -- end + for i = 1, #curSelectHeroList do + if curSelectHeroList[i].type == RoleUpStarMatType.hero then + if curSelectHeroList[i].dynamicId == heroData.dynamicId then + choosed:SetActive(true) + end + elseif curSelectHeroList[i].type == RoleUpStarMatType.item then + if curSelectHeroList[i].id == heroData.id and curSelectHeroList[i].index == heroData.index then + choosed:SetActive(true) end - end end - Util.AddOnceClick(GongMingMask, function() - PopupTipPanel.ShowTip(Language[12184]) - end) - Util.AddOnceClick(cardBtn, function() - if curSelectHeroList[heroData.dynamicId] then + Util.GetGameObject(go.transform, "posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) + local frame = Util.GetGameObject(go.transform, "frame"):GetComponent("Image") + local lvGo = Util.GetGameObject(go.transform, "lv") + local icon = Util.GetGameObject(go.transform, "icon"):GetComponent("Image") + local proIcon = Util.GetGameObject(go.transform, "proIcon") + local name = Util.GetGameObject(go.transform, "name"):GetComponent("Text") + local formationMask = Util.GetGameObject(go.transform, "formationMask") + local formationImage = Util.GetGameObject(formationMask.transform, "formationImage") + local lockImage = Util.GetGameObject(formationMask.transform, "lockImage") + local noumenon = Util.GetGameObject(go, "noumenon") + local starGrid = Util.GetGameObject(go.transform, "star") + local cardBtn = Util.GetGameObject(go.transform, "icon") + local GongMingMask = Util.GetGameObject(go.transform, "GongMingMask") + LogYellow("heroData.type "..heroData.type) + if heroData.type == RoleUpStarMatType.hero then + frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(heroData.heroConfig.Quality,heroData.star)) + lvGo:SetActive(true) + Util.GetGameObject(lvGo.transform, "Text"):GetComponent("Text").text = heroData.lv + icon.sprite = Util.LoadSprite(heroData.icon) + proIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName)) + formationMask:SetActive((heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) or heroData.lockState == 1) + formationImage:SetActive(heroData.isFormation ~= "" ) + lockImage:SetActive( heroData.lockState == 1) + noumenon:SetActive( heroData.id == curHeroData.id ) + name.text = SubString2(GetLanguageStrById(heroData.heroConfig.ReadingName),8) + SetHeroStars(starGrid, heroData.star,1,nil,nil,Vector2.New(0,1)) + GongMingMask:SetActive(false)--最后检测是否共鸣 + if heroData.lockState == 1 or (heroData.isFormation ~= "" and heroData.isFormation ~= Language[10410]) then + else + if HarmonyManager.IsChangeColor(heroData.dynamicId) then + Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" + GongMingMask:SetActive(true) + elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) then + if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then + -- body + Util.GetGameObject(go.transform, "lv/Text"):GetComponent("Text").text = ""..heroData.lv.."" + GongMingMask:SetActive(true) + end + + end + end + Util.AddOnceClick(GongMingMask, function() + PopupTipPanel.ShowTip(Language[12184]) + end) + Util.AddOnceClick(cardBtn, function() + local isSelect = false + local selectIndex = 0 + for i = 1, #curSelectHeroList do + if curSelectHeroList[i].type == RoleUpStarMatType.hero then + if curSelectHeroList[i].dynamicId == heroData.dynamicId then + isSelect = true + selectIndex = i + end + end + end + if isSelect then + choosed:SetActive(false) + -- curSelectHeroList[heroData.dynamicId]=nil + table.remove(curSelectHeroList,selectIndex) + this.numText.text=string.format("%s/%s",LengthOfTable(curSelectHeroList),curNeedRoleNum) + return + end + if LengthOfTable(curSelectHeroList)>=curNeedRoleNum then + PopupTipPanel.ShowTip(Language[10403]) + return + end + -- curSelectHeroList[heroData.dynamicId]=heroData + table.insert(curSelectHeroList,heroData) + choosed:SetActive(true) + this.numText.text=string.format("%s/%s",LengthOfTable(curSelectHeroList),curNeedRoleNum) + end) + + Util.AddOnceClick(formationMask, function() + if heroData.isFormation ~= "" then + PopupTipPanel.ShowTip( heroData.isFormation) + return + end + if heroData.lockState == 1 then + PopupTipPanel.ShowTip(Language[10413]) + return + end + end) + elseif heroData.type == RoleUpStarMatType.item then + LogYellow("heroData.id "..heroData.id) + local itemConfig = ConfigManager.TryGetConfigData(ConfigName.ItemConfig,heroData.id) + if not itemConfig then return end + frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(itemConfig.Quantity,itemConfig.HeroStar[1])) + lvGo:SetActive(false) + icon.sprite = Util.LoadSprite(GetResourcePath(itemConfig.ResourceID)) + proIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig.PropertyName)) + formationMask:SetActive(false) + formationImage:SetActive(false) + lockImage:SetActive(false) + noumenon:SetActive(false) + GongMingMask:SetActive(false) + name.text = SubString2(GetLanguageStrById(itemConfig.Name),8) + SetHeroStars(starGrid, itemConfig.HeroStar[1] or 6,1,nil,nil,Vector2.New(0,1)) + Util.AddOnceClick(cardBtn, function() + local isSelect = false + local selectIndex = 0 + for i = 1, #curSelectHeroList do + if curSelectHeroList[i].type == RoleUpStarMatType.item then + if curSelectHeroList[i].id == heroData.id and curSelectHeroList[i].index == heroData.index then + isSelect = true + selectIndex = i + choosed:SetActive(true) + end + end + end + if isSelect then choosed:SetActive(false) - curSelectHeroList[heroData.dynamicId]=nil + -- curSelectHeroList[heroData.dynamicId]=nil + table.remove(curSelectHeroList,selectIndex) this.numText.text=string.format("%s/%s",LengthOfTable(curSelectHeroList),curNeedRoleNum) return end @@ -202,55 +285,53 @@ function this.OnShowSingleCardData(go,heroData)--isSelect 1选择 2 没选择 PopupTipPanel.ShowTip(Language[10403]) return end - curSelectHeroList[heroData.dynamicId]=heroData + -- curSelectHeroList[heroData.dynamicId]=heroData + table.insert(curSelectHeroList,heroData) choosed:SetActive(true) this.numText.text=string.format("%s/%s",LengthOfTable(curSelectHeroList),curNeedRoleNum) - end) - - Util.AddOnceClick(formationMask, function() - if heroData.isFormation ~= "" then - PopupTipPanel.ShowTip( heroData.isFormation) - return - end - if heroData.lockState == 1 then - PopupTipPanel.ShowTip(Language[10413]) - return - end - end) + end) + end + end function this.HeroSortData(heroData) Log("#heroData "..#heroData) --"该神将在大闹天宫阵容中已上阵" table.sort(heroData, function(a, b) - if (a.isFormation == "" or (a.isFormation ~= "" and a.isFormation == Language[10410])) and (b.isFormation == "" or (b.isFormation ~= "" and b.isFormation == Language[10410])) - or (a.isFormation ~= "" and a.isFormation ~= Language[10410]) and (b.isFormation ~= "" and b.isFormation ~= Language[10410]) then - if a.lockState == b.lockState then - if a.heroConfig.Star == b.heroConfig.Star then - if a.lv == b.lv then - if a.id ~= curHeroData.id and b.id ~= curHeroData.id or a.id == curHeroData.id and b.id == curHeroData.id then - return a.id > b.id + if a.type == b.type and a.type == RoleUpStarMatType.hero and b.type == RoleUpStarMatType.hero then + if (a.isFormation == "" or (a.isFormation ~= "" and a.isFormation == Language[10410])) and (b.isFormation == "" or (b.isFormation ~= "" and b.isFormation == Language[10410])) + or (a.isFormation ~= "" and a.isFormation ~= Language[10410]) and (b.isFormation ~= "" and b.isFormation ~= Language[10410]) then + if a.lockState == b.lockState then + if a.heroConfig.Star == b.heroConfig.Star then + if a.lv == b.lv then + if a.id ~= curHeroData.id and b.id ~= curHeroData.id or a.id == curHeroData.id and b.id == curHeroData.id then + return a.id > b.id + else + return not a.id ~= curHeroData.id and b.id == curHeroData.id + end else - return not a.id ~= curHeroData.id and b.id == curHeroData.id + return a.lv < b.lv end else - return a.lv < b.lv + return a.heroConfig.Star < b.heroConfig.Star end else - return a.heroConfig.Star < b.heroConfig.Star + return a.lockState < b.lockState end else - return a.lockState < b.lockState + return (a.isFormation == "" or (a.isFormation ~= "" and a.isFormation == Language[10410])) and (not b.dynamicId ~= "" and b.isFormation ~= Language[10410]) end else - return (a.isFormation == "" or (a.isFormation ~= "" and a.isFormation == Language[10410])) and (not b.dynamicId ~= "" and b.isFormation ~= Language[10410]) + return a.type > b.type end end) end function RoleUpStarListPanel:AutoSelectHero() curSelectHeroList = {} for i = 1, #heroDataList do - if LengthOfTable(curSelectHeroList) < curNeedRoleNum and heroDataList[i].isFormation == "" and heroDataList[i].lockState == 0 and (not HarmonyManager.IsChangeColor(heroDataList[i].dynamicId) and(not HarmonyManager:IsEnvoy(heroDataList[i].dynamicId))) then - curSelectHeroList[heroDataList[i].dynamicId]=heroDataList[i] + if heroDataList[i].type == RoleUpStarMatType.item and LengthOfTable(curSelectHeroList) < curNeedRoleNum or heroDataList[i].type == RoleUpStarMatType.hero and LengthOfTable(curSelectHeroList) < curNeedRoleNum + and heroDataList[i].isFormation == "" and heroDataList[i].lockState == 0 and (not HarmonyManager.IsChangeColor(heroDataList[i].dynamicId) and(not HarmonyManager:IsEnvoy(heroDataList[i].dynamicId))) then + -- curSelectHeroList[heroDataList[i].dynamicId]=heroDataList[i] + table.insert(curSelectHeroList,heroDataList[i]) end end this.numText.text=string.format("%s/%s",LengthOfTable(curSelectHeroList),curNeedRoleNum) diff --git a/Assets/ManagedResources/~Lua/View/ItemView.lua b/Assets/ManagedResources/~Lua/View/ItemView.lua index d3a2c8fc11..8358868acf 100644 --- a/Assets/ManagedResources/~Lua/View/ItemView.lua +++ b/Assets/ManagedResources/~Lua/View/ItemView.lua @@ -234,6 +234,17 @@ function ItemView:GetRewardShow(_itemData, effectLayer) --所有的魂印打开都用这个界面 UIManager.OpenPanel(UIName.SoulPrintPopUp, ShowType.showTip3, nil,_itemData.backData.itemId) end) + elseif _itemData.configData.ItemType == ItemType.heroDogFood then --狗粮 + --狗粮 + Util.AddOnceClick(self.frameBtn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.backData.itemId,nil,self.isRewardItemPop) + end) + self.heroShowGo:SetActive(true) + local propertyName=itemConfig[_itemData.backData.itemId].PropertyName + if(propertyName~=0) then + self.fragmentIcon:SetActive(true) + self.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) + end else Util.AddOnceClick(self.frameBtn, function() UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.backData.itemId,nil,self.isRewardItemPop) @@ -328,11 +339,7 @@ function ItemView:GetRewardShow(_itemData, effectLayer) Util.AddOnceClick(self.frameBtn, function() UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, _itemData.backData.itemId,nil,self.isRewardItemPop) end) - elseif _itemData.itemType == ItemType.LingShou then - Util.AddOnceClick(self.frameBtn, function() - local pokemonData={tempId=_itemData.configData.Id,id=_itemData.configData.Id,star=0,level=1} - UIManager.OpenPanel(UIName.PokemonGetInfoPopup, true,pokemonData) - end) + elseif _itemData.itemType == ItemType.LingShou then end self.gameObject:GetComponent("RectTransform").localScale = Vector2.New(self.scale, self.scale) end @@ -570,6 +577,18 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage) Util.AddOnceClick(self.frameBtn, function() UIManager.OpenPanel(UIName.RewardBoxPanel,nil,itemSId) end) + elseif itemDataConFig.ItemType == ItemType.heroDogFood then + --狗粮 + self.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity)) + self.icon.sprite = Util.LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID)) + local propertyName=itemConfig[itemSId].PropertyName + if(propertyName~=0) then + self.fragmentIcon:SetActive(true) + self.fragmentIcon:GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(propertyName)) + end + Util.AddOnceClick(self.frameBtn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, itemSId,nil,self.isRewardItemPop) + end) else --,5随机道具,6符文 self.frame.sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[itemSId].Quantity))