private SelectBox GetSelectBox(
            FilterHtmlGenerator.Filter filterData,
            Store storeFilter,
            bool isRangeControlId,
            bool isAdditionalFieldSet,
            bool isHideParentFieldSet)
        {
            var selectBox = new SelectBox(StandartConfigSelectBoxFilter())
            {
                ID           = RegistrationControlToRepository(UniquePrefixes.SelectBoxFilterOperations, filterData, isAdditionalFieldSet, isHideParentFieldSet),
                ClientIDMode = ClientIDMode.Static,
            };

            if (filterData.Type == FilterHtmlGenerator.FilterType.Boolean)
            {
                selectBox.Triggers.Add(new FieldTrigger()
                {
                    Icon = TriggerIcon.Clear,
                    Qtip = Resources.SRemoveSelected
                });
                selectBox.Listeners.TriggerClick.Handler = @"
                            this.clearValue();";
            }
            selectBox.Store.Add(storeFilter);
            SetListenersSelectBox(filterData, isRangeControlId, selectBox);
            return(selectBox);
        }
Example #2
0
    protected virtual void MultiSelect()
    {
        player.userInput.Deselect();
        SelectBox.Disable();
        Vector3 groundClickedPosition = WorldTouchPoint(Camera.main.ScreenToWorldPoint(clickedPosition));
        Vector3 groundMousePosition   = WorldTouchPoint(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        float   distance = Mathf.Abs(groundMousePosition.x - groundClickedPosition.x);
        float   xMin     = Mathf.Min(groundMousePosition.x, groundClickedPosition.x);
        float   zMin     = Mathf.Min(groundMousePosition.z, groundClickedPosition.z);
        float   zMax     = Mathf.Max(groundMousePosition.z, groundClickedPosition.z);
        List <MobileWorldObject> mobileWoList = new List <MobileWorldObject> ();

        RaycastHit[] hits = Physics.CapsuleCastAll(new Vector3(xMin, 0f, zMin), new Vector3(xMin, 0f, zMax), 0.1f, Vector3.right, distance, LayerMask.GetMask(new string[] { player.species.ToString() }));
        foreach (RaycastHit hit in hits)
        {
            MobileWorldObject mobileWO = hit.collider.gameObject.GetComponent <MobileWorldObject> ();
            if (mobileWO && mobileWO as SentryMob == null)
            {
                mobileWoList.Add(mobileWO);
            }
        }
        foreach (MobileWorldObject mobileWO in mobileWoList)
        {
            mobileWO.SelectTap(player);
            player.userInput.SelectedObjects.Add(mobileWO as WorldObject);
        }
        if (mobileWoList.Count == 1)
        {
            player.userInput.OpenPanel(mobileWoList[0].buttons);
        }
    }
Example #3
0
        void TrySelectMultipleUnits(SelectBox selectBox)
        {
            if (!_selectableTeam)
            {
                return;
            }

            foreach (var unit in RBTUnit.ActiveUnitsPerTeam[_selectableTeam])
            {
                if (!unit.Alive)
                {
                    continue;
                }

                var  pointOnScreen = Camera.main.WorldToScreenPoint(unit.Bounds.Center);
                bool selected      = selectBox.IsWithinBox(pointOnScreen);
                foreach (var point in unit.Bounds.Corners)
                {
                    if (selected)
                    {
                        _selectedUnits.Add(unit);
                        break;
                    }
                    pointOnScreen = Camera.main.WorldToScreenPoint(point);
                    selected      = selectBox.IsWithinBox(pointOnScreen);
                }
                unit.Selected = selected;
            }
        }
Example #4
0
        public object Render(QueryBuilder <T> builder)
        {
            var txtOperator = new SelectBox(_operators)
            {
                Width          = "10em",
                SelectedOption = _operator
            };

            txtOperator.SelectionChanged += (_, __) =>
            {
                _operator = (string)txtOperator.SelectedOption;
            };

            var txtValue = new TextBox()
            {
                Width = "10em",
                Text  = _value.ToString()
            };

            txtValue.TextInput += (_, __) =>
            {
                try
                {
                    _value = (TNumeric)Convert.ChangeType(txtValue.Text, typeof(TNumeric));
                }
                catch (Exception)
                {
                    //ignore
                }
            };

            return(Layout.Horizontal(txtOperator, txtValue));
        }
Example #5
0
        public object Render(QueryBuilder <T> builder)
        {
            var txtOperator = new SelectBox(operators)
            {
                Width          = "10em",
                SelectedOption = _operator
            };

            txtOperator.SelectionChanged += (_, __) =>
            {
                _operator = (string)txtOperator.SelectedOption;
            };

            var txtValue = new TextBox()
            {
                Width = "10em",
                Text  = _value
            };

            txtValue.TextInput += (_, __) =>
            {
                _value = txtValue.Text;
            };

            return(Layout.Horizontal(txtOperator, txtValue));
        }
        void MakeBlendDropdown(Table table, Skin skin, string label, string propertyName)
        {
            FieldInfo fieldInfo = typeof(ParticleEmitterConfig).GetField(propertyName);
            Blend     value     = (Blend)fieldInfo.GetValue(_particleEmitterConfig);

            var dropdown     = new SelectBox <string>(skin);
            var dropdownList = new List <string>()
            {
                "Zero",
                "One",
                "SourceColor",
                "InverseSourceColor",
                "SourceAlpha",
                "InverseSourceAlpha",
                "DestinationAlpha",
                "InverseDestinationAlpha",
                "DestinationColor",
                "InverseDestinationColor",
                "SourceAlphaSaturation"
            };

            dropdown.SetItems(dropdownList);

            // Make a lookup table from string to blend function
            var nameLookup = new Dictionary <string, Blend>()
            {
                { "Zero", Blend.Zero },
                { "One", Blend.One },
                { "SourceColor", Blend.SourceColor },
                { "InverseSourceColor", Blend.InverseSourceColor },
                { "SourceAlpha", Blend.SourceAlpha },
                { "InverseSourceAlpha", Blend.InverseSourceAlpha },
                { "DestinationAlpha", Blend.DestinationAlpha },
                { "InverseDestinationAlpha", Blend.InverseDestinationAlpha },
                { "DestinationColor", Blend.DestinationColor },
                { "InverseDestinationColor", Blend.InverseDestinationColor },
                { "SourceAlphaSaturation", Blend.SourceAlphaSaturation }
            };

            // Make a lookup table from blend function to string
            var functionLookup = new Dictionary <Blend, string>();

            foreach (var str in nameLookup.Keys)
            {
                functionLookup.Add(nameLookup[str], str);
            }

            ;

            dropdown.SetSelectedIndex(dropdownList.IndexOf(functionLookup[value]));
            dropdown.OnChanged += (str) =>
            {
                Blend newValue = nameLookup[str];
                fieldInfo.SetValue(_particleEmitterConfig, newValue);
                ResetEmitter();
            };

            table.Add(dropdown);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control != null && e.OldElement == null && Element != null && e.NewElement is SelectBox)
            {
                _control = (SelectBox)e.NewElement;
            }
        }
