146 lines
4.1 KiB
Lua
146 lines
4.1 KiB
Lua
--文件是自动生成,请勿手动修改.来自数据文件:month_card
|
|
local L_CompressMaxColumn = 3
|
|
local L_CompressData = {
|
|
72194570753147361,282063395897376,147461000,
|
|
--1,畅游周卡,7,1_300,2_300_1,2_600_1;60071_18_1;16_48_1,0,tex_fuli_bg22,tex_fl_changyouzhouka,5000,4500,,
|
|
72221423718105650,282166476685350,618674840,
|
|
--2,尊享月卡,30,1_680,2_880_1,2_600_1;60071_18_1,0,tex_fuli_bg8,tex_fuli_bg9,15000,18880,,
|
|
72194570777264788,282063395897386,127800200,
|
|
--4,畅游月卡,30,1_300,2_300_1,2_120_1,0,tex_fuli_bg22,tex_fl_changyouzhouka,5000,3900,,
|
|
72252210043683509,282166476685357,228735640,
|
|
--5,至尊月卡,30,1_680,2_680_1,2_210_1,0,tex_fuli_bg8,tex_fuli_bg9,15000,6980,,
|
|
}
|
|
local L_MainKeyDic = {
|
|
[1]=1,[2]=2,[4]=3,[5]=4,}
|
|
local L_NamesByNum = {
|
|
Id = 1,
|
|
Day = 3,
|
|
ExpAddPer = 7,
|
|
MagicBowl = 10,
|
|
TotalReward = 11,
|
|
}
|
|
local L_NamesByString = {
|
|
Name = 2,
|
|
Cost = 4,
|
|
Nowitem = 5,
|
|
DayAddItem = 6,
|
|
Icon = 8,
|
|
Texture = 9,
|
|
}
|
|
local L_ColNameIndexs = {
|
|
Id = 0,
|
|
Name = 1,
|
|
Day = 2,
|
|
Cost = 3,
|
|
Nowitem = 4,
|
|
DayAddItem = 5,
|
|
ExpAddPer = 6,
|
|
Icon = 7,
|
|
Texture = 8,
|
|
MagicBowl = 9,
|
|
TotalReward = 10,
|
|
}
|
|
--local L_ColumnUseBitCount = {4,16,6,16,16,16,2,16,16,15,16,}
|
|
--local L_ColumnList = {1,1,1,1,1,2,2,2,2,3,3,}
|
|
--local L_ShiftDataList = {0,4,20,26,42,0,16,18,34,0,15,}
|
|
--local L_AndDataList = {7,32767,31,32767,32767,32767,1,32767,32767,16383,32767,}
|
|
local L_ColumnShiftAndList = {1,0,7,1,4,32767,1,20,31,1,26,32767,1,42,32767,2,0,32767,2,16,1,2,18,32767,2,34,32767,3,0,16383,3,15,32767,}
|
|
local L_ColNum = 11;
|
|
local L_UseDataK = setmetatable({ },{ __mode = 'k'});
|
|
local L_UseDataV = setmetatable({ },{ __mode = 'v'});
|
|
local L_UseDataRow = setmetatable({ },{ __mode = 'v'});
|
|
local L_IsCache = false;
|
|
local mt = {}
|
|
local function GetData(row, column)
|
|
local startIndex = (column - 1) * 3
|
|
local _compressData = L_CompressData[(row - 1)*L_CompressMaxColumn+L_ColumnShiftAndList[startIndex + 1]]
|
|
local _tempData = _compressData >> L_ColumnShiftAndList[startIndex + 2]
|
|
local _data = _tempData & L_ColumnShiftAndList[startIndex + 3]
|
|
local _andSign = L_ColumnShiftAndList[startIndex + 3] + 1
|
|
local _isMinus = (_andSign & _tempData) == _andSign
|
|
return _isMinus and -_data or _data;
|
|
end
|
|
|
|
mt.__index = function (t,key)
|
|
local _key = L_UseDataK[t];
|
|
local _row = L_MainKeyDic[_key];
|
|
local _column = L_NamesByNum[key];
|
|
if _column ~= nil then
|
|
if L_IsCache then
|
|
local _data = L_UseDataRow[_row * L_ColNum + _column]
|
|
if not _data then
|
|
_data = GetData(_row, _column)
|
|
L_UseDataRow[_row * L_ColNum + _column] = _data
|
|
end
|
|
return _data
|
|
else
|
|
return GetData(_row, _column)
|
|
end
|
|
end
|
|
_column = L_NamesByString[key]
|
|
if _column ~= nil then
|
|
return StringDefines[GetData(_row, _column)]
|
|
end
|
|
if string.find(key, '_') then
|
|
local _newKey = string.gsub(key, '_', '')
|
|
_column = L_NamesByString[_newKey]
|
|
if _column ~= nil then
|
|
return GetData(_row, _column)
|
|
end
|
|
end
|
|
if key ~= '_OnCopyAfter_' then
|
|
return
|
|
end
|
|
end
|
|
|
|
local M = {
|
|
_CompressData_ = L_CompressData,
|
|
_ColumnShiftAndList_ = L_ColumnShiftAndList,
|
|
_CompressMaxColumn_ = L_CompressMaxColumn,
|
|
_ColumnNameIndexs_ = L_ColNameIndexs,
|
|
Count = 4
|
|
}
|
|
|
|
function M:Foreach(func)
|
|
for i=1,M.Count do
|
|
local _key = GetData(i, 1)
|
|
func(_key, M[_key])
|
|
end
|
|
end
|
|
|
|
function M:ForeachCanBreak(func)
|
|
for i = 1,M.Count do
|
|
local _key = GetData(i, 1)
|
|
if func(_key, M[_key]) then
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
function M:GetByIndex(index)
|
|
return M[GetData(index, 1)];
|
|
end
|
|
|
|
function M:IsContainKey(key)
|
|
return not(not L_MainKeyDic[key]);
|
|
end
|
|
|
|
function M:SetIsCache(isCh)
|
|
L_IsCache = isCh;
|
|
end
|
|
|
|
setmetatable(M, {__index = function(t, key)
|
|
if not L_MainKeyDic[key] then
|
|
return;
|
|
end
|
|
local _t = L_UseDataV[key];
|
|
if not _t then
|
|
_t = setmetatable({}, mt);
|
|
L_UseDataV[key] = _t;
|
|
L_UseDataK[_t] = key;
|
|
end
|
|
return _t
|
|
end})
|
|
|
|
return M
|