Exemplo n.º 1
0
 //[MenuItem("Tools/UAP Accessibility/Enable NGUI support")]
 static public void EnableNGUISupport()
 {
     if (EditorUtility.DisplayDialog("Really enable NGUI support?", "Make sure you have NGUI added to your project before you enable UAP NGUI support.\n\nOtherwise the plugin will not compile.", "Go Ahead", "Cancel"))
     {
         UAP_WelcomeWindow.EnableNGUISupport();
     }
 }
Exemplo n.º 2
0
    //////////////////////////////////////////////////////////////////////////

    static public void Init()
    {
        // Get existing open window or if none, make a new one:
        UAP_WelcomeWindow window = (UAP_WelcomeWindow)EditorWindow.GetWindow(typeof(UAP_WelcomeWindow));

        window.titleContent.text = "About UAP";
        window.position          = new Rect(50 + 0, 50 + 0, 400, 500);
        window.maxSize           = new Vector2(405f, 505f);
        //window.minSize = window.maxSize;
        window.Show();
    }
Exemplo n.º 3
0
    //////////////////////////////////////////////////////////////////////////

    public override void OnInspectorGUI()
    {
        SetupGUIStyles();
        serializedObject.Update();

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        if (m_LogoTexture == null)
        {
            LoadLogoTexture();
        }

        if (m_LogoTexture == null)
        {
            EditorGUILayout.LabelField("UAP - UI Accessibility Plugin", myTopStyle);
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
        }
        else
        {
            //GUILayout.FlexibleSpace();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            var headerRect = GUILayoutUtility.GetRect(0.0f, 5.0f);
            headerRect.width  = m_LogoTexture.width;
            headerRect.height = m_LogoTexture.height;
            GUI.DrawTexture(headerRect, m_LogoTexture);

            GUILayout.FlexibleSpace();
            //GUILayout.FlexibleSpace();
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            GUILayout.Space(60);
            //GUILayout.FlexibleSpace();
        }

        if (GUILayout.Button("Open Documentation", GUILayout.Height(25)))
        {
            Application.OpenURL("http://www.metalpopgames.com/assetstore/accessibility/doc");
        }


        // ENABLING
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        DrawSectionHeader("Turn On/Off Accessibility", true);
        //EditorGUILayout.PropertyField(m_DefaultState, new GUIContent("Enabled on App Install", "Default: Off\nDetermines whether accessibility should be on or off when the user installs the app for the first time. If Auto Enable is on, this can usually be left off."), GUILayout.ExpandWidth(true));
        //EditorGUILayout.PropertyField(m_AutoTurnOnIfScreenReaderDetected, new GUIContent("Auto-Enable if screen reader detected", "Default: On\nThe plugin can detect whether screen reader software is running on the target platform (TalkBack, VoiceOver, NVDA, etc) and turn on automatically if that is the case."));
        m_DefaultState.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Enabled after app install", "Determines whether accessibility should be on or off when the user installs the app for the first time. If Auto Enable is on, this can usually be left off."), m_DefaultState.boolValue);
        if (m_DefaultState.boolValue)
        {
            DrawWarningBox("Are you sure?\nIf this is on then all users, including sighted ones, will start the app with accessibility mode enabled.");
        }
        m_AutoTurnOnIfScreenReaderDetected.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Auto-Enable if screen reader detected", "The plugin can detect whether screen reader software is running on the target platform (TalkBack, VoiceOver, NVDA, etc) and turn on automatically if that is the case."), m_AutoTurnOnIfScreenReaderDetected.boolValue);
        if (!m_AutoTurnOnIfScreenReaderDetected.boolValue)
        {
            DrawWarningBox("Are you sure?\nIf this is off then the only option for blind users to activate accessibility is with a Magic Gesture or asking a sighted friend for help.");
        }
        m_SaveEnabledState.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Save Enabled State", "Turn accessibility mode on or off, depending on what it was when the app was last closed."), m_SaveEnabledState.boolValue);

        if (Application.isPlaying)
        {
            EditorGUILayout.LabelField("Accessibility is currently " + (UAP_AccessibilityManager.IsEnabled() ? "ON" : "OFF"));
            //EditorGUILayout.LabelField("Accessibility GUID " + Accessibility_Manager.GetInstanceID());
        }


        // TESTING
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        showDebugging = DrawSectionHeader("Testing and Debugging", showDebugging);
        if (showDebugging)
        {
            EditorGUILayout.LabelField(new GUIContent("Editor Only - Force Accessibility Mode", "You can manually force to start the application with accessibility enabled or disabled. This overrides any other setting. These settings are only applicable while inside the Editor and will be ignored when the application is built."));
            //EditorGUILayout.LabelField("Force Accessibility to be:");
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            //EditorGUILayout.Space();
            bool forceOn = EditorGUILayout.Toggle(m_EditorOverride.boolValue && m_EditorEnabledState.boolValue, EditorStyles.radioButton, GUILayout.MaxWidth(15));
            EditorGUILayout.LabelField("On", GUILayout.MaxWidth(60));
            bool forceOff = EditorGUILayout.Toggle(m_EditorOverride.boolValue && !m_EditorEnabledState.boolValue, EditorStyles.radioButton, GUILayout.MaxWidth(15));
            EditorGUILayout.LabelField("Off", GUILayout.MaxWidth(60));
            bool useDefault = EditorGUILayout.Toggle(!m_EditorOverride.boolValue, EditorStyles.radioButton, GUILayout.MaxWidth(15));
            EditorGUILayout.LabelField(new GUIContent("App Controlled", "Controlled by the app. Use whatever has been saved in the user preferences."), GUILayout.MaxWidth(90));
            //GUILayout.FlexibleSpace();
            GUILayout.FlexibleSpace();
            //EditorGUILayout.Space();
            if (useDefault && m_EditorOverride.boolValue)
            {
                m_EditorOverride.boolValue     = false;
                m_EditorEnabledState.boolValue = false;
            }
            else if (forceOn && (!m_EditorEnabledState.boolValue || !m_EditorOverride.boolValue))
            {
                m_EditorOverride.boolValue     = true;
                m_EditorEnabledState.boolValue = true;
            }
            else if (forceOff && (m_EditorEnabledState.boolValue || !m_EditorOverride.boolValue))
            {
                m_EditorOverride.boolValue     = true;
                m_EditorEnabledState.boolValue = false;
            }
            EditorGUILayout.EndHorizontal();

            // If the app is playing/running, offer a button to toggle accessibility manually
            if (Application.isPlaying)
            {
                EditorGUILayout.Separator();
                if (GUILayout.Button("Toggle Accessibility", GUILayout.Height(25)))
                {
                    UAP_AccessibilityManager.ToggleAccessibility();
                }
            }
        }


        // SETTINGS
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        showSettings = DrawSectionHeader("Settings", showSettings);
        if (showSettings)
        {
            EditorGUILayout.HelpBox("Please consult the documentation before changing these values.\nThe default settings conform to the way VoiceOver and other screen readers work. Only change these if you are certain your application needs it.", MessageType.Info);

            m_HandleUI.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Handle UI", "If true (Default), the plugin will block direct touch to the screen."), m_HandleUI.boolValue);
            if (!m_HandleUI.boolValue)
            {
                DrawErrorBox("Attention:\nIf you just want the plugin to stop handling swipes, use PauseAccessibility() instead.");
            }
            m_ExploreByTouch.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Explore By Touch", "If true (Default) the plugin reads out the UI element that is under the user's finger. If 'Handle UI' is not active, this setting will be ignored."), m_ExploreByTouch.boolValue);
            EditorGUILayout.Separator();
            m_HandleMagicGestures.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Magic Gestures", "If true (Default), the plugin will recognize magic gestures for functions like Back, Exit and Pause, and call the appropriate callbacks to your game."), m_HandleMagicGestures.boolValue);
            if (!m_HandleMagicGestures.boolValue)
            {
                DrawErrorBox("Are you sure?\nYou don't need to subscribe to any events.\nBut disabling this also takes away the player's ability to enable/disable accessibility with a finger gesture.");
            }
            m_ReadDisabledInteractables.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Read Disabled", "If true (Default), the plugin reads out disabled but visible interactive UI elements. The plugin will read out 'Disabled' after the name."), m_ReadDisabledInteractables.boolValue);
            if (!m_ReadDisabledInteractables.boolValue)
            {
                DrawErrorBox("Careful!\nIt's important that blind users know about buttons, sliders etc even if they are disabled. If they are not read while exploring the screen, they are invisible to them. They might not realize a button has become active later if they never knew it was there in the first place.");
            }
            m_CyclicMenus.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Cyclic Menus", "Default is false. If true, when reaching the last element on the screen, the focus will jump back around to the first element."), m_CyclicMenus.boolValue);
            if (m_CyclicMenus.boolValue)
            {
                DrawErrorBox("Attention:\nThis can be very irritating to blind players. Even though it makes sense to sighted people, this was regularly reported as a negative feature during beta tests.");
            }
            m_AllowVoiceOverGlobal.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Allow VoiceOver (iOS only)", "Default is true. On iOS, Text-To-Speech will by default use VoiceOver. If VoiceOver is not running, the plugin will use the system's voice as a fallback. You can disable the use of VoiceOver altogether and enforce using the system's voice here."), m_AllowVoiceOverGlobal.boolValue);
            if (!m_AllowVoiceOverGlobal.boolValue)
            {
                DrawErrorBox("Attention:\nBlind users have their voice and speech rate selected carefully to their personal taste. Only use the system voice and a default speech rate if you have a good reason to ignore their settings.\nHint:\nYou can disable VoiceOver for individual UI elements instead.");
            }

            if (GUILayout.Button("Reset Settings to Default"))
            {
                m_HandleUI.boolValue                  = true;
                m_ExploreByTouch.boolValue            = true;
                m_HandleMagicGestures.boolValue       = true;
                m_ReadDisabledInteractables.boolValue = true;
                m_CyclicMenus.boolValue               = false;
                m_AllowVoiceOverGlobal.boolValue      = true;
            }
        }


        // SOUND EFFECTS
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        showSounds = DrawSectionHeader("Sounds", showSounds);
        if (showSounds)
        {
            EditorGUILayout.PropertyField(m_UINavigationClick, new GUIContent("Navigation", "SFX when the UI element is changed"));
            EditorGUILayout.PropertyField(m_UIInteract, new GUIContent("Interact", "SFX when a button or toggle is pressed"));
            EditorGUILayout.PropertyField(m_UIFocusEnter, new GUIContent("Focus Enter", "SFX when an element receives exclusive focus, such as a slider"));
            EditorGUILayout.PropertyField(m_UIFocusLeave, new GUIContent("Focus Leave", "SFX when an element loses exclusive focus, such as a slider"));
            EditorGUILayout.PropertyField(m_UIBoundsReached, new GUIContent("Bounds Reached", "SFX when navigation reaches the end of the screen"));
            EditorGUILayout.PropertyField(m_UIPopUpOpen, new GUIContent("Popup Open", "SFX when popup opens"));
            EditorGUILayout.PropertyField(m_UIPopUpClose, new GUIContent("Popup Close", "SFX when popup closes"));
        }

        // SOUND EFFECTS
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        showNGUI = DrawSectionHeader("NGUI", showNGUI);
        if (showNGUI)
        {
            EditorGUILayout.HelpBox("UAP supports NGUI.\nNGUI has to be added to your project before enabling NGUI support.", MessageType.None);
            bool nguiDetected = UAP_WelcomeWindow.IsNGUIDetected();
            if (nguiDetected)
            {
                myLabelStyle.normal.textColor = Color.green;
                EditorGUILayout.LabelField("NGUI detected.", myLabelStyle);
            }
            else
            {
                myLabelStyle.normal.textColor = Color.red;
                EditorGUILayout.LabelField("NGUI not detected.", myLabelStyle);
            }
            myLabelStyle.normal.textColor = myHeadingStyle.normal.textColor;
            EditorGUILayout.Separator();

            bool nguiSupportEnabled = false;
#if !ACCESS_NGUI
            nguiSupportEnabled = false;
#else
            nguiSupportEnabled = true;
#endif
            EditorGUI.BeginDisabledGroup(!nguiDetected);
            bool desiredState = EditorGUILayout.ToggleLeft(new GUIContent("Enable NGUI Support", "Sets a precompiler flag that will include NGUI specific code in the plugin's compilation."), nguiSupportEnabled);
            EditorGUI.EndDisabledGroup();
            if (desiredState != nguiSupportEnabled)
            {
                if (nguiSupportEnabled)
                {
#if ACCESS_NGUI
                    Accessibility_EditorFunctions.DisableNGUISupport();
#endif
                }
                else
                {
#if !ACCESS_NGUI
                    // Make sure the user understands what he is doing
                    Accessibility_EditorFunctions.EnableNGUISupport();
#endif
                }
            }
            EditorGUILayout.Separator();
        }

        /*
         *
         #if !ACCESS_NGUI
         * // NGUI Check
         * if (!Application.isPlaying)
         * {
         *      if (UAP_WelcomeWindow.IsNGUIDetected())
         *      {
         *              // NGUI was detected in this project
         *              myHeadingStyle.normal.textColor = Color.red;
         *              EditorGUILayout.LabelField("NGUI detected but support not enabled.", myHeadingStyle);
         *              myHeadingStyle.normal.textColor = myLabelStyle.normal.textColor;
         *              EditorGUILayout.LabelField("Enable NGUI support?");
         *              if (GUILayout.Button("Enable NGUI support"))
         *              {
         *                      UAP_WelcomeWindow.EnableNGUISupport();
         *              }
         *              EditorGUILayout.Separator();
         *              EditorGUILayout.Separator();
         *      }
         * }
         #endif
         *
         */


        serializedObject.ApplyModifiedProperties();
        DrawDefaultInspectorSection();
    }
Exemplo n.º 4
0
    //////////////////////////////////////////////////////////////////////////

#if ACCESS_NGUI
    //[MenuItem("Tools/UAP Accessibility/Disable NGUI support")]
    static public void DisableNGUISupport()
    {
        UAP_WelcomeWindow.DisableNGUISupport();
    }
Exemplo n.º 5
0
 static public void OpenAboutWindow()
 {
     UAP_WelcomeWindow.Init();
 }