Пример #1
0
        private void load()
        {
            Container audioTrackFileChooserContainer = new Container
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
            };

            Children = new Drawable[]
            {
                backgroundSpriteContainer = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = 250,
                    Masking          = true,
                    CornerRadius     = 10,
                },
                new OsuSpriteText
                {
                    Text = "Resources"
                },
                audioTrackTextBox = new FileChooserLabelledTextBox
                {
                    Label   = "Audio Track",
                    Current = { Value = Beatmap.Value.Metadata.AudioFile ?? "Click to select a track" },
                    Target  = audioTrackFileChooserContainer,
                    TabbableContentContainer = this
                },
                audioTrackFileChooserContainer,
            };

            updateBackgroundSprite();

            audioTrackTextBox.Current.BindValueChanged(audioTrackChanged);
        }
Пример #2
0
        private void load()
        {
            var metadata = Beatmap.Metadata;

            Children = new[]
            {
                ArtistTextBox = createTextBox <LabelledTextBox>("Artist",
                                                                !string.IsNullOrEmpty(metadata.ArtistUnicode) ? metadata.ArtistUnicode : metadata.Artist),
                RomanisedArtistTextBox = createTextBox <LabelledRomanisedTextBox>("Romanised Artist",
                                                                                  !string.IsNullOrEmpty(metadata.Artist) ? metadata.Artist : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),

                Empty(),

                TitleTextBox = createTextBox <LabelledTextBox>("Title",
                                                               !string.IsNullOrEmpty(metadata.TitleUnicode) ? metadata.TitleUnicode : metadata.Title),
                RomanisedTitleTextBox = createTextBox <LabelledRomanisedTextBox>("Romanised Title",
                                                                                 !string.IsNullOrEmpty(metadata.Title) ? metadata.Title : MetadataUtils.StripNonRomanisedCharacters(metadata.ArtistUnicode)),

                Empty(),

                creatorTextBox    = createTextBox <LabelledTextBox>("Creator", metadata.Author.Username),
                difficultyTextBox = createTextBox <LabelledTextBox>("Difficulty Name", Beatmap.BeatmapInfo.DifficultyName),
                sourceTextBox     = createTextBox <LabelledTextBox>(BeatmapsetsStrings.ShowInfoSource, metadata.Source),
                tagsTextBox       = createTextBox <LabelledTextBox>(BeatmapsetsStrings.ShowInfoTags, metadata.Tags)
            };

            foreach (var item in Children.OfType <LabelledTextBox>())
            {
                item.OnCommit += onCommit;
            }
        }
        private void createTextBox(bool hasDescription = false)
        {
            AddStep("create component", () =>
            {
                LabelledTextBox component;

                Child = new Container
                {
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Width        = 500,
                    AutoSizeAxes = Axes.Y,
                    Child        = component = new LabelledTextBox
                    {
                        Anchor          = Anchor.Centre,
                        Origin          = Anchor.Centre,
                        Label           = "Testing text",
                        PlaceholderText = "This is definitely working as intended",
                    }
                };

                component.Label       = "a sample component";
                component.Description = hasDescription ? "this text describes the component" : string.Empty;
            });
        }
Пример #4
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddInternal(new RhythmicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Spacing          = new Vector2(0, 10),
                        Children         = new Drawable[]
                        {
                            songTitle = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Song Title",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Song?.Name ?? "",
                            },
                            romanisedSongTitle = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Romanised Song Title",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Song?.NameUnicode ?? ""
                            },
                            new Box
                            {
                                Name             = "Spacer",
                                RelativeSizeAxes = Axes.X,
                                Height           = 1,
                                Colour           = Color4.Transparent
                            },
                            author = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Author",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Song?.Author ?? ""
                            },
                            romanisedAuthor = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Romanised Author",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Song?.AuthorUnicode ?? ""
                            }
                        }
                    }
                }
            });

            songTitle.OnCommit          += val => collection.CurrentBeatmap.Value.Metadata.Song.Name = val;
            romanisedSongTitle.OnCommit += val => collection.CurrentBeatmap.Value.Metadata.Song.NameUnicode = val;
            author.OnCommit             += val => collection.CurrentBeatmap.Value.Metadata.Song.Author = val;
            romanisedAuthor.OnCommit    += val => collection.CurrentBeatmap.Value.Metadata.Song.AuthorUnicode = val;
        }
Пример #5
0
        private void transferIfRomanised(string value, LabelledTextBox target)
        {
            if (MetadataUtils.IsRomanised(value))
            {
                target.Current.Value = value;
            }

            updateReadOnlyState();
            updateMetadata();
        }
Пример #6
0
        private void load()
        {
            Container audioTrackFileChooserContainer = createFileChooserContainer();
            Container backgroundFileChooserContainer = createFileChooserContainer();

            Children = new Drawable[]
            {
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        backgroundTextBox = new FileChooserLabelledTextBox(".jpg", ".jpeg", ".png")
                        {
                            Label                    = "Background",
                            FixedLabelWidth          = LABEL_WIDTH,
                            PlaceholderText          = "Click to select a background image",
                            Current                  = { Value = working.Value.Metadata.BackgroundFile },
                            Target                   = backgroundFileChooserContainer,
                            TabbableContentContainer = this
                        },
                        backgroundFileChooserContainer,
                    }
                },
                new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Direction        = FillDirection.Vertical,
                    Children         = new Drawable[]
                    {
                        audioTrackTextBox = new FileChooserLabelledTextBox(".mp3", ".ogg")
                        {
                            Label                    = "Audio Track",
                            FixedLabelWidth          = LABEL_WIDTH,
                            PlaceholderText          = "Click to select a track",
                            Current                  = { Value = working.Value.Metadata.AudioFile },
                            Target                   = audioTrackFileChooserContainer,
                            TabbableContentContainer = this
                        },
                        audioTrackFileChooserContainer,
                    }
                }
            };

            backgroundTextBox.Current.BindValueChanged(backgroundChanged);
            audioTrackTextBox.Current.BindValueChanged(audioTrackChanged);
        }
Пример #7
0
        private void load()
        {
            Children = new Drawable[]
            {
                new OsuSpriteText
                {
                    Text = "Beatmap metadata"
                },
                artistTextBox = new LabelledTextBox
                {
                    Label   = "Artist",
                    Current = { Value = Beatmap.Metadata.Artist },
                    TabbableContentContainer = this
                },
                titleTextBox = new LabelledTextBox
                {
                    Label   = "Title",
                    Current = { Value = Beatmap.Metadata.Title },
                    TabbableContentContainer = this
                },
                creatorTextBox = new LabelledTextBox
                {
                    Label   = "Creator",
                    Current = { Value = Beatmap.Metadata.AuthorString },
                    TabbableContentContainer = this
                },
                difficultyTextBox = new LabelledTextBox
                {
                    Label   = "Difficulty Name",
                    Current = { Value = Beatmap.BeatmapInfo.Version },
                    TabbableContentContainer = this
                },
            };

            foreach (var item in Children.OfType <LabelledTextBox>())
            {
                item.OnCommit += onCommit;
            }
        }
Пример #8
0
        private void load(BindableClassWithCurrent <Singer> currentSinger)
        {
            Children = new Drawable[]
            {
                new OsuSpriteText
                {
                    Text = "Singer metadata"
                },
                nameTextBox = new LabelledTextBox
                {
                    Label = "Singer",
                    TabbableContentContainer = this
                },
                romajiNameTextBox = new LabelledTextBox
                {
                    Label = "Romaji name",
                    TabbableContentContainer = this
                },
                englishNameTextBox = new LabelledTextBox
                {
                    Label = "English name",
                    TabbableContentContainer = this
                },
                descriptionTextBox = new LabelledTextBox
                {
                    Label = "Description",
                    TabbableContentContainer = this
                },
            };

            currentSinger.BindValueChanged(e =>
            {
                var singer = e.NewValue;
                nameTextBox.Current.Value        = singer.Name;
                romajiNameTextBox.Current.Value  = singer.RomajiName;
                englishNameTextBox.Current.Value = singer.EnglishName;
                descriptionTextBox.Current.Value = singer.Description;
            });

            foreach (var item in Children.OfType <LabelledTextBox>())
            {
                item.OnCommit += onCommit;
            }

            void onCommit(TextBox sender, bool newText)
            {
                if (!newText)
                {
                    return;
                }

                var singer = currentSinger.Value;

                // for now, update these on commit rather than making BeatmapMetadata bindables.
                // after switching database engines we can reconsider if switching to bindables is a good direction.
                singer.Name        = nameTextBox.Current.Value;
                singer.RomajiName  = romajiNameTextBox.Current.Value;
                singer.EnglishName = englishNameTextBox.Current.Value;
                singer.Description = descriptionTextBox.Current.Value;

                // trigger update change to let parent update info.
                currentSinger.TriggerOtherChange();
            }
        }
        private void load(OsuColour colours)
        {
            Child = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Padding          = new MarginPadding(50),
                Child            = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Masking          = true,
                    CornerRadius     = 10,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.GreySeafoamDark,
                            RelativeSizeAxes = Axes.Both,
                        },
                        new OsuScrollContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(10),
                            Child            = flow = new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Spacing          = new Vector2(20),
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 250,
                                        Masking          = true,
                                        CornerRadius     = 10,
                                        Child            = new BeatmapBackgroundSprite(Beatmap.Value)
                                        {
                                            RelativeSizeAxes = Axes.Both,
                                            Anchor           = Anchor.Centre,
                                            Origin           = Anchor.Centre,
                                            FillMode         = FillMode.Fill,
                                        },
                                    },
                                    new OsuSpriteText
                                    {
                                        Text = "Beatmap metadata"
                                    },
                                    artistTextBox = new LabelledTextBox
                                    {
                                        Label   = "Artist",
                                        Current = { Value = Beatmap.Value.Metadata.Artist },
                                        TabbableContentContainer = this
                                    },
                                    titleTextBox = new LabelledTextBox
                                    {
                                        Label   = "Title",
                                        Current = { Value = Beatmap.Value.Metadata.Title },
                                        TabbableContentContainer = this
                                    },
                                    creatorTextBox = new LabelledTextBox
                                    {
                                        Label   = "Creator",
                                        Current = { Value = Beatmap.Value.Metadata.AuthorString },
                                        TabbableContentContainer = this
                                    },
                                    difficultyTextBox = new LabelledTextBox
                                    {
                                        Label   = "Difficulty Name",
                                        Current = { Value = Beatmap.Value.BeatmapInfo.Version },
                                        TabbableContentContainer = this
                                    },
                                }
                            },
                        },
                    }
                }
            };

            foreach (var item in flow.OfType <LabelledTextBox>())
            {
                item.OnCommit += onCommit;
            }
        }
Пример #10
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            AddInternal(new RhythmicScrollContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        Direction        = FillDirection.Vertical,
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Spacing          = new Vector2(0, 10),
                        Children         = new Drawable[]
                        {
                            levelTitle = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Level Title",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Level?.LevelName ?? ""
                            },
                            romanisedLevelTitle = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Romanised Level Title",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Level?.LevelNameUnicode ?? ""
                            },
                            new Box
                            {
                                Name             = "Spacer",
                                RelativeSizeAxes = Axes.X,
                                Height           = 1,
                                Colour           = Color4.Transparent
                            },
                            difficulty = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Difficulty",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Level?.Difficulty ?? ""
                            },
                            source = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Source",
                                Text             = collection?.CurrentBeatmap?.Value?.Metadata?.Level?.Source ?? ""
                            },
                            tags = new LabelledTextBox
                            {
                                RelativeSizeAxes = Axes.X,
                                LabelText        = "Tags"
                            },
                        }
                    }
                }
            });

            levelTitle.OnCommit          += val => collection.CurrentBeatmap.Value.Metadata.Level.LevelName = val;
            romanisedLevelTitle.OnCommit += val => collection.CurrentBeatmap.Value.Metadata.Level.LevelNameUnicode = val;
            difficulty.OnCommit          += val => collection.CurrentBeatmap.Value.Metadata.Level.Difficulty = val;
            source.OnCommit += val => collection.CurrentBeatmap.Value.Metadata.Level.Source = val;
            tags.OnCommit   += val => collection.CurrentBeatmap.Value.Metadata.Level.Tags.Add(val);
        }