zhangqiang 2020-10-15 15:43:35 +08:00
parent eaf610e9c2
commit b93d7d0435
9 changed files with 13372 additions and 16325 deletions

View File

@ -242,8 +242,9 @@ function this.UpdateHeroInfoData()
else
self.dragView.gameObject:SetActive(false)
end
local starSize = Vector2.New(60,60)
SetHeroStars(self.starGrid, curPokemonData.star,2,starSize,-10,Vector2.New(0.5,0.5))
local starSize = Vector2.New(65,65)
SetHeroStars(self.starGrid, curPokemonData.star,1,starSize,0,Vector2.New(0.5,0.5))
--SetHeroStars(starGrid, heroData.star,1,nil,nil,Vector2.New(0,1))
--常规属性赋值
end

View File

@ -141,23 +141,14 @@ function this.ShowSinglePokemonList(go,singleData,liveIndex)
local LiveName = GetResourcePath(singleData.config.Live)
local live2d = poolManager:LoadLive(LiveName, curPokemonLive.transform,Vector3.one * heroConfig.Scale, Vector3.New(heroConfig.Position[1],heroConfig.Position[2],0))
live2dList[liveIndex] = {name=configData.Icon, go=live2d}
this.SetStarGrid(Util.GetGameObject(go, "upZhenInfo/starGrid"),2)
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)
end)
end
end
function this.SetStarGrid(go,starNum)
for i = 1, 5 do
if starNum <= i then
go.transform:GetChild(i - 1):SetActive(true)
else
go.transform:GetChild(i - 1):SetActive(false)
end
end
end
--界面关闭时调用(用于子类重写)
function PokemonMainPanel:OnClose()
poolManager:UnLoadLive(this.LiveName,this.LiveGO )

View File

