Files
Main/Assets/GameAssets/Resources/Lua/Logic/GrowthWay/GrowthWayTreasureData.lua
2025-01-25 04:38:09 +08:00

75 lines
1.9 KiB
Lua

------------------------------------------------
--作者: 王圣
--日期: 2019-07-15
--文件: GrowthWayTreasureData.lua
--模块: GrowthWayTreasureData
--描述: 成长之路宝箱奖励数据
------------------------------------------------
--引用
local ItemData = require "Logic.ServeCrazy.ServeCrazyItemData"
local GrowthWayTreasureData = {
CfgId = 0,
--对应的star
StarNum = 0,
IconId = 0,
OpenIconId = 0,
--是否领取
IsReward = false,
--是否是模型
IsModel = false,
TexPath = nil,
ListItem = List:New(),
}
--初始化排行榜Cfg
function GrowthWayTreasureData:New()
local _m = Utils.DeepCopy(self)
return _m
end
--解析数据
function GrowthWayTreasureData:Parase(cfg)
if cfg == nil then
return
end
self.CfgId = cfg.Id
self.StarNum = cfg.Scroe
self.IconId = cfg.LockPic
self.OpenIconId = cfg.OpenPic
self.IsReward = false
self.TexPath = cfg.ShowTexture
if cfg.IsModel == 1 then
self.IsModel = true
else
self.IsModel = false
end
local player = GameCenter.GameSceneSystem:GetLocalPlayer()
local playerOcc = 0
if player then
playerOcc = player.IntOcc
end
local list = Utils.SplitStr(cfg.Item,';')
for i = 1,#list do
local values = Utils.SplitStr(list[i],'_')
local id = tonumber(values[1])
local num = tonumber(values[2])
local bind = tonumber(values[3])
local occ = tonumber(values[4])
if occ == 9 or occ == playerOcc then
local item = {Id = id, Num = num, Bind = bind == 1}
self.ListItem:Add(item)
end
end
end
--判断宝箱是否领取了
function GrowthWayTreasureData:SetReward(state, mask)
if state & mask > 0 then
self.IsReward = true
else
self.IsReward = false
end
end
return GrowthWayTreasureData