Esempio n. 1
0
        partial void Callback_OnMaxClicked()
        {
            ColorDistribution distribution = Value;

            if (DistributionType == PropertyDistributionType.RandomRange)
            {
                ColorPicker.Show(distribution.GetMaxConstant(), (success, value) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    Value = new ColorDistribution(distribution.GetMinConstant(), value);
                    OnChanged?.Invoke();
                });
            }
            else if (DistributionType == PropertyDistributionType.RandomCurveRange)
            {
                GradientPicker.Show(distribution.GetMaxGradient(), (success, colorGradient) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    Value = new ColorDistribution(distribution.GetMinGradient(), colorGradient);
                    OnChanged?.Invoke();
                });
            }
        }
        /// <summary>
        /// Callback triggered when the user clicks on the GUI element.
        /// </summary>
        partial void OnClicked()
        {
            GradientPicker.Show(Gradient, (success, colorGradient) =>
            {
                if (!success)
                    return;

                Gradient = colorGradient;
            });

        }
Esempio n. 3
0
        /// <summary>
        /// Callback triggered when the user clicks on the GUI element.
        /// </summary>
        partial void Callback_OnClicked()
        {
            GradientPicker.Show(Gradient, (success, colorGradient) =>
            {
                if (!success)
                {
                    return;
                }

                Gradient = colorGradient;
            });
        }
Esempio n. 4
0
        /// <summary>
        /// Callback triggered when the user clicks on the GUI element.
        /// </summary>
        partial void OnClicked()
        {
            GradientPicker.Show(Value, (success, colorGradient) =>
            {
                if (!success)
                {
                    return;
                }

                Value = colorGradient;
                OnChanged?.Invoke(colorGradient);
            });
        }
        partial void OnMinClicked()
        {
            ColorDistribution distribution = Value;

            if (DistributionType == PropertyDistributionType.Constant ||
                DistributionType == PropertyDistributionType.RandomRange)
            {
                ColorPicker.Show(distribution.GetMinConstant(), (success, value) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    if (DistributionType == PropertyDistributionType.Constant)
                    {
                        Value = new ColorDistribution(value);
                    }
                    else
                    {
                        Value = new ColorDistribution(value, distribution.GetMaxConstant());
                    }

                    OnChanged?.Invoke();
                });
            }
            else if (DistributionType == PropertyDistributionType.Curve ||
                     DistributionType == PropertyDistributionType.RandomCurveRange)
            {
                GradientPicker.Show(distribution.GetMinGradient(), (success, colorGradient) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    if (DistributionType == PropertyDistributionType.Curve)
                    {
                        Value = new ColorDistribution(colorGradient);
                    }
                    else
                    {
                        Value = new ColorDistribution(colorGradient, distribution.GetMaxGradient());
                    }

                    OnChanged?.Invoke();
                });
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Callback triggered when the user clicks on the GUI element.
        /// </summary>
        partial void Callback_OnClicked()
        {
            // Note: Should allow HDR color gradient
            ColorGradient gradient = new ColorGradient(Gradient.GetKeys());

            GradientPicker.Show(gradient, (success, colorGradient) =>
            {
                if (!success)
                {
                    return;
                }

                Gradient = new ColorGradientHDR(colorGradient.GetKeys());
            });
        }
        /// <summary>
        /// Shows the gradient picker window and sets the initial gradient to show.
        /// </summary>
        /// <param name="gradient">Gradient to initially display in the window.</param>
        /// <param name="closedCallback">Optional callback to trigger when the user finishes editing the gradient or
        ///                              cancels out of the dialog.</param>
        /// <returns>A. instance of the gradient picker window.</returns>
        public static GradientPicker Show(ColorGradient gradient, Action <bool, ColorGradient> closedCallback = null)
        {
            GradientPicker picker = new GradientPicker(gradient, closedCallback);

            return(picker);
        }