Example #8
0
        /// <summary>
        /// 设置Style样式
        /// </summary>
        /// <returns></returns>
        protected override string SetControlStyle()
        {
            SelectBox control      = this.ControlHost.Content as SelectBox;
            string    baseStyle    = base.SetControlStyle();
            string    backColor    = control.BackColor.R.ToString() + "," + control.BackColor.G.ToString() + "," + control.BackColor.B.ToString() + "," + control.BackColor.A.ToString();
            string    currentStyle = string.Format("background-color:rgba({0});", backColor);

            return(baseStyle + currentStyle);
        }
        public CourseEditPage(Session session) : base(session)
        {
            var inputs = FindElements(By.XPath("//form/div"));

            Number     = inputs[0].FindElement(By.TagName("div")).Text;
            Title      = new TextField <CourseEditPage>(this, inputs[1].FindElement(By.TagName("input")));
            Credits    = new ValidatedTextField <CourseEditPage>(this, inputs[2]);
            Department = new SelectBox <CourseEditPage>(this, inputs[3].FindElement(By.TagName("select")));
        }
        public DepartmentCreatePage(Session session) : base(session)
        {
            var inputs = FindElements(By.XPath("//form//div"));

            Name       = new TextField <DepartmentCreatePage>(this, inputs[0].FindElement(By.TagName("input")));
            Budget     = new ValidatedTextField <DepartmentCreatePage>(this, inputs[1]);
            StartDate  = new ValidatedDateField <DepartmentCreatePage>(this, inputs[2]);
            Instructor = new SelectBox <DepartmentCreatePage>(this, inputs[3].FindElement(By.TagName("select")));
        }
        public CourseCreatePage(Session session) : base(session)
        {
            var xpath = By.XPath("//form//div");

            Number     = new ValidatedTextField <CoursesPage>(this, By.Ordinal(xpath, 0));
            Title      = new TextField <CoursesPage>(this, By.Ordinal(xpath, 1));
            Credits    = new ValidatedTextField <CoursesPage>(this, By.Ordinal(xpath, 2));
            Department = new SelectBox <CoursesPage>(this, By.Function(ctx => ctx.FindElement(By.Ordinal(xpath, 3)).FindElement(By.TagName("select"))));
        }
 private void SetListenersSelectBox(
     FilterHtmlGenerator.Filter filterData,
     bool isRangeControlId,
     SelectBox selectBox)
 {
     if (isRangeControlId)
     {
         selectBox.Listeners.Change.Handler = FilterJs.JsCallToggleVisibleSecondRangeControl;
     }
 }
