71 lines
1.7 KiB
Lua
71 lines
1.7 KiB
Lua
--作者: ws,gzg
|
|
--日期: 2020-02-18
|
|
--文件: XmRewardBoxInfo.lua
|
|
--模块: XmRewardBoxInfo
|
|
--描述: 仙盟中的奖励宝箱的信息
|
|
-----------------------------------------------
|
|
local XmRewardBoxInfo =
|
|
{
|
|
--配置文件ID
|
|
CfgID = 0,
|
|
--排列序号
|
|
Count = 0,
|
|
--描述信息
|
|
Desc = "",
|
|
--仙盟奖励的列表
|
|
ItemList = "",
|
|
--当前奖励宝箱的状态 0:未领取, 1:已领取
|
|
State = 0,
|
|
--当前包裹内是连胜奖励,还是终结奖励
|
|
Type = 0,
|
|
}
|
|
|
|
--构造函数
|
|
function XmRewardBoxInfo:New(cfgid,lsCount,itemList,desc,state,type)
|
|
local _m = Utils.DeepCopy(self);
|
|
_m.CfgID = cfgid;
|
|
_m.ItemList = itemList;
|
|
_m.Count = lsCount;
|
|
_m.Desc = desc;
|
|
_m.State = state;
|
|
_m.Type = type;
|
|
if itemList == nil or #itemList == 0 then
|
|
Debug.LogError("当前宝箱的物品列表位空!" .. tostring(cfgid));
|
|
end
|
|
return _m;
|
|
end
|
|
|
|
--获取展示物品
|
|
function XmRewardBoxInfo:GetShowItem()
|
|
if self.ItemList then
|
|
return self.ItemList[1];
|
|
else
|
|
return nil;
|
|
end
|
|
end
|
|
|
|
--获取描述
|
|
function XmRewardBoxInfo:GetFlagDesc()
|
|
if self:EnableGet() then
|
|
return DataConfig.DataMessageString.Get("XMREWARDBOXINFO_TISHI_1");
|
|
else
|
|
return self.Desc;
|
|
end
|
|
end
|
|
|
|
--是否可领取
|
|
function XmRewardBoxInfo:EnableGet()
|
|
|
|
if self.State == 0 and GameCenter.XmFightSystem:CanGetLSReward(self.Type) then
|
|
|
|
if self.Type == 0 then
|
|
return GameCenter.XmFightSystem.LSXmCount >= self.Count;
|
|
elseif self.Type == 1 then
|
|
return GameCenter.XmFightSystem.ZJXmCount >= self.Count;
|
|
end
|
|
end
|
|
return false;
|
|
end
|
|
|
|
return XmRewardBoxInfo;
|