public ActivityUi(UiBuilder uiBuilder)
 {
     FeedTextSource  = uiBuilder.CreateSpecificOrUpstreamValueChooser("Chatter Message", nameof(FeedTextSource), requestUpstream: true, availability: AvailabilityType.RunTime);
     ChatterSelector = new DropDownList
     {
         Name     = nameof(ChatterSelector),
         Label    = "Get which object?",
         Required = true,
         Events   = new List <ControlEvent> {
             ControlEvent.RequestConfig
         }
     };
     ChatterFilter = new QueryBuilder
     {
         Name     = nameof(ChatterFilter),
         Label    = "Meeting which conditions?",
         Required = true,
         Source   = new FieldSourceDTO
         {
             Label        = QueryFilterCrateLabel,
             ManifestType = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     QueryForChatterOption = new RadioButtonOption
     {
         Name     = nameof(QueryForChatterOption),
         Value    = "Query for chatter objects",
         Controls = new List <ControlDefinitionDTO> {
             ChatterSelector, ChatterFilter
         }
     };
     IncomingChatterIdSelector = new UpstreamFieldChooser
     {
         Name   = nameof(IncomingChatterIdSelector),
         Source = new FieldSourceDTO
         {
             AvailabilityType = AvailabilityType.RunTime,
             ManifestType     = CrateManifestTypes.StandardDesignTimeFields
         }
     };
     UseIncomingChatterIdOption = new RadioButtonOption
     {
         Name     = nameof(UseIncomingChatterIdOption),
         Value    = "Use this incoming value as chatter Id",
         Controls = new List <ControlDefinitionDTO> {
             IncomingChatterIdSelector
         }
     };
     ChatterSelectionGroup = new RadioButtonGroup
     {
         Name      = nameof(ChatterSelectionGroup),
         GroupName = nameof(ChatterSelectionGroup),
         Label     = "Which chatter to post to?",
         Radios    = new List <RadioButtonOption> {
             QueryForChatterOption, UseIncomingChatterIdOption
         }
     };
     Controls.Add(FeedTextSource);
     Controls.Add(ChatterSelectionGroup);
 }
        public override void Build(U.UiBuilder <U.Panel.UPanel> builder)
        {
            // Capacity 9 will fit all modifiers and separators and the text
            StringBuilder text = new StringBuilder(capacity: 9);

            text.Append($"<color {UConst.SHORTCUT_TEXT_HEX}>");

            if (this.shift_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Shift"));
                text.Append("+");
            }
            if (this.ctrl_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Ctrl"));
                text.Append("+");
            }
            if (this.alt_)
            {
                text.Append(Translation.Options.Get("Shortcut.Modifier:Alt"));
                text.Append("+");
            }

            text.Append(TranslationForMouseButton(this.button_));

            text.Append("</color> ");
            text.Append(this.localizedText_);

            using (UiBuilder <ULabel> labelB = builder.Label <U.Label.ULabel>(text.ToString())) {
                labelB.Control.processMarkup = true;
                labelB.ResizeFunction(
                    r => { r.Stack(mode: UStackMode.NewRowBelow); });
            }
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     SmsNumber = uiBuilder.CreateSpecificOrUpstreamValueChooser("SMS Number", "SMS_Number", addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(SmsNumber);
     SmsBody = uiBuilder.CreateSpecificOrUpstreamValueChooser("SMS Body", "SMS_Body", addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(SmsBody);
 }
Example #4
0
        public override void Build(U.UiBuilder <U.UPanel> builder)
        {
            StringBuilder text           = new StringBuilder();
            List <string> keybindStrings = this.keybindSetting_.ToLocalizedStringList();
            bool          firstShortcut  = true; // tracking | separators between multiple keybinds

            using (UiBuilder <ULabel> labelB = builder.Label <U.ULabel>(string.Empty)) {
                labelB.Control.processMarkup = true;
                labelB.ResizeFunction(
                    r => {
                    r.Stack(mode: UStackMode.NewRowBelow);
                });

                foreach (string keybindStr in keybindStrings)
                {
                    if (!firstShortcut)
                    {
                        text.Append("| ");
                    }
                    else
                    {
                        firstShortcut = false;
                    }

                    text.Append($"<color {UConst.SHORTCUT_TEXT_HEX}>{keybindStr}</color>");
                }

                text.Append(" ");
                text.Append(this.localizedText_);
                labelB.Control.text = text.ToString();
            }
        }
        public override async Task FollowUp()
        {
            //In Follow Up config, Get Fields of the user selected object(ex., Lead) and populate Text Source controls
            //to let the user to specify the values.

            //if user did not select any object, retur the activity as it is
            string chosenObject = ExtractChosenSFObject();

            if (string.IsNullOrEmpty(chosenObject))
            {
                return;
            }

            if (Storage.CratesOfType <FieldDescriptionsCM>().Any(x => x.Label.EndsWith(" - " + chosenObject)))
            {
                return;
            }

            var chosenObjectFieldsList = await _salesforce.GetProperties(chosenObject.ToEnum <SalesforceObjectType>(), AuthorizationToken, true);

            //clear any existing TextSources. This is required when user changes the object in DDLB
            ConfigurationControls.Controls.RemoveAll(ctl => ctl is TextSource);
            chosenObjectFieldsList.ToList().ForEach(selectedObjectField =>
                                                    AddControl(UiBuilder.CreateSpecificOrUpstreamValueChooser(selectedObjectField.Label, selectedObjectField.Name, string.Empty, addRequestConfigEvent: true, requestUpstream: true)));

            Storage.RemoveByLabelPrefix("Salesforce Object Fields - ");
            Storage.Add("Salesforce Object Fields - " + chosenObject, new FieldDescriptionsCM(chosenObjectFieldsList));
        }
Example #6
0
        public override Task Initialize()
        {
            //build a controls crate to render the pane
            var textBlock = UiBuilder.GenerateTextBlock("Monitor Fr8 Events",
                                                        "This Activity doesn't require any configuration.", "well well-lg");

            AddControls(textBlock);

            // var planActivatedCrate = CrateManager.CreateManifestDescriptionCrate("Available Run-Time Objects", "RouteActivated", "13", AvailabilityType.RunTime);
            // var planDeactivatedCrate = CrateManager.CreateManifestDescriptionCrate("Available Run-Time Objects", "RouteDeactivated", "13", AvailabilityType.RunTime);
            //  var containerLaunched = CrateManager.CreateManifestDescriptionCrate("Available Run-Time Objects", "ContainerLaunched", "13", AvailabilityType.RunTime);
            // var containerExecutionComplete = CrateManager.CreateManifestDescriptionCrate("Available Run-Time Objects", "ContainerExecutionComplete", "13", AvailabilityType.RunTime);
            //  var actionExecuted = CrateManager.CreateManifestDescriptionCrate("Available Run-Time Objects", "ActionExecuted", "13", AvailabilityType.RunTime);

            //  Storage.Add(planActivatedCrate);
            // Storage.Add(planDeactivatedCrate);
            //Storage.Add(containerLaunched);
            // Storage.Add(containerExecutionComplete);
            // Storage.Add(actionExecuted);

            EventSubscriptions.Manufacturer = "Fr8Core";
            EventSubscriptions.AddRange("RouteActivated", "RouteDeactivated", "ContainerLaunched", "ContainerExecutionComplete", "ActionExecuted");

            return(Task.FromResult(0));
        }
Example #7
0
        private AddButtonsResult SetupControls_ToolPanel(UiBuilder <UPanel> innerPanelB,
                                                         U.AtlasBuilder atlasBuilder)
        {
            // This is tool buttons panel
            using (UiBuilder <UPanel> leftPanelB = innerPanelB.ChildPanel <U.UPanel>(
                       setupFn: panel => {
                panel.name = "TMPE_MainMenu_ToolPanel";
            }))
            {
                leftPanelB.ResizeFunction(r => {
                    r.Stack(mode: UStackMode.Below);
                    r.FitToChildren();
                });

                // Create 1 or 2 rows of button objects
                var toolButtonsResult = AddButtonsFromButtonDefinitions(
                    builder: leftPanelB,
                    atlasBuilder: atlasBuilder,
                    buttonDefs: TOOL_BUTTON_DEFS,
                    minRowLength: 4);
                ToolButtonsList = toolButtonsResult.Buttons;

                return(toolButtonsResult);
            }
        }
Example #8
0
        private void SetupControls_ExtraPanel(UiBuilder <UPanel> innerPanelB,
                                              U.AtlasBuilder atlasBuilder,
                                              AddButtonsResult toolButtonsResult)
        {
            // This is toggle despawn and clear traffic panel
            using (UiBuilder <UPanel> rightPanelB = innerPanelB.ChildPanel <U.UPanel>(
                       setupFn: p => {
                p.name = "TMPE_MainMenu_ExtraPanel";
                // Silver background panel
                p.atlas = TextureUtil.FindAtlas("Ingame");
                p.backgroundSprite = "GenericPanel";
                // The panel will be Dark Silver at 50% dark 100% alpha
                p.color = new Color32(128, 128, 128, 255);
            }))
            {
                rightPanelB.ResizeFunction(r => {
                    // Step to the right by 4px
                    r.Stack(mode: UStackMode.ToTheRight,
                            spacing: UConst.UIPADDING);
                    r.FitToChildren();
                });

                // Place two extra buttons (despawn & clear traffic).
                // Use as many rows as in the other panel.
                var extraButtonsResult = AddButtonsFromButtonDefinitions(
                    builder: rightPanelB,
                    atlasBuilder: atlasBuilder,
                    buttonDefs: EXTRA_BUTTON_DEFS,
                    minRowLength: toolButtonsResult.Layout.Rows == 2 ? 1 : 2);
                ExtraButtonsList = extraButtonsResult.Buttons;
            }
        }
Example #9
0
        private void SetupControls_OnscreenDisplayPanel(UiBuilder <MainMenuWindow> builder)
        {
            using (var osdBuilder = builder.ChildPanel <U.UPanel>(
                       p => {
                p.name = "TMPE_MainMenu_KeybindsPanel";
                // the GenericPanel sprite is Light Silver, make it dark
                p.atlas = TextureUtil.FindAtlas("Ingame");
                p.backgroundSprite = "GenericPanel";
                p.color = new Color32(64, 64, 64, 240);
                p.opacity = GlobalConfig.Instance.Main.KeybindsPanelVisible
                                    ? 1f
                                    : 0f;
            }))
            {
                osdBuilder.SetPadding(UConst.UIPADDING);

                // The keybinds panel belongs to main menu but does not expand it to fit
                UResizerConfig.From(osdBuilder.Control).ContributeToBoundingBox = false;
                this.OnscreenDisplayPanel = osdBuilder.Control;

                // bool keybindsVisible = GlobalConfig.Instance.Main.KeybindsPanelVisible;
                // this.OnscreenDisplayPanel.gameObject.SetActive(keybindsVisible);

                osdBuilder.ResizeFunction(
                    r => {
                    r.Stack(mode: UStackMode.Below, spacing: UConst.UIPADDING * 2);

                    // As the control technically belongs inside the mainmenu, it will respect
                    // the 4px padding, we want to shift it slightly left to line up with the
                    // main menu panel.
                    r.MoveBy(new Vector2(-UConst.UIPADDING, 0f));
                    r.FitToChildren();
                });
            }
        }
        public static void Register(UiBuilder uiBuilder)
        {
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Cursor/Cursor", new CursorToolButton());

            SetSketchButtons(uiBuilder);

            //uiBuilder.AddRibbonButton("Ribbon/Modelling/Sketch/Selection", new SelectionToolsSplitButton());

            uiBuilder.AddMapping("Ribbon/Modelling/Solid", new SolidsToolsGroup());

            uiBuilder.AddRibbonButton("Ribbon/Modelling/Gizmos/GizmoNone", new GizmoTypeNoneButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Gizmos/GizmoTranslate", new GizmoTypeTranslateButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Gizmos/GizmoRotate", new GizmoTypeRotateButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Gizmos/GizmoScale", new GizmoTypeScaleButton());

            uiBuilder.AddRibbonButton("Ribbon/Modelling/Boolean/Fuse", new FuseToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Boolean/Intersect", new IntersectToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Boolean/Substract", new SubstractToolButton());

            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/Translate", new TranslateToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/Copy", new CopyToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/RotateAxis", new RotateAroundAxisButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/CircularPattern", new CircularPatternButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/ArrayPattern", new ArrayPatternButton());
            //uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/Measure", new MeasureDistanceToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/Offset2D", new Offset2DToolButton());
            uiBuilder.AddRibbonButton("Ribbon/Modelling/Tools/Mirror", new MirrorToolsSplitButton());
        }
        private static void SetSketchButtons(UiBuilder uiBuilder)
        {
            var sketchButton = new SketchButton();

            uiBuilder.AddMapping("Ribbon/Modelling/Sketch/Sketch", sketchButton);

            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Point", new PointToolButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/RectangleTools",
                              new RectangleToolsSplitButton());

            /*uiBuilder.AddRibbonButton("Ribbon/Modelling/Sketch/RectangleThreePoints", new Rectangle2ToolButton());
            *  uiBuilder.AddRibbonButton("Ribbon/Modelling/Sketch/RectangleThreePoints", new Rectangle2ToolButton());*/
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Line", new LineToolsSplitButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Spline", new SplineToolsSplitButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Circle", new CircleToolsSplitButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Arc", new ArcToolsSplitButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Dimension", new DimensionToolButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Trim", new TrimToolButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/Fillet", new ChamferFillet2DToolsSplitButton());
            //    SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Sketch/BlockPlane", new BlockPlaneButton());

            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Extrude", new ExtrudeToolButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Cut", new CutToolButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Pipe", new PipeToolButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Revolve", new RevolveToolButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Fillet", new ChamferFilletToolsSplitButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/Sew", new SewToolButton());
            FeatureButtonSetup(uiBuilder, sketchButton, "Ribbon/Modelling/Features/AngleDraft", new AngleDraftToolButton());


            //SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Constraints/Sketch/SketchConstraintMapper",
            //                  new SketchConstraintToolButton());
            SketchButtonSetup(uiBuilder, sketchButton, "Ribbon/Constraints/Sketch/SketchConstraintPoint",
                              new SketchConstraintPointsButton());
        }
        public ItemSearchWindow(ItemSearchPlugin plugin, string searchText = "")
        {
            this.pluginInterface = plugin.PluginInterface;
            this.data            = pluginInterface.Data;
            this.builder         = pluginInterface.UiBuilder;
            this.pluginConfig    = plugin.PluginConfig;
            this.plugin          = plugin;

            while (!data.IsDataReady)
            {
                Thread.Sleep(1);
            }

            SearchFilters = new List <SearchFilter> {
                new ItemNameSearchFilter(pluginConfig, searchText),
                new ItemUICategorySearchFilter(pluginConfig, data),
                new LevelEquipSearchFilter(pluginConfig),
                new LevelItemSearchFilter(pluginConfig),
                new EquipAsSearchFilter(pluginConfig, data),
                new RaceSexSearchFilter(pluginConfig, data),
                new DyeableSearchFilter(pluginConfig),
                new StatSearchFilter(pluginConfig, data),
            };

            ActionButtons = new List <IActionButton> {
                new MarketBoardActionButton(pluginInterface, pluginConfig),
                new DataSiteActionButton(pluginConfig)
            };
        }
Example #13
0
        /// <summary>
        /// On Screen Display feature:
        /// Clear, and hide the keybind panel.
        /// Populate with items, which can be keyboard shortcuts or hardcoded mouse clicks.
        /// </summary>
        /// <param name="items">List of <see cref="OsdItem"/> to display.</param>
        public static void Display(List <OsdItem> items)
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            Hide();

            // Deactivate old items, and destroy them. Also remove them from the panel till Unity
            // is happy to delete them.
            foreach (Transform c in mainMenu.OnscreenDisplayPanel.transform)
            {
                c.gameObject.SetActive(false);
                UnityEngine.Object.Destroy(c.gameObject);
            }

            // mainMenu.KeybindsPanel.transform.DetachChildren();

            // Populate the panel with the items
            using (var builder = new UiBuilder <U.UPanel>(mainMenu.OnscreenDisplayPanel)) {
                foreach (var item in items)
                {
                    item.Build(builder);
                }
            }

            if (items.Count > 0 &&
                mainMenu.OnscreenDisplayPanel.GetUIView() != null)
            {
                mainMenu.OnscreenDisplayPanel.opacity = 1f; // fully visible, opaque
            }

            // Recalculate now
            UResizer.UpdateControl(mainMenu);
        }
        public override void OnRegister()
        {
            base.OnRegister();
            _builder = new UiBuilderFake(ActionsGraph);

            AddNotificationHandler(NotificationNames.GetValue, OnGetValue);
        }
Example #15
0
        /// <summary>
        /// On Screen Display feature: Add a click info to the panel.
        /// </summary>
        /// <param name="localizedText">Text from Translation.Get() or English if doesn't exist.</param>
        public static void Click(bool shift, bool ctrl, bool alt, string localizedText)
        {
            MainMenuWindow mainMenu = ModUI.Instance.MainMenu;

            mainMenu.KeybindsPanel.isVisible = true;

            var builder = new UiBuilder <U.Panel.UPanel>(mainMenu.KeybindsPanel);

            using (var modifierLabel = builder.ModifierLabel(shift, ctrl, alt)) {
                modifierLabel.ResizeFunction(r => { r.Stack(UStackMode.NewRowBelow); });
            }

            using (var plusLabel = builder.Label <U.Label.ULabel>("+ ")) {
                plusLabel.ResizeFunction(r => { r.Stack(UStackMode.ToTheRight); });
            }

            string clickText = Translation.Options.Get("Shortcut:Click");

            using (var clickLabel = builder.Label <U.Label.ULabel>(clickText)) {
                clickLabel.Control.backgroundSprite = "GenericPanelDark";
                clickLabel.Control.textColor        = UConst.SHORTCUT_KEYBIND_TEXT;
                clickLabel.ResizeFunction(r => { r.Stack(UStackMode.ToTheRight); });
            }

            using (var descriptionLabel = builder.Label <U.Label.ULabel>(localizedText)) {
                descriptionLabel.ResizeFunction(
                    r => {
                    r.Stack(
                        mode: UStackMode.ToTheRight,
                        spacing: UConst.UIPADDING * 2f);     // double space
                });
            }
        }
            public ActivityUi(UiBuilder builder)
            {
                UpstreamCrateChooser = new CrateChooser
                {
                    Label  = "Select a File",
                    Name   = "file_selector",
                    Events = new List <ControlEvent>
                    {
                        ControlEvent.RequestConfig
                    },
                    Required             = true,
                    AllowedManifestTypes = new[] { MT.StandardFileHandle.GetEnumDisplayName() },
                    SingleManifestOnly   = true,
                    RequestUpstream      = true
                };

                Controls.Add(UpstreamCrateChooser);

                FileNameTextBox = new TextBox
                {
                    Label = "Name of file",
                    Name  = "File_Name"
                };
                Controls.Add(FileNameTextBox);
            }
 public override void Build(U.UiBuilder <U.Panel.UPanel> builder)
 {
     using (UiBuilder <ULabel> labelB = builder.Label <U.Label.ULabel>(string.Empty)) {
         labelB.ResizeFunction(r => { r.Stack(mode: UStackMode.NewRowBelow); });
         labelB.Control.text    = this.localizedText_;
         labelB.Control.opacity = 0.8f;
     }
 }
        private void BuildPluginUi()
        {
            var ribbonView = RibbonView.ribbonControl;

            _builder =
                _mainGraph.InputContainer[InputNames.UiBuilderInput].GetData(NotificationNames.GetValue).Get <UiBuilder>();
            _builder.Factory.RegisterPath("Ribbon", new RibbonConcretePathFactory(ribbonView));
        }
Example #19
0
        private UILabel SetupControls_TopRow(UiBuilder <MainMenuWindow> builder,
                                             U.AtlasBuilder atlasBuilder)
        {
            UILabel versionLabel;

            using (var versionLabelB = builder.Label <U.ULabel>(TrafficManagerMod.ModName)) {
                versionLabelB.ResizeFunction(r => r.Stack(UStackMode.Below));
                this.VersionLabel = versionLabel = versionLabelB.Control;
            }

            using (var btnBuilder = builder.Button <U.UButton>()) {
                UButton control = btnBuilder.Control;
                this.toggleOsdButton_ = control;
                control.atlas         = this.allButtonsAtlas_;
                control.name          = "TMPE_MainMenu_HelpButton";

                // Texture for Help will be included in the `allButtonsAtlas_`
                ButtonSkin skin = new ButtonSkin {
                    BackgroundPrefix  = "RoundButton",
                    Prefix            = "Help",
                    BackgroundHovered = true,
                    BackgroundActive  = true,
                    ForegroundActive  = true,
                };
                skin.UpdateAtlasBuilder(
                    atlasBuilder,
                    spriteSize: new IntVector2(50));

                control.Skin = skin;
                control.UpdateButtonImage();

                // This has to be done later when form setup is done:
                // helpB.Control.atlas = allButtonsAtlas_;

                btnBuilder.ResizeFunction(
                    resizeFn: r => {
                    r.Control.isVisible = true;     // not sure why its hidden on create? TODO
                    r.Stack(mode: UStackMode.ToTheRight,
                            spacing: UConst.UIPADDING * 3f,
                            stackRef: versionLabel);
                    r.Width(UValue.FixedSize(18f));     // assume Version label is 18pt high
                    r.Height(UValue.FixedSize(18f));
                });

                control.uCanActivate = c => true;
                control.uTooltip     = Translation.Menu.Get("Tooltip:Toggle onscreen display panel");

                control.uIsActive =
                    c => GlobalConfig.Instance.Main.KeybindsPanelVisible;

                control.uOnClick += (component, eventParam) => {
                    ModUI.Instance.MainMenu.OnToggleOsdButtonClicked(component as U.UButton);
                };
            }

            return(versionLabel);
        }
Example #20
0
        /// <summary>Create buttons and add them to the given panel UIBuilder.</summary>
        /// <param name="builder">UI builder to use.</param>
        /// <param name="atlasKeysSet">Atlas keys to update for button images.</param>
        /// <param name="buttonDefs">Button defs collection to create from it.</param>
        /// <param name="minRowLength">Longest the row can be without breaking.</param>
        /// <returns>A list of created buttons.</returns>
        private AddButtonsResult AddButtonsFromButtonDefinitions(UiBuilder <UPanel> builder,
                                                                 U.AtlasBuilder atlasBuilder,
                                                                 MenuButtonDef[] buttonDefs,
                                                                 int minRowLength)
        {
            AddButtonsResult result;

            result.Buttons = new List <BaseMenuButton>();

            // Count the button objects and set their layout
            result.Layout = new MainMenuLayout();
            result.Layout.CountEnabledButtons(buttonDefs);
            int placedInARow = 0;

            foreach (MenuButtonDef buttonDef in buttonDefs)
            {
                if (!buttonDef.IsEnabledFunc())
                {
                    // Skip buttons which are not enabled
                    continue;
                }

                // Create and populate the panel with buttons
                var buttonBuilder = builder.Button <BaseMenuButton>(buttonDef.ButtonType);

                // Count buttons in a row and break the line
                bool doRowBreak = result.Layout.IsRowBreak(placedInARow, minRowLength);

                buttonBuilder.ResizeFunction(r => {
                    r.Stack(doRowBreak ? UStackMode.NewRowBelow : UStackMode.ToTheRight);
                    r.Width(UValue.FixedSize(40f));
                    r.Height(UValue.FixedSize(40f));
                });

                if (doRowBreak)
                {
                    placedInARow = 0;
                    result.Layout.Rows++;
                }
                else
                {
                    placedInARow++;
                }

                // Also ask each button what sprites they need
                buttonBuilder.Control.SetupButtonSkin(atlasBuilder);

                string buttonName = buttonDef.ButtonType.ToString().Split('.').Last();
                buttonBuilder.Control.name = $"TMPE_MainMenuButton_{buttonName}";

                ButtonsDict.Add(buttonDef.Mode, buttonBuilder.Control);
                result.Buttons.Add(buttonBuilder.Control);
            }

            return(result);
        }
Example #21
0
        private void CreateControls()
        {
            var crateChooser = UiBuilder.CreateCrateChooser("TableChooser", "Select Upstream Data", true, true);
            //this cell's list items will be filled on followup configuration
            var cellDdTemplate = new DropDownList()
            {
                Label            = "Find the cell labelled",
                Name             = "cellChooser",
                Required         = true,
                HasRefreshButton = true,
                Source           = new FieldSourceDTO()
                {
                    RequestUpstream = false,
                    ManifestType    = CrateManifestTypes.StandardDesignTimeFields,
                    Label           = AvailableCellsCrateLabel
                },
                Events = new List <ControlEvent> {
                    ControlEvent.RequestConfig
                }
            };

            var extractValueFromDdTemplate = new DropDownList()
            {
                Label     = "and extract the value",
                Name      = "extractValueFrom",
                Required  = true,
                ListItems = new List <ListItem>
                {
                    new ListItem {
                        Key = ImmediatelyToRightKey, Value = ImmediatelyToRightValue
                    },
                    new ListItem {
                        Key = ImmediatelyBelowKey, Value = ImmediatelyBelowValue
                    }
                },
                Events = new List <ControlEvent> {
                    ControlEvent.RequestConfig
                }
            };

            var controlList = new ControlList(new ListTemplate()
            {
                Name = "ddlb_pair", Template = { cellDdTemplate, extractValueFromDdTemplate }
            })
            {
                AddControlGroupButtonText = "Add Cell Extractor",
                Name          = "extractor_list",
                Label         = "Select fields to extract",
                NoDataMessage = "No field is selected",
                Events        = new List <ControlEvent> {
                    ControlEvent.RequestConfig
                }
            };

            AddControls(crateChooser, controlList);
        }
        /// <summary>
        /// Callback for the event fired when an arrow is added to the game Board.
        /// </summary>
        /// <param name="player">Player who owns the added Arrow</param>
        /// <param name="arrow">Arrow added to the Board</param>
        /// <param name="eventArgs">Event args (unused)</param>
        private void Arrow_AddedToBoardCallback(Player player, Arrow arrow, EventArgs eventArgs)
        {
            // CreateOrUpdateArrowImage will return null if it updated an existing arrow image
            Image newArrowImage = this.uiBuilder.CreateOrUpdateArrowImage(player, arrow);

            if (newArrowImage != null)
            {
                UiBuilder.AddItemToGrid(this.DynamicArrowPanel, newArrowImage);
            }
        }
Example #23
0
 private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(ViewModel.SelectedBlob))
     {
         if (ViewModel.Account.Definition is BlobApplicationAccount baa)
         {
             UiBuilder.BuildMenu(BlobContextMenu, _blobContextMenuItemCount, baa, ViewModel.Storage, ViewModel.SelectedBlob);
         }
     }
 }
