ObjectPath = {}; ObjectPath.ActorClassPath = { UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/UGCPlayerPawn.UGCPlayerPawn_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Start/BP_ActorStart.BP_ActorStart_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/PickUp/Recycle/BP_CustomItemBase.BP_CustomItemBase_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Resource/BP_ResourceBase.BP_ResourceBase_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Shape/BP_ShapeBase.BP_ShapeBase_C'), '/Game/BluePrints/Environment/BP_radiation.BP_radiation_C', UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Range/BP_HoldPoint.BP_HoldPoint_C'), }; if not UE_SERVER then ObjectPath.ClientClassPath = { -- 高位摄像机 UGCGameSystem.GetUGCResourcesFullPath('Asset/Blueprint/SceneObj/Camera/BP_GodCamera.BP_GodCamera_C'), ------------------------------------------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/Child/WB_SelectPartItem.WB_SelectPartItem_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/Child/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'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/Child/WB_SelectWeaponItem.WB_SelectWeaponItem_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectWeapons/Child/WB_SelectWeaponOtherItem.WB_SelectWeaponOtherItem_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectSoldier/WB_SelectSolider_Item.WB_SelectSolider_Item_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/Tool/Child/WB_PlayerSoldier_Item.WB_PlayerSoldier_Item_C'), UGCGameSystem.GetUGCResourcesFullPath('Asset/UI/SelectSoldier/WB_ShowPlayerSelectSoldier.WB_ShowPlayerSelectSoldier_C'), }; --- 需要加载 Object 的类 ObjectPath.ActorObjectPath = { '/Game/Arts_Effect/ParticleSystems/Share/P_AH6_baozha_01.P_AH6_baozha_01', -- 爆炸特效 '/Game/Arts_Player/Characters/Animation/Shared_Anim/Lobby_Anim/Dance/SS15/Effect/SaoLuoC/P_Implosive.P_Implosive', -- 冷冻特效 '/Game/Arts/UI/Atlas/BattleUI/Tmode/Frames/Armament_img_kuang2_50x50_png.Armament_img_kuang2_50x50_png', --- 音效 '/Game/WwiseEvent/Weapon_Player/RPG/Play_RPG_Explosion.Play_RPG_Explosion', }; end function ObjectPath.LoadClass(Path) local dot_num = string.find(Path, '%.'); local val = string.sub(Path, dot_num + 1, string.len(Path) - 2); UE.AsyncLoadClass(Path, 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 function ObjectPath.LoadObject(Path) local dot_num = string.find(Path, '%.'); local val = string.sub(Path, dot_num + 1, string.len(Path)); UE.AsyncLoadObject(Path, function(TargetObject) ObjectPath[val] = TargetObject; if ObjectPath.WaitFuncs[val] then for c, d in pairs(ObjectPath.WaitFuncs[val]) do d(TargetObject); end ObjectPath.WaitFuncs[val] = nil; end end); end function ObjectPath.Init() for i, v in pairs(ObjectPath.ActorClassPath) do ObjectPath.LoadClass(v); end if not UE_SERVER then for i, v in pairs(ObjectPath.ClientClassPath) do ObjectPath.LoadClass(v); end for i, v in pairs(ObjectPath.ActorObjectPath) do ObjectPath.LoadObject(v); end end end ObjectPath.WaitFuncs = {}; ---@param Func fun(Target: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) UGCLogSystem.LogTree(string.format("[ObjectPath.AddFunc] ObjectPath ="), ObjectPath) end end return ObjectPath;