using UnityEngine;
using System.Collections.Generic;
using UnityEngine.AdaptivePerformance;
using UnityEditor.AdaptivePerformance.Editor;
using UnityEngine.AdaptivePerformance.Provider;
namespace UnityEditor.AdaptivePerformance.Simulator.Editor
{
///
/// SimulatorProviderLoader implements the loader for the Adaptive Performance Device Simulator plugin.
///
[AdaptivePerformanceSupportedBuildTargetAttribute(BuildTargetGroup.Standalone)]
public class SimulatorProviderLoader : AdaptivePerformanceLoaderHelper
{
static List s_SimulatorSubsystemDescriptors =
new List();
/// Returns the currently active Simulator Subsystem instance, if any.
public SimulatorAdaptivePerformanceSubsystem simulatorSubsystem
{
get { return GetLoadedSubsystem(); }
}
///
/// Implementation of
///
/// The Simulator as currently loaded default subststem. Adaptive Performance always initializes the first subsystem and uses it as a default, because only one subsystem can be present at a given time. You can change subsystem order in the Adaptive Performance Provider Settings.
public override ISubsystem GetDefaultSubsystem()
{
return simulatorSubsystem;
}
///
/// Implementation of .
///
/// Returns the Simulator settings.
public override IAdaptivePerformanceSettings GetSettings()
{
return SimulatorProviderSettings.GetSettings();
}
/// Implementation of .
/// True if successfully initialized the Simulator subsystem, false otherwise.
public override bool Initialize()
{
CreateSubsystem(s_SimulatorSubsystemDescriptors, "SimulatorAdaptivePerformanceSubsystem");
if (simulatorSubsystem == null)
{
Debug.LogError("Unable to start the Simulator subsystem.");
}
return simulatorSubsystem != null;
}
/// Implementation of .
/// True if successfully started the Simulator subsystem, false otherwise.
public override bool Start()
{
StartSubsystem();
return true;
}
/// Implementation of .
/// True if successfully stopped the Simulator subsystem, false otherwise
public override bool Stop()
{
StopSubsystem();
return true;
}
/// Implementation of .
/// True if successfully deinitialized the Simulator subsystem, false otherwise.
public override bool Deinitialize()
{
DestroySubsystem();
return true;
}
}
}