diff --git a/Assets/ManagedResources/Prefabs/UI/Pokemon/PokemonAllSkillInfoPopup.prefab b/Assets/ManagedResources/Prefabs/UI/Pokemon/PokemonAllSkillInfoPopup.prefab index d9544ee247..38d949df6f 100644 --- a/Assets/ManagedResources/Prefabs/UI/Pokemon/PokemonAllSkillInfoPopup.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Pokemon/PokemonAllSkillInfoPopup.prefab @@ -72,7 +72,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 25.7, y: 421} + m_AnchoredPosition: {x: -1543, y: 421} m_SizeDelta: {x: 662.6, y: 198.5} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1860555992772850798 diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 3045e6254a..39e63362dc 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -2103,4 +2103,10 @@ Pokemon_Popup_Type={ PokemonListPanel_UpWar=1,--出战 PokemonListPanel_List=2,--列表 PokemonListPanel_Fetter=3,--羁绊 +} +--通用弹窗类型 +Pokemon_Formation_RefreshType={ + UpZhen = 1,--上阵 + DownZhen = 2,--下阵 + Replace = 3,--替换 } \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua index 87c4f2ea58..9dd73503a7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua @@ -291,7 +291,16 @@ function this.GetBagItemDataByItemType(_itemType) end return items end - +--通过物品类型获得物品list +function this.GetDataByItemType(_itemType) + local items = {} + for i, v in pairs(this.bagDatas) do + if v.itemConfig.ItemType == _itemType and v.num > 0 and v.itemConfig.BackpackOrNot then + table.insert(items,v) + end + end + return items +end --获取所有的魂印 function this.GetAllSoulPrintData(quality) local items = {} diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 3dbd54fd41..8dc96c810d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -907,8 +907,16 @@ function this.DiffMonsterRequest(func) local data = buffer:DataByte() local msg = HeroInfoProto_pb.GetAllPokemonResponse() msg:ParseFromString(data) - -- DiffMonsterManager.Init(msg.pokemonInfo) - PokemonManager.InitPokemonsData(msg.pokemonInfo) + local pokemonInfo = {} + for i = 1, 8 do + local singledata = {} + singledata.tempId = 20000 + i + singledata.id = tostring((20000 + i)) + singledata.star =1 + singledata.level = 1 + table.insert(pokemonInfo,singledata) + end + PokemonManager.InitPokemonsData(pokemonInfo)--msg.pokemonInfo) if func then func(msg) end @@ -4493,4 +4501,18 @@ function this.UpPokemonLevelRequest(pokemonDId, upLv,oldLv, func) end end) end +--请求灵兽升星 +function this.UpPokemonStarRequest(pokemonDId, func) + local data = HeroInfoProto_pb.PokenmonUpLevelRequest() + LogPink("pokemonDId " .. pokemonDId) + data.pokemonId = pokemonDId + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_COMONPENT_LEVELUP_REQUEST, MessageTypeProto_pb.POKEMON_COMONPENT_LEVELUP_RESPONSE, msg, function(buffer) + local data = buffer:DataByte() + msg:ParseFromString(data) + if func then + func(msg) + end + end) +end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonAllSkillInfoPopup.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonAllSkillInfoPopup.lua index c95f8280fa..780fd8d1a4 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonAllSkillInfoPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonAllSkillInfoPopup.lua @@ -43,16 +43,23 @@ function PokemonAllSkillInfoPopup:OnShow() end function this.ShowPokemonList() + local allSkillIds = ConfigManager.GetConfigData(ConfigName.SpiritAnimal,curPokemonData.id).SkillArray pokemonSkillDataList = {} + for i = 1, #allSkillIds do + table.insert(pokemonSkillDataList,{star = allSkillIds[i][1],conFig = ConfigManager.GetConfigData(ConfigName.SkillConfig,allSkillIds[i][2])}) + end this.ScrollView:SetData(pokemonSkillDataList, function (index, go) this.SingPokemonDataShow(go, pokemonSkillDataList[index]) end) end - +--478A5F B9AC97 string.format("%s/%s",PrintWanNum2(curMaterialBagNum),PrintWanNum2(upStarMaterialsData[i][2])) function this.SingPokemonDataShow(go,data) - Util.GetGameObject(go, "lv"):GetComponent("Text").Text = "" - Util.GetGameObject(go, "need"):GetComponent("Text").Text = "" - Util.GetGameObject(go, "info"):GetComponent("Text").Text = "" + local lvStr = "等级"..data.conFig.Id%10 + local starStr = "灵兽".. data.star .."星激活" + local isCurStar = (data.star == curPokemonData.star) + Util.GetGameObject(go, "lv"):GetComponent("Text").Text = isCurStar and string.format("%s",lvStr) or string.format("%s",lvStr) + Util.GetGameObject(go, "need"):GetComponent("Text").Text = isCurStar and string.format("%s",starStr) or string.format("%s",starStr) + Util.GetGameObject(go, "info"):GetComponent("Text").Text = isCurStar and string.format("%s",GetSkillConfigDesc(data.conFig)) or string.format("%s",GetSkillConfigDesc(data.conFig)) end --界面关闭时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua index 0684a13b40..67c2fb5ab2 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua @@ -92,65 +92,71 @@ function PokemonInfoPanel:BindEvent() end) --涅槃 Util.AddClick(this.nirvanaBtn, function() - local lv=curPokemonData.lv - local star=curPokemonData.star - local qua=curPokemonData.Quality - --所有材料 - local allMaterials={} - --升级消耗 - local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",lv,"Quality",star) - if lvConfig then - local matrs=lvConfig.SumConsume - if matrs then + local lv=curPokemonData.lv + local star=curPokemonData.star + local qua=curPokemonData.Quality + --所有材料 + local allMaterials={} + --升级消耗 + local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",lv,"Quality",star) + 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]}) + local mat=matrs[i] + table.insert(allMaterials,{mat[1],mat[2]}) end - end - end - --升星消耗 - local starConfig=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",star,"Quality",qua) - if starConfig then - --消耗本体数量,分解成碎片 - local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,curPokemonData.id) - if starConfig.ConsumeItemNum>0 then - local chipNum=lingshouConfig.PiecesCount*(1+starConfig.ConsumeItemNum) - table.insert(allMaterials,{lingshouConfig.PiecesId,chipNum}) - end - 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 - local coin=0 - --消耗妖晶的数量 - if spiritConfig then - coin=spiritConfig.ReturnCost - end - --判断妖晶是否充足 - if coin0 then + local chipNum=lingshouConfig.PiecesCount*(1+starConfig.ConsumeItemNum) + table.insert(allMaterials,{lingshouConfig.PiecesId,chipNum}) + end + 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 + local coin=0 + --消耗妖晶的数量 + if spiritConfig then + coin=spiritConfig.ReturnCost + end + --判断妖晶是否充足 + if coin 0) + this.sortText:GetComponent("Text").text = sortIndex + this.upZhenImage:SetActive(sortIndex > 0) end @@ -328,8 +336,9 @@ function this.RightBtnOnClick() this:UpdateLiveList() this.leftLiveObj = this.curLiveObj this.curLiveObj = this.rightLiveObj - this.rightLiveObj = this:LoadHerolive(rightPokemonData,this.rightObj) - this:UpdatePanelData() + this.rightLiveObj = this.LoadHerolive(rightPokemonData,this.rightObj) + this.OnShowData() + this.contents[curIndex].view:OnShow(this,curPokemonData) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) this.rightBtn:GetComponent("Button").enabled = true @@ -357,8 +366,9 @@ function this.LeftBtnOnClick() this:UpdateLiveList() this.rightLiveObj = this.curLiveObj this.curLiveObj = this.leftLiveObj - this.leftLiveObj = this:LoadHerolive(leftPokemonData,this.leftObj) - this:UpdatePanelData() + this.leftLiveObj = this.LoadHerolive(leftPokemonData,this.leftObj) + this.OnShowData() + this.contents[curIndex].view:OnShow(this,curPokemonData) local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic") SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false) this.leftBtn:GetComponent("Button").enabled = true diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonListPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonListPanel.lua index d3c5de24e6..b0a6a549e6 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonListPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonListPanel.lua @@ -2,7 +2,8 @@ PokemonListPanel = Inherit(BasePanel) local this = PokemonListPanel local curIndex = 1 - +local curUpZhenPokemonData +local upZhenIndex this.contents = { [1] = {view = require("Modules/Pokemon/view/PokemonListPanel_UpWar"), panelName = "PokemonListPanel_UpWar"}, [2] = {view = require("Modules/Pokemon/view/PokemonListPanel_List"), panelName = "PokemonListPanel_List"}, @@ -44,8 +45,10 @@ function PokemonListPanel:RemoveListener() end --界面打开时调用(用于子类重写) -function PokemonListPanel:OnOpen(_curIndex) +function PokemonListPanel:OnOpen(_curIndex,_curUpZhenPokemonData,_upZhenIndex)--_curUpZhenPokemonData,_upZhenIndex 只有上阵才会传 curIndex = _curIndex and _curIndex or 1 + curUpZhenPokemonData = _curUpZhenPokemonData + upZhenIndex = _upZhenIndex end --界面打开或者重新打开后,界面刷新时调用(用于子类重写) function PokemonListPanel:OnShow() @@ -73,7 +76,7 @@ function this.ShowSShowwitchView(index) this.prefabs[i].gameObject:SetActive(i == index)--切换子模块预设显隐 end --执行子模块初始化 - this.contents[index].view:OnShow(this) + this.contents[index].view:OnShow(this,curUpZhenPokemonData,upZhenIndex) end --界面关闭时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua index c9e8bd0046..64bb4e4fa7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua @@ -148,7 +148,7 @@ function this.ShowSinglePokemonList(go,singleData,liveIndex) elseif state == 3 then addInfo:SetActive(true) Util.AddOnceClick( Util.GetGameObject(go, "addInfo/addInfo/addClick"), function() - UIManager.OpenPanel(UIName.PokemonListPanel,Pokemon_Popup_Type.PokemonListPanel_UpWar) + UIManager.OpenPanel(UIName.PokemonListPanel,Pokemon_Popup_Type.PokemonListPanel_UpWar,nil,liveIndex) end) elseif state == 4 then dragViewListGo[liveIndex].gameObject:SetActive(true) @@ -168,7 +168,7 @@ function this.ShowSinglePokemonList(go,singleData,liveIndex) local starSize = Vector2.New(65,65) SetHeroStars(Util.GetGameObject(go, "upZhenInfo/starGrid"), singleData.star,1,starSize,0,Vector2.New(0.5,0.5)) Util.AddOnceClick( Util.GetGameObject(go, "upZhenInfo/upZhenClick"), function() - UIManager.OpenPanel(UIName.PokemonInfoPanel,singleData) + UIManager.OpenPanel(UIName.PokemonInfoPanel,singleData,PokemonManager.GetPokemonDatas()) end) end end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index 77d964d468..2649c8543d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -4,9 +4,16 @@ local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) local spiritAnimalBook = ConfigManager.GetConfig(ConfigName.SpiritAnimalBook) local pokemons = {}--灵兽数据 local pokemonFetter = {}--灵兽羁绊 -local pokemonFormatipn = {}--灵兽编队 +local pokemonFormation = {}--灵兽编队 function this.Initialize() + pokemonFormation = {} + for i = 1, 6 do + local teamInfo = {} + teamInfo.pokemonDid = nil + teamInfo.position = i + table.insert(pokemonFormation, teamInfo) + end end --------------------------------------------- --初始化灵兽数据 @@ -81,10 +88,10 @@ if pokemons[_did] then end end --获取当前所有可吞卡灵兽数据 -function this.GetNoUpLvPokemonData(_id) +function this.GetNoUpLvPokemonData(_id,_did) local curAllPokemonList = {} for key, value in pairs(pokemons) do - if value.isZhen == false and value.star <= 0 and value.lv <= 1 then + if value.isZhen == false and value.star <= 0 and value.lv <= 1 and value.id == _id and value.dynamicId ~= _did then table.insert(curAllPokemonList,value) end end @@ -137,8 +144,6 @@ function this.GetCurStarSkillId(_sid,_star) end - - --------------------------------------------- --灵兽羁绊 (羁绊属性直接就是团队属性) --------------------------------------------- @@ -226,30 +231,42 @@ end --刷新本地灵兽编队数据 function this.UpdatePokemonFormationDatas(_msgPokemonFormationList) - pokemonFormatipn = {} - for i = 1, #_msgPokemonFormationList do - local teamInfo = {} - teamInfo.pokemonDid = _msgPokemonFormationList[i].pokemonDid - teamInfo.position = _msgPokemonFormationList[i].position - table.insert(pokemonFormatipn, teamInfo) + for i = 1, #pokemonFormation do + if _msgPokemonFormationList[i] and _msgPokemonFormationList[i].pokemonDid then + if i == _msgPokemonFormationList[i].position then + pokemonFormation[i].pokemonDid = _msgPokemonFormationList[i].pokemonDid + end + end end end - +--获取变队形信息 +function this.GetAllPokemonFormationData() + return pokemonFormation +end --获取编队灵兽静态id list function this.GetAllPokemonFormationSids() local formationSids = {} - for i = 1, #pokemonFormatipn do - if pokemons[pokemonFormatipn[i].pokemonDid] then - formationSids[pokemons[pokemonFormatipn[i].pokemonDid].id] = pokemons[pokemonFormatipn[i].pokemonDid] + for i = 1, #pokemonFormation do + if pokemons[pokemonFormation[i].pokemonDid] then + formationSids[pokemons[pokemonFormation[i].pokemonDid].id] = pokemons[pokemonFormation[i].pokemonDid] end end return formationSids end - +--获取编队灵兽动态id list +function this.GetAllPokemonFormationDids() + local formationDids = {} + for i = 1, #pokemonFormation do + if pokemons[pokemonFormation[i].pokemonDid] then + formationDids[pokemonFormation[i].pokemonDid] = pokemonFormation[i] + end + end + return formationDids +end --获取灵兽编队属性 function this.GetPokemonFormationAddPro() local allPro = {} - for key, value in pairs(pokemonFormatipn) do + for key, value in pairs(pokemonFormation) do if pokemons[key] then local curPokemonAddPro = this.GetNoUpLvPokemonData(key) HeroManager.DoubleTableCompound(allPro, curPokemonAddPro) @@ -257,4 +274,33 @@ function this.GetPokemonFormationAddPro() end return allPro end +--刷新编队信息 type 1 上阵 2 下阵 3 替换(上阵) +function this.RefreshPokemonFormation(type,did,pos) + for i = 1, #pokemonFormation do + if pos then + if pokemonFormation[i].position == pos then + if type == Pokemon_Formation_RefreshType.UpZhen then + pokemonFormation[i].pokemonDid = did + elseif type == Pokemon_Formation_RefreshType.DownZhen then + pokemonFormation[i].pokemonDid = nil + elseif type == Pokemon_Formation_RefreshType.Replace then + pokemonFormation[i].pokemonDid = did + end + end + else--只有下阵 + if type == Pokemon_Formation_RefreshType.DownZhen then + if pokemonFormation[i].pokemonDid == did then + pokemonFormation[i].pokemonDid = nil + end + end + end + end +end + +function this.PiaoWarPowerChange(oldWarPower,newWarPower) + --飘战力 + if oldWarPower ~= newWarPower then + UIManager.OpenPanel(UIName.WarPowerChangeNotifyPanelV2,{oldValue = oldWarPower,newValue = newWarPower,pos=Vector3.New(-467,837.2),duration=0.7,isShowBg=false,isShowOldNum=false,pivot=Vector2.New(0,0.5)}) + end +end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSkillInfoPopup.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSkillInfoPopup.lua index fda0a2a680..0634520bf7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSkillInfoPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonSkillInfoPopup.lua @@ -45,29 +45,37 @@ function PokemonSkillInfoPopup:OnShow() end function this.ShowPokemonSkillList() - this.titleText.Text = "" - this.skillIcon.sprite = Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.SkillConfig,curSkillId).Icon)) - this.skillLv.Text = "" - this.curSkillLv.Text = "" - this.curSkillInfo.Text = "" - pokemonSkillDataList = {} + local curSkillId = PokemonManager.GetCurStarSkillId(curPokemonData.id,curPokemonData.star) + local nextSkillId = PokemonManager.GetCurStarSkillId(curPokemonData.id,curPokemonData.star + 1) + local curSkillConFig = ConfigManager.GetConfigData(ConfigName.SkillConfig,curSkillId) + table.insert(pokemonSkillDataList,curSkillConFig) + if nextSkillId then + local nextSkillConFig = ConfigManager.GetConfigData(ConfigName.SkillConfig,nextSkillId) + table.insert(pokemonSkillDataList,nextSkillConFig) + end + this.titleText.Text = curSkillConFig.Name + this.skillIcon.sprite = Util.LoadSprite(GetResourcePath(curSkillConFig.Icon)) + this.skillLv.Text = curSkillConFig.Id%10 + this.curSkillLv.Text = "等级"..curSkillConFig.Id%10 + this.curSkillInfo.Text = curSkillConFig.ShortDesc + for i = 1, #pokemonSkillPreList do if pokemonSkillDataList[i] then pokemonSkillPreList[i]:SetActive(true) - this.ShowSinglePokemonSkillList(pokemonSkillPreList[i],pokemonSkillDataList[i]) + this.ShowSinglePokemonSkillList(pokemonSkillPreList[i],pokemonSkillDataList[i],i) else pokemonSkillPreList[i]:SetActive(false) end end end -function this.ShowSinglePokemonSkillList(go,data) - Util.GetGameObject(go, "nameText"):GetComponent("Text").Text = "" - Util.GetGameObject(go, "lvText"):GetComponent("Text").Text = "" - Util.GetGameObject(go, "Text (1)"):GetComponent("Text").Text = "" +function this.ShowSinglePokemonSkillList(go,data,index) + Util.GetGameObject(go, "nameText"):GetComponent("Text").Text = index == 1 and "当前等级" or "下一等级" + Util.GetGameObject(go, "lvText"):GetComponent("Text").Text = "等级"..data.Id%10 + Util.GetGameObject(go, "Text (1)"):GetComponent("Text").Text = GetSkillConfigDesc(data) Util.AddOnceClick(Util.GetGameObject(go, "Text (1)"), function() - UIManager.OpenPanel(UIName.PokemonAllSkillInfoPopup) + UIManager.OpenPanel(UIName.PokemonAllSkillInfoPopup,curPokemonData) end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua index 3796a1554f..6e9fcf724a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua @@ -25,7 +25,7 @@ function this:InitComponent(gameObject) Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/Image/Text"):GetComponent("Text").text = "基础属性" Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/Image (1)/Text"):GetComponent("Text").text = "技能" Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/Image (2)/Text"):GetComponent("Text").text = "升级要求" - Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/tipText"):GetComponent("Text").text = "灵兽属性的20%平分给上阵的所有神将" + Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/tipText"):GetComponent("Text").text = "灵兽属性会平分给上阵的所有神将" --技能 this.skillIcon = Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/skill/icon"):GetComponent("Image") this.skillName = Util.GetGameObject(gameObject,"PokemonInfoPanel_UpLv/skill/skillName"):GetComponent("Text") @@ -167,15 +167,12 @@ end --长按升级结束后请求协议 function this.LongLvUpClick(oldLv) NetManager.HeroLvUpEvent(curPokemonData.dynamicId,curPokemonData.lv,oldLv,function (msg) - this.LongLvUpClickUpdataData(msg) + PokemonManager.UpdateSinglePokemonData(curPokemonData.dynamicId,msg.targetLevel,curPokemonData.star) + curPokemonData = PokemonManager.GetSinglePokemonData(curPokemonData.dynamicId) + this.ShowPokemonInfo() + _isReqLvUp = false end) end -function this.LongLvUpClickUpdataData(msg) - PokemonManager.UpdateSinglePokemonData(curPokemonData.dynamicId,msg.targetLevel,curPokemonData.star) - curPokemonData = PokemonManager.GetSinglePokemonData(curPokemonData.dynamicId) - this.ShowPokemonInfo() - _isReqLvUp = false -end --升级按钮点击事件处理 function this.LvUpClick(isSingleLvUp) --各种判断能否升级 diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpStar.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpStar.lua index 6d2fccf749..81f0dea2ce 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpStar.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpStar.lua @@ -2,9 +2,10 @@ local this = {} local sortingOrder=0 local isHeroUpStar=false--是否可升星 -local isUpStarMaterials=true--升星 材料是否充足 +local isUpStarMaterials=0--升星 材料是否充足 local upStarMaterialsPre = {} local curPokemonData = {} +local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) function this:InitComponent(gameObject) Util.GetGameObject(gameObject,"PokemonInfoPanel_UpStar/upStar/Image (1)/Text"):GetComponent("Text").text = "灵兽提升" Util.GetGameObject(gameObject,"PokemonInfoPanel_UpStar/upStar/Image (2)/Text"):GetComponent("Text").text = "升星要求" @@ -59,11 +60,12 @@ end function this.OnUpdate() end +local curUpStarSelectPokemonData = {} --进阶属性提升 function this.OnShowData() --curPokemonData - local curUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", 4, "Star", 4) - local nextUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", 4, "Star", 4) + local curUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", spiritAnimal[curPokemonData.id].Quality, "Star", curPokemonData.star) + local nextUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", spiritAnimal[curPokemonData.id].Quality, "Star", curPokemonData.star + 1) if not nextUpStarConfig then this.upStar:SetActive(false) this.noUpStarText:SetActive(true) @@ -90,9 +92,9 @@ function this.OnShowData() end local nextSkillConFig = ConfigManager.GetConfigData(ConfigName.SkillConfig,nextSkillId) this.skill1Icon.sprite = Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.SkillConfig,curSkillId).Icon)) - this.skill1Lv.text = 10 + this.skill1Lv.text = curSkillId%10 this.skill2Icon.sprite = Util.LoadSprite(GetResourcePath(nextSkillConFig.Icon)) - this.skill2Lv.text = 10 + this.skill2Lv.text = nextSkillId%10 -- local skillstr = "" -- for i = 1, #nextSkillConFig.DescValue do -- if skillstr == "" then @@ -104,25 +106,36 @@ function this.OnShowData() this.skillTip.text = "提升预览:"--.. string.format(nextSkillConFig.Desc,nextSkillConFig.DescValue) local upStarMaterialsData = {{curPokemonData.id,curUpStarConfig.ConsumeItemNum},curUpStarConfig.ConsumeRes[1]} - isUpStarMaterials = true + isUpStarMaterials = 0 for i = 1, #upStarMaterialsPre do local itemParent = Util.GetGameObject(upStarMaterialsPre[i],"itemParent") local num = Util.GetGameObject(upStarMaterialsPre[i],"num"):GetComponent("Text") if upStarMaterialsData[i] then - SubUIManager.Open(SubUIConfig.ItemView, itemParent.transform):OnOpen(false, {upStarMaterialsData[i][1],0}, 0.97) + local configMaterialId = upStarMaterialsData[i][1] + local configMaterialNum = upStarMaterialsData[i][2] + SubUIManager.Open(SubUIConfig.ItemView, itemParent.transform):OnOpen(false, {configMaterialId,0}, 0.97) local curMaterialBagNum = 0 if i == 1 then--需要的灵兽 - curMaterialBagNum = LengthOfTable(PokemonManager.GetNoUpLvPokemonData(curPokemonData.id)) + curUpStarSelectPokemonData = {} + local NoUpLvPokemonData = PokemonManager.GetNoUpLvPokemonData(curPokemonData.id,curPokemonData.dynamicId) + curMaterialBagNum = LengthOfTable(NoUpLvPokemonData) + for i = 1, #NoUpLvPokemonData do + if i <= configMaterialNum then + table.insert(curUpStarSelectPokemonData,NoUpLvPokemonData[i]) + end + end elseif i == 2 then--需要的材料 curMaterialBagNum = BagManager.GetItemCountById(upStarMaterialsData[i][1]) end - if curMaterialBagNum < upStarMaterialsData[i][2] then - isUpStarMaterials = false + if curMaterialBagNum < configMaterialNum then + if isUpStarMaterials <= 0 then + isUpStarMaterials = configMaterialId + end -- go.transform:Find("Image").gameObject:SetActive(true)--显示加号 - num.text=string.format("%s/%s",PrintWanNum2(curMaterialBagNum),PrintWanNum2(upStarMaterialsData[i][2])) + num.text=string.format("%s/%s",PrintWanNum2(curMaterialBagNum),PrintWanNum2(configMaterialNum)) else -- go.transform:Find("Image").gameObject:SetActive(false)--隐藏加号 - num.text=string.format("%s/%s",PrintWanNum2(curMaterialBagNum),PrintWanNum2(upStarMaterialsData[i][2])) + num.text=string.format("%s/%s",PrintWanNum2(curMaterialBagNum),PrintWanNum2(configMaterialNum)) end end end @@ -133,13 +146,26 @@ end --扣除升星 消耗的材料 更新英雄数据 function this.DeleteUpStarMaterials() - + if curUpStarSelectPokemonData then + for i = 1, #curUpStarSelectPokemonData do + PokemonManager.RemoveSinglePokemonData(curUpStarSelectPokemonData[i].dynamicId) + end + end end --进阶按钮点击事件处理 function this.StarUpClick() - + if isUpStarMaterials ~= 0 then + PopupTipPanel.ShowTip("【"..ConfigManager.GetConfigData(ConfigName.ItemConfig,isUpStarMaterials).."】不足!") + return + end + NetManager.UpPokemonStarRequest(curPokemonData.dynamicId, function() + PokemonManager.UpdateSinglePokemonData(curPokemonData.dynamicId,curPokemonData.lv,curPokemonData.star + 1) + curPokemonData = PokemonManager.GetSinglePokemonData(curPokemonData.dynamicId) + this.DeleteUpStarMaterials() + this.ShowPokemonInfo() + end) end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua index fc83e06913..db8849b704 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua @@ -2,6 +2,7 @@ local this = {} local sortingOrder=0 local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) +local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) local TabBox = require("Modules/Common/TabBox") local _TabData={ [1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "灵兽" }, [2] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "碎片" }, @@ -14,6 +15,7 @@ local curIndex = 0 local pokemonList = {} local pokemonChipList = {} function this:InitComponent(gameObject) + this.ChipItemList={}--存储itemview 重复利用 Util.GetGameObject(gameObject, "PokemonListPanel_List/name"):GetComponent("Text").text = "灵兽列表" this.tabBox = Util.GetGameObject(gameObject, "PokemonListPanel_List/TabBox") @@ -70,6 +72,7 @@ function this.OnClickTabBtn(_curIndex) this.ScrollParentView1:SetActive(true) this.ScrollParentView2:SetActive(false) pokemonList = PokemonManager.GetPokemonDatas() + this.PokemonDataSort(pokemonList) this.ScrollView:SetData(pokemonList, function (index, go) this.SingPokemonDataShow(go, pokemonList[index]) end) @@ -78,7 +81,11 @@ function this.OnClickTabBtn(_curIndex) elseif curIndex == 2 then this.ScrollParentView1:SetActive(false) this.ScrollParentView2:SetActive(true) - pokemonChipList = {} + pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip) + this.PokemonChipDataSort(pokemonChipList) + for key, value in pairs(this.ChipItemList) do + value.gameObject:SetActive(false) + end this.ScrollView2:SetData(pokemonChipList, function (index, go) this.SingPokemonChipDataShow(go, pokemonChipList[index]) end) @@ -94,7 +101,7 @@ function this.OnClickTabBtn(_curIndex) end -function this.SingPokemonDataShow(_go,_itemData,curEquipStarsConfig) +function this.SingPokemonDataShow(_go,_itemData) Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(itemConfig[_itemData.id].Quantity)) Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(itemConfig[_itemData.id].ResourceID)) Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=itemConfig[_itemData.id].Name @@ -102,34 +109,49 @@ function this.SingPokemonDataShow(_go,_itemData,curEquipStarsConfig) Util.GetGameObject(_go.transform,"pokemonStateText"):GetComponent("Text").text="休息中" local starSize = Vector2.New(50,50) SetHeroStars(Util.GetGameObject(_go.transform, "star/starGrid"), _itemData.star,1,starSize,-5,Vector2.New(0.5,0.5)) - -- local choosed =Util.GetGameObject(_go.transform, "choosed") - -- choosed:SetActive(curSelectEquip.Id == _itemData .Id) - -- local redPoint = Util.GetGameObject(_go.transform,"redPoint") - -- redPoint:SetActive(bagPosEquips[curEquipStarsConfig.Id - 1] and bagPosEquips[curEquipStarsConfig.Id - 1] >= equipStarsConfig[curEquipStarsConfig.Id - 1].RankupCount) Util.AddOnceClick(Util.GetGameObject(_go.transform,"click"), function() - -- NetManager.UpPokemonLevelRequest(_itemData.dynamicId, _itemData.lv + 1,_itemData.lv, function() - -- PokemonManager.UpdateSinglePokemonData(_itemData.dynamicId,_itemData.lv + 1,_itemData.star) - -- end) UIManager.OpenPanel(UIName.PokemonInfoPanel,_itemData) end) end -function this.SingPokemonChipDataShow(_go,_itemData,curEquipStarsConfig) - local view = SubUIManager.Open(SubUIConfig.ItemView, Util.GetTransform(item, "content").transform) - view:OnOpen(false, { 1, 0 }, 0.97) - Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.Name - SetHeroStars(Util.GetGameObject(_go.transform, "star"), curEquipStarsConfig.Stars,1,nil,-15) - local choosed =Util.GetGameObject(_go.transform, "choosed") - choosed:SetActive(curSelectEquip.Id == _itemData .Id) - local redPoint = Util.GetGameObject(_go.transform,"redPoint") - redPoint:SetActive(bagPosEquips[curEquipStarsConfig.Id - 1] and bagPosEquips[curEquipStarsConfig.Id - 1] >= equipStarsConfig[curEquipStarsConfig.Id - 1].RankupCount) - if curSelectEquip.Id == _itemData .Id then - curSelectGO = _go - end - Util.AddOnceClick(Util.GetGameObject(_go.transform,"click"), function() +function this.SingPokemonChipDataShow(_go,_itemData) + if not this.ChipItemList[_go] then + this.ChipItemList[_go] = SubUIManager.Open(SubUIConfig.ItemView, Util.GetTransform(_go, "itemParent").transform) + end + this.ChipItemList[_go]:OnOpen(false, { _itemData.id, 0 }, 0.97) + this.ChipItemList[_go].gameObject:SetActive(true) + + Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.itemConfig.Name + Util.GetGameObject(_go.transform,"num/Text"):GetComponent("Text").text = BagManager.GetItemCountById(_itemData.id).."/".._itemData.itemConfig.UsePerCount + Util.AddOnceClick(Util.GetGameObject(_go.transform,"compoundBtn"), function() end) end - +function this.PokemonDataSort(pokemonList) + table.sort(pokemonList, function(a,b) + if spiritAnimal[a.id].Quality == spiritAnimal[b.id].Quality then + if a.star == b.star then + if a.lv == b.lv then + return a.id < b.id + else + return a.lv > b.lv + end + else + return a.star > b.star + end + else + return spiritAnimal[a.id].Quality > spiritAnimal[b.id].Quality + end + end) +end +function this.PokemonChipDataSort(pokemonChipList) + -- table.sort(pokemonChipList, function(a,b) + -- if spiritAnimal[a.id].Quality == spiritAnimal[b.id].Quality then + + -- else + -- return spiritAnimal[a.id].Quality > spiritAnimal[b.id].Quality + -- end + -- end) +end -- tab节点显示自定义 function this.TabAdapter(tab, index, status) local tabLab = Util.GetGameObject(tab, "Text") @@ -146,11 +168,9 @@ function this.SwitchView(index) end function this:OnClose() - needGoldNum=0 end function this:OnDestroy() - needGoldNum=0 end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_UpWar.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_UpWar.lua index 531a662914..2456a4c84c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_UpWar.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_UpWar.lua @@ -4,6 +4,8 @@ local sortingOrder=0 local polemonList = {} local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) +local curUpZhenPokemonData --替换时需要下阵的数据 +local upZhenIndex function this:InitComponent(gameObject) Util.GetGameObject(gameObject, "PokemonListPanel_UpWar/name"):GetComponent("Text").text = "选择出战灵兽" @@ -34,7 +36,9 @@ function this:OnSortingOrderChange(_sortingOrder) sortingOrder = _sortingOrder end -function this:OnShow(...) +function this:OnShow(_parent,_curUpZhenPokemonData,_upZhenIndex) + curUpZhenPokemonData = _curUpZhenPokemonData + upZhenIndex = _upZhenIndex polemonList = PokemonManager.GetCanUpZhenPokemonDatas() table.sort(polemonList, function(a,b) if spiritAnimal[a.id].Quality == spiritAnimal[b.id].Quality then @@ -71,7 +75,33 @@ function this.SingleItemDataShow(_go,_itemData) local starSize = Vector2.New(50,50) SetHeroStars(Util.GetGameObject(_go.transform, "star/starGrid"), _itemData.star,1,starSize,-5,Vector2.New(0.5,0.5)) Util.AddOnceClick(Util.GetGameObject(_go.transform,"upZhen"), function() - + if curUpZhenPokemonData then + --替换 协议 + -- NetManager + local oldWarPower = 0 + local pos + local allPokemonFormation = PokemonManager.GetAllPokemonFormationData() + for i = 1, #allPokemonFormation do + if allPokemonFormation[i].pokemonDid == curUpZhenPokemonData.dynamicId then + pos = allPokemonFormation[i].position + end + end + if pos then + PokemonManager.RefreshPokemonFormation(Pokemon_Formation_RefreshType.UpZhen,_itemData.dynamicId,pos) + end + local newWarPower = 0 + PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower) + else + --上阵 协议 + -- NetManager + local oldWarPower = 0 + if upZhenIndex then + PokemonManager.RefreshPokemonFormation(Pokemon_Formation_RefreshType.UpZhen,_itemData.dynamicId,upZhenIndex) + end + local newWarPower = 0 + --飘战力 + PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower) + end end) Util.AddOnceClick(Util.GetGameObject(_go.transform,"click"), function() UIManager.OpenPanel(UIName.PokemonInfoPanel,_itemData,PokemonManager.GetPokemonDatas())