Пример #1
0
        private static void HandleOnPlayModeChanged()
#endif
        {
            if (EditorApplication.isPlaying && TobiiEulaFile.IsEulaAccepted() == false)
            {
                ShowWindow();
            }
        }
Пример #2
0
        private static void TobiiEulaChecker()
        {
            if (TobiiEulaFile.IsEulaAccepted() == false)
            {
                EditorApplication.update += Update;
#if UNITY_2017_2_OR_NEWER
                EditorApplication.playModeStateChanged += HandleOnPlayModeChanged;
#else
                EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged;
#endif
            }
        }
Пример #3
0
        public static bool Start(TobiiXR_Settings settings = null)
        {
            if (!TobiiEulaFile.IsEulaAccepted())
            {
                Debug.LogError("You need to accept Tobii Software Development License Agreement to be able to use Tobii XR Unity SDK.");
                return(false);
            }

            if (_eyeTrackingProvider != null)
            {
                Debug.LogWarning(string.Format("TobiiXR already started with provider ({0})", _eyeTrackingProvider));
                VerifyInstanceIntegrity();
                return(false);
            }

            if (settings == null)
            {
                settings = TobiiXR_Settings.CreateDefaultSettings();
            }

            if (settings.FieldOfUse == FieldOfUse.NotSelected)
            {
                //For more info, see https://developer.tobii.com/vr/develop/unity/documentation/configure-tobii-xr/
                Debug.LogError("Field of use has not been selected. Please specify intended field of use in TobiiXR_Settings (can also be edited in Window->Tobii->Tobii Settings)");
            }

            _eyeTrackingProvider = settings.EyeTrackingProvider;

            if (_eyeTrackingProvider == null)
            {
                _eyeTrackingProvider = new NoseDirectionProvider();
                Debug.LogWarning(string.Format("Creating ({0}) failed. Using ({1}) as fallback", settings.GetProviderType(), _eyeTrackingProvider.GetType().Name));
            }

            Debug.Log(string.Format("Starting TobiiXR with ({0}) as provider for eye tracking", _eyeTrackingProvider));

            Internal.Settings = settings;
            Internal.G2OM     = settings.G2OM;

            VerifyInstanceIntegrity();

            return(true);
        }
Пример #4
0
        public void OnGUI()
        {
            EditorGUILayout.BeginVertical(EditorStyles.label);
#if UNITY_5_3 || UNITY_5_3_OR_NEWER
            var logo = AssetDatabase.LoadAssetAtPath <Texture2D>(TexturePath + "TobiiLogo.png");
#else
            var logo = (Texture2D)AssetDatabase.LoadAssetAtPath(TexturePath + "TobiiLogo.png", typeof(Texture2D));
#endif
            var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box);
            if (logo != null)
            {
                GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit);
            }

            EditorGUILayout.LabelField("");


            var style = new GUIStyle();
            style.richText = true;
            EditorGUILayout.LabelField(LicenseTitle, style, GUILayout.Height(30));

            EditorGUILayout.LabelField("");

            EditorGUILayout.BeginVertical("Box");
            scroll = EditorGUILayout.BeginScrollView(scroll);
            EditorGUILayout.SelectableLabel(LicenseText, style, GUILayout.Height(360));
            EditorGUILayout.EndScrollView();

            EditorGUILayout.EndVertical();

            EditorGUILayout.LabelField("");

            EditorGUILayout.HelpBox("To use this package please read and accept the Tobii XR Unity SDK License and Use Agreement.", MessageType.Info);

            EditorGUILayout.LabelField("");

            if (GUILayout.Button("Read the Tobii XR Unity SDK License and Use Agreement", GUILayout.Height(30)))
            {
                Application.OpenURL(EulaUrl);
            }

            EditorGUILayout.LabelField("");

            EditorGUILayout.BeginHorizontal(EditorStyles.label, GUILayout.Height(40));

            if (GUILayout.Button("Decline", GUILayout.Height(30)))
            {
                GetWindow <TobiiEulaCheck>(true).Close();
            }

            GUILayout.Button("", EditorStyles.miniBoldLabel);

            if (GUILayout.Button("Accept", GUILayout.Height(30)))
            {
#if UNITY_2017_2_OR_NEWER
                EditorApplication.playModeStateChanged -= HandleOnPlayModeChanged;
#else
                EditorApplication.playmodeStateChanged -= HandleOnPlayModeChanged;
#endif
                TobiiEulaFile.SetEulaAccepted();
                GetWindow <TobiiEulaCheck>(true).Close();
            }



            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
        }