48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
|
|
|
|
|
|
#include "GameModes/OLSExperienceManager.h"
|
|
|
|
#if WITH_EDITOR
|
|
void UOLSExperienceManager::OnPlayInEditorBegun()
|
|
{
|
|
ensure(GameFeaturePluginRequestCountMap.IsEmpty());
|
|
GameFeaturePluginRequestCountMap.Empty();
|
|
}
|
|
|
|
void UOLSExperienceManager::NotifyOfPluginActivation(const FString pluginURL)
|
|
{
|
|
if (GIsEditor)
|
|
{
|
|
UOLSExperienceManager* experienceManagerSubsystem = GEngine->GetEngineSubsystem<UOLSExperienceManager>();
|
|
check(experienceManagerSubsystem);
|
|
|
|
// Track the number of requesters who activate this plugin. Multiple load/activation requests are always allowed because concurrent requests are handled.
|
|
int32& count = experienceManagerSubsystem->GameFeaturePluginRequestCountMap.FindOrAdd(pluginURL);
|
|
++count;
|
|
}
|
|
}
|
|
|
|
bool UOLSExperienceManager::RequestToDeactivatePlugin(const FString pluginURL)
|
|
{
|
|
if (GIsEditor)
|
|
{
|
|
UOLSExperienceManager* experienceManagerSubsystem = GEngine->GetEngineSubsystem<UOLSExperienceManager>();
|
|
check(experienceManagerSubsystem);
|
|
|
|
// Only let the last requester to get this far deactivate the plugin
|
|
int32& count = experienceManagerSubsystem->GameFeaturePluginRequestCountMap.FindChecked(pluginURL);
|
|
--count;
|
|
|
|
if (count == 0)
|
|
{
|
|
experienceManagerSubsystem->GameFeaturePluginRequestCountMap.Remove(pluginURL);
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
#endif |