【灵兽系统】 添加碎片合成红点

zhangqiang 2020-10-27 17:02:37 +08:00
parent 0d9ed28c23
commit a20217223a
7 changed files with 46 additions and 1 deletions

View File

@ -828,6 +828,7 @@ RedPointType = {
Pokemon_CanUpZhen = 793,--灵兽可上阵 Pokemon_CanUpZhen = 793,--灵兽可上阵
Pokemon_Fetter = 794,--灵兽羁绊 Pokemon_Fetter = 794,--灵兽羁绊
Pokemon_Recruit = 795,--灵兽 御兽斋免费 Pokemon_Recruit = 795,--灵兽 御兽斋免费
Pokemon_ChipCompound = 796,--灵兽 碎片合成
} }

View File

@ -405,6 +405,7 @@ GameEvent = {
PokemonCompound="Pokemon.PokemonCompound", PokemonCompound="Pokemon.PokemonCompound",
PokemonUpZhenRefresh="Pokemon.PokemonUpZhenRefresh", PokemonUpZhenRefresh="Pokemon.PokemonUpZhenRefresh",
PokemonMainPanelRefresh="Pokemon.PokemonMainPanelRefresh", PokemonMainPanelRefresh="Pokemon.PokemonMainPanelRefresh",
PokemonChipRefresh="Pokemon.PokemonChipRefresh",
}, },
DynamicTask={ DynamicTask={
OnMissionChange = "DynamicTask.MissionChange", OnMissionChange = "DynamicTask.MissionChange",

View File

@ -1053,6 +1053,9 @@ function this.BagIndicationRefresh(msg)
end end
CheckRedPointStatus(RedPointType.Guild_Skill) CheckRedPointStatus(RedPointType.Guild_Skill)
end end
if itemConfig[v.itemId].ItemType == ItemType.LingShouChip then--灵兽碎片获得刷新红点
Game.GlobalEvent:DispatchEvent(GameEvent.Pokemon.PokemonChipRefresh)
end
end end
end end
elseif msg.type == 1 then elseif msg.type == 1 then

View File

@ -263,6 +263,7 @@ function this.InitRedPointAllRelate()
RPData:SetParent(RedPointType.Pokemon_CanUpZhen, RedPointType.PokemonMainCity) RPData:SetParent(RedPointType.Pokemon_CanUpZhen, RedPointType.PokemonMainCity)
RPData:SetParent(RedPointType.Pokemon_Fetter, RedPointType.PokemonMainCity) RPData:SetParent(RedPointType.Pokemon_Fetter, RedPointType.PokemonMainCity)
RPData:SetParent(RedPointType.Pokemon_Recruit, RedPointType.PokemonMainCity) RPData:SetParent(RedPointType.Pokemon_Recruit, RedPointType.PokemonMainCity)
RPData:SetParent(RedPointType.Pokemon_ChipCompound, RedPointType.PokemonMainCity)
end end
-- 注册红点检测方法 -- 注册红点检测方法
@ -441,6 +442,7 @@ function this.RegisterRedCheckFunc()
RPData:AddCheckFunc(RedPointType.Pokemon_CanUpZhen,PokemonManager.RefreshPokemonCanUpZhenRedPoint) RPData:AddCheckFunc(RedPointType.Pokemon_CanUpZhen,PokemonManager.RefreshPokemonCanUpZhenRedPoint)
RPData:AddCheckFunc(RedPointType.Pokemon_Fetter,PokemonManager.RefreshPokemonFetterRedPoint) RPData:AddCheckFunc(RedPointType.Pokemon_Fetter,PokemonManager.RefreshPokemonFetterRedPoint)
RPData:AddCheckFunc(RedPointType.Pokemon_Recruit,PokemonManager.RefreshPokemonRecruitRedPoint) RPData:AddCheckFunc(RedPointType.Pokemon_Recruit,PokemonManager.RefreshPokemonRecruitRedPoint)
RPData:AddCheckFunc(RedPointType.Pokemon_ChipCompound,PokemonManager.PokemonChipCompoundRedPoint)
end end

View File

@ -28,6 +28,7 @@ function PokemonMainPanel:InitComponent()
this.btnFetter = Util.GetGameObject(self.transform, "btnEndRoot/btnFetter") this.btnFetter = Util.GetGameObject(self.transform, "btnEndRoot/btnFetter")
this.btnFetterRed = Util.GetGameObject(this.btnFetter, "redPoint") this.btnFetterRed = Util.GetGameObject(this.btnFetter, "redPoint")
this.btnPokemonList = Util.GetGameObject(self.transform, "btnEndRoot/btnPokemonList") this.btnPokemonList = Util.GetGameObject(self.transform, "btnEndRoot/btnPokemonList")
this.btnPokemonListRed = Util.GetGameObject(this.btnPokemonList, "redPoint")
Util.GetGameObject(this.btnPokemonList, "redPoint"):SetActive(false) Util.GetGameObject(this.btnPokemonList, "redPoint"):SetActive(false)
this.line = Util.GetGameObject(self.transform,"lineParent/line") this.line = Util.GetGameObject(self.transform,"lineParent/line")
this.line:SetActive(false) this.line:SetActive(false)
@ -94,6 +95,7 @@ function PokemonMainPanel:BindEvent()
end) end)
BindRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed) BindRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed)
BindRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed) BindRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed)
BindRedPointObject(RedPointType.Pokemon_ChipCompound, this.btnPokemonListRed)
end end
--添加事件监听(用于子类重写) --添加事件监听(用于子类重写)
@ -345,6 +347,7 @@ end
function PokemonMainPanel:OnClose() function PokemonMainPanel:OnClose()
ClearRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed) ClearRedPointObject(RedPointType.Pokemon_Recruit, this.btnInfoRed)
ClearRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed) ClearRedPointObject(RedPointType.Pokemon_Fetter, this.btnFetterRed)
ClearRedPointObject(RedPointType.Pokemon_ChipCompound, this.btnPokemonListRed)
end end
--界面销毁时调用(用于子类重写) --界面销毁时调用(用于子类重写)