Example #24
0
        /// <summary>
        /// Create EmailBody RadioButtonGroup
        /// </summary>
        /// <returns></returns>
        private ControlDefinitionDTO CreateEmailBodyTextSourceControl()
        {
            var control = UiBuilder.CreateSpecificOrUpstreamValueChooser(
                "Email Body",
                "EmailBody",
                addRequestConfigEvent: true,
                requestUpstream: true
                );

            return(control);
        }
Example #25
0
        private void CreateControls()
        {
            var crateChooser = UiBuilder.CreateCrateChooser(
                "Available_Crates",
                "This Loop will process the data inside of",
                true,
                true
                );

            AddControls(crateChooser);
        }
Example #26
0
        private UILabel SetupControls_TopRow(UiBuilder <MainMenuWindow> builder,
                                             HashSet <string> atlasKeySet)
        {
            UILabel versionLabel;

            using (var versionLabelB = builder.Label <U.Label.ULabel>(TrafficManagerMod.ModName)) {
                versionLabelB.ResizeFunction(r => r.Stack(UStackMode.Below));
                this.VersionLabel = versionLabel = versionLabelB.Control;
            }

            using (var helpB = builder.Button <U.Button.UButton>()) {
                this.helpButton_    = helpB.Control;
                helpB.Control.atlas = this.allButtonsAtlas_;
                helpB.Control.name  = "TMPE_MainMenu_HelpButton";

                // Texture for Help will be included in the `allButtonsAtlas_`
                ButtonSkin skin = new ButtonSkin {
                    BackgroundPrefix  = "RoundButton",
                    Prefix            = "Help",
                    BackgroundHovered = true,
                    BackgroundActive  = true,
                    ForegroundActive  = true,
                };
                atlasKeySet.AddRange(skin.CreateAtlasKeyset());

                helpB.Control.Skin = skin;
                helpB.Control.UpdateButtonImage();

                // This has to be done later when form setup is done:
                // helpB.Control.atlas = allButtonsAtlas_;

                helpB.ResizeFunction(
                    resizeFn: r => {
                    r.Control.isVisible = true;     // not sure why its hidden on create? TODO
                    r.Stack(mode: UStackMode.ToTheRight,
                            spacing: UConst.UIPADDING * 3f,
                            stackRef: versionLabel);
                    r.Width(UValue.FixedSize(18f));     // assume Version label is 18pt high
                    r.Height(UValue.FixedSize(18f));
                });

                helpB.Control.uCanActivate = c => true;

                helpB.Control.uIsActive =
                    c => GlobalConfig.Instance.Main.KeybindsPanelVisible;

                helpB.Control.uOnClick += (component, eventParam) => {
                    ModUI.Instance.MainMenu.OnHelpButtonClicked(component as U.Button.UButton);
                };
            }

            return(versionLabel);
        }
 public ActivityUi(UiBuilder uiBuilder)
 {
     ChannelSelector = new DropDownList {
         Label  = "Select Slack Channel",
         Events = new List <ControlEvent> {
             ControlEvent.RequestConfig
         }
     };
     MessageSource = uiBuilder.CreateSpecificOrUpstreamValueChooser("Message", nameof(MessageSource), addRequestConfigEvent: true, requestUpstream: true, availability: AvailabilityType.RunTime);
     Controls.Add(ChannelSelector);
     Controls.Add(MessageSource);
 }
