/// <summary> /// Constructs a new limit from the provided properties. /// </summary> /// <param name="limitData">Linear range specific properties.</param> /// <param name="commonData">Properties common to all limit types.</param> public LimitLinearRange(LimitLinearRangeData limitData, LimitCommonData commonData) : base(commonData) { this.data = limitData; }
/// <summary> /// Constructs a new set of GUI elements for inspecting the limit object. /// </summary> /// <param name="limit">Initial values to assign to the GUI elements.</param> /// <param name="layout">Layout to append the GUI elements to.</param> /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state. /// </param> public LimitLinearRangeGUI(LimitLinearRange limit, GUILayout layout, SerializableProperties properties) { this.limitData = limit.Data; limitLowerField.OnChanged += x => { limitData.lower = x; MarkAsModified(); }; limitLowerField.OnFocusLost += ConfirmModify; limitUpperField.OnChanged += x => { limitData.upper = x; MarkAsModified(); }; limitUpperField.OnFocusLost += ConfirmModify; layout.AddElement(limitLowerField); layout.AddElement(limitUpperField); limitCommonGUI = new LimitCommonGUI("linearRange", limit.CommonData, layout, properties); limitCommonGUI.OnChanged += x => MarkAsModified(); limitCommonGUI.OnConfirmed += ConfirmModify; }