128 lines
4.1 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
LevelTable = {}
--- 配置的地图数据
---@type table<ELevelType, LevelItem>
LevelTable.LevelInfo = {
{
ShowName = "林间训练场",
MapName = "Map_SLXLC",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/Minimap/T_SLXLC.T_SLXLC'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_CLDT_BG.T_CLDT_BG'),
MapCentre = { X = 5600, Y = 2100, Z = 100 },
MapSize = 10000.0,
MapScale = 30.,
}
},
{
ShowName = "遗迹废墟",
MapName = "Map_SMDJ",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/Minimap/T_YJDJ.T_YJDJ'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_YJDJ_BG.T_YJDJ_BG'),
MapCentre = { X = 6500., Y = 4000., Z = 0. },
MapSize = 13000.0,
MapScale = 30.,
}
},
{
ShowName = "海岛对决",
MapName = "Map_HDDJ",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_HDDJ.MiniMap_HDDJ'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_HDDJ_BG.T_HDDJ_BG'),
MapCentre = { X = 4500.000000, Y = 1500.000000, Z = 100.000015 },
MapSize = 6000.0,
MapScale = 30.,
}
},
{
ShowName = "假车库",
MapName = "Map_JCK",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_JCK.MiniMap_JCK'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_JCK_BG.T_JCK_BG'),
MapCentre = { X = 5630.000000, Y = 1540.000000, Z = 100.000015 },
MapSize = 4000.0,
MapScale = 30.,
}
},
{
ShowName = "旋转楼",
MapName = "Map_SCL",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_SCL.MiniMap_SCL'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_SCL_BG.T_SCL_BG'),
MapCentre = { X = 5630.000000, Y = 1540.000000, Z = 100.000015 },
MapSize = 4000.0,
MapScale = 30.,
}
},
{
ShowName = "打靶楼",
MapName = "Map_DBL",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_DBL.MiniMap_DBL'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_DBL_BG.T_DBL_BG'),
MapCentre = { X = 5630.000000, Y = 1540.000000, Z = 100.000015 },
MapSize = 4000.0,
MapScale = 30.,
}
},
{
ShowName = "瑞兽迎春",
MapName = "Map_NewYear",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_NewYear.MiniMap_NewYear'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_NewYear_BG.T_NewYear_BG'),
MapCentre = { X=7260.000000,Y=1400.000000,Z=0.000000 },
MapSize = 10000.0,
MapScale = 30.,
}
},
{
ShowName = "大仓",
MapName = "Map_DC",
MiniMapInfo = {
MapPath = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/MiniMap/MiniMap_DC.MiniMap_DC'),
BG_Path = UGCGameSystem.GetUGCResourcesFullPath('Asset/Levels/ScenePic/T_DC_BG.T_DC_BG'),
MapCentre = { X=7500.000000,Y=2700.000000,Z=0.000000 },
MapSize = 10000.0,
MapScale = 30.,
}
},
}
---@param IsUseRate bool 是否使用比例进行随机
---@return table<int32, int32> 获取随机地图的 index
function LevelTable.GetRandomLevel(IsUseRate)
if IsUseRate then
local Total = 0;
for i = 1, #LevelTable.LevelInfo do
local Info = LevelTable.LevelInfo[i]
if Info and Info.Rate then
Total = Total + Info.Rate;
end
end
local MapIndies = {};
local RandomNum = math.pop() * Total
UGCLogSystem.Log("[LevelTable.GetRandomLevel] RandomNum = %f", RandomNum)
for i = 1, #LevelTable.LevelInfo do
local Info = LevelTable.LevelInfo[i];
UGCLogSystem.Log("[LevelTable.GetRandomLevel] RandomNum = %f", RandomNum)
if Info and Info.Rate then
RandomNum = RandomNum - Info.Rate;
if RandomNum <= 0 then
table.insert(MapIndies, i);
break ;
end
end
end
return MapIndies;
end
local Count = table.getCount(LevelTable.LevelInfo);
-- 默认 Random 是 0;
if Count == 2 then return { 1 }; end
return math.random(Count);
end