using System.Collections.Generic; using UnityEngine; using UnityEngine.AdaptivePerformance; #if UNITY_EDITOR using UnityEditor; using UnityEditor.AdaptivePerformance.Editor; #endif using System.Runtime.InteropServices; using UnityEngine.AdaptivePerformance.Provider; namespace UnityEngine.AdaptivePerformance.Samsung.Android { /// /// SamsungAndroidProviderLoader implements the loader for Adaptive Performance on Samsung devices running Android. /// #if UNITY_EDITOR [AdaptivePerformanceSupportedBuildTargetAttribute(BuildTargetGroup.Android)] #endif public class SamsungAndroidProviderLoader : AdaptivePerformanceLoaderHelper { static List s_SamsungGameSDKSubsystemDescriptors = new List(); #if UNITY_ANDROID /// Returns the currently active Samsung Android Subsystem instance, if an instance exists. public SamsungGameSDKAdaptivePerformanceSubsystem samsungGameSDKSubsystem { get { return GetLoadedSubsystem(); } } #endif /// /// Implementation of . /// /// Returns the Samsung Android Subsystem, which is the loaded default subsystem. Because only one subsystem can be present at a time, Adaptive Performance always initializes the first subsystem and uses it as a default. You can change subsystem order in the Adaptive Performance Provider Settings. public override ISubsystem GetDefaultSubsystem() { #if UNITY_ANDROID return samsungGameSDKSubsystem; #else return null; #endif } /// /// Implementation of . /// /// Returns the Samsung Android settings. public override IAdaptivePerformanceSettings GetSettings() { return SamsungAndroidProviderSettings.GetSettings(); } /// Implementaion of . /// True if successfully initialized the Samsung Android subsystem, false otherwise. public override bool Initialize() { #if UNITY_ANDROID CreateSubsystem(s_SamsungGameSDKSubsystemDescriptors, "SamsungGameSDK"); if (samsungGameSDKSubsystem == null) { Debug.LogError("Unable to create the Samsung Android subsystem."); return false; } if (!samsungGameSDKSubsystem.initialized) { if (!samsungGameSDKSubsystem.Initialize()) { Debug.LogError("Unable to initialize the Samsung Android subsystem."); return false; } } return samsungGameSDKSubsystem != null && samsungGameSDKSubsystem.initialized; #else return false; #endif } /// Implementation of . /// True if successfully started the Samsung Android subsystem, false otherwise. public override bool Start() { #if UNITY_ANDROID StartSubsystem(); return true; #else return false; #endif } /// Implementaion of . /// True if successfully stopped the Samsung Android subsystem, false otherwise. public override bool Stop() { #if UNITY_ANDROID StopSubsystem(); return true; #else return false; #endif } /// Implementaion of . /// True if successfully deinitialized the Samsung Android subsystem, false otherwise. public override bool Deinitialize() { #if UNITY_ANDROID DestroySubsystem(); return true; #else return false; #endif } } }