74 lines
2.7 KiB
Lua
74 lines
2.7 KiB
Lua
|
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类------------------------------------------
|
||
|
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Child/WB_PlayerInfoItem.WB_PlayerInfoItem_C'),
|
||
|
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Child/WB_PlayerInfoItem_Small.WB_PlayerInfoItem_Small_C'),
|
||
|
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/WB_SelectPartItem.WB_SelectPartItem_C'),
|
||
|
UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/WB_SelectPartButton.WB_SelectPartButton_C'),
|
||
|
|
||
|
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
|
||
|
|
||
|
--- 需要加载 Object 的类
|
||
|
--ObjectPath.ActorObjectPath = {
|
||
|
-- '/Game/Arts_Effect/ParticleSystems/Share/P_AH6_baozha_01.P_AH6_baozha_01'
|
||
|
--}
|
||
|
|
||
|
function ObjectPath.Init()
|
||
|
ObjectPath.LoadClass(ObjectPath.ActorClassPath)
|
||
|
if not UE_SERVER then
|
||
|
ObjectPath.LoadClass(ObjectPath.ClientClassPath)
|
||
|
end
|
||
|
--for i, v in pairs(ObjectPath.ActorObjectPath) do
|
||
|
-- local dot_num = string.find(v, '%.');
|
||
|
-- local val = string.sub(v, dot_num + 1, string.len(v));
|
||
|
-- UE.AsyncLoadObject(v, function(TargetObject) ObjectPath[val] = TargetObject; end);
|
||
|
--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
|
||
|
if ObjectPath.WaitFuncs[InClassName] == nil then
|
||
|
ObjectPath.WaitFuncs[InClassName] = {};
|
||
|
end
|
||
|
table.insert(ObjectPath.WaitFuncs[InClassName], Func);
|
||
|
UGCLogSystem.LogTree(string.format("[ObjectPath.AddFunc] ObjectPath.WaitFuncs ="), ObjectPath.WaitFuncs)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
return ObjectPath;
|