From a20217223a9d95105d6118a57bf49d577be820df Mon Sep 17 00:00:00 2001 From: zhangqiang <657634622@qq.com> Date: Tue, 27 Oct 2020 17:02:37 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=81=B5=E5=85=BD=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E3=80=91=20=E6=B7=BB=E5=8A=A0=E7=A2=8E=E7=89=87=E5=90=88?= =?UTF-8?q?=E6=88=90=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../~Lua/Common/GlobalDefine.lua | 1 + .../ManagedResources/~Lua/Logic/GameEvent.lua | 1 + .../~Lua/Modules/Bag/BagManager.lua | 3 +++ .../~Lua/Modules/Player/RedpotManager.lua | 2 ++ .../~Lua/Modules/Pokemon/PokemonMainPanel.lua | 3 +++ .../~Lua/Modules/Pokemon/PokemonManager.lua | 23 ++++++++++++++++++- .../Pokemon/view/PokemonListPanel_List.lua | 14 +++++++++++ 7 files changed, 46 insertions(+), 1 deletion(-) diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 3fc69ada68..6afd50a413 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -828,6 +828,7 @@ RedPointType = { Pokemon_CanUpZhen = 793,--灵兽可上阵 Pokemon_Fetter = 794,--灵兽羁绊 Pokemon_Recruit = 795,--灵兽 御兽斋免费 + Pokemon_ChipCompound = 796,--灵兽 碎片合成 } diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index 61d75b4d61..e9ff6a04df 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -405,6 +405,7 @@ GameEvent = { PokemonCompound="Pokemon.PokemonCompound", PokemonUpZhenRefresh="Pokemon.PokemonUpZhenRefresh", PokemonMainPanelRefresh="Pokemon.PokemonMainPanelRefresh", + PokemonChipRefresh="Pokemon.PokemonChipRefresh", }, DynamicTask={ OnMissionChange = "DynamicTask.MissionChange", diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua index 4a80582787..bf4f3797bc 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua @@ -1053,6 +1053,9 @@ function this.BagIndicationRefresh(msg) end CheckRedPointStatus(RedPointType.Guild_Skill) end + if itemConfig[v.itemId].ItemType == ItemType.LingShouChip then--灵兽碎片获得刷新红点 + Game.GlobalEvent:DispatchEvent(GameEvent.Pokemon.PokemonChipRefresh) + end end end elseif msg.type == 1 then diff --git a/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua b/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua index 179058faec..89e28bd8b0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Player/RedpotManager.lua @@ -263,6 +263,7 @@ function this.InitRedPointAllRelate() RPData:SetParent(RedPointType.Pokemon_CanUpZhen, RedPointType.PokemonMainCity) RPData:SetParent(RedPointType.Pokemon_Fetter, RedPointType.PokemonMainCity) RPData:SetParent(RedPointType.Pokemon_Recruit, RedPointType.PokemonMainCity) + RPData:SetParent(RedPointType.Pokemon_ChipCompound, RedPointType.PokemonMainCity) end -- 注册红点检测方法 @@ -441,6 +442,7 @@ function this.RegisterRedCheckFunc() RPData:AddCheckFunc(RedPointType.Pokemon_CanUpZhen,PokemonManager.RefreshPokemonCanUpZhenRedPoint) RPData:AddCheckFunc(RedPointType.Pokemon_Fetter,PokemonManager.RefreshPokemonFetterRedPoint) RPData:AddCheckFunc(RedPointType.Pokemon_Recruit,PokemonManager.RefreshPokemonRecruitRedPoint) + RPData:AddCheckFunc(RedPointType.Pokemon_ChipCompound,PokemonManager.PokemonChipCompoundRedPoint) end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua index f3953d84d4..31285b2666 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonMainPanel.lua @@ -28,6 +28,7 @@ function PokemonMainPanel:InitComponent() this.btnFetter = Util.GetGameObject(self.transform, "btnEndRoot/btnFetter") this.btnFetterRed = Util.GetGameObject(this.btnFetter, "redPoint") this.btnPokemonList = Util.GetGameObject(self.transform, "btnEndRoot/btnPokemonList") + this.btnPokemonListRed = Util.GetGameObject(this.btnPokemonList, "redPoint") Util.GetGameObject(this.btnPokemonList, "redPoint"):SetActive(false) this.line = Util.GetGameObject(self.transform,"lineParent/line") this.line:SetActive(false) @@ -94,6 +95,7 @@ function PokemonMainPanel:BindEvent() end) BindRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed) BindRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed) + BindRedPointObject(RedPointType.Pokemon_ChipCompound, this.btnPokemonListRed) end --添加事件监听(用于子类重写) @@ -345,6 +347,7 @@ end function PokemonMainPanel:OnClose() ClearRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed) ClearRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed) + ClearRedPointObject(RedPointType.Pokemon_ChipCompound, this.btnPokemonListRed) end --界面销毁时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index 308735b112..5ebda7f649 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -1,6 +1,7 @@ PokemonManager = {} local this = PokemonManager local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) +local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local spiritAnimalBook = ConfigManager.GetConfig(ConfigName.SpiritAnimalBook) local pokemons = {}--灵兽数据 local pokemonFetter = {}--灵兽羁绊 @@ -14,6 +15,7 @@ function this.Initialize() teamInfo.position = i table.insert(pokemonFormation, teamInfo) end + Game.GlobalEvent:AddEvent(GameEvent.Pokemon.PokemonChipRefresh, this.PokemonChipRefresh) end --------------------------------------------- --初始化灵兽数据 @@ -431,7 +433,6 @@ end --------------------------------------------- --灵兽红点检测方法 function this.CheckRedPointStatusPokemonMainCityRed() - LogPink("sssssssssssssssssssssssss") CheckRedPointStatus(RedPointType.Pokemon_UpLv) CheckRedPointStatus(RedPointType.Pokemon_UpStar) CheckRedPointStatus(RedPointType.Pokemon_CanUpZhen) @@ -597,4 +598,24 @@ function this.RefreshPokemonRecruitRedPoint() return false end end +function this.PokemonChipRefresh() + CheckRedPointStatus(RedPointType.Pokemon_ChipCompound) +end +--碎片可以合成红点 +function this.PokemonChipCompoundRedPoint() + local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.POKEMON) + if not isOpen then + return false + end + local pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip) + if #pokemonChipList > 0 then + for i = 1, #pokemonChipList do + -- LogPink("pokemonChipList[i].id "..pokemonChipList[i].id.." "..BagManager.GetItemCountById(pokemonChipList[i].id).." "..itemConfig[pokemonChipList[i].id].UsePerCount) + if BagManager.GetItemCountById(pokemonChipList[i].id) >= itemConfig[pokemonChipList[i].id].UsePerCount then + return true + end + end + end + return false +end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua index 23a602ecfb..7a1a436e2f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonListPanel_List.lua @@ -15,6 +15,7 @@ local curIndex = 0 local pokemonList = {} local pokemonChipList = {} local AllPokemonFormationDids = {} +local redPointList = {} function this:InitComponent(gameObject) this.ChipItemList={}--存储itemview 重复利用 Util.GetGameObject(gameObject, "PokemonListPanel_List/name"):GetComponent("Text").text = "灵兽列表" @@ -65,6 +66,16 @@ function this:OnShow(...) this.TabCtrl:SetTabAdapter(this.TabAdapter) this.TabCtrl:SetChangeTabCallBack(this.SwitchView) this.TabCtrl:Init(this.tabBox, _TabData,curIndex) + redPointList = {} + for i = 1, #_TabData do + local curTabBtn = Util.GetGameObject(this.tabBox, "box").transform:GetChild(i-1) + redPointList[i] = Util.GetGameObject(curTabBtn, "Redpot") + end + pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip) + this.PokemonChipDataSort(pokemonChipList) + if redPointList[2] and redPointList[2].gameObject then + redPointList[2]:SetActive(PokemonManager.PokemonChipCompoundRedPoint()) + end end local sortingOrder = 0 function this:OnSortingOrderChange(_sortingOrder) @@ -90,6 +101,9 @@ function this.OnClickTabBtn(_curIndex) this.ScrollParentView2:SetActive(true) pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip) this.PokemonChipDataSort(pokemonChipList) + if redPointList[2] and redPointList[2].gameObject then + redPointList[2]:SetActive(PokemonManager.PokemonChipCompoundRedPoint()) + end for key, value in pairs(this.ChipItemList) do value.gameObject:SetActive(false) end