コード例 #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 void add_text_entry_field(Cockpit cockpit)
        {
            float fUseRadius = HUDRadius * 0.85f;
            float fAngle     = -35.0f;

            entryField            = new HUDTextEntry();
            entryField.Text       = GetDefaultFileName();
            entryField.Width      = 1.0f;
            entryField.Height     = 0.08f;
            entryField.TextHeight = 0.06f;
            entryField.Create();
            entryField.Name = "selectFileName";
            HUDUtil.PlaceInSphere(entryField, fUseRadius, 0.0f, fAngle);
            cockpit.AddUIElement(entryField, true);

            tooltipText                 = new HUDLabel();
            tooltipText.Shape           = new HUDShape(HUDShapeType.Rectangle, 1.0f, 0.04f);
            tooltipText.Text            = Tooltip;
            tooltipText.TextHeight      = 0.03f;
            tooltipText.BackgroundColor = Colorf.TransparentBlack;
            tooltipText.TextColor       = Colorf.Silver;
            tooltipText.Create();
            tooltipText.Name = "tooltip";
            HUDUtil.PlaceInSphere(tooltipText, fUseRadius, 0.0f, fAngle);
            UnityUtil.TranslateInFrame(tooltipText.RootGameObject, 0.0f, -entryField.Height, 0, CoordSpace.WorldCoords);
            cockpit.AddUIElement(tooltipText, true);


            HUDButton saveButton = HUDBuilder.CreateRectIconClickButton(
                0.2f, 0.1f, fUseRadius, 0.0f, fAngle,
                "icons/save_v1");

            UnityUtil.TranslateInFrame(saveButton.RootGameObject, 0.2f, -0.1f, 0, CoordSpace.WorldCoords);
            saveButton.Name = "save";
            cockpit.AddUIElement(saveButton, true);
            saveButton.OnClicked += (s, e) => { SaveFromEntryText(); };

            HUDButton cancelButton = HUDBuilder.CreateRectIconClickButton(
                0.2f, 0.1f, fUseRadius, 0.0f, fAngle,
                "icons/cancel_v1");

            UnityUtil.TranslateInFrame(cancelButton.RootGameObject, 0.4f, -0.1f, 0, CoordSpace.WorldCoords);
            cancelButton.Name = "cancel";
            cockpit.AddUIElement(cancelButton, true);
            cancelButton.OnClicked += (s, e) => {
                cockpit.Context.PopCockpit(true);
            };
        }
コード例 #3
0
 public HUDTextEntryTarget(HUDTextEntry entry)
 {
     Entry = entry;
 }
コード例 #4
0
 public FileBrowserTextFieldKeyHandler(FContext c, HUDTextEntry entry)
 {
     controller = c;
     entryField = entry;
 }