60 lines
2.2 KiB
Lua
Raw Permalink Normal View History

2025-01-04 23:00:19 +08:00
ObjectPath = {};
-- 在前面加上工程名就是这个 /TrainingCamp/Asset/Blueprint/UGCPlayerPawn.UGCPlayerPawn_C
ObjectPath.ActorClassPath = {
UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/UGCPlayerPawn.UGCPlayerPawn_C'),
UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Start/BP_ActorStart.BP_ActorStart_C'),
};
if not UE_SERVER then
ObjectPath.ClientClassPath = {
------------------------------------------UI类------------------------------------------
2025-01-21 11:29:14 +08:00
--- UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/Child/WB_PlayerInfoItem.WB_PlayerInfoItem_C'),
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/Child/WB_SelectPartItem.WB_SelectPartItem_C'),
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/Child/WB_SelectPartButton.WB_SelectPartButton_C'),
2025-01-04 23:00:19 +08:00
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/Child/WB_AllWeapon_Type.WB_AllWeapon_Type_C'),
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/Child/WB_AllWeapon_Item.WB_AllWeapon_Item_C'),
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/Child/WB_SelectWeaponItems.WB_SelectWeaponItems_C'),
};
end
function ObjectPath.Init()
ObjectPath.LoadClass(ObjectPath.ActorClassPath)
if not UE_SERVER then
ObjectPath.LoadClass(ObjectPath.ClientClassPath)
end
end
function ObjectPath.LoadClass(InTable)
for i, v in pairs(InTable) do
local dot_num = string.find(v, '%.');
local val = string.sub(v, dot_num + 1, string.len(v) - 2);
UE.AsyncLoadClass(v, function(TargetClass)
ObjectPath[val] = TargetClass;
if ObjectPath.WaitFuncs[val] then
for c, d in pairs(ObjectPath.WaitFuncs[val]) do
d(TargetClass);
end
ObjectPath.WaitFuncs[val] = nil;
end
end);
end
end
ObjectPath.WaitFuncs = {};
---@param Func fun(TargetClass:UClass)
function ObjectPath.AddFunc(InClassName, Func)
UGCLogSystem.Log("[ObjectPath.AddFunc] 开始添加 %s", InClassName);
if ObjectPath[InClassName] then
Func(ObjectPath[InClassName]);
else
2025-01-21 11:29:14 +08:00
if ObjectPath.WaitFuncs[InClassName] == nil then ObjectPath.WaitFuncs[InClassName] = {}; end
2025-01-04 23:00:19 +08:00
table.insert(ObjectPath.WaitFuncs[InClassName], Func);
UGCLogSystem.LogTree(string.format("[ObjectPath.AddFunc] ObjectPath.WaitFuncs ="), ObjectPath.WaitFuncs)
end
end
return ObjectPath;