@ -1,21 +1,21 @@
PokemonManager = {}
local this = PokemonManager
local spiritAnimal = ConfigManager.GetConfig(ConfigName.SpiritAnimal)
local pokemons = {}
local pokemons = {}--灵兽数据
local pokemonFetter = {}--灵兽羁绊
function this.Initialize()
end
--初始化灵兽数据
function this.InitPokemonsData(_msgPokemonList)
--Log("服务端推送英雄数量:" .. #_msgHeroList)
--Log("初始化灵兽数据" .. #_msgPokemonList)
for i = 1, #_msgPokemonList do
this.UpdatePokemonDatas(_msgPokemonList[i])
end
end
--刷新本地数据
function this.UpdatePokemonDatas(_msgPokemonData)
--刷新本地数据v 掉落时调用
function this.UpdatePokemonDatas(_msgPokemonData,isRefreshFetter)
local singPokemonData = {}
singPokemonData.heroBackData = _msgPokemonData
singPokemonData.id = _msgPokemonData.sId
@ -24,6 +24,9 @@ function this.UpdatePokemonDatas(_msgPokemonData)
singPokemonData.lv = _msgPokemonData.level
singPokemonData.isZhen = _msgPokemonData.isZhen
pokemons[singPokemonData.dynamicId] = singPokemonData
if isRefreshFetter then
this.GetPokemonRefreshFetter(singPokemonData.id)
end
end
--获取当前灵兽数据
function this.GetSinglePokemonData(_did)
@ -61,4 +64,60 @@ function this.RemoveSinglePokemonData(_id)
end
return curAllPokemonList
end
--灵兽羁绊
function this.InitPokemonsFetterData(_msgPokemonFetterList)
--Log("灵兽羁绊" .. #_msgPokemonFetterList)
for i = 1, #_msgPokemonFetterList do
this.UpdatePokemonFetterDatas(_msgPokemonFetterList[i])
end
end
--刷新本地灵兽羁绊数据
function this.UpdatePokemonFetterDatas(_msgPokemonFetter)
local singPokemonFetterData = {}
singPokemonFetterData.id = _msgPokemonFetter.id
pokemonFetter[singPokemonFetterData.id] = singPokemonFetterData
end
function this.GetAllPokemonFetterDatas()
return pokemonFetter
end
--判断是否激活新的灵兽羁绊数据
function this.GetPokemonRefreshFetter(_sid)
local curPokemonSidList = this.GetCurPokemonSidList()
local allActivityFetterIds = {}
for key, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.SpiritAnimalBook)) do
if pokemonFetter[key] then--已有的羁绊去掉
return
end
local stateNum = 0
for i = 1, #configInfo.Teamers do
if configInfo.Teamers[i] == _sid then
stateNum = stateNum + 1
else
if curPokemonSidList[configInfo.Teamers[i]] then
stateNum = stateNum + 1
end
end
end
if stateNum >= #configInfo.Teamers then
table.insert(allActivityFetterIds,configInfo)
end
end
if #allActivityFetterIds > 0 then
for i = 1, #allActivityFetterIds do
PopupTipPanel.ShowTip("已激活灵兽羁绊—【".. allActivityFetterIds[i].Name .."】!")
local curBackData = {}
curBackData.id = allActivityFetterIds[i].Id
this.UpdatePokemonFetterDatas(curBackData)
end
end
end
function this.GetCurPokemonSidList()
local curPokemonSidList = {}
for key, value in pairs(pokemons) do
curPokemonSidList[value.id] = value
end
return curPokemonSidList
end
return this

View File

@ -2,6 +2,8 @@
local this = {}
local sortingOrder=0
local fetterList = {}
local curPokemonSidList = {}
-- local spiritAnimalBook = ConfigManager.GetConfig(ConfigName.SpiritAnimalBook)
function this:InitComponent(gameObject)
this.fetterPre = Util.GetGameObject(gameObject, "PokemonListPanel_Fetter/fetterPre")
local v2 = Util.GetGameObject(gameObject, "PokemonListPanel_Fetter/ScrollParentView"):GetComponent("RectTransform").rect
@ -25,12 +27,29 @@ function this:OnSortingOrderChange(_sortingOrder)
sortingOrder = _sortingOrder
end
function this:OnShow(...)
this.ShowCurrPosTreasures()
this.ShowPokemonFetterData()
end
--显示当前阵营的宝物
function this.ShowCurrPosTreasures()
function this.ShowPokemonFetterData()
local curGetAllPokemonFetter = PokemonManager.GetAllPokemonFetterDatas()
fetterList = {}
for key, configInfo in ConfigPairs(ConfigManager.GetConfig(ConfigName.SpiritAnimalBook)) do
local curSingleData = {}
if curGetAllPokemonFetter[key] then
curSingleData = {config = configInfo,isGet = 1}
else
curSingleData = {config = configInfo,isGet = 2}
end
table.insert(fetterList,curSingleData)
end
table.sort(fetterList, function(a,b)
if a.isGet == b.isGet then
return a.config.Id < b.config.Id
else
return a.isGet > b.isGet
end
end)
curPokemonSidList = PokemonManager.GetCurPokemonSidList()
this.ScrollView:SetData(fetterList, function (index, go)
this.SingleItemDataShow(go, fetterList[index])
end)
@ -43,27 +62,44 @@ function this.ShowCurrPosTreasures()
end
--宝物列表宝物数据显示
function this.SingleItemDataShow(_go,_itemData)
function this.SingleItemDataShow(_go,_fetterData)
Util.GetGameObject(_go.transform,"nameImage/nameText"):GetComponent("Text").text = _fetterData.config.Name
Util.GetGameObject(_go.transform,"tipText"):GetComponent("Text").text="获得下方所有灵兽后激活图鉴属性"
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(curEquipStarsConfig.Quality))
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
Util.GetGameObject(_go,"proImg"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
local onePokemonSid = _fetterData.Teamers[1]
local twoPokemonSid = _fetterData.Teamers[2]
Util.GetGameObject(_go.transform,"frame1"):GetComponent("Image").sprite =
Util.LoadSprite(GetQuantityImageByquality(ConfigManager.GetConfigData(ConfigName.SpiritAnimal,onePokemonSid).Quality))
Util.GetGameObject(_go.transform,"frame1/icon"):GetComponent("Image").sprite =
Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,onePokemonSid).ResourceID))
Util.GetGameObject(_go.transform,"mask"):SetActive(curPokemonSidList[onePokemonSid] ~= nil)
Util.GetGameObject(_go.transform,"frame1/name"):GetComponent("Text").text=_itemData.name
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(curEquipStarsConfig.Quality))
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
Util.GetGameObject(_go,"proImg"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
Util.GetGameObject(_go.transform,"frame2"):GetComponent("Image").sprite =
Util.LoadSprite(GetQuantityImageByquality(ConfigManager.GetConfigData(ConfigName.SpiritAnimal,twoPokemonSid).Quality))
Util.GetGameObject(_go.transform,"frame2/icon"):GetComponent("Image").sprite =
Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,twoPokemonSid).ResourceID))
Util.GetGameObject(_go.transform,"mask"):SetActive(curPokemonSidList[twoPokemonSid] ~= nil)
Util.GetGameObject(_go.transform,"frame2/name"):GetComponent("Text").text=_itemData.name
Util.GetGameObject(_go.transform,"nextproValue"):GetComponent("Text").text="羁绊属性[已激活]"
-- SetHeroStars(Util.GetGameObject(_go.transform, "star"), 0)
Util.GetGameObject(_go.transform,"nextproValue"):GetComponent("Text").text =
_fetterData.isGet == 1 and string.format("<color=#00FF06>%s</color>","羁绊属性[已激活]") or string.format("<color=#C1C1C1>%s</color>","羁绊属性[未激活]")
local proList = _fetterData.config.ActivePara
for i = 1, 4 do
local singlePro = Util.GetGameObject(_go.transform,"proList/pro (".. i ..")")
Util.GetGameObject(singlePro.transform,"proName"):GetComponent("Text").text="name"
Util.GetGameObject(singlePro.transform,"proValue"):GetComponent("Text").text="value"
if proList[i] then
singlePro:SetActive(true)
local proVal = proList[i]
local proName = ConfigManager.GetConfigData(ConfigName.PropertyConfig,proVal[1]).Info
Util.GetGameObject(singlePro.transform,"proName"):GetComponent("Text").text =
_fetterData.isGet == 1 and string.format("<color=#00FF06>%s</color>",proName) or string.format("<color=#C1C1C1>%s</color>",proName)
Util.GetGameObject(singlePro.transform,"proValue"):GetComponent("Text").text =
_fetterData.isGet == 1 and string.format("<color=#00FF06>%s</color>",proVal[2]) or string.format("<color=#C1C1C1>%s</color>",proVal[2])
else
singlePro:SetActive(false)
end
end
end

View File

@ -101,7 +101,8 @@ function this.SingPokemonDataShow(_go,_itemData,curEquipStarsConfig)
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(curEquipStarsConfig.Quality))
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(itemConfig[_itemData.Id].ResourceID))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.Name
SetHeroStars(Util.GetGameObject(_go.transform, "star"), curEquipStarsConfig.Stars,1,nil,-15)
local starSize = Vector2.New(50,50)
SetHeroStars(Util.GetGameObject(_go.transform, "star"), curEquipStarsConfig.Stars,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")

View File

@ -51,7 +51,8 @@ function this.SingleItemDataShow(_go,_itemData)
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.Name
SetHeroStars(Util.GetGameObject(_go.transform, "star"), curEquipStarsConfig.Stars,1,nil,-15)
local starGrid = Util.GetGameObject(_go, "star")
SetHeroStars(starGrid, heroData.star)
local starSize = Vector2.New(50,50)
SetHeroStars(starGrid, _itemData.star,1,starSize,-5,Vector2.New(0.5,0.5))
Util.AddOnceClick(Util.GetGameObject(_go.transform,"upZhen"), function()
end)