Ejemplo n.º 1
0
        private Drawable createTranslateTextBox(Lyric lyric, Bindable <CultureInfo> bindable)
        {
            var textBox = new OsuTextBox
            {
                Anchor           = Anchor.CentreLeft,
                Origin           = Anchor.CentreLeft,
                RelativeSizeAxes = Axes.X,
            };

            languageDropdown.Current.BindValueChanged(v =>
            {
                var hasCultureInfo = v.NewValue != null;

                // disable and clear textbox if contains no language in language list.
                textBox.Text = hasCultureInfo ? translateManager.GetTranslate(lyric, v.NewValue) : null;
                ScheduleAfterChildren(() =>
                {
                    textBox.Current.Disabled = !hasCultureInfo;
                });
            }, true);
            textBox.Current.BindValueChanged(textBoxValue =>
            {
                var cultureInfo = languageDropdown.Current.Value;
                if (cultureInfo == null)
                {
                    return;
                }

                var translateText = textBoxValue.NewValue;
                translateManager.SaveTranslate(lyric, cultureInfo, translateText);
            });
            return(textBox);
        }
Ejemplo n.º 2
0
        public void TestSetAndClearLabelText()
        {
            SettingsTextBox textBox = null;
            RestoreDefaultValueButton <string> restoreDefaultValueButton = null;
            OsuTextBox control = null;

            AddStep("create settings item", () =>
            {
                Child = textBox = new SettingsTextBox
                {
                    Current = new Bindable <string>
                    {
                        Default = "test",
                        Value   = "test"
                    }
                };
            });
            AddUntilStep("wait for loaded", () => textBox.IsLoaded);
            AddStep("retrieve components", () =>
            {
                restoreDefaultValueButton = textBox.ChildrenOfType <RestoreDefaultValueButton <string> >().Single();
                control = textBox.ChildrenOfType <OsuTextBox>().Single();
            });

            AddStep("set non-default value", () => restoreDefaultValueButton.Current.Value = "non-default");
            AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1));

            AddStep("set label", () => textBox.LabelText = "label text");
            AddAssert("default value button centre aligned to label size", () =>
            {
                var label = textBox.ChildrenOfType <OsuSpriteText>().Single(spriteText => spriteText.Text == "label text");
                return(Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, label.DrawHeight, 1));
            });

            AddStep("clear label", () => textBox.LabelText = default);
            AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1));

            AddStep("set warning text", () => textBox.WarningText = "This is some very important warning text! Hopefully it doesn't break the alignment of the default value indicator...");
            AddAssert("default value button centre aligned to control size", () => Precision.AlmostEquals(restoreDefaultValueButton.Parent.DrawHeight, control.DrawHeight, 1));
        }
Ejemplo n.º 3
0
        private void load()
        {
            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 10),
                    Children         = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Margin = new MarginPadding {
                                Vertical = 10
                            },
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Font   = OsuFont.GetFont(size: 20),
                            Text   = "Let's create an account!",
                        },
                        usernameTextBox = new OsuTextBox
                        {
                            PlaceholderText          = UsersStrings.LoginUsername.ToLower(),
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        usernameDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        emailTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "email address",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        emailAddressDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        passwordTextBox = new OsuPasswordTextBox
                        {
                            PlaceholderText          = UsersStrings.LoginPassword.ToLower(),
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this,
                        },
                        passwordDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                registerShake = new ShakeContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Child            = new SettingsButton
                                    {
                                        Text   = "Register",
                                        Margin = new MarginPadding {
                                            Vertical = 20
                                        },
                                        Action = performRegistration
                                    }
                                }
                            }
                        },
                    },
                },
                loadingLayer = new LoadingLayer(true)
            };

            textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };

            usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");

            emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
            emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold));

            passwordDescription.AddText("At least ");
            characterCheckText = passwordDescription.AddText("8 characters long");
            passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song.");

            passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true);
            characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour();
        }
