Пример #1
0
        void add_float_param(FloatParameter p)
        {
            HUDTextEntry entry = new HUDTextEntry()
            {
                Width          = PaddedWidth - HorzParamLabelWidth,
                Height         = RowHeight,
                TextHeight     = EntryTextHeight,
                AlignmentHorz  = HorizontalAlignment.Right,
                TextValidatorF = StringValidators.SignedRealEdit
            };

            entry.OnTextEdited += (sender, newtext) => {
                float fNewValue = float.Parse(newtext);
                p.setValue(fNewValue);
            };
            Action on_float_param_changed = () => {
                entry.Text = p.getValue().ToString();
            };

            on_float_param_changed();
            ModifiedHandlers.Add(p.name, on_float_param_changed);

            entry.Create();
            HUDElementList row = make_horz_labeled_param(p.name, entry);

            AddListItem(row);
        }
Пример #2
0
        public static HUDElementList CreateAutoSizeVerticalList(string name, float spacing, params SceneUIElement[] items)
        {
            HUDElementList items_list = new HUDElementList()
            {
                Width     = 0, Height = 0,
                Direction = HUDElementList.ListDirection.Vertical,
                SizeMode  = HUDElementList.SizeModes.AutoSizeToFit,
                Spacing   = spacing
            };

            foreach (var item in items)
            {
                items_list.AddListItem(item);
            }
            items_list.Create();
            items_list.Name = name;
            return(items_list);
        }
Пример #3
0
        HUDElementList make_horz_labeled_param(string textLabel, HUDStandardItem item)
        {
            HUDElementList container = new HUDElementList()
            {
                Direction = ListDirection.Horizontal,
                Width     = this.Width,
                Height    = this.RowHeight,
                Spacing   = this.Padding
            };
            HUDLabel label = new HUDLabel()
            {
                Shape      = new HUDShape(HUDShapeType.Rectangle, HorzParamLabelWidth, LabelTextHeight),
                TextHeight = LabelTextHeight,
                Text       = textLabel
            };

            label.Create();
            container.AddListItem(label);
            container.AddListItem(item);
            container.Create();
            return(container);
        }