Exemplo n.º 1
0
        private void Init()
        {
            context = new DropdownContext();
            context.ImportFromEnum <MapCategoryType>(Model.Options.Category.Value);
            context.OnSelection += (data) =>
            {
                var category = Model.Options.Category;
                if (data != null && !category.RawValue.ToString().Equals(data.ExtraData.ToString()))
                {
                    category.RawValue = data.ExtraData;
                }
            };

            label.Text = "Rank state";

            dropdown = CreateChild <DropdownButton>("dropdown", 1);
            {
                dropdown.Anchor = AnchorType.Fill;
                dropdown.Offset = new Offset(0f, 24f, 0f, 0f);
                dropdown.BackgroundSprite.Color = new Color(1f, 1f, 1f, 0.25f);

                dropdown.Context       = context;
                dropdown.UseAutoSelect = false;
            }

            OnEnableInited();
        }
Exemplo n.º 2
0
        private void Init()
        {
            dropdownContext              = new DropdownContext();
            dropdownContext.OnSelection += (data) =>
            {
                if (enumEntry != null)
                {
                    enumEntry.Value = data.Text;
                }
            };

            label = CreateLabel();
            {
                label.Alignment = TextAnchor.UpperLeft;
            }

            dropdown = CreateChild <DropdownButton>("dropdown");
            {
                dropdown.Anchor = AnchorType.BottomStretch;
                dropdown.Pivot  = PivotType.Bottom;
                dropdown.SetOffsetHorizontal(8f);
                dropdown.Y       = 8f;
                dropdown.Height  = 30f;
                dropdown.Context = dropdownContext;
            }
        }
        public DropdownMenu OpenAt(DropdownContext context, Vector2 worldPos)
        {
            DropdownMenu menu = OpenInternal(context);

            menu.PositionMenu(worldPos, Space.World);
            return(menu);
        }
Exemplo n.º 4
0
        private void Init()
        {
            apiDropdownContext = new DropdownContext();
            apiDropdownContext.ImportFromEnum <ApiProviderType>(CurProviderType.Value);

            CurProviderType.BindAndTrigger(OnLastLoginApiChange);
            Auth.OnNewValue += OnAuthenticationChange;
        }
        /// <summary>
        /// Internally handles opening of a dropdown menu.
        /// </summary>
        private DropdownMenu OpenInternal(DropdownContext context)
        {
            var menu = recycler.GetNext();

            menu.OpenMenu(context);
            int depth = GetNextMenuDepth();

            menu.Depth = depth;
            var canvas = menu.GetComponent <Canvas>();

            canvas.sortingOrder = depth;
            return(menu);
        }
Exemplo n.º 6
0
        private void Init()
        {
            // Initilaize scheduler.
            searchScheduler = new SynchronizedTimer()
            {
                Limit = SearchDelay
            };
            searchScheduler.OnFinished += OnSearchSchedulerEnd;

            // Init dropdown context.
            dropdownContext = new DropdownContext()
            {
                IsSelectionMenu = false
            };
            dropdownContext.OnSelection += OnDropdownSelection;
            dropdownContext.Datas.Add(new DropdownData("Offset", SongOffsetAction));
            dropdownContext.Datas.Add(new DropdownData("Delete", SongDeleteAction));

            // Set initial selection
            SetSort(GameConfiguration.MapsetSort.Value);
        }
        private void Init()
        {
            context = new DropdownContext();
            context.Datas.Add(new DropdownData("Selection A", "Extra A"));
            context.Datas.Add(new DropdownData("Selection B", "Extra B"));
            context.Datas.Add(new DropdownData("Selection C", "Extra C"));
            context.Datas.Add(new DropdownData("Selection D", "Extra D"));
            context.Datas.Add(new DropdownData("Selection E", "Extra E"));
            context.SelectData(context.Datas[0]);
            context.OnSelection += OnSelectionChange;

            var container = RootMain.CreateChild <UguiSprite>("bg");
            {
                container.Size  = new Vector2(500f, 500f);
                container.Alpha = 0.25f;

                var button = container.CreateChild <DropdownButton>("dropdown");
                button.Size    = new Vector2(200f, 42f);
                button.Context = context;
            }
        }
        private void Init()
        {
            context = new DropdownContext();
            context.ImportFromEnum <MapSortType>(Model.Options.Sort.Value);
            context.OnSelection += (data) =>
            {
                var sort = Model.Options.Sort;
                if (data != null && !sort.RawValue.ToString().Equals(data.ExtraData.ToString()))
                {
                    sort.RawValue = data.ExtraData;
                }
            };

            label.Text = "Sort by";

            dropdown = CreateChild <DropdownButton>("dropdown", 1);
            {
                dropdown.Anchor = AnchorType.LeftStretch;
                dropdown.Pivot  = PivotType.Left;
                dropdown.X      = 0f;
                dropdown.SetOffsetVertical(24f, 0f);
                dropdown.Width = 140f;
                dropdown.BackgroundSprite.Color = new Color(1f, 1f, 1f, 0.25f);

                dropdown.Context       = context;
                dropdown.UseAutoSelect = false;
            }
            toggle = CreateChild <LabelledToggle>("toggle", 2);
            {
                toggle.Anchor = AnchorType.Fill;
                toggle.Offset = new Offset(156f, 24f, 0f, 0f);

                toggle.LabelText = "Descending";

                toggle.OnTriggered += Model.Options.ToggleIsDescending;
            }

            OnEnableInited();
        }
Exemplo n.º 9
0
        private void Init()
        {
            context              = new DropdownContext();
            context.OnSelection += (data) =>
            {
                if (bindable != null && data != null && !bindable.RawValue.ToString().Equals(data.ExtraData.ToString()))
                {
                    bindable.RawValue = data.ExtraData;
                }
            };

            dropdown = container.CreateChild <DropdownButton>("dropdown", 1);
            {
                dropdown.Anchor = AnchorType.Fill;
                dropdown.Offset = new Offset(106f, 12f, 16f, 12f);
                dropdown.BackgroundSprite.Color = new Color(1f, 1f, 1f, 0.125f);

                dropdown.Context       = context;
                dropdown.UseAutoSelect = false;
            }

            OnEnableInited();
        }
Exemplo n.º 10
0
        private void Init()
        {
            context              = new DropdownContext();
            context.OnSelection += OnSelectionChange;
            context.Datas.Add(new DropdownData("Selection A", "Extra A"));
            context.Datas.Add(new DropdownData("Selection B", "Extra B"));
            context.Datas.Add(new DropdownData("Selection C", "Extra C"));
            context.Datas.Add(new DropdownData("Selection D", "Extra D"));
            context.Datas.Add(new DropdownData("Selection E", "Extra E"));
            context.Datas.Add(new DropdownData("Selection F", "Extra F"));
            context.Datas.Add(new DropdownData("Selection G", "Extra G"));
            context.Datas.Add(new DropdownData("Selection H", "Extra H"));
            context.Datas.Add(new DropdownData("Selection I", "Extra I"));
            context.Datas.Add(new DropdownData("Selection J", "Extra J"));

            var container = RootMain.CreateChild <UguiSprite>("bg");
            {
                container.Size  = new Vector2(500f, 500f);
                container.Alpha = 0.25f;

                menu = container.CreateChild <DropdownMenu>("dropdown");
                menu.CloseMenu();
            }
        }
Exemplo n.º 11
0
 public DropdownMenu Open(DropdownContext context) => OpenInternal(context);