Ejemplo n.º 4
0
            private void load(OsuColour colours)
            {
                Container dimContent;

                InternalChildren = new Drawable[]
                {
                    dimContent = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Children         = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = Color4Extensions.FromHex(@"28242d"),
                            },
                            new GridContainer
                            {
                                RelativeSizeAxes = Axes.Both,
                                RowDimensions    = new[]
                                {
                                    new Dimension(GridSizeMode.Distributed),
                                    new Dimension(GridSizeMode.AutoSize),
                                },
                                Content = new[]
                                {
                                    new Drawable[]
                                    {
                                        new OsuScrollContainer
                                        {
                                            Padding = new MarginPadding
                                            {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                                Vertical   = 10
                                            },
                                            RelativeSizeAxes = Axes.Both,
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Padding = new MarginPadding {
                                                        Horizontal = SearchableListOverlay.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Duration")
                                                                {
                                                                    Child = DurationField = new DurationDropdown
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Items            = new[]
                                                                        {
                                                                            TimeSpan.FromMinutes(30),
                                                                            TimeSpan.FromHours(1),
                                                                            TimeSpan.FromHours(2),
                                                                            TimeSpan.FromHours(4),
                                                                            TimeSpan.FromHours(8),
                                                                            TimeSpan.FromHours(12),
                                                                            //TimeSpan.FromHours(16),
                                                                            TimeSpan.FromHours(24),
                                                                            TimeSpan.FromDays(3),
                                                                            TimeSpan.FromDays(7)
                                                                        }
                                                                    }
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new GameTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                                Enabled          = { Value = false }
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = field_padding / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Playlist")
                                                                {
                                                                    Child = new GridContainer
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 300,
                                                                        Content          = new[]
                                                                        {
                                                                            new Drawable[]
                                                                            {
                                                                                playlist = new DrawableRoomPlaylist(true, true)
                                                                                {
                                                                                    RelativeSizeAxes = Axes.Both
                                                                                }
                                                                            },
                                                                            new Drawable[]
                                                                            {
                                                                                new PurpleTriangleButton
                                                                                {
                                                                                    RelativeSizeAxes = Axes.X,
                                                                                    Height           = 40,
                                                                                    Text             = "Edit playlist",
                                                                                    Action           = () => EditPlaylist?.Invoke()
                                                                                }
                                                                            }
                                                                        },
                                                                        RowDimensions = new[]
                                                                        {
                                                                            new Dimension(),
                                                                            new Dimension(GridSizeMode.AutoSize),
                                                                        }
                                                                    }
                                                                },
                                                            },
                                                        },
                                                    },
                                                }
                                            },
                                        },
                                    },
                                    new Drawable[]
                                    {
                                        new Container
                                        {
                                            Anchor           = Anchor.BottomLeft,
                                            Origin           = Anchor.BottomLeft,
                                            Y                = 2,
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new Box
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                                },
                                                new FillFlowContainer
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Direction        = FillDirection.Vertical,
                                                    Spacing          = new Vector2(0, 20),
                                                    Margin           = new MarginPadding {
                                                        Vertical = 20
                                                    },
                                                    Padding = new MarginPadding {
                                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                                    },
                                                    Children = new Drawable[]
                                                    {
                                                        ApplyButton = new CreateRoomButton
                                                        {
                                                            Anchor  = Anchor.BottomCentre,
                                                            Origin  = Anchor.BottomCentre,
                                                            Size    = new Vector2(230, 55),
                                                            Enabled = { Value = false },
                                                            Action  = apply,
                                                        },
                                                        ErrorText = new OsuSpriteText
                                                        {
                                                            Anchor = Anchor.BottomCentre,
                                                            Origin = Anchor.BottomCentre,
                                                            Alpha  = 0,
                                                            Depth  = 1,
                                                            Colour = colours.RedDark
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            },
                        }
                    },
                    loadingLayer = new LoadingLayer(dimContent)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value   = duration.NewValue, true);

                playlist.Items.BindTo(Playlist);
            }
Ejemplo n.º 5
0
        private void load(OsuColour colours, APIAccess api)
        {
            this.api = api;

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 10),
                    Children         = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            TextSize = 20,
                            Margin   = new MarginPadding {
                                Vertical = 10
                            },
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Text   = "Let's create an account!",
                        },
                        usernameTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "username",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        usernameDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        emailTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "email address",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        emailAddressDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        passwordTextBox = new OsuPasswordTextBox
                        {
                            PlaceholderText          = "password",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this,
                        },
                        passwordDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                registerShake = new ShakeContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Child            = new SettingsButton
                                    {
                                        Text   = "Register",
                                        Margin = new MarginPadding {
                                            Vertical = 20
                                        },
                                        Action = performRegistration
                                    }
                                }
                            }
                        },
                    },
                },
                processingOverlay = new ProcessingOverlay {
                    Alpha = 0
                }
            };

            textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };

            usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");

            emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
            emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = "Exo2.0-Bold");

            passwordDescription.AddText("At least ");
            characterCheckText = passwordDescription.AddText("8 characters long");
            passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song.");

            passwordTextBox.Current.ValueChanged += text => { characterCheckText.ForEach(s => s.Colour = text.Length == 0 ? Color4.White : Interpolation.ValueAt(text.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); };
        }
Ejemplo n.º 6
0
 public void SetUpSteps()
 {
     AddStep("create number box", () => Child    = numberBox = new SettingsNumberBox());
     AddStep("get inner text box", () => textBox = numberBox.ChildrenOfType <OsuTextBox>().Single());
 }