Example #13
0
        public object Render(QueryBuilder <T> builder)
        {
            var lstOptions = new SelectBox(SelectBoxKind.DropDown, _options, 0,
                                           (lst) => { _value = (string)lst.SelectedOption; })
            {
                Width = "20em", SelectedOption = _value
            };

            return(Layout.Horizontal(lstOptions));
        }
Example #14
0
        public PauseForm(Engine.Engine engine, SaveManager manager, Integration.IMouse mouse, Engine.IDrawer drawer, IGameScene scene) : base(new Color(204, 153, 51), 150, null, mouse, drawer)
        {
            var list = new Box[] { new Box("Resume", Resume), new Box("Save", Save) };

            selectBox = new SelectBox(new Vector2(0, 20), list, drawer, mouse);
            controls.Add(selectBox);
            this.engine  = engine;
            this.manager = manager;
            SaveForm     = new SaveWorldForm(manager, this, mouse, drawer, scene);
        }
Example #15
0
        public MainMenu(IMouse mouse, Engine.IDrawer drawer, IGameScene scene, StartUp init) : base(new Color(0, 100, 100), 300, null, mouse, drawer)
        {
            var options = new Box[] { new Box("Start", SwichToNewWorldForm), new Box("Load World", SwichToLoadWorldForm) };

            controls.Add(new Label(new Vector2(0, 80), "PixCraft", 200, drawer, mouse));
            controls.Add(new Label(new Vector2(90, -90), "V.2.0", 20, drawer, mouse));
            optionsWindow = new SelectBox(new Vector2(0, 0), options, drawer, mouse);
            controls.Add(optionsWindow);
            LoadWorldform = new LoadWorldForm(this, mouse, drawer, scene, init);
            NewWorldForm  = new NewWorldForm(this, init, mouse, drawer, scene);
        }
