From bfaed0d9375a825875b532d49f33ad3fa01590a1 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Fri, 23 Oct 2020 19:45:14 +0900 Subject: [PATCH] =?UTF-8?q?=E7=81=B5=E5=85=BD=E6=94=BE=E7=94=9F=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Modules/Bag/BagManager.lua | 1 + .../~Lua/Modules/Net/NetManager.lua | 29 ++++- .../~Lua/Modules/Pokemon/PokemonInfoPanel.lua | 5 +- .../~Lua/Modules/Pokemon/PokemonManager.lua | 11 ++ .../Pokemon/PokemonSummonOneResultPanel.lua | 1 + .../View/GeneralPopup_PokemonResolve.lua | 1 + .../View/GeneralPopup_PokemonRestore.lua | 8 +- .../Modules/Resolve/View/Resolve_Pokemon.lua | 123 +++++++++++++++--- 8 files changed, 154 insertions(+), 25 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua index 24c2d7327f..9bfd3dcd4a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua @@ -42,6 +42,7 @@ function this.UpdateBagData(_itemData, isNoSendNewItemEvent) itemdata.frame = GetQuantityImageByquality(_itemCfgData.Quantity) itemdata.type = _itemCfgData.ItemBaseType itemdata.itemType = _itemCfgData.ItemType + itemdata.name=_itemCfgData.Name -- if _itemCfgData.ItemBaseType == ItemBaseType.Equip then -- LogBlue( itemdata.id.." ".. _itemData.itemNum) -- end diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 90c062a139..2562a0398a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -4528,13 +4528,38 @@ function this.PokemonBackRequest(pokemons, func) data.pokemonId = pokemons local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_BACK_REQUEST, MessageTypeProto_pb.POKEMON_BACK_RESPONSE, msg, function(buffer) - -- local data = buffer:DataByte() - -- msg:ParseFromString(data) + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.PokemonBackResponse() + msg:ParseFromString(data) if func then func(msg) end end) end + +--请求灵兽放生 +function this.PokemonFreeRequest(pokemonIds,chipId,chipNum, func) + local data = HeroInfoProto_pb.PokemonFreeRequest() + if pokemonIds then + for i = 1, #pokemonIds do + data.pokemonId:append(pokemonIds[i]) + end + end + --data.pokemonId:append() = pokemonIds + data.pieceId=chipId + data.pieceNum=chipNum + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_FREE_REQUEST, MessageTypeProto_pb.POKEMON_FREE_RESPONSE, msg, function(buffer) + local data = buffer:DataByte() + local msg = HeroInfoProto_pb.PokemonFreeResponse() + msg:ParseFromString(data) + if func then + func(msg) + end + end) +end + + --替换灵兽编队 function this.ReplaceTeamPokemonInfoRequest(_teamPokemonInfos, func) local data = HeroInfoProto_pb.ReplaceTeamPokemonInfoRequest() diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua index e4d074d032..adaec73bf2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua @@ -139,8 +139,11 @@ function PokemonInfoPanel:BindEvent() UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonResolve,lingshouConfig,allMaterials,function () NetManager.PokemonBackRequest(curPokemonData.dynamicId,function(msg) -- this.OnClickTabBtn(curIndex) + LogError("物品"..#msg.drop.itemlist) + LogError("灵兽"..#msg.drop.pokemon) + PopupTipPanel.ShowTip("涅槃成功!") UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() - PopupTipPanel.ShowTip("涅槃成功!") + PokemonManager.UpdateSinglePokemonData(curPokemonData.dynamicId,1,0) end) end) end) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index 6d7fe31425..787bbe06b7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -46,6 +46,7 @@ function this.UpdatePokemonDatas(_msgPokemonData,isRefreshFetter)--单个掉落 this.GetPokemonRefreshFetter(singPokemonData.id) end end + --获取当前灵兽数据 function this.GetSinglePokemonData(_did) if not _did then return nil end @@ -65,6 +66,16 @@ function this.GetPokemonDatas() end return curAllPokemonList end +--移除多个灵兽数据 +function this.RemovePokemonData(ids) +if not ids then + return +end +for i = 1,#ids do + local id=ids[i] + this.RemoveSinglePokemonData(id) +end +end --获取当前可上阵的所有灵兽数据 function this.GetCanUpZhenPokemonDatas() local upZhenSidList = this.GetAllPokemonFormationSids() diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSummonOneResultPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSummonOneResultPanel.lua index c6a793b412..11b866b52b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSummonOneResultPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSummonOneResultPanel.lua @@ -103,6 +103,7 @@ function PokemonSummonOneResultPanel:OnOpen(...) --是否激活特权 local isActive = PrivilegeManager.GetPrivilegeOpenStatusById(3004) if itemNum>10 and isActive then + local currPrivilege=privilegeConfig[3004] itemNum=itemNum*(1+currPrivilege.Condition[1][2]/10000) end --获取免费次数 diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua index 932187be73..2359e818cd 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua @@ -35,6 +35,7 @@ function this:BindEvent() PopupTipPanel.ShowTip(Language[11139]) return end + LogError("请求涅槃") if fun then fun() end diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonRestore.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonRestore.lua index c1029c6744..ad5f4899f4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonRestore.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonRestore.lua @@ -16,7 +16,7 @@ function this:InitComponent(gameObject) this.titleText.text="确认放生" this.infoTxt=Util.GetGameObject(gameObject,"Body/infoText"):GetComponent("Text") this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn") - this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn") + this.confirmBtn=Util.GetGameObject(gameObject,"resetBtn") Util.GetGameObject(gameObject,"resetBtn/Text"):GetComponent("Text").text="放生" --滚动条根节点 this.root = Util.GetGameObject(gameObject, "Root") @@ -45,10 +45,10 @@ function this:OnShow(_parent,...) sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 local args = {...} - this.num.text = args[1] - fun = args[3] + --this.num.text = args[1] + fun = args[2] this.infoTxt.text="确认要放生所选的灵兽或灵兽碎片?" - FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,10,1,sortingOrder,false,args[2]) + FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,10,1,sortingOrder,false,args[1]) end function this:OnClose() diff --git a/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua b/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua index 305bee1b35..a671432797 100644 --- a/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua +++ b/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua @@ -56,9 +56,10 @@ function this:BindEvent() Util.SetGray(this.btn_add,false) end selectChipNum=selectChipNum-1 - this.chipNumTxt=selectChipNum - end - ) + this.chipNumTxt.text=selectChipNum + end) + + --增加按钮 Util.AddClick(this.btn_add,function() if selectChipNum==maxChipNum then @@ -71,21 +72,14 @@ function this:BindEvent() Util.SetGray(this.btn_remove,false) end selectChipNum=selectChipNum + 1 - this.chipNumTxt=selectChipNum - end - ) + this.chipNumTxt.text=selectChipNum + end) + + Util.AddClick(this.helpBtn,function() UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Resolve_Dismantle,this.helpPos.x,this.helpPos.y) end) - Util.AddClick(this.confirmBtn,function() - if tonumber(LengthOfTable(selectHeroData))==0 then - PopupTipPanel.ShowTip(Language[12394]) - else - UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.ResolveDismantle, - HeroManager.GetHeroReturnItems(selectHeroData,GENERAL_POPUP_TYPE.ResolveDismantle),selectHeroData,selectChipId,selectChipNum) - end - end) - + Util.AddClick(this.shopBtn, function() local isActive, errorTip = ShopManager.IsActive(SHOP_TYPE.SOUL_CONTRACT_SHOP) if not isActive then @@ -94,6 +88,93 @@ function this:BindEvent() end UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.SOUL_CONTRACT_SHOP) end) + + --放生按钮 +Util.AddClick(this.confirmBtn,function() + if isPokemon and tonumber(LengthOfTable(selectHeroData))==0 then + PopupTipPanel.ShowTip(Language[12394]) + return + end + + if not isPokemon and (selectChipId==0 or selectChipNum==0) then + PopupTipPanel.ShowTip(Language[12394]) + return + end + + --奖励物品 + --所有材料 + local allMaterials={} + local pokemonIds={} + --灵兽 +if isPokemon then + local allCoin=0 + for key, value in pairs(selectHeroData) do + --升级消耗 + table.insert(pokemonIds,key) + local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",value.lv,"Quality",value.quality) + if lvConfig then + local matrs=lvConfig.SumConsume + if matrs then + for i = 1, #matrs do + local mat=matrs[i] + table.insert(allMaterials,{mat[1],mat[2]}) + end + end + end + --升星消耗 + local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,value.id) + local haveNum=0 + if value.star>0 then + local starConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",value.star,"Quality",value.quality) + if starConfig then + haveNum=starConfig.SumItemNum + local starMatrs=starConfig.SumConsume + --消耗材料 + if starMatrs then + for i = 1, #starMatrs do + local starm=starMatrs[i] + table.insert(allMaterials,{starm[1],starm[2]}) + end + end + end + end + --消耗本体数量,分解成碎片 + allCoin=allCoin+lingshouConfig.CoinReturn[2]*(haveNum+1) + end + --加上所有的分解币 + table.insert(allMaterials,{1203,allCoin}) +else--灵兽碎片 + local itemConfig=ConfigManager.GetConfigData(ConfigName.ItemConfig,selectChipId) + if itemConfig then + local groupId=itemConfig.RewardGroup[1] + local groupConfig=ConfigManager.GetConfigData(ConfigName.RewardGroup,groupId) + if groupConfig then + LogError("掉落组显示:"..groupConfig.ShowItem[1][1]) + local pokemon=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,groupConfig.ShowItem[1][1]) + if pokemon then + table.insert(allMaterials,{pokemon.PiecesCoinReturn[1],pokemon.PiecesCoinReturn[2]*selectChipNum}) + end + end + end +end + +--显示分解界面 +UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonRestore,allMaterials,function() + LogError("灵兽长度 "..#pokemonIds.."碎片id "..selectChipId.." num"..selectChipNum) + NetManager.PokemonFreeRequest(pokemonIds,selectChipId,selectChipNum,function(msg) + UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1) + if pokemonIds and #pokemonIds>0 then + PokemonManager.RemovePokemonData(pokemonIds) + else + BagManager.HeroLvUpUpdateItemsNum(selectChipId,selectChipNum) + end + this.SortTypeClick(sortingOrder) +end) + +end) + +end) + end function this:AddListener() @@ -148,6 +229,7 @@ function this.SortTypeClick(_sortType) chip.num=v.num chip.name=v.name chip.returnCoin=0 + LogError(v.name) chip.dynamicId=v.id table.insert(items,chip) end @@ -157,6 +239,10 @@ function this.SortTypeClick(_sortType) this.selectText.gameObject:SetActive(true) this.selectText.text = Language[11775].."0/"..maxSelectNum -- this.SortHeroDatas(heroDatas) + if oldChoosed then + LogError("2222222222222") + oldChoosed:SetActive(false) + end this.Empty:SetActive(#heroDatas <= 0) this.ScrollView:SetData(heroDatas, function (index, go) this.SingleHeroDataShow(go, heroDatas[index],false) @@ -238,9 +324,6 @@ function this.SingleHeroDataShow(go,_heroData,isGray) --如果灵兽是选中状态,取消选中 if selectHeroData[heroData.dynamicId] then choosed:SetActive(false) - if oldChoosed then - oldChoosed:SetActive(false) - end selectChipId=0 selectHeroData[heroData.dynamicId] = nil local haveNum=LengthOfTable(selectHeroData) @@ -254,6 +337,10 @@ function this.SingleHeroDataShow(go,_heroData,isGray) end return end + if oldChoosed then + oldChoosed:SetActive(false) + oldChoosed=nil + end --如果选中灵兽的数量为最大 if LengthOfTable(selectHeroData)==maxSelectNum then PopupTipPanel.ShowTip(string.format(Language[12396],maxSelectNum))