Ejemplo n.º 7
0
            private void load(OverlayColourProvider colourProvider, OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colourProvider.Background4
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new OsuTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 100,
                                                                    },
                                                                },
                                                                // new Section("Room visibility")
                                                                // {
                                                                //     Alpha = disabled_alpha,
                                                                //     Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                //     {
                                                                //         Enabled = { Value = false }
                                                                //     },
                                                                // },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                                new Section("Queue mode")
                                                                {
                                                                    Child = new Container
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 40,
                                                                        Child            = QueueModeDropdown = new OsuEnumDropdown <QueueMode>
                                                                        {
                                                                            RelativeSizeAxes = Axes.X
                                                                        }
                                                                    }
                                                                },
                                                                new Section("Auto start")
                                                                {
                                                                    Child = new Container
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Height           = 40,
                                                                        Child            = startModeDropdown = new OsuEnumDropdown <StartMode>
                                                                        {
                                                                            RelativeSizeAxes = Axes.X
                                                                        }
                                                                    }
                                                                }
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new OsuNumberBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new OsuPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        LengthLimit = 255,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                playlistContainer = new FillFlowContainer
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Width            = 0.5f,
                                                    Depth            = float.MaxValue,
                                                    Spacing          = new Vector2(5),
                                                    Children         = new Drawable[]
                                                    {
                                                        drawablePlaylist = new DrawableRoomPlaylist
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = DrawableRoomPlaylistItem.HEIGHT
                                                        },
                                                        new PurpleTriangleButton
                                                        {
                                                            RelativeSizeAxes = Axes.X,
                                                            Height           = 40,
                                                            Text             = "Select beatmap",
                                                            Action           = SelectBeatmap
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = colourProvider.Background5
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text                     = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text                               = name.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value                         = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text            = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => playlistContainer.Alpha                      = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text                     = password.NewValue ?? string.Empty, true);
                QueueMode.BindValueChanged(mode => QueueModeDropdown.Current.Value             = mode.NewValue, true);
                AutoStartDuration.BindValueChanged(duration => startModeDropdown.Current.Value = (StartMode)(int)duration.NewValue.TotalSeconds, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
Ejemplo n.º 8
0
 private void expectedValue(OsuTextBox textBox, string value) => AddAssert("expected textbox value", () => textBox.Text == value);
Ejemplo n.º 9
0
            private void load(OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(GridSizeMode.Distributed),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new Container
                                        {
                                            Padding = new MarginPadding {
                                                Horizontal = SearchableListOverlay.WIDTH_PADDING
                                            },
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new SectionContainer
                                                {
                                                    Padding = new MarginPadding {
                                                        Right = field_padding / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("房间名")
                                                        {
                                                            Child = NameField = new SettingsTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                OnCommit = (sender, text) => apply(),
                                                            },
                                                        },
                                                        new Section("房间可见性")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                            {
                                                                Enabled = { Value = false }
                                                            },
                                                        },
                                                        new Section("游戏类型")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = new FillFlowContainer
                                                            {
                                                                AutoSizeAxes     = Axes.Y,
                                                                RelativeSizeAxes = Axes.X,
                                                                Direction        = FillDirection.Vertical,
                                                                Spacing          = new Vector2(7),
                                                                Children         = new Drawable[]
                                                                {
                                                                    TypePicker = new GameTypePicker
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Enabled          = { Value = false }
                                                                    },
                                                                    typeLabel = new OsuSpriteText
                                                                    {
                                                                        Font   = OsuFont.GetFont(size: 14),
                                                                        Colour = colours.Yellow
                                                                    },
                                                                },
                                                            },
                                                        },
                                                    },
                                                },
                                                new SectionContainer
                                                {
                                                    Anchor  = Anchor.TopRight,
                                                    Origin  = Anchor.TopRight,
                                                    Padding = new MarginPadding {
                                                        Left = field_padding / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("最大人数")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = MaxParticipantsField = new SettingsNumberTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                                OnCommit = (sender, text) => apply()
                                                            },
                                                        },
                                                        new Section("持续时间")
                                                        {
                                                            Child = DurationField = new DurationDropdown
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Items            = new[]
                                                                {
                                                                    TimeSpan.FromMinutes(30),
                                                                    TimeSpan.FromHours(1),
                                                                    TimeSpan.FromHours(2),
                                                                    TimeSpan.FromHours(4),
                                                                    TimeSpan.FromHours(8),
                                                                    TimeSpan.FromHours(12),
                                                                    //TimeSpan.FromHours(16),
                                                                    TimeSpan.FromHours(24),
                                                                    TimeSpan.FromDays(3),
                                                                    TimeSpan.FromDays(7)
                                                                }
                                                            }
                                                        },
                                                        new Section("密码(可选)")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = new SettingsPasswordTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                                OnCommit = (sender, text) => apply()
                                                            },
                                                        },
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = OsuColour.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateRoomButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    processingOverlay = new ProcessingOverlay {
                        Alpha = 0
                    }
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value   = duration.NewValue, true);
            }
Ejemplo n.º 10
0
        public RoomSettingsOverlay(Room room)
        {
            Masking = true;

            Child = content = new Container
            {
                RelativeSizeAxes     = Axes.Both,
                RelativePositionAxes = Axes.Y,
                Children             = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.FromHex(@"28242d"),
                    },
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Padding          = new MarginPadding {
                            Top = 35, Bottom = 75, Horizontal = SearchableListOverlay.WIDTH_PADDING
                        },
                        Children = new[]
                        {
                            new SectionContainer
                            {
                                Padding = new MarginPadding {
                                    Right = field_padding / 2
                                },
                                Children = new[]
                                {
                                    new Section("ROOM NAME")
                                    {
                                        Child = NameField = new SettingsTextBox
                                        {
                                            RelativeSizeAxes         = Axes.X,
                                            TabbableContentContainer = this,
                                            OnCommit = (sender, text) => apply(),
                                        },
                                    },
                                    new Section("ROOM VISIBILITY")
                                    {
                                        Child = AvailabilityPicker = new RoomAvailabilityPicker(),
                                    },
                                    new Section("GAME TYPE")
                                    {
                                        Child = new FillFlowContainer
                                        {
                                            AutoSizeAxes     = Axes.Y,
                                            RelativeSizeAxes = Axes.X,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(7),
                                            Children         = new Drawable[]
                                            {
                                                TypePicker = new GameTypePicker
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                },
                                                typeLabel = new OsuSpriteText
                                                {
                                                    TextSize = 14,
                                                },
                                            },
                                        },
                                    },
                                },
                            },
                            new SectionContainer
                            {
                                Anchor  = Anchor.TopRight,
                                Origin  = Anchor.TopRight,
                                Padding = new MarginPadding {
                                    Left = field_padding / 2
                                },
                                Children = new[]
                                {
                                    new Section("MAX PARTICIPANTS")
                                    {
                                        Child = MaxParticipantsField = new SettingsNumberTextBox
                                        {
                                            RelativeSizeAxes         = Axes.X,
                                            TabbableContentContainer = this,
                                            OnCommit = (sender, text) => apply(),
                                        },
                                    },
                                    new Section("PASSWORD (OPTIONAL)")
                                    {
                                        Child = new SettingsPasswordTextBox
                                        {
                                            RelativeSizeAxes         = Axes.X,
                                            TabbableContentContainer = this,
                                            OnCommit = (sender, text) => apply(),
                                        },
                                    },
                                },
                            },
                        },
                    },
                    ApplyButton = new ApplySettingsButton
                    {
                        Anchor = Anchor.BottomCentre,
                        Origin = Anchor.BottomCentre,
                        Size   = new Vector2(230, 35),
                        Margin = new MarginPadding {
                            Bottom = 20
                        },
                        Action = apply,
                    },
                },
            };

            TypePicker.Current.ValueChanged += t => typeLabel.Text = t.Name;

            nameBind.ValueChanged            += n => NameField.Text = n;
            availabilityBind.ValueChanged    += a => AvailabilityPicker.Current.Value = a;
            typeBind.ValueChanged            += t => TypePicker.Current.Value = t;
            maxParticipantsBind.ValueChanged += m => MaxParticipantsField.Text = m?.ToString();

            nameBind.BindTo(room.Name);
            availabilityBind.BindTo(room.Availability);
            typeBind.BindTo(room.Type);
            maxParticipantsBind.BindTo(room.MaxParticipants);
        }
Ejemplo n.º 11
0
        private void load(OsuColour colours)
        {
            FillFlowContainer mainContent;

            InternalChildren = new Drawable[]
            {
                mainContent = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 10),
                    Children         = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Margin = new MarginPadding {
                                Vertical = 10
                            },
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Font   = OsuFont.GetFont(size: 20),
                            Text   = "創建 osu! 帳號!",
                        },
                        usernameTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "暱稱",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        usernameDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        emailTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "E-mail地址",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        emailAddressDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        passwordTextBox = new OsuPasswordTextBox
                        {
                            PlaceholderText          = "密碼",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this,
                        },
                        passwordDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                registerShake = new ShakeContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Child            = new SettingsButton
                                    {
                                        Text   = "註冊!",
                                        Margin = new MarginPadding {
                                            Vertical = 20
                                        },
                                        Action = performRegistration
                                    }
                                }
                            }
                        },
                    },
                },
                loadingLayer = new LoadingLayer(mainContent)
            };

            textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };

            usernameDescription.AddText("暱稱將成爲你的公開名字 不要包含褻瀆文字或者僞裝他人的暱稱 當然也不要把你的個人資訊公開啦");
            //This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!
            emailAddressDescription.AddText("將用於獲取通知, 帳號驗證和重設密碼. 我們承諾不會發送垃圾信封到這個E-mail.");
            emailAddressDescription.AddText(" 確定這裏是對的!", cp => cp.Font = cp.Font.With(Typeface.Torus, weight: FontWeight.Bold));

            passwordDescription.AddText("至少 ");
            characterCheckText = passwordDescription.AddText("有 8 個字長");
            passwordDescription.AddText(". 選擇一個不錯的 不會忘記的密碼 比如一首你最喜歡的曲名.");

            passwordTextBox.Current.ValueChanged += password => { characterCheckText.ForEach(s => s.Colour = password.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(password.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); };
        }
Ejemplo n.º 12
0
        public MatchSettingsOverlay(Room room)
        {
            this.room = room;

            bindings.Room = room;

            Masking = true;

            Child = content = new Container
            {
                RelativeSizeAxes     = Axes.Both,
                RelativePositionAxes = Axes.Y,
                Children             = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = OsuColour.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(GridSizeMode.Distributed),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new ScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new Container
                                        {
                                            Padding = new MarginPadding {
                                                Horizontal = SearchableListOverlay.WIDTH_PADDING
                                            },
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new SectionContainer
                                                {
                                                    Padding = new MarginPadding {
                                                        Right = field_padding / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Room name")
                                                        {
                                                            Child = NameField = new SettingsTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                OnCommit = (sender, text) => apply(),
                                                            },
                                                        },
                                                        new Section("Room visibility")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = AvailabilityPicker = new RoomAvailabilityPicker(),
                                                        },
                                                        new Section("Game type")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = new FillFlowContainer
                                                            {
                                                                AutoSizeAxes     = Axes.Y,
                                                                RelativeSizeAxes = Axes.X,
                                                                Direction        = FillDirection.Vertical,
                                                                Spacing          = new Vector2(7),
                                                                Children         = new Drawable[]
                                                                {
                                                                    TypePicker = new GameTypePicker
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                    },
                                                                    typeLabel = new OsuSpriteText
                                                                    {
                                                                        TextSize = 14,
                                                                    },
                                                                },
                                                            },
                                                        },
                                                    },
                                                },
                                                new SectionContainer
                                                {
                                                    Anchor  = Anchor.TopRight,
                                                    Origin  = Anchor.TopRight,
                                                    Padding = new MarginPadding {
                                                        Left = field_padding / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Max participants")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = MaxParticipantsField = new SettingsNumberTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                OnCommit = (sender, text) => apply(),
                                                            },
                                                        },
                                                        new Section("Duration")
                                                        {
                                                            Child = DurationField = new DurationDropdown
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Items            = new[]
                                                                {
                                                                    TimeSpan.FromMinutes(30),
                                                                    TimeSpan.FromHours(1),
                                                                    TimeSpan.FromHours(2),
                                                                    TimeSpan.FromHours(4),
                                                                    TimeSpan.FromHours(8),
                                                                    TimeSpan.FromHours(12),
                                                                    //TimeSpan.FromHours(16),
                                                                    TimeSpan.FromHours(24),
                                                                    TimeSpan.FromDays(3),
                                                                    TimeSpan.FromDays(7)
                                                                }
                                                            }
                                                        },
                                                        new Section("Password (optional)")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = PasswordField = new SettingsPasswordTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                OnCommit = (sender, text) => apply()
                                                            },
                                                        },
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = OsuColour.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateRoomButton
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Size   = new Vector2(230, 55),
                                                    Action = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    processingOverlay = new ProcessingOverlay {
                        Alpha = 0
                    }
                },
            };

            TypePicker.Current.ValueChanged += t => typeLabel.Text = t.Name;

            bindings.Name.BindValueChanged(n => NameField.Text = n, true);
            bindings.Availability.BindValueChanged(a => AvailabilityPicker.Current.Value = a, true);
            bindings.Type.BindValueChanged(t => TypePicker.Current.Value             = t, true);
            bindings.MaxParticipants.BindValueChanged(m => MaxParticipantsField.Text = m?.ToString(), true);
            bindings.Duration.BindValueChanged(d => DurationField.Current.Value      = d, true);
        }
Ejemplo n.º 13
0
        private void load(OsuColour colours, IAPIProvider api, GameHost host)
        {
            this.api  = api;
            this.host = host;

            InternalChildren = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Direction        = FillDirection.Vertical,
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    Padding          = new MarginPadding(20),
                    Spacing          = new Vector2(0, 10),
                    Children         = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Margin = new MarginPadding {
                                Vertical = 10
                            },
                            Anchor = Anchor.TopCentre,
                            Origin = Anchor.TopCentre,
                            Font   = OsuFont.GetFont(size: 20),
                            Text   = "让我们创建一个账号!",
                        },
                        usernameTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "用户名(最多15字符)",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        usernameDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        emailTextBox = new OsuTextBox
                        {
                            PlaceholderText          = "电子邮箱地址",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this
                        },
                        emailAddressDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        passwordTextBox = new OsuPasswordTextBox
                        {
                            PlaceholderText          = "密码",
                            RelativeSizeAxes         = Axes.X,
                            TabbableContentContainer = this,
                        },
                        passwordDescription = new ErrorTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                registerShake = new ShakeContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Child            = new SettingsButton
                                    {
                                        Text   = "注册",
                                        Margin = new MarginPadding {
                                            Vertical = 20
                                        },
                                        Action = performRegistration
                                    }
                                }
                            }
                        },
                    },
                },
                processingOverlay = new ProcessingOverlay {
                    Alpha = 0
                }
            };

            textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };

            usernameDescription.AddText("这将在您的资料卡内公开显示,", cp => cp.Font         = cp.Font.With(size: 16));
            usernameDescription.AddText("你不能输入任何带有亵渎,冒充他人等不良信息,", cp => cp.Font = cp.Font.With(size: 16));
            usernameDescription.AddText("另外,也请不要泄露任何真实信息!", cp => cp.Font       = cp.Font.With(Typeface.Exo, weight: FontWeight.Bold, size: 16));

            emailAddressDescription.AddText("这将会用于发送通知和验证邮件. 我们不会发送垃圾邮件.", cp => cp.Font = cp.Font.With(size: 16));
            emailAddressDescription.AddText("请确保正确填写!", cp => cp.Font = cp.Font.With(Typeface.Exo, weight: FontWeight.Bold, size: 16));

            passwordDescription.AddText("请输入至少", cp => cp.Font = cp.Font.With(size: 16));
            characterCheckText = passwordDescription.AddText("8个字符", cp => cp.Font = cp.Font.With(size: 16));
            passwordDescription.AddText(". 选择一个你能记住的长密码,比如说你喜欢的一首歌?", cp => cp.Font = cp.Font.With(size: 16));

            passwordTextBox.Current.ValueChanged += password => { characterCheckText.ForEach(s => s.Colour = password.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(password.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); };
        }
Ejemplo n.º 14
0
        public TestSceneLyricLineLayout()
        {
            Child = new GridContainer
            {
                RelativeSizeAxes = Axes.Both,
                ColumnDimensions = new[]
                {
                    new Dimension(GridSizeMode.Absolute, 210f)
                },
                Content = new[]
                {
                    new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Name             = "Setting background",
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.Gray
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Padding          = new MarginPadding(5),
                                    Spacing          = new Vector2(10),
                                    Children         = new Drawable[]
                                    {
                                        new EditSection
                                        {
                                            Name     = "Name section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Name"
                                                },
                                                nameTextBox = new OsuTextBox
                                                {
                                                    Width = 200
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Anchor section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Anchor"
                                                },
                                                alignmentDropdown = new OsuDropdown <Anchor>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Items            = (Anchor[])Enum.GetValues(typeof(Anchor))
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Horizontal margin section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Horizontal margin"
                                                },
                                                horizontalMarginSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 500,
                                                        Value    = 30,
                                                        Default  = 30
                                                    }
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Vertical margin section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Vertical margin"
                                                },
                                                verticalMarginSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 500,
                                                        Value    = 30,
                                                        Default  = 30
                                                    }
                                                }
                                            }
                                        },
                                        continuousCheckbox = new OsuCheckbox
                                        {
                                            Name      = "Continuous section",
                                            LabelText = "Continuous"
                                        },
                                        new EditSection
                                        {
                                            Name     = "Smart horizon section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Smart horizon"
                                                },
                                                smartHorizonDropdown = new OsuDropdown <KaraokeTextSmartHorizon>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Items            = (KaraokeTextSmartHorizon[])Enum.GetValues(typeof(KaraokeTextSmartHorizon))
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Lyrics interval section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Lyrics interval"
                                                },
                                                lyricIntervalSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 30,
                                                        Value    = 10,
                                                        Default  = 10
                                                    }
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Ruby interval section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Ruby interval"
                                                },
                                                rubyIntervalSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 30,
                                                        Value    = 10,
                                                        Default  = 10
                                                    }
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Romaji interval section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Romaji interval"
                                                },
                                                romajiIntervalSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 30,
                                                        Value    = 10,
                                                        Default  = 10
                                                    }
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Ruby alignment section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Ruby alignment"
                                                },
                                                rubyAlignmentDropdown = new OsuDropdown <LyricTextAlignment>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Items            = (LyricTextAlignment[])Enum.GetValues(typeof(LyricTextAlignment))
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Romaji alignment section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Romaji alignment"
                                                },
                                                romajiAlignmentDropdown = new OsuDropdown <LyricTextAlignment>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Items            = (LyricTextAlignment[])Enum.GetValues(typeof(LyricTextAlignment))
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Ruby margin section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Ruby margin"
                                                },
                                                rubyMarginSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 30,
                                                        Value    = 10,
                                                        Default  = 10
                                                    }
                                                }
                                            }
                                        },
                                        new EditSection
                                        {
                                            Name     = "Romaji margin section",
                                            Children = new Drawable[]
                                            {
                                                new OsuSpriteText {
                                                    Text = "Romaji margin"
                                                },
                                                romajiMarginSliderBar = new OsuSliderBar <int>
                                                {
                                                    RelativeSizeAxes = Axes.X,
                                                    Current          = new BindableNumber <int>
                                                    {
                                                        MinValue = 0,
                                                        MaxValue = 30,
                                                        Value    = 10,
                                                        Default  = 10
                                                    }
                                                }
                                            }
                                        },
                                    }
                                }
                            }
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.Both,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    Name             = "Setting background",
                                    RelativeSizeAxes = Axes.Both,
                                    Colour           = Color4.WhiteSmoke
                                },
                                layoutArea = new SkinProvidingContainer(new KaraokeLayoutEditorSkin())
                                {
                                    RelativeSizeAxes = Axes.Both,
                                }
                            }
                        }
                    }
                }
            };

            // Initial bindable
            nameTextBox.Current.BindValueChanged(x =>
            {
                /*TODO : maybe do something in the future.*/
            });
            alignmentDropdown.Current.BindValueChanged(x => applyChange(l => l.Alignment = x.NewValue));
            horizontalMarginSliderBar.Current.BindValueChanged(x => applyChange(l => l.HorizontalMargin = x.NewValue));
            verticalMarginSliderBar.Current.BindValueChanged(x => applyChange(l => l.VerticalMargin     = x.NewValue));
            continuousCheckbox.Current.BindValueChanged(x => applyChange(l => l.Continuous           = x.NewValue));
            smartHorizonDropdown.Current.BindValueChanged(x => applyChange(l => l.SmartHorizon       = x.NewValue));
            lyricIntervalSliderBar.Current.BindValueChanged(x => applyChange(l => l.LyricsInterval   = x.NewValue));
            rubyIntervalSliderBar.Current.BindValueChanged(x => applyChange(l => l.RubyInterval      = x.NewValue));
            romajiIntervalSliderBar.Current.BindValueChanged(x => applyChange(l => l.RomajiInterval  = x.NewValue));
            rubyAlignmentDropdown.Current.BindValueChanged(x => applyChange(l => l.RubyAlignment     = x.NewValue));
            romajiAlignmentDropdown.Current.BindValueChanged(x => applyChange(l => l.RomajiAlignment = x.NewValue));
            rubyMarginSliderBar.Current.BindValueChanged(x => applyChange(l => l.RubyMargin          = x.NewValue));
            romajiMarginSliderBar.Current.BindValueChanged(x => applyChange(l => l.RomajiMargin      = x.NewValue));

            AddStep("Small size lyric layout",
                    () => initialLyricLine(createDefaultLyricLine("@カラオケ",
                                                                  new[]
            {
                "@Ruby1=カ,か",
                "@Ruby2=ラ,ら",
                "@Ruby3=オ,お",
                "@Ruby4=ケ,け"
            },
                                                                  new[]
            {
                "@Romaji1=カ,ka",
                "@Romaji2=ラ,ra",
                "@Romaji3=オ,o",
                "@Romaji4=ケ,ke"
            }
                                                                  , "karaoke")));
            AddStep("Medium size lyric layout",
                    () => initialLyricLine(createDefaultLyricLine("@[00:18:58]た[00:18:81]だ[00:19:36]風[00:20:09]に[00:20:29]揺[00:20:49]ら[00:20:68]れ[00:20:89]て[00:20:93]",
                                                                  new[]
            {
                "@Ruby1=風,かぜ",
                "@Ruby2=揺,ゆ"
            },
                                                                  new[]
            {
                "@Romaji1=た,ta",
                "@Romaji2=だ,da",
                "@Romaji3=風,kaze",
                "@Romaji4=に,ni",
                "@Romaji5=揺,yu",
                "@Romaji6=ら,ra",
                "@Romaji7=れ,re",
                "@Romaji8=て,te"
            }
                                                                  , "karaoke")));
            AddStep("Large size lyric layout", () => initialLyricLine(createDefaultLyricLine("@灰色(いろ)(いろ)の景色(いろ)(いろ)さえ色づき始める",
                                                                                             Array.Empty <string>(), Array.Empty <string>(), "karaoke")));
        }
Ejemplo n.º 15
0
            private void load(OverlayColourProvider colourProvider, OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = colourProvider.Background4
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new Container
                                        {
                                            Padding = new MarginPadding {
                                                Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                            },
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Children         = new Drawable[]
                                            {
                                                new SectionContainer
                                                {
                                                    Padding = new MarginPadding {
                                                        Right = FIELD_PADDING / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Room name")
                                                        {
                                                            Child = NameField = new OsuTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                LengthLimit = 100
                                                            },
                                                        },
                                                        new Section("Duration")
                                                        {
                                                            Child = DurationField = new DurationDropdown
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Items            = new[]
                                                                {
                                                                    TimeSpan.FromMinutes(30),
                                                                    TimeSpan.FromHours(1),
                                                                    TimeSpan.FromHours(2),
                                                                    TimeSpan.FromHours(4),
                                                                    TimeSpan.FromHours(8),
                                                                    TimeSpan.FromHours(12),
                                                                    //TimeSpan.FromHours(16),
                                                                    TimeSpan.FromHours(24),
                                                                    TimeSpan.FromDays(3),
                                                                    TimeSpan.FromDays(7)
                                                                }
                                                            }
                                                        },
                                                        new Section("Allowed attempts (across all playlist items)")
                                                        {
                                                            Child = MaxAttemptsField = new OsuNumberBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                PlaceholderText          = "Unlimited",
                                                            },
                                                        },
                                                        new Section("Room visibility")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                            {
                                                                Enabled = { Value = false }
                                                            },
                                                        },
                                                        new Section("Max participants")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = MaxParticipantsField = new OsuNumberBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                            },
                                                        },
                                                        new Section("Password (optional)")
                                                        {
                                                            Alpha = disabled_alpha,
                                                            Child = new OsuPasswordTextBox
                                                            {
                                                                RelativeSizeAxes         = Axes.X,
                                                                TabbableContentContainer = this,
                                                                ReadOnly = true,
                                                            },
                                                        },
                                                    },
                                                },
                                                new SectionContainer
                                                {
                                                    Anchor  = Anchor.TopRight,
                                                    Origin  = Anchor.TopRight,
                                                    Padding = new MarginPadding {
                                                        Left = FIELD_PADDING / 2
                                                    },
                                                    Children = new[]
                                                    {
                                                        new Section("Playlist")
                                                        {
                                                            Child = new GridContainer
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                Height           = 448,
                                                                Content          = new[]
                                                                {
                                                                    new Drawable[]
                                                                    {
                                                                        playlist = new DrawableRoomPlaylist(true, true)
                                                                        {
                                                                            RelativeSizeAxes = Axes.Both
                                                                        }
                                                                    },
                                                                    new Drawable[]
                                                                    {
                                                                        playlistLength = new OsuSpriteText
                                                                        {
                                                                            Margin = new MarginPadding {
                                                                                Vertical = 5
                                                                            },
                                                                            Colour = colours.Yellow,
                                                                            Font   = OsuFont.GetFont(size: 12),
                                                                        }
                                                                    },
                                                                    new Drawable[]
                                                                    {
                                                                        editPlaylistButton = new PurpleTriangleButton
                                                                        {
                                                                            RelativeSizeAxes = Axes.X,
                                                                            Height           = 40,
                                                                            Text             = "Edit playlist",
                                                                            Action           = () => EditPlaylist?.Invoke()
                                                                        }
                                                                    }
                                                                },
                                                                RowDimensions = new[]
                                                                {
                                                                    new Dimension(),
                                                                    new Dimension(GridSizeMode.AutoSize),
                                                                    new Dimension(GridSizeMode.AutoSize),
                                                                }
                                                            }
                                                        },
                                                    },
                                                },
                                            },
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = colourProvider.Background5
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateRoomButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                RoomName.BindValueChanged(name => NameField.Text = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text            = count.NewValue?.ToString(), true);
                MaxAttempts.BindValueChanged(count => MaxAttemptsField.Text       = count.NewValue?.ToString(), true);
                Duration.BindValueChanged(duration => DurationField.Current.Value = duration.NewValue ?? TimeSpan.FromMinutes(30), true);

                playlist.Items.BindTo(Playlist);
                Playlist.BindCollectionChanged(onPlaylistChanged, true);
            }
Ejemplo n.º 16
0
            private void load(OsuColour colours)
            {
                InternalChildren = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4Extensions.FromHex(@"28242d"),
                    },
                    new GridContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        RowDimensions    = new[]
                        {
                            new Dimension(),
                            new Dimension(GridSizeMode.AutoSize),
                        },
                        Content = new[]
                        {
                            new Drawable[]
                            {
                                new OsuScrollContainer
                                {
                                    Padding = new MarginPadding
                                    {
                                        Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING,
                                        Vertical   = 10
                                    },
                                    RelativeSizeAxes = Axes.Both,
                                    Children         = new[]
                                    {
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 10),
                                            Children         = new Drawable[]
                                            {
                                                new Container
                                                {
                                                    Anchor  = Anchor.TopCentre,
                                                    Origin  = Anchor.TopCentre,
                                                    Padding = new MarginPadding {
                                                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                                                    },
                                                    RelativeSizeAxes = Axes.X,
                                                    AutoSizeAxes     = Axes.Y,
                                                    Children         = new Drawable[]
                                                    {
                                                        new SectionContainer
                                                        {
                                                            Padding = new MarginPadding {
                                                                Right = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Room name")
                                                                {
                                                                    Child = NameField = new SettingsTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                                new Section("Room visibility")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = AvailabilityPicker = new RoomAvailabilityPicker
                                                                    {
                                                                        Enabled = { Value = false }
                                                                    },
                                                                },
                                                                new Section("Game type")
                                                                {
                                                                    Child = new FillFlowContainer
                                                                    {
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        RelativeSizeAxes = Axes.X,
                                                                        Direction        = FillDirection.Vertical,
                                                                        Spacing          = new Vector2(7),
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            TypePicker = new MatchTypePicker
                                                                            {
                                                                                RelativeSizeAxes = Axes.X,
                                                                            },
                                                                            typeLabel = new OsuSpriteText
                                                                            {
                                                                                Font   = OsuFont.GetFont(size: 14),
                                                                                Colour = colours.Yellow
                                                                            },
                                                                        },
                                                                    },
                                                                },
                                                            },
                                                        },
                                                        new SectionContainer
                                                        {
                                                            Anchor  = Anchor.TopRight,
                                                            Origin  = Anchor.TopRight,
                                                            Padding = new MarginPadding {
                                                                Left = FIELD_PADDING / 2
                                                            },
                                                            Children = new[]
                                                            {
                                                                new Section("Max participants")
                                                                {
                                                                    Alpha = disabled_alpha,
                                                                    Child = MaxParticipantsField = new SettingsNumberTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                        ReadOnly = true,
                                                                    },
                                                                },
                                                                new Section("Password (optional)")
                                                                {
                                                                    Child = PasswordTextBox = new SettingsPasswordTextBox
                                                                    {
                                                                        RelativeSizeAxes         = Axes.X,
                                                                        TabbableContentContainer = this,
                                                                    },
                                                                },
                                                            }
                                                        }
                                                    },
                                                },
                                                initialBeatmapControl = new BeatmapSelectionControl
                                                {
                                                    Anchor           = Anchor.TopCentre,
                                                    Origin           = Anchor.TopCentre,
                                                    RelativeSizeAxes = Axes.X,
                                                    Width            = 0.5f
                                                }
                                            }
                                        }
                                    },
                                },
                            },
                            new Drawable[]
                            {
                                new Container
                                {
                                    Anchor           = Anchor.BottomLeft,
                                    Origin           = Anchor.BottomLeft,
                                    Y                = 2,
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Colour           = Color4Extensions.FromHex(@"28242d").Darken(0.5f).Opacity(1f),
                                        },
                                        new FillFlowContainer
                                        {
                                            RelativeSizeAxes = Axes.X,
                                            AutoSizeAxes     = Axes.Y,
                                            Direction        = FillDirection.Vertical,
                                            Spacing          = new Vector2(0, 20),
                                            Margin           = new MarginPadding {
                                                Vertical = 20
                                            },
                                            Padding = new MarginPadding {
                                                Horizontal = OsuScreen.HORIZONTAL_OVERFLOW_PADDING
                                            },
                                            Children = new Drawable[]
                                            {
                                                ApplyButton = new CreateOrUpdateButton
                                                {
                                                    Anchor  = Anchor.BottomCentre,
                                                    Origin  = Anchor.BottomCentre,
                                                    Size    = new Vector2(230, 55),
                                                    Enabled = { Value = false },
                                                    Action  = apply,
                                                },
                                                ErrorText = new OsuSpriteText
                                                {
                                                    Anchor = Anchor.BottomCentre,
                                                    Origin = Anchor.BottomCentre,
                                                    Alpha  = 0,
                                                    Depth  = 1,
                                                    Colour = colours.RedDark
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    },
                    loadingLayer = new LoadingLayer(true)
                };

                TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue.GetLocalisableDescription(), true);
                RoomName.BindValueChanged(name => NameField.Text           = name.NewValue, true);
                Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true);
                Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true);
                MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true);
                RoomID.BindValueChanged(roomId => initialBeatmapControl.Alpha       = roomId.NewValue == null ? 1 : 0, true);
                Password.BindValueChanged(password => PasswordTextBox.Text          = password.NewValue ?? string.Empty, true);

                operationInProgress.BindTo(ongoingOperationTracker.InProgress);
                operationInProgress.BindValueChanged(v =>
                {
                    if (v.NewValue)
                    {
                        loadingLayer.Show();
                    }
                    else
                    {
                        loadingLayer.Hide();
                    }
                });
            }
Ejemplo n.º 17
0
 private void clearTextbox(OsuTextBox textBox) => AddStep("clear textbox", () => textBox.Text = null);