104 lines
1.9 KiB
Lua
104 lines
1.9 KiB
Lua
--新的命格管理
|
||
GiftManager = {}
|
||
local this = GiftManager
|
||
local giftConfig=ConfigManager.GetConfig(ConfigName.GiftConfig)
|
||
local equipConfig=ConfigManager.GetConfig(ConfigName.EquipConfig)
|
||
function this.Initialize()
|
||
this.allHeroGifts={}
|
||
this.playerGifts={}
|
||
end
|
||
|
||
--初始化命石
|
||
function this.InitGemsInfo(msg)
|
||
|
||
|
||
end
|
||
|
||
--初始化英雄礼物
|
||
function this.InitHeroGift(id,list)
|
||
this.allHeroGifts[id]=list
|
||
end
|
||
--初始化主角礼物
|
||
function this.InitPlayerGift(list)
|
||
this.playerGifts=list
|
||
end
|
||
|
||
--获取收取等级和最大数量
|
||
function this.GetCollectLvAndNum()
|
||
local lv=0
|
||
local maxNum=0
|
||
local collect=0
|
||
local curNum=0
|
||
for i=1,#this.playerGifts do
|
||
local id=this.playerGifts[i]
|
||
if equipConfig[id] then
|
||
collect=collect+equipConfig[id].Gift
|
||
end
|
||
end
|
||
for k, v in ConfigPairs(giftConfig) do
|
||
if collect>=v.Gift then
|
||
lv=v.Id
|
||
curNum=v.Box
|
||
else
|
||
maxNum=v.Box
|
||
break
|
||
end
|
||
end
|
||
return lv,curNum,maxNum
|
||
end
|
||
|
||
|
||
--设置英雄礼物 type 1:穿 2:脱
|
||
function this.SetHeroGift(id,list,type)
|
||
if this.allHeroGifts[id]==nil then
|
||
this.allHeroGifts[id]={}
|
||
end
|
||
for i=1,#list do
|
||
if type==1 then
|
||
table.insert(this.allHeroGifts[id],list[i])
|
||
elseif type==2 then
|
||
table.removebyvalue(this.allHeroGifts[id],list[i])
|
||
end
|
||
|
||
end
|
||
end
|
||
--设置主角礼物
|
||
function this.SetPlayerGift(list)
|
||
for i=1,#list do
|
||
table.insert(this.playerGifts,list[i])
|
||
end
|
||
end
|
||
|
||
function this.GetHeroGifts(_id)
|
||
if this.allHeroGifts[_id] then
|
||
return this.allHeroGifts[_id]
|
||
end
|
||
return {}
|
||
end
|
||
function this.GetPlayerGifts()
|
||
return this.playerGifts
|
||
end
|
||
|
||
function this.changeGiftsByType(_type,_list)
|
||
|
||
end
|
||
|
||
|
||
function this.CheckGemRed()
|
||
|
||
return false
|
||
end
|
||
|
||
function this.CheckSuperGemRed()
|
||
|
||
return false
|
||
end
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
return this |