Ejemplo n.º 1
0
        private void DoRangeInspector()
        {
            Debug.Assert(m_CurrentAngleRange != null);

            var start = m_CurrentAngleRange.start;
            var end   = m_CurrentAngleRange.end;
            var order = m_CurrentAngleRange.order;

            DrawHeader(new GUIContent(string.Format(Contents.angleRangeLabel.text, (end - start))));

            EditorGUIUtility.labelWidth = 0f;
            EditorGUI.BeginChangeCheck();

            RangeField(ref start, ref end, ref order);

            if (EditorGUI.EndChangeCheck())
            {
                RegisterUndo("Set Range");

                m_CurrentAngleRange.order = order;
                controller.SetRange(m_CurrentAngleRange, start, end);

                if (start >= end)
                {
                    controller.RemoveInvalidRanges();
                }
            }

            EditorGUILayout.Space();

            if (m_AngleRangeSpriteList != null)
            {
                m_AngleRangeSpriteList.DoLayoutList();
            }
        }
Ejemplo n.º 2
0
        private void DoRangeInspector()
        {
            var start = 0f;
            var end   = 0f;
            var order = 0;

            if (m_CurrentAngleRange != null)
            {
                start = m_CurrentAngleRange.start;
                end   = m_CurrentAngleRange.end;
                order = m_CurrentAngleRange.order;
            }

            using (new EditorGUI.DisabledGroupScope(m_CurrentAngleRange == null))
            {
                DrawHeader(new GUIContent(string.Format(Contents.angleRangeLabel.text, (end - start))));

                EditorGUIUtility.labelWidth = 0f;
                EditorGUI.BeginChangeCheck();

                RangeField(ref start, ref end, ref order);

                if (EditorGUI.EndChangeCheck() && m_CurrentAngleRange != null)
                {
                    RegisterUndo("Set Range");

                    m_CurrentAngleRange.order = order;
                    controller.SetRange(m_CurrentAngleRange, start, end);

                    if (start >= end)
                    {
                        controller.RemoveInvalidRanges();
                    }
                }

                EditorGUILayout.Space();

                var arSize = m_AngleRangesProp.arraySize;

                if (m_AngleRangeSpriteList != null && arSize > 0)
                {
                    m_AngleRangeSpriteList.DoLayoutList();
                }
                else
                {
                    m_EmptySpriteList.DoLayoutList();
                }
            }
        }