Example #16
0
        /// <summary>
        /// 设置Class样式
        /// </summary>
        protected override string SetControlClass()
        {
            string    baseClass = base.SetControlClass();
            string    isEnable  = "";
            SelectBox control   = this.ControlHost.Content as SelectBox;

            if (!control.IsEnable)
            {
                isEnable = "disabled ";
            }
            return(isEnable + baseClass);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <Picker> e)
        {
            base.OnElementChanged(e);

            if (Control != null && e.OldElement == null && Element != null && e.NewElement is SelectBox)
            {
                _control = (SelectBox)e.NewElement;

                Control.SetBackground(Context.GetDrawable(Resource.Drawable.EntryBorder));
                Control.SetPadding(10, 10, 10, 10);
                Control.TextSize = Convert.ToSingle(Device.GetNamedSize(NamedSize.Medium, _control));
            }
        }
        private FieldContainer GetFieldContainer(
            FilterHtmlGenerator.Filter filterData,
            SelectBox selectBox)
        {
            var fieldContainer = new FieldContainer(StandartConfigFilterFieldContainer(filterData))
            {
                ID           = RegistrationControlToRepository(UniquePrefixes.FieldContainerCommon, filterData),
                ClientIDMode = ClientIDMode.Static,
            };

            fieldContainer.Items.Add(selectBox);
            return(fieldContainer);
        }
Example #19
0
        public void OnEnter()
        {
            List <Select> selects = new List <Select>()
            {
                new Select(new Vector2(500, 50), "Items", new Action(itemMenu)),
                new Select(new Vector2(500, 125), "Equipment", new Action(equipMenu)), new Select(new Vector2(500, 200), "Stats", new Action(statsMenu)),
                new Select(new Vector2(500, 275), "Options", new Action(configMenu)), new Select(new Vector2(500, 350), "Exit", new Action(exitMenu))
            };

            MenuOptions = new SelectBox(selects);
            menuHandler = new InputHandler();
            menuHandler.RegisterKey(Keys.Up, MenuOptions.PrevOption);
            menuHandler.RegisterKey(Keys.Down, MenuOptions.NextOption);
            menuHandler.RegisterKey(Keys.Enter, MenuOptions.Confirm);
        }
Example #20
0
        public NewWorldForm(Form previousForm, StartUp init, IMouse mouse, IDrawer drawer, IGameScene scene) : base(new Color(200, 100, 0), 300, previousForm, mouse, drawer)
        {
            IList <Box> PreBoxs = new Box[]
            {
                new Box("0", StaticExtensions.configureAsTextBox(true, scene)),
                new Box("0", StaticExtensions.configureAsTextBox(true, scene)),
                new Box("Generate", GenerateWorld)
            };

            controls.Add(new Label(new Vector2(-30, 20), "size", 20, drawer, mouse));
            controls.Add(new Label(new Vector2(-30, -10), "seed", 20, drawer, mouse));
            parameters = new SelectBox(new Vector2(0, 20), PreBoxs, drawer, mouse);
            controls.Add(parameters);
            this.init = init;
        }
Example #21
0
        private void Button5_Click(object sender, EventArgs e)
        {
            SelectBox box = new SelectBox();

            box.AllowMultiSelection = false;
            box.Items       = new string[] { "选项1", "选项2", "选项3", "选项4", "选项5", "选项6" };
            box.CheckFormat = (list) =>
            {
                if (list.Count > 0)
                {
                    return(true);
                }
                return(false);
            };
            box.ShowDialog();
        }
Example #22
0
        void OnPostRender()
        {
            if (!Input.GetMouseButton(0) || _hasSelectedSingle)
            {
                return;
            }

            var selectBox = new SelectBox(_selectBoxStartCorner, Input.mousePosition);

            if (_material)
            {
                selectBox.Draw(_material);
            }

            TrySelectMultipleUnits(selectBox);
        }
Example #23
0
        public void OnEnter()
        {
            //TODO, Select should have an Action in initializer
            MenuInput = new InputHandler();
            List <Select> select = new List <Select>();
            var           main   = new Select(new Vector2(325, 125), "Start Game", new Action(GotoMainRoom));
            var           load   = new Select(new Vector2(325, 200), "Load Game", new Action(Load));
            var           exit   = new Select(new Vector2(325, 275), "Exit Game", new Action(Exit));

            select.Add(main);
            select.Add(load);
            select.Add(exit);
            mainSelect = new SelectBox(select);
            MenuInput.RegisterKey(Keys.Up, mainSelect.PrevOption);
            MenuInput.RegisterKey(Keys.Down, mainSelect.NextOption);
            MenuInput.RegisterKey(Keys.Enter, mainSelect.Confirm);
        }
