예제 #1
0
 protected override string GetControlDescriptionForLabel(AccessibilitySettings aSettings)
 {
     if (aSettings is ToggleAccessibilitySettings)
     {
         ToggleAccessibilitySettings toggleAccessibilitySettings = aSettings as ToggleAccessibilitySettings;
         Toggle componentInChildren = toggleAccessibilitySettings.gameObject.GetComponentInChildren <Toggle>(includeInactive: false);
         if (toggleAccessibilitySettings != null)
         {
             string @string;
             if (toggleAccessibilitySettings.ReferenceToggleGroup != null)
             {
                 string labelFromReferenceToken = GetLabelFromReferenceToken(toggleAccessibilitySettings.ToggleGroupName.gameObject);
                 @string = localization.GetString("GlobalUI.Navigation.radio_button");
                 if (!string.IsNullOrEmpty(labelFromReferenceToken) && !string.IsNullOrEmpty(@string))
                 {
                     return(labelFromReferenceToken + " " + @string);
                 }
                 return("");
             }
             @string = localization.GetString("GlobalUI.Navigation.toggle");
             string text = "";
             if (componentInChildren != null)
             {
                 text = (componentInChildren.isOn ? ((!(toggleAccessibilitySettings.OnText != null)) ? localization.GetString("GlobalUI.Navigation.enabled") : GetLabelFromReferenceToken(toggleAccessibilitySettings.OnText.gameObject)) : ((!(toggleAccessibilitySettings.OffText != null)) ? localization.GetString("GlobalUI.Navigation.disabled") : GetLabelFromReferenceToken(toggleAccessibilitySettings.OffText.gameObject)));
             }
             if (!string.IsNullOrEmpty(@string) && !string.IsNullOrEmpty(text))
             {
                 return(@string + " " + text);
             }
             return("");
         }
         return("");
     }
     return("");
 }
예제 #2
0
        protected override string GetControlDescriptionForLabel(AccessibilitySettings aSettings)
        {
            string @string = localization.GetString("GlobalUI.Navigation.button");

            if (!string.IsNullOrEmpty(@string))
            {
                return(@string);
            }
            return("");
        }
예제 #3
0
 protected void CheckCustomOnClickHandler(int aId)
 {
     if (items != null && items.ContainsKey(aId) && items[aId] != null)
     {
         AccessibilitySettings component = GetGameobject(items[aId]).GetComponent <AccessibilitySettings>();
         if (component != null && component.CustomOnClickEvent != null)
         {
             component.CustomOnClickEvent.Invoke();
         }
     }
 }
예제 #4
0
        protected virtual void Update(T aItem)
        {
            AccessibilitySettings component = GetGameobject(aItem).GetComponent <AccessibilitySettings>();
            Rect rectInPhysicalScreenSpace  = Util.GetRectInPhysicalScreenSpace((component.ReferenceRect != null) ? component.ReferenceRect : GetGameobject(aItem).GetComponent <RectTransform>());

            if (rectInPhysicalScreenSpace.width <= 0f || rectInPhysicalScreenSpace.height <= 0f)
            {
                items.Remove(GetGameobject(aItem).GetInstanceID());
            }
            else
            {
                MonoSingleton <NativeAccessibilityManager> .Instance.Native.UpdateView(GetGameobject(aItem).GetInstanceID(), rectInPhysicalScreenSpace, GetTokenText(component));
            }
        }
예제 #5
0
        protected override string GetControlDescriptionForLabel(AccessibilitySettings aSettings)
        {
            string @string             = localization.GetString("GlobalUI.Navigation.slider");
            string text                = "";
            Slider componentInChildren = aSettings.gameObject.GetComponentInChildren <Slider>(includeInactive: false);

            if (componentInChildren != null)
            {
                text = ((int)(componentInChildren.normalizedValue * 100f)).ToString();
            }
            if (!string.IsNullOrEmpty(@string) && !string.IsNullOrEmpty(text))
            {
                return(@string + " " + text + " " + localization.GetString("GlobalUI.Navigation.percent"));
            }
            return("");
        }
예제 #6
0
        public string GetTokenText(AccessibilitySettings aSettings)
        {
            string text = "";

            if (aSettings == null)
            {
                return(text);
            }
            if (!string.IsNullOrEmpty(aSettings.DynamicText))
            {
                return(aSettings.DynamicText);
            }
            if (!string.IsNullOrEmpty(aSettings.CustomToken))
            {
                text = localization.GetString(aSettings.CustomToken);
            }
            if (aSettings.ReferenceToken != null)
            {
                text = GetLabelFromReferenceToken(aSettings.ReferenceToken);
            }
            if (aSettings.AdditionalReferenceTokens != null && aSettings.AdditionalReferenceTokens.Length > 0)
            {
                string[] array = new string[aSettings.AdditionalReferenceTokens.Length];
                for (int i = 0; i < aSettings.AdditionalReferenceTokens.Length; i++)
                {
                    array[i] = GetLabelFromReferenceToken(aSettings.AdditionalReferenceTokens[i]);
                }
                text = text + " " + string.Join(" ", array);
            }
            if (aSettings is ScrollerAccessibilitySettings)
            {
                string scrollPercent = (aSettings as ScrollerAccessibilitySettings).GetScrollPercent();
                if (!string.IsNullOrEmpty(scrollPercent))
                {
                    text = text + ", " + scrollPercent;
                }
            }
            string text2 = "";

            text2 = GetControlDescriptionForLabel(aSettings);
            if (!string.IsNullOrEmpty(text2))
            {
                text = text + " " + text2;
            }
            return(Regex.Replace(text, "<.*?>", string.Empty));
        }
예제 #7
0
        protected virtual bool Add(T aItem, int aId, bool isVoiceOnly)
        {
            AccessibilitySettings component  = GetGameobject(aItem).GetComponent <AccessibilitySettings>();
            Rect   rectInPhysicalScreenSpace = Util.GetRectInPhysicalScreenSpace((component.ReferenceRect != null) ? component.ReferenceRect : GetGameobject(aItem).GetComponent <RectTransform>());
            string tokenText = GetTokenText(component);

            if (rectInPhysicalScreenSpace.width <= 0f || rectInPhysicalScreenSpace.height <= 0f)
            {
                return(false);
            }
            if (isVoiceOnly)
            {
                MonoSingleton <NativeAccessibilityManager> .Instance.Native.RenderText(aId, rectInPhysicalScreenSpace, tokenText);
            }
            else
            {
                MonoSingleton <NativeAccessibilityManager> .Instance.Native.RenderButton(aId, rectInPhysicalScreenSpace, tokenText);
            }
            return(true);
        }
예제 #8
0
        public void Parse(GameObject[] gameObjects)
        {
            List <int> list = new List <int>();

            foreach (GameObject gameObject in gameObjects)
            {
                if (!gameObject.activeSelf)
                {
                    continue;
                }
                T[] componentsInChildren = gameObject.GetComponentsInChildren <T>(includeInactive: false);
                T[] array = componentsInChildren;
                foreach (T val in array)
                {
                    Object @object = val as Object;
                    if (@object == null)
                    {
                        continue;
                    }
                    AccessibilitySettings component = GetGameobject(val).GetComponent <AccessibilitySettings>();
                    if (!(component != null) || component.IgnoreText || (val is Image && (GetGameobject(val).GetComponent <Button>() != null || GetGameobject(val).GetComponent <InputFieldEx>() != null)) || (component.VoiceOnly && MonoSingleton <NativeAccessibilityManager> .Instance.AccessibilityLevel != NativeAccessibilityLevel.VOICE) || component.DontRender)
                    {
                        continue;
                    }
                    if (GetGameobject(val).transform.parent.gameObject.activeSelf&& component.VisibleOnlyForSwitchControl)
                    {
                        GetGameobject(val).SetActive(value: true);
                    }
                    if (!GetGameobject(val).activeSelf)
                    {
                        continue;
                    }
                    int instanceID = GetGameobject(val).GetInstanceID();
                    if (MonoSingleton <NativeAccessibilityManager> .Instance.HiddenScrollItemIds.IndexOf(component) <= -1)
                    {
                        list.Add(instanceID);
                        if (items.ContainsKey(instanceID))
                        {
                            Update(val);
                        }
                        else if (Add(val, instanceID, component.VoiceOnly))
                        {
                            items.Add(instanceID, val);
                        }
                    }
                }
            }
            Dictionary <int, T> dictionary = new Dictionary <int, T>();

            foreach (KeyValuePair <int, T> item in items)
            {
                if (item.Value != null && list.Contains(item.Key))
                {
                    dictionary.Add(item.Key, item.Value);
                }
                else
                {
                    Remove(item.Key);
                }
            }
            items = dictionary;
        }
예제 #9
0
 protected virtual string GetControlDescriptionForLabel(AccessibilitySettings aSettings)
 {
     return("");
 }