Files
Main/Assets/GameAssets/Resources/Lua/Logic/ServerActive/ServeExChangeData.lua

59 lines
1.6 KiB
Lua
Raw Normal View History

2025-01-25 04:38:09 +08:00
------------------------------------------------
--作者: 王圣
--日期: 2019-07-22
--文件: ServeExChangeData.lua
--模块: ServeExChangeData
--描述: 开服活动兑换数据
------------------------------------------------
--引用
local ItemData = require "Logic.ServeCrazy.ServeCrazyItemData"
local ServeExChangeData = {
--配置表Id
CfgId = 0,
--今日兑换剩余次数 -1:无限制兑换
LeftCount = 0,
--消耗道具
ListCostItem = List:New(),
--获得道具
ListRewardItem = List:New(),
}
function ServeExChangeData:New()
local _m = Utils.DeepCopy(self)
return _m
end
function ServeExChangeData:ParaseCfg(cfg)
if cfg ~= nil then
self.CfgId = cfg.Id
--设置消耗道具数据
local list = Utils.SplitStr(cfg.Item,';')
if list ~= nil then
for i = 1,#list do
local item = ItemData:New()
item:Parase(list[i])
self.ListCostItem:Add(item)
end
end
--设置奖励道具数据
list = Utils.SplitStr(cfg.Reward, ';')
if list ~= nil then
for i = 1,#list do
local item = ItemData:New()
item:Parase(list[i])
self.ListRewardItem:Add(item)
end
end
end
if cfg.LimitTime == 0 or cfg.LimitTime == nil then
self.LeftCount = -1
end
end
--解析服务器消息
function ServeExChangeData:ParaseMsg(msg)
if self.LeftCount ~= -1 then
self.LeftCount = msg
end
end
return ServeExChangeData