Ejemplo n.º 1
0
        public InputAxis Union(InputAxis other)
        {
            if (other == null)
            {
                return(this);
            }

            if (other.Parameters.Count == 0)
            {
                return(this);
            }

            if (other.Parameters.Count == 1)
            {
                var ret = new InputAxis(ReadableName, Origin);
                ret.KBRecord     = KBRecord;
                ret.ReadableName = ReadableName;

                float newmin = Math.Min(Parameters[0].MinimumValue, other.Parameters[0].MinimumValue);
                float newmax = Math.Max(Parameters[0].MaximumValue, other.Parameters[0].MaximumValue);

                var param = new InputParameter(Parameters[0].ReadableName, newmin, newmax);
                ret.Parameters.Add(param);

                return(ret);
            }

            return(null);
        }
Ejemplo n.º 2
0
        internal EditWidgetParameter(InputParameter param)
        {
            InitializeComponent();
            EditParameter = param;

            ParameterNameLabel.Text = EditParameter.ReadableName;

            MinimumValue.Minimum = (decimal)EditParameter.MinimumValue;
            MaximumValue.Maximum = (decimal)EditParameter.MaximumValue;

            MinimumValue.Value = (decimal)EditParameter.MinimumValue;
            MaximumValue.Value = (decimal)EditParameter.MaximumValue;
        }
Ejemplo n.º 3
0
        public InputAxis Clamp(List <InputParameterValue> parameters)
        {
            if (parameters == null)
            {
                return(this);
            }

            if (parameters.Count == 0)
            {
                return(this);
            }

            if (parameters.Count == 1)
            {
                var ret = new InputAxis(ReadableName, Origin);
                ret.KBRecord     = KBRecord;
                ret.ReadableName = ReadableName;

                float newmin = Math.Max(Parameters[0].MinimumValue, parameters[0].Value);
                float newmax = Math.Min(Parameters[0].MaximumValue, parameters[0].Value);

                var param = new InputParameter(Parameters[0].ReadableName, newmin, newmax);
                ret.Parameters.Add(param);

                return(ret);
            }

            if (parameters.Count == 2)
            {
                var ret = new InputAxis(ReadableName, Origin);
                ret.KBRecord     = KBRecord;
                ret.ReadableName = ReadableName;

                float newmin = Math.Max(Parameters[0].MinimumValue, parameters[0].Value);
                float newmax = Math.Min(Parameters[1].MaximumValue, parameters[1].Value);

                var param = new InputParameter(Parameters[0].ReadableName, newmin, newmax);
                ret.Parameters.Add(param);

                return(ret);
            }

            return(this);
        }
Ejemplo n.º 4
0
        internal EditWidgetParameter(InputParameter param, Project project)
        {
            InitializeComponent();

            EditingProject   = project;
            EditingParameter = param;

            ParameterNameLabel.Text = EditingParameter.ReadableName;

            if (EditingParameter is InputParameterNumeric)
            {
                var p = EditingParameter as InputParameterNumeric;

                MinimumValue.Minimum = (decimal)p.MinimumValue;
                MaximumValue.Maximum = (decimal)p.MaximumValue;

                MinimumValue.Value = (decimal)p.MinimumValue;
                MaximumValue.Value = (decimal)p.MaximumValue;

                NumericPanel.Visible     = true;
                EnumerationPanel.Visible = false;
            }
            else if (EditingParameter is InputParameterEnumeration)
            {
                var p = EditingParameter as InputParameterEnumeration;

                if (p.ScoreOnMatch)
                {
                    EnumerationDropDown.SelectedIndex = 0;
                }
                else
                {
                    EnumerationDropDown.SelectedIndex = 1;
                }

                NumericPanel.Visible     = false;
                EnumerationPanel.Visible = true;
            }
        }
Ejemplo n.º 5
0
 public InputParameterValue(InputParameter controller, float value)
 {
     ControllingParameter = controller;
     Value = value;
 }