コード例 #1
0
ファイル: InputAxis.cs プロジェクト: shanemcdermott/curvature
        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);
        }
コード例 #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;
        }
コード例 #3
0
ファイル: InputAxis.cs プロジェクト: shanemcdermott/curvature
        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);
        }
コード例 #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;
            }
        }
コード例 #5
0
 public InputParameterValue(InputParameter controller, float value)
 {
     ControllingParameter = controller;
     Value = value;
 }