检查工具
This commit is contained in:
parent
28e0b2c050
commit
0a437537bc
@ -136,71 +136,17 @@ namespace BFEditor
|
||||
var configFileInfos = configDirInfo.GetFiles(suffix, SearchOption.TopDirectoryOnly);
|
||||
|
||||
// 检查棋盘文件格式
|
||||
checkBoard("chapter_board", env, sb);
|
||||
checkBoard("chapter_board_bossrush", env, sb);
|
||||
checkBoard("chapter_board_daily_challenge", env, sb);
|
||||
checkBoard("chapter_board_dungeon_armor", env, sb);
|
||||
checkBoard("chapter_board_dungeon_equip", env, sb);
|
||||
checkBoard("chapter_board_dungeon_gold", env, sb);
|
||||
checkBoard("chapter_board_dungeon_shards", env, sb);
|
||||
checkBoard("chapter_board_rune", env, sb);
|
||||
checkBoard("activity_pvp_board", env, sb);
|
||||
checkBoard("arena_board", env, sb);
|
||||
|
||||
var luaScriptString = @"local cfg = require('app/config/chapter_board')
|
||||
if not cfg or not cfg.data then
|
||||
return ''
|
||||
end
|
||||
cfg = cfg.data
|
||||
local tempMap = {}
|
||||
local addErrorInfo = function(errorInfo, cfgId, errorStr)
|
||||
if not tempMap[cfgId] then
|
||||
tempMap[cfgId] = true
|
||||
table.insert(errorInfo, 'cfgId = ' .. cfgId)
|
||||
end
|
||||
|
||||
table.insert(errorInfo, ' ' .. errorStr)
|
||||
end
|
||||
|
||||
local errorInfo = {}
|
||||
for k, info in pairs(cfg) do
|
||||
local board = info.board
|
||||
if not board then
|
||||
addErrorInfo(errorInfo, k, '没有board字段,请检查')
|
||||
end
|
||||
|
||||
if #board < 49 then
|
||||
addErrorInfo(errorInfo, k, '没有board长度不足,请检查,当前长度为' .. #board)
|
||||
end
|
||||
|
||||
for index, v in ipairs(board) do
|
||||
if not v[1] then
|
||||
addErrorInfo(errorInfo, k, 'board字段中' .. index .. '索引没有格子类型')
|
||||
end
|
||||
if not v[2] then
|
||||
addErrorInfo(errorInfo, k, 'board字段中' .. index .. '索引没有元素类型')
|
||||
end
|
||||
end
|
||||
|
||||
local mystery_box_board = info.mystery_box_board
|
||||
if mystery_box_board then
|
||||
for index, v in ipairs(mystery_box_board) do
|
||||
if not v[1] then
|
||||
addErrorInfo(errorInfo, k, 'mystery_box_board字段中' .. index .. '索引没有格子类型')
|
||||
end
|
||||
if not v[2] then
|
||||
addErrorInfo(errorInfo, k, 'mystery_box_board字段中' .. index .. '索引没有元素类型')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if #errorInfo > 0 then
|
||||
return table.concat(errorInfo, '\n');
|
||||
end
|
||||
|
||||
return ''";
|
||||
var resultStr = env.DoString(luaScriptString);
|
||||
if (resultStr.Length > 0)
|
||||
{
|
||||
foreach(var strObj in resultStr)
|
||||
{
|
||||
var str = Convert.ToString(strObj);
|
||||
if(!String.IsNullOrEmpty(str))
|
||||
{
|
||||
sb.Append(str + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 检查monster
|
||||
string monsterConfigListLua = "{";
|
||||
@ -213,7 +159,7 @@ namespace BFEditor
|
||||
}
|
||||
}
|
||||
monsterConfigListLua += "}";
|
||||
luaScriptString = "local ids = {}\n local MONSTER_LIST = " + monsterConfigListLua + "\n";
|
||||
var luaScriptString = "local ids = {}\n local MONSTER_LIST = " + monsterConfigListLua + "\n";
|
||||
luaScriptString += @"local str = {}
|
||||
for i, name in ipairs(MONSTER_LIST) do
|
||||
if name ~= 'monster_base' and name ~= 'monster_position' and name ~= 'monster_position_base' then
|
||||
@ -230,7 +176,7 @@ namespace BFEditor
|
||||
return table.concat(str, '\n');
|
||||
end
|
||||
return ''";
|
||||
resultStr = env.DoString(luaScriptString);
|
||||
var resultStr = env.DoString(luaScriptString);
|
||||
if (resultStr.Length > 0)
|
||||
{
|
||||
foreach(var strObj in resultStr)
|
||||
@ -299,6 +245,76 @@ namespace BFEditor
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static void checkBoard(string configName, LuaEnv env, in StringBuilder sb)
|
||||
{
|
||||
var luaScriptString = @"
|
||||
if not cfg or not cfg.data then
|
||||
return ''
|
||||
end
|
||||
cfg = cfg.data
|
||||
local tempMap = {}
|
||||
local addErrorInfo = function(errorInfo, cfgId, errorStr)
|
||||
if not tempMap[cfgId] then
|
||||
tempMap[cfgId] = true
|
||||
table.insert(errorInfo, 'cfgId = ' .. cfgId)
|
||||
end
|
||||
|
||||
table.insert(errorInfo, ' ' .. errorStr)
|
||||
end
|
||||
|
||||
local errorInfo = {}
|
||||
for k, info in pairs(cfg) do
|
||||
local board = info.board or info.board_daily_challenge
|
||||
if not board then
|
||||
addErrorInfo(errorInfo, k, configName .. ' 没有board字段,请检查')
|
||||
else
|
||||
if #board < 49 then
|
||||
addErrorInfo(errorInfo, k, configName .. ' 没有board长度不足,请检查,当前长度为' .. #board)
|
||||
end
|
||||
|
||||
for index, v in ipairs(board) do
|
||||
if not v[1] then
|
||||
addErrorInfo(errorInfo, k, configName .. ' board字段中' .. index .. '索引没有格子类型')
|
||||
end
|
||||
if not v[2] then
|
||||
addErrorInfo(errorInfo, k, configName .. ' board字段中' .. index .. '索引没有元素类型')
|
||||
elseif v[2] > 5 or v[2] < 0 then
|
||||
addErrorInfo(errorInfo, k, configName .. ' board字段中' .. index .. '元素类型不合法,当前为' .. v[2])
|
||||
end
|
||||
end
|
||||
|
||||
local mystery_box_board = info.mystery_box_board
|
||||
if mystery_box_board then
|
||||
for index, v in ipairs(mystery_box_board) do
|
||||
if not v[1] then
|
||||
addErrorInfo(errorInfo, k, configName .. ' mystery_box_board字段中' .. index .. '索引没有格子类型')
|
||||
end
|
||||
if not v[2] then
|
||||
addErrorInfo(errorInfo, k, configName .. ' mystery_box_board字段中' .. index .. '索引没有元素类型')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if #errorInfo > 0 then
|
||||
return table.concat(errorInfo, '\n');
|
||||
end
|
||||
|
||||
return ''";
|
||||
var resultStr = env.DoString(" local cfg = require('app/config/" + configName + "')\n" + "local configName = '" + configName + "'\n" + luaScriptString);
|
||||
if (resultStr.Length > 0)
|
||||
{
|
||||
foreach(var strObj in resultStr)
|
||||
{
|
||||
var str = Convert.ToString(strObj);
|
||||
if(!String.IsNullOrEmpty(str))
|
||||
{
|
||||
sb.Append(str + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool FastExportExcelToLua(bool isDeveloper, string designExcelPath)
|
||||
{
|
||||
failFlag = false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user