94 lines
2.5 KiB
Lua
94 lines
2.5 KiB
Lua
|
--新的命格管理
|
||
|
GemNewManager = {}
|
||
|
local this = GemNewManager
|
||
|
local gemConfig = ConfigManager.GetConfig(ConfigName.GemConfigNew)
|
||
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||
|
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||
|
function this.Initialize()
|
||
|
this.myGemList = {}--我穿戴命石的id
|
||
|
this.sperGemList ={} --高级命石
|
||
|
this.typeGemList = {}
|
||
|
end
|
||
|
|
||
|
--初始化命石
|
||
|
function this.InitGemsInfo(msg)
|
||
|
if msg==nil then
|
||
|
return
|
||
|
end
|
||
|
local gemsData=msg.gems
|
||
|
if gemsData==nil then
|
||
|
return
|
||
|
end
|
||
|
LogError("gemsData len==========="..#gemsData)
|
||
|
this.myGemList={}
|
||
|
this.sperGemList={}
|
||
|
for i=1,#gemsData do
|
||
|
local id=gemsData[i].id
|
||
|
local config=gemConfig[id]
|
||
|
local proList=gemsData[i].attr
|
||
|
local gemsData={}
|
||
|
gemsData.id=id
|
||
|
gemsData.config=config
|
||
|
gemsData.sId = id
|
||
|
gemsData.backData = gemsData[i]
|
||
|
gemsData.configData = config
|
||
|
--local itemConfig = itemConfig[drop.pokemon[i].tempId]
|
||
|
gemsData.name = config.Name
|
||
|
-- itemdata.config=itemConfig
|
||
|
gemsData.ItemType = 31--itemConfig.ItemType
|
||
|
gemsData.frame = GetHeroQuantityImageByquality(config.Quality)
|
||
|
gemsData.icon = GetResourcePath(config.Image)
|
||
|
gemsData.num = 1
|
||
|
local pros={}
|
||
|
for j=1,#proList do
|
||
|
--pros[proList[j].id]=proList[j].value
|
||
|
pros[j]={proList[j].id,proList[j].value}
|
||
|
end
|
||
|
gemsData.pro=pros
|
||
|
if config.Library==1 then
|
||
|
this.myGemList[config.Type]=gemsData
|
||
|
else
|
||
|
this.sperGemList[config.Type]=gemsData
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
--根据类型获取属性
|
||
|
function this.GetProListByType(type)
|
||
|
local list=nil
|
||
|
local proList={}
|
||
|
if type==1 then
|
||
|
list=this.myGemList
|
||
|
else
|
||
|
list=this.sperGemList
|
||
|
end
|
||
|
for k, v in pairs(list) do
|
||
|
if v.pro then
|
||
|
for i=1,#v.pro do
|
||
|
if proList[v.pro[i][1]] then
|
||
|
proList[v.pro[i][1]]=proList[v.pro[i][1]]+v.pro[i][2]
|
||
|
else
|
||
|
proList[v.pro[i][1]]=v.pro[i][2]
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
for k, v in pairs(proList) do
|
||
|
LogError("k=========="..k.." v======="..v)
|
||
|
end
|
||
|
return proList
|
||
|
end
|
||
|
|
||
|
|
||
|
|
||
|
--根据类型获取集合
|
||
|
function this.GetGemListByType(type)
|
||
|
if type==1 then
|
||
|
return this.myGemList
|
||
|
else
|
||
|
return this.sperGemList
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
return this
|