示例#1
0
        // todo, make a UIRangedDataValue subclass?, make this generic?

        public UIRange(UIRangedDataValue <T> data)
        {
            this.data = data;
            this.Height.Set(20f, 0f);
            this._GetProportion = data.GetProportion;
            this._SetProportion = data.SetProportion;

            label        = new UIText(data.label, 0.85f);
            label.HAlign = 0;
            label.VAlign = 0.5f;
            Append(label);

            slider = new UISlider(null, _GetProportion, _SetProportion, null, 0, Color.AliceBlue);
            slider.Height.Set(16, 0f);
            slider.Width.Set(0, .4f);
            slider.Left.Set(0, .4f);
            slider.VAlign = 0.5f;
            Append(slider);

            input = new NewUITextBox("input:", 0.85f);
            input.SetPadding(0);
            input.OnUnfocus += () => data.ParseValue(input.Text);
            input.Width.Set(0, .16f);
            input.HAlign = 1f;
            input.VAlign = 0.5f;
            Append(input);

            data.OnValueChanged += Data_OnValueChanged;
            data.SetValue(data.Data);
        }
示例#2
0
        public UI2DRange(UIRangedDataValue <T> dataX, UIRangedDataValue <T> dataY)
        {
            this.dataX = dataX;
            this.dataY = dataY;

            this.Height.Set(20f, 0f);
            this.Width.Set(20f, 0f);
        }