UI Parameter for .fx float
Inheritance: UIbaseParam
示例#1
0
        public static UIFloatParam FromString(string _inputs, string _value)
        {
            //Inputs => display name, minvalue, maxvalue
            //ex. "Factor", 0.0, 10.0
            var inputs = _inputs.Split(',');
            if (inputs.Length != 3)
                return null;

            string name = inputs[0].Replace("\"", "");

            float min, max;
            if (!float.TryParse(inputs[1], NumberStyles.Float, CultureInfo.InvariantCulture, out min))
                return null;

            if (!float.TryParse(inputs[2], NumberStyles.Float, CultureInfo.InvariantCulture, out max))
                return null;

            //Value 
            //ex. 0.0
            float value;
            if (!float.TryParse(_value, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
                return null;

            //Create instance
            if (min < max)
            {
                var param = new UIFloatParam(min, max);
                param.Name = name;
                param.Value = value;
                return param;
            }

            return null;
        }
        private void Control_ValueChanging(object sender, System.EventArgs e)
        {
            SlideCtrl    s = sender as SlideCtrl;
            UIFloatParam p = s.Tag as UIFloatParam;

            p.Value = s.Pos;
        }
示例#3
0
        void Parse_FloatParam(string _inputs, string _value)
        {
            //Inputs => display name, minvalue, maxvalue
            //ex. "Factor", 0.0, 10.0
            UIFloatParam p = UIFloatParam.FromString(_inputs, _value);

            if (p != null)
            {
                m_game.Parameters.Add(p);
            }
        }
示例#4
0
        public static UIFloatParam FromString(string _inputs, string _value)
        {
            //Inputs => display name, minvalue, maxvalue
            //ex. "Factor", 0.0, 10.0
            var inputs = _inputs.Split(',');

            if (inputs.Length != 3)
            {
                return(null);
            }

            string name = inputs[0].Replace("\"", "");

            float min, max;

            if (!float.TryParse(inputs[1], NumberStyles.Float, CultureInfo.InvariantCulture, out min))
            {
                return(null);
            }

            if (!float.TryParse(inputs[2], NumberStyles.Float, CultureInfo.InvariantCulture, out max))
            {
                return(null);
            }

            //Value
            //ex. 0.0
            float value;

            if (!float.TryParse(_value, NumberStyles.Float, CultureInfo.InvariantCulture, out value))
            {
                return(null);
            }

            //Create instance
            if (min < max)
            {
                var param = new UIFloatParam(min, max);
                param.Name  = name;
                param.Value = value;
                return(param);
            }

            return(null);
        }