Exemplo n.º 1
0
        IEnumerator Init()
        {
            //MagicLeapLogger.Debug(kLogTag, "Checking for XRGeneralSettings.Instance");
            while (XRGeneralSettings.Instance == null)
            {
                //MagicLeapLogger.Debug(kLogTag, "Waiting for XRGeneralSettings.Instance to spawn");
                yield return(null);
            }
            //MagicLeapLogger.Debug(kLogTag, "Checking for XRGeneralSettings.Instance.Manager");
            while (XRGeneralSettings.Instance.Manager == null)
            {
                //MagicLeapLogger.Debug(kLogTag, "Waiting for XRGeneralSettings.Instance.Manager to spawn");
                yield return(null);
            }
            m_Loader = XRGeneralSettings.Instance.Manager.ActiveLoaderAs <MagicLeapLoader>();
            MLLog.Assert(m_Loader != null, kLogTag, "Cannot get reference to MagicLeapLoader!");
            if (m_Loader != null)
            {
                m_MeshSubsystem = m_Loader.meshSubsystem;
            }

            MLLog.Assert(m_MeshSubsystem != null, kLogTag, "Cannot get reference to Mesh Subsystem!");

            UpdateSettings();
            UpdateBounds();
            UpdateBatchSize();

            StartSubsystem();
        }
        public static bool RequestPrivilege(uint privilegeId)
        {
            if (!isInitialized())
            {
                return(false);
            }
            var result = Native.RequestPrivilege(privilegeId);

            MLLog.Debug(kLogTag, "requesting privilege id {0}: {1}", privilegeId, result.ToString());
            return(result == ResultCode.Granted);
        }
        public static bool IsPrivilegeApproved(uint privilegeId)
        {
            if (!isInitialized())
            {
                return(false);
            }
            var result = Native.CheckPrivilege(privilegeId);

            MLLog.Debug(kLogTag, "checking privilege id {0}: {1}", privilegeId, result.ToString());
            return(result == ResultCode.Granted);
        }
Exemplo n.º 4
0
        IEnumerator Init()
        {
            //MagicLeapLogger.Debug(kLogTag, "Checking for XRGeneralSettings.Instance");
            while (XRGeneralSettings.Instance == null)
            {
                //MagicLeapLogger.Debug(kLogTag, "Waiting for XRGeneralSettings.Instance to spawn");
                yield return(null);
            }
            //MagicLeapLogger.Debug(kLogTag, "Checking for XRGeneralSettings.Instance.Manager");
            while (XRGeneralSettings.Instance.Manager == null)
            {
                //MagicLeapLogger.Debug(kLogTag, "Waiting for XRGeneralSettings.Instance.Manager to spawn");
                yield return(null);
            }
            m_Loader = XRGeneralSettings.Instance.Manager.ActiveLoaderAs <MagicLeapLoader>();
            MLLog.Assert(m_Loader != null, kLogTag, "Cannot get reference to MagicLeapLoader!");
            if (m_Loader == null)
            {
                //MagicLeapLogger.Debug(kLogTag, "Waiting for MagicleapLegacyLoader to spawn");
                while (MagicLeapLegacyLoader.instance == null)
                {
                    yield return(null);
                }
                //MagicLeapLogger.Debug(kLogTag, "Waiting for MagicleapLegacyLoader to initialize");
                while (!MagicLeapLegacyLoader.instance.isInitialized)
                {
                    yield return(null);
                }
                //MagicLeapLogger.Debug(kLogTag, "Attempting to load mesh subsystem from MagicLeapLegacyLoader");
                m_MeshSubsystem = MagicLeapLegacyLoader.instance.meshSubsystem;
                if (m_MeshSubsystem == null)
                {
                    enabled = false;
                    yield break;
                }
            }
            else
            {
                m_MeshSubsystem = m_Loader.meshSubsystem;
            }

            MLLog.Assert(m_MeshSubsystem != null, kLogTag, "Cannot get reference to Mesh Subsystem!");

            UpdateSettings();
            UpdateBounds();
            UpdateBatchSize();
            SetLod();

            StartSubsystem();
        }
        internal static void Shutdown()
        {
            // TODO :: Need to enfore access on main thread only..
            lock (s_LockObject)
            {
                s_RefCount--;
                if (s_RefCount > 0)
                {
                    return;
                }
            }
            MLLog.Debug(kLogTag, "Stopping Privileges Service");
            Application.quitting -= Shutdown;
            var result = Native.Shutdown();

            MLLog.Assert(result == ResultCode.Ok, kLogTag, "Failed to shutdown privileges service");
        }
        internal static void Initialize()
        {
            // TODO :: Need to enfore access on main thread only..
            lock (s_LockObject)
            {
                s_RefCount++;
                if (s_RefCount != 1)
                {
                    return;
                }
            }
            MLLog.Debug(kLogTag, "Starting Privileges Service");
            var result = Native.Startup();

            MLLog.Assert(result == ResultCode.Ok, kLogTag, "Failed to initialize privileges service");
            // on app shutdown, we're tearing the world down anyways, so futzing with the ref count is okay.
            Application.quitting += () => { Shutdown(); };
        }
 static void Log(string msg) => MLLog.Debug(kLogTag, $"{msg}");
 static void LogError(string msg) => MLLog.Error(kLogTag, $"{msg}");
 static void LogWarning(string msg) => MLLog.Warning(kLogTag, $"{msg}");
 static void LogError(string msg)
 {
     MLLog.Error(kLogTag, msg);
 }
 static void LogWarning(string msg)
 {
     MLLog.Warning(kLogTag, msg);
 }
 static void DebugLog(string msg)
 {
     MLLog.Debug(kLogTag, msg);
 }