GiftXML = GiftXML or BaseClass()
|
|
|
|
|
|
|
|
function GiftXML:__init()
|
|
GiftXML.Instance=self
|
|
|
|
end
|
|
|
|
function GiftXML:getGiftdatabyID(id)
|
|
|
|
return Config.GiftList[id]
|
|
|
|
end
|
|
|
|
function GiftXML:getGiftVobyID(id)
|
|
|
|
local tgiftstr= Config.GiftList[id].gifts
|
|
local tgiftstr2=string.sub(tgiftstr, 2, -2)
|
|
local result={}
|
|
if tgiftstr2=="" then
|
|
print("礼包数据为空 id ",id)
|
|
return result
|
|
end
|
|
local tgiftstr1=string.sub(tgiftstr2, 2, -2)
|
|
local strarr=Split(tgiftstr1,"},{")
|
|
for key, var in ipairs(strarr) do
|
|
local tstr=string.sub(var, 2)
|
|
local larr=Split(var,",")
|
|
local vo={}
|
|
vo.info=larr[1]
|
|
vo.id=larr[2]
|
|
vo.count=larr[3]
|
|
table.insert(result,vo)
|
|
end
|
|
return result
|
|
end
|
|
|
|
|
|
function GiftXML:getInstance()
|
|
if GiftXML.Instance==nil then
|
|
GiftXML.New()
|
|
end
|
|
return GiftXML.Instance
|
|
end
|