Example #24
0
    protected void AdjustSelectionBox()
    {
        if (!SelectBox.isActive)
        {
            SelectBox.Enable();
        }
        Vector3 worldClickedPosition = Camera.main.ScreenToWorldPoint(clickedPosition);
        Vector3 worldMousePosition   = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        float   xMin = Mathf.Min(worldMousePosition.x, worldClickedPosition.x);
        float   xMax = Mathf.Max(worldMousePosition.x, worldClickedPosition.x);
        float   yMin = Mathf.Min(worldMousePosition.y, worldClickedPosition.y);
        float   yMax = Mathf.Max(worldMousePosition.y, worldClickedPosition.y);
        float   zMin = Mathf.Min(worldMousePosition.z, worldClickedPosition.z);
        float   zMax = Mathf.Max(worldMousePosition.z, worldClickedPosition.z);

        SelectBox.AdjustSize(new Vector3(xMin, yMin, zMin), new Vector3(xMax, yMax, zMax));
    }
Example #25
0
        public void OnEnter()
        {
            //Creates temp items for storing
            StatManager.FillInventory(1);
            StatManager.FillInventory(100);
            //Make a grid 10x10 to fill
            itemGrid = StatManager.getItemGrid(10, 10);
            itemMenu = new InputHandler();
            List <Select> itemSelector = new List <Select> {
                new Select(new Vector2(450, 250), "Select", Select), new Select(new Vector2(450, 325), "Exit", ExitMenu)
            };

            itemOptions = new SelectBox(itemSelector);
            itemMenu.RegisterKey(Keys.Up, itemOptions.PrevOption);
            itemMenu.RegisterKey(Keys.Down, itemOptions.NextOption);
            itemMenu.RegisterKey(Keys.Enter, itemOptions.Confirm);
            itemMenu.RegisterKey(Keys.OemPlus, AddItem);
        }
Example #26
0
        protected override void InitializeCore()
        {
            ShowDebug = true;

            //Debugger.Launch();

            stage = new Stage(Context.GraphicsDevice.Viewport.Width, Context.GraphicsDevice.Viewport.Height, true, Context.GraphicsDevice);

            Skin skin = new Skin(Context.GraphicsDevice, "Data/uiskin.json");

            Context.Input.Processor = stage;

            SelectBox box = new SelectBox(selectItems, skin);

            box.SetPosition(200, 300);

            stage.AddActor(box);
        }
		static void Main()
		{
			var rootWindow = new RootWindow();
			var selectBox = new SelectBox(new string[] { "First", "Second", "Last", "Another",
			                                             "2",
			                                             "3",
			                                             "4",
			                                             "5",
			                                             "6",
			                                             "7",
			                                             "8",
			                                             "9",
			                                             "10",
			                                             "11",
			                                             "12",});

			while (true)
			{
				rootWindow.Update();
				var info = rootWindow.ReadKey();

				if (info.Key == ConsoleKey.Escape)
				{
					return;
				}
				selectBox.FeedInput(info);
				selectBox.Update();
				selectBox.OnSelect += (selection) => {
					rootWindow.RootArea.Move(new Position(10,20));
					rootWindow.RootArea.ClearLine();
					rootWindow.RootArea.AddString($"You selected '{selection}'");
				};
				selectBox.OnFocus += (selection) => {
					rootWindow.RootArea.Move(new Position(10, 22));
					rootWindow.RootArea.ClearLine();
					rootWindow.RootArea.AddString($"You focused '{selection}'");
				};
				rootWindow.RootArea.Copy(selectBox.Area, new Position((rootWindow.RootArea.Size.Width - selectBox.Area.Size.Width) / 2, 0));
				Thread.Sleep(33);
			}
		}