View File

@ -1,6 +1,7 @@
PokemonManager = {} PokemonManager = {}
local this = PokemonManager local this = PokemonManager
local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal) local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local spiritAnimalBook = ConfigManager.GetConfig(ConfigName.SpiritAnimalBook) local spiritAnimalBook = ConfigManager.GetConfig(ConfigName.SpiritAnimalBook)
local pokemons = {}--灵兽数据 local pokemons = {}--灵兽数据
local pokemonFetter = {}--灵兽羁绊 local pokemonFetter = {}--灵兽羁绊
@ -14,6 +15,7 @@ function this.Initialize()
teamInfo.position = i teamInfo.position = i
table.insert(pokemonFormation, teamInfo) table.insert(pokemonFormation, teamInfo)
end end
Game.GlobalEvent:AddEvent(GameEvent.Pokemon.PokemonChipRefresh, this.PokemonChipRefresh)
end end
--------------------------------------------- ---------------------------------------------
--初始化灵兽数据 --初始化灵兽数据
@ -431,7 +433,6 @@ end
--------------------------------------------- ---------------------------------------------
--灵兽红点检测方法 --灵兽红点检测方法
function this.CheckRedPointStatusPokemonMainCityRed() function this.CheckRedPointStatusPokemonMainCityRed()
LogPink("sssssssssssssssssssssssss")
CheckRedPointStatus(RedPointType.Pokemon_UpLv) CheckRedPointStatus(RedPointType.Pokemon_UpLv)
CheckRedPointStatus(RedPointType.Pokemon_UpStar) CheckRedPointStatus(RedPointType.Pokemon_UpStar)
CheckRedPointStatus(RedPointType.Pokemon_CanUpZhen) CheckRedPointStatus(RedPointType.Pokemon_CanUpZhen)
@ -597,4 +598,24 @@ function this.RefreshPokemonRecruitRedPoint()
return false return false
end end
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 return this

View File

@ -15,6 +15,7 @@ local curIndex = 0
local pokemonList = {} local pokemonList = {}
local pokemonChipList = {} local pokemonChipList = {}
local AllPokemonFormationDids = {} local AllPokemonFormationDids = {}
local redPointList = {}
function this:InitComponent(gameObject) function this:InitComponent(gameObject)
this.ChipItemList={}--存储itemview 重复利用 this.ChipItemList={}--存储itemview 重复利用
Util.GetGameObject(gameObject, "PokemonListPanel_List/name"):GetComponent("Text").text = "灵兽列表" Util.GetGameObject(gameObject, "PokemonListPanel_List/name"):GetComponent("Text").text = "灵兽列表"
@ -65,6 +66,16 @@ function this:OnShow(...)
this.TabCtrl:SetTabAdapter(this.TabAdapter) this.TabCtrl:SetTabAdapter(this.TabAdapter)
this.TabCtrl:SetChangeTabCallBack(this.SwitchView) this.TabCtrl:SetChangeTabCallBack(this.SwitchView)
this.TabCtrl:Init(this.tabBox, _TabData,curIndex) 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 end
local sortingOrder = 0 local sortingOrder = 0
function this:OnSortingOrderChange(_sortingOrder) function this:OnSortingOrderChange(_sortingOrder)
@ -90,6 +101,9 @@ function this.OnClickTabBtn(_curIndex)
this.ScrollParentView2:SetActive(true) this.ScrollParentView2:SetActive(true)
pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip) pokemonChipList = BagManager.GetDataByItemType(ItemType.LingShouChip)
this.PokemonChipDataSort(pokemonChipList) 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 for key, value in pairs(this.ChipItemList) do
value.gameObject:SetActive(false) value.gameObject:SetActive(false)
end end