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

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_Fetter = 794,--灵兽羁绊
Pokemon_Recruit = 795,--灵兽 御兽斋免费
Pokemon_ChipCompound = 796,--灵兽 碎片合成
}

View File

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

View File

@ -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

View File

@ -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

View File

@ -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
--界面销毁时调用(用于子类重写)

View File

@ -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

View File

@ -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