Example #28
0
        public override void Initialize(Table table, Skin skin, float leftCellWidth)
        {
            var label = CreateNameLabel(table, skin, leftCellWidth);

            // gotta get ugly here
            _selectBox = new SelectBox <string>(skin);

            var enumValues       = Enum.GetValues(_valueType);
            var enumStringValues = new List <string>();

            foreach (var e in enumValues)
            {
                enumStringValues.Add(e.ToString());
            }
            _selectBox.SetItems(enumStringValues);

            _selectBox.OnChanged += selectedItem => { SetValue(Enum.Parse(_valueType, selectedItem)); };

            table.Add(label);
            table.Add(_selectBox).SetFillX();
        }
Example #29
0
		public override void initialize( Table table, Skin skin )
		{
			var label = createNameLabel( table, skin );

			// gotta get ugly here
			_selectBox = new SelectBox<string>( skin );

			var enumValues = Enum.GetValues( _valueType );
			var enumStringValues = new List<string>();
			foreach( var e in enumValues )
				enumStringValues.Add( e.ToString() );
			_selectBox.setItems( enumStringValues );

			_selectBox.onChanged += selectedItem =>
			{
				setValue( Enum.Parse( _valueType, selectedItem ) );
			};

			table.add( label );
			table.add( _selectBox ).setFillX();
		}
Example #30
0
    protected override void MultiSelect()
    {
        DeselectAll();
        SelectBox.Disable();
        Vector3 groundClickedPosition = WorldTouchPoint(Camera.main.ScreenToWorldPoint(clickedPosition));
        Vector3 groundMousePosition   = WorldTouchPoint(Camera.main.ScreenToWorldPoint(Input.mousePosition));
        float   distance = Mathf.Abs(groundMousePosition.x - groundClickedPosition.x);
        float   xMin     = Mathf.Min(groundMousePosition.x, groundClickedPosition.x);
        float   zMin     = Mathf.Min(groundMousePosition.z, groundClickedPosition.z);
        float   zMax     = Mathf.Max(groundMousePosition.z, groundClickedPosition.z);

        RaycastHit[] hits = Physics.CapsuleCastAll(new Vector3(xMin, 0f, zMin), new Vector3(xMin, 0f, zMax), 0.1f, Vector3.right, distance, LayerMask.GetMask(new string[] { player.species.ToString() }));
        foreach (RaycastHit hit in hits)
        {
            Unit unit = hit.collider.gameObject.GetComponent <Unit> ();
            if (unit)
            {
                SelectWorldOject(unit as WorldObject);
            }
        }
    }
        void MakeEmitterDropdown(Table table, Skin skin, string label)
        {
            ParticleEmitterType value = _particleEmitterConfig.EmitterType;

            var dropdown     = new SelectBox <string>(skin);
            var dropdownList = new List <string>()
            {
                "Gravity",
                "Radial"
            };

            dropdown.SetItems(dropdownList);

            if (_particleEmitterConfig.EmitterType == ParticleEmitterType.Gravity)
            {
                dropdown.SetSelectedIndex(0);
            }
            else
            {
                dropdown.SetSelectedIndex(1);
            }

            dropdown.OnChanged += (str) =>
            {
                if (str == "Gravity")
                {
                    _particleEmitterConfig.EmitterType = ParticleEmitterType.Gravity;
                }
                else
                {
                    _particleEmitterConfig.EmitterType = ParticleEmitterType.Radial;
                }
                ResetEmitter();
                ResetUi();
            };

            table.Add(label).Left().Width(140);
            table.Add("").Width(1);             // This is a 3 column table
            table.Add(dropdown);
        }
 /// <summary>
 /// select corresponded selectbox if need with detecting for search applying
 /// </summary>
 public void SearchInSelectBox(SelectBox slkBox, String text, By locator)
 {
     if ((text != "") || (text != "\""))
     {
         slkBox.SelectOptionWithDelay(text, locator);
     }
 }