private static void HandleOnPlayModeChanged() #endif { if (EditorApplication.isPlaying && TobiiEula.IsEulaAccepted() == false) { ShowWindow(); } }
private static void TobiiEulaChecker() { TobiiEula.SetEulaFile(LoadOrCreateEulaFile()); if (TobiiEula.IsEulaAccepted() == false) { EditorApplication.update += Update; #if UNITY_2017_2_OR_NEWER EditorApplication.playModeStateChanged += HandleOnPlayModeChanged; #else EditorApplication.playmodeStateChanged += HandleOnPlayModeChanged; #endif } }
public void OnGUI() { if (TobiiEula.IsEulaAccepted()) { GetWindow <TobiiEulaCheck>(true).Close(); return; } EditorGUILayout.BeginVertical(EditorStyles.label); 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))) { _window.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 TobiiEula.SetEulaAccepted(); GetWindow <TobiiEulaCheck>(true).Close(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); }