Ejemplo n.º 1
0
 public void OnUpdatingParameter(IvyParameter ivyParameter, float multiplier)
 {
     updatingParameter       = ivyParameter;
     updatingValue           = true;
     updatingValueMultiplier = multiplier;
     originalUpdatingValue   = ivyParameter.value;
     mouseStartPoint         = GUIUtility.GUIToScreenPoint(Event.current.mousePosition).x;
 }
Ejemplo n.º 2
0
        public static void CustomIntFloatField(IvyParameter ivyParameter, float multiplier, string labelText,
                                               float width, float YSpace, float XSpace, GUISkin windowSkin, Action <IvyParameter, float> onDropDown)
        {
            Rect rect = new Rect(XSpace, YSpace, width, 20f);

            GUI.Label(new Rect(rect.x - 30f, rect.y, rect.width + 60f, rect.height), labelText, windowSkin.GetStyle("intfloatfieldlabel"));
            if (EditorGUI.DropdownButton(rect, GUIContent.none, FocusType.Keyboard, windowSkin.GetStyle("transparent")))
            {
                if (onDropDown != null)
                {
                    onDropDown(ivyParameter, multiplier);
                }
            }
            if (rect.Contains(Event.current.mousePosition))
            {
                EditorGUIUtility.AddCursorRect(new Rect(Event.current.mousePosition, Vector2.one * 20f), MouseCursor.SlideArrow);
            }
            float value = EditorGUI.FloatField(new Rect(rect.x, rect.y + 20f, rect.width, 25f), "", ivyParameter.value, windowSkin.GetStyle("textfield"));

            multiplier         = Mathf.Ceil(1f / multiplier);
            value              = Mathf.Floor(value * multiplier) / multiplier;
            ivyParameter.value = value;
        }