Example #28
0
        /// <summary>
        /// Set up the interface and populate all fields needed.
        /// </summary>
        /// <param name="dalamud"></param>
        public DalamudPluginInterface(Dalamud dalamud, string pluginName, PluginConfigurations configs)
        {
            this.CommandManager      = dalamud.CommandManager;
            this.Framework           = dalamud.Framework;
            this.ClientState         = dalamud.ClientState;
            this.UiBuilder           = new UiBuilder(dalamud.InterfaceManager, pluginName);
            this.TargetModuleScanner = dalamud.SigScanner;
            this.Data = dalamud.Data;

            this.dalamud    = dalamud;
            this.pluginName = pluginName;
            this.configs    = configs;
        }
 /// <summary>
 /// Callback for the event fired when a wall is added to the game Board.
 /// </summary>
 /// <param name="cellCol">Column for one of the cells the wall borders</param>
 /// <param name="cellRow">Row for one of the cells the wall borders</param>
 /// <param name="wallPosition">Position the wall is relative to the given cell</param>
 /// <param name="eventArgs">Event args (unused)</param>
 private void Wall_AddedToBoardCallback(int cellCol, int cellRow, WallPositionFlags wallPosition, EventArgs eventArgs)
 {
     if (wallPosition == WallPositionFlags.Left || wallPosition == WallPositionFlags.Right)
     {
         UiBuilder.AddItemToGrid(this.DynamicVertWallPanel,
                                 this.uiBuilder.CreateVerticalWallImage(cellCol, cellRow, wallPosition));
     }
     else if (wallPosition == WallPositionFlags.Up || wallPosition == WallPositionFlags.Down)
     {
         UiBuilder.AddItemToGrid(this.DynamicHorizWallPanel,
                                 this.uiBuilder.CreateHorizontalWallImage(cellCol, cellRow, wallPosition));
     }
 }
Example #30
0
            public ActivityUi(UiBuilder uiBuilder)
            {
                MessageSource = uiBuilder.CreateSpecificOrUpstreamValueChooser(
                    "Message",
                    nameof(MessageSource),
                    requestUpstream: true,
                    availability: AvailabilityType.RunTime);

                Controls.Add(PhoneNumber = new TextBox {
                    Label = "Phone Number"
                });
                Controls.Add(MessageSource);
            }