コード例 #1
0
 void SetPivotLerpBoundsPosition(TargetWrapper.Component comp, float sliderClampedValue)
 {
     foreach (var t in m_Targets)
     {
         t.SetPivot(comp, t.LerpBoundsPosition(comp, sliderClampedValue), API.Space.Global);
     }
 }
コード例 #2
0
        void GUISliderBounds(TargetWrapper.Component comp, string label, Color color, float value, bool mixedValue)
        {
            using (new EditorGUILayout.HorizontalScope())
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.LabelField(label, GUILayout.Width(15f));
                EditorGUI.showMixedValue = mixedValue;
                var prevColor = GUI.color;
                GUI.color = color;
                value     = EditorGUILayout.Slider(value, 0f, 1f);
                GUI.color = prevColor;
                EditorGUI.showMixedValue = false;

                var buttonStyle = new GUIStyle(EditorStyles.miniButton);
                buttonStyle.fixedWidth = 20f;
                buttonStyle.alignment  = TextAnchor.MiddleCenter;
                if (GUILayout.Button("<", buttonStyle))
                {
                    value = 0.0f;
                }
                if (GUILayout.Button("|", buttonStyle))
                {
                    value = 0.5f;
                }
                if (GUILayout.Button(">", buttonStyle))
                {
                    value = 1.0f;
                }

                if (EditorGUI.EndChangeCheck())
                {
                    SetPivotLerpBoundsPosition(comp, value);
                }
            }
        }