static int FindSelectableOnRight(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 1);
        Scrollbar  obj = (Scrollbar)LuaScriptMgr.GetUnityObjectSelf(L, 1, "Scrollbar");
        Selectable o   = obj.FindSelectableOnRight();

        LuaScriptMgr.Push(L, o);
        return(1);
    }
Exemple #2
0
    public static int FindSelectableOnRight(IntPtr l)
    {
        int result;

        try
        {
            Scrollbar  scrollbar = (Scrollbar)LuaObject.checkSelf(l);
            Selectable o         = scrollbar.FindSelectableOnRight();
            LuaObject.pushValue(l, true);
            LuaObject.pushValue(l, o);
            result = 2;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemple #3
0
        /// <summary>
        /// <para>See: Editor.OnInspectorGUI.</para>
        /// </summary>
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();
            base.serializedObject.Update();
            EditorGUI.BeginChangeCheck();
            RectTransform transform = EditorGUILayout.ObjectField("Handle Rect", this.m_HandleRect.objectReferenceValue, typeof(RectTransform), true, new GUILayoutOption[0]) as RectTransform;

            if (EditorGUI.EndChangeCheck())
            {
                List <UnityEngine.Object> list = new List <UnityEngine.Object> {
                    transform
                };
                foreach (UnityEngine.Object obj2 in this.m_HandleRect.serializedObject.targetObjects)
                {
                    MonoBehaviour item = obj2 as MonoBehaviour;
                    if (item != null)
                    {
                        list.Add(item);
                        list.Add(item.GetComponent <RectTransform>());
                    }
                }
                Undo.RecordObjects(list.ToArray(), "Change Handle Rect");
                this.m_HandleRect.objectReferenceValue = transform;
            }
            if (this.m_HandleRect.objectReferenceValue != null)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_Direction, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    Scrollbar.Direction enumValueIndex = (Scrollbar.Direction) this.m_Direction.enumValueIndex;
                    foreach (UnityEngine.Object obj3 in base.serializedObject.targetObjects)
                    {
                        (obj3 as Scrollbar).SetDirection(enumValueIndex, true);
                    }
                }
                EditorGUILayout.PropertyField(this.m_Value, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_Size, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_NumberOfSteps, new GUILayoutOption[0]);
                bool flag = false;
                foreach (UnityEngine.Object obj4 in base.serializedObject.targetObjects)
                {
                    Scrollbar scrollbar2 = obj4 as Scrollbar;
                    switch (scrollbar2.direction)
                    {
                    case Scrollbar.Direction.LeftToRight:
                    case Scrollbar.Direction.RightToLeft:
                        flag = (scrollbar2.navigation.mode != Navigation.Mode.Automatic) && ((scrollbar2.FindSelectableOnLeft() != null) || (scrollbar2.FindSelectableOnRight() != null));
                        break;

                    default:
                        flag = (scrollbar2.navigation.mode != Navigation.Mode.Automatic) && ((scrollbar2.FindSelectableOnDown() != null) || (scrollbar2.FindSelectableOnUp() != null));
                        break;
                    }
                }
                if (flag)
                {
                    EditorGUILayout.HelpBox("The selected scrollbar direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning);
                }
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(this.m_OnValueChanged, new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.HelpBox("Specify a RectTransform for the scrollbar handle. It must have a parent RectTransform that the handle can slide within.", MessageType.Info);
            }
            base.serializedObject.ApplyModifiedProperties();
        }
Exemple #4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();

            serializedObject.Update();

            // EditorGUILayout.PropertyField(m_HandleRect);
            EditorGUI.BeginChangeCheck();
            RectTransform newRectTransform = EditorGUILayout.ObjectField("Handle Rect", m_HandleRect.objectReferenceValue, typeof(RectTransform), true) as RectTransform;

            if (EditorGUI.EndChangeCheck())
            {
                // Handle Rect will modify its GameObject RectTransform drivenBy, so we need to Record the old and new RectTransform.
                List <Object> modifiedObjects = new List <Object>();
                modifiedObjects.Add(newRectTransform);
                foreach (var target in m_HandleRect.serializedObject.targetObjects)
                {
                    MonoBehaviour mb = target as MonoBehaviour;
                    if (mb == null)
                    {
                        continue;
                    }

                    modifiedObjects.Add(mb);
                    modifiedObjects.Add(mb.GetComponent <RectTransform>());
                }
                Undo.RecordObjects(modifiedObjects.ToArray(), "Change Handle Rect");
                m_HandleRect.objectReferenceValue = newRectTransform;
            }

            if (m_HandleRect.objectReferenceValue != null)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(m_Direction);
                if (EditorGUI.EndChangeCheck())
                {
                    Scrollbar.Direction direction = (Scrollbar.Direction)m_Direction.enumValueIndex;
                    foreach (var obj in serializedObject.targetObjects)
                    {
                        Scrollbar scrollbar = obj as Scrollbar;
                        scrollbar.SetDirection(direction, true);
                    }
                }

                EditorGUILayout.PropertyField(m_Value);
                EditorGUILayout.PropertyField(m_Size);
                EditorGUILayout.PropertyField(m_NumberOfSteps);

                bool warning = false;
                foreach (var obj in serializedObject.targetObjects)
                {
                    Scrollbar           scrollbar = obj as Scrollbar;
                    Scrollbar.Direction dir       = scrollbar.direction;
                    if (dir == Scrollbar.Direction.LeftToRight || dir == Scrollbar.Direction.RightToLeft)
                    {
                        warning = (scrollbar.navigation.mode != Navigation.Mode.Automatic && (scrollbar.FindSelectableOnLeft() != null || scrollbar.FindSelectableOnRight() != null));
                    }
                    else
                    {
                        warning = (scrollbar.navigation.mode != Navigation.Mode.Automatic && (scrollbar.FindSelectableOnDown() != null || scrollbar.FindSelectableOnUp() != null));
                    }
                }

                if (warning)
                {
                    EditorGUILayout.HelpBox("The selected scrollbar direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning);
                }

                EditorGUILayout.Space();
                // Draw the event notification options
                EditorGUILayout.PropertyField(m_OnValueChanged);
            }
            else
            {
                EditorGUILayout.HelpBox("Specify a RectTransform for the scrollbar handle. It must have a parent RectTransform that the handle can slide within.", MessageType.Info);
            }

            serializedObject.ApplyModifiedProperties();
        }
Exemple #5
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            EditorGUILayout.Space();
            base.serializedObject.Update();
            EditorGUI.BeginChangeCheck();
            RectTransform rectTransform = EditorGUILayout.ObjectField("Handle Rect", this.m_HandleRect.objectReferenceValue, typeof(RectTransform), true, new GUILayoutOption[0]) as RectTransform;

            if (EditorGUI.EndChangeCheck())
            {
                List <UnityEngine.Object> list = new List <UnityEngine.Object>();
                list.Add(rectTransform);
                UnityEngine.Object[] targetObjects = this.m_HandleRect.serializedObject.targetObjects;
                for (int i = 0; i < targetObjects.Length; i++)
                {
                    UnityEngine.Object @object       = targetObjects[i];
                    MonoBehaviour      monoBehaviour = @object as MonoBehaviour;
                    if (!(monoBehaviour == null))
                    {
                        list.Add(monoBehaviour);
                        list.Add(monoBehaviour.GetComponent <RectTransform>());
                    }
                }
                Undo.RecordObjects(list.ToArray(), "Change Handle Rect");
                this.m_HandleRect.objectReferenceValue = rectTransform;
            }
            if (this.m_HandleRect.objectReferenceValue != null)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(this.m_Direction, new GUILayoutOption[0]);
                if (EditorGUI.EndChangeCheck())
                {
                    Scrollbar.Direction  enumValueIndex = (Scrollbar.Direction) this.m_Direction.enumValueIndex;
                    UnityEngine.Object[] targetObjects2 = base.serializedObject.targetObjects;
                    for (int j = 0; j < targetObjects2.Length; j++)
                    {
                        UnityEngine.Object object2   = targetObjects2[j];
                        Scrollbar          scrollbar = object2 as Scrollbar;
                        scrollbar.SetDirection(enumValueIndex, true);
                    }
                }
                EditorGUILayout.PropertyField(this.m_Value, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_Size, new GUILayoutOption[0]);
                EditorGUILayout.PropertyField(this.m_NumberOfSteps, new GUILayoutOption[0]);
                bool flag = false;
                UnityEngine.Object[] targetObjects3 = base.serializedObject.targetObjects;
                for (int k = 0; k < targetObjects3.Length; k++)
                {
                    UnityEngine.Object  object3    = targetObjects3[k];
                    Scrollbar           scrollbar2 = object3 as Scrollbar;
                    Scrollbar.Direction direction  = scrollbar2.direction;
                    if (direction == Scrollbar.Direction.LeftToRight || direction == Scrollbar.Direction.RightToLeft)
                    {
                        flag = (scrollbar2.navigation.mode != Navigation.Mode.Automatic && (scrollbar2.FindSelectableOnLeft() != null || scrollbar2.FindSelectableOnRight() != null));
                    }
                    else
                    {
                        flag = (scrollbar2.navigation.mode != Navigation.Mode.Automatic && (scrollbar2.FindSelectableOnDown() != null || scrollbar2.FindSelectableOnUp() != null));
                    }
                }
                if (flag)
                {
                    EditorGUILayout.HelpBox("The selected scrollbar direction conflicts with navigation. Not all navigation options may work.", MessageType.Warning);
                }
                EditorGUILayout.Space();
                EditorGUILayout.PropertyField(this.m_OnValueChanged, new GUILayoutOption[0]);
            }
            else
            {
                EditorGUILayout.HelpBox("Specify a RectTransform for the scrollbar handle. It must have a parent RectTransform that the handle can slide within.", MessageType.Info);
            }
            base.serializedObject.ApplyModifiedProperties();
        }