Exemple #1
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            hoverColour  = colours.Yellow;
            artistColour = colours.Gray9;

            var metadata = BeatmapSetInfo.Metadata;

            FilterTerms = metadata.SearchableTerms;

            Children = new Drawable[]
            {
                handle = new PlaylistItemHandle
                {
                    Colour = colours.Gray5
                },
                text = new OsuTextFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Left = 20
                    },
                    ContentIndent = 10f,
                },
            };

            titleBind  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
            artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);

            artistBind.ValueChanged += newText => recreateText();
            artistBind.TriggerChange();
        }
Exemple #2
0
        private LocalisationEngine engine; //keep a reference to avoid GC of the engine

        public override void Reset()
        {
            base.Reset();

            var config = new FakeFrameworkConfigManager();

            engine = new LocalisationEngine(config);

            engine.AddLanguage("en", new FakeStorage());
            engine.AddLanguage("zh-CHS", new FakeStorage());
            engine.AddLanguage("ja", new FakeStorage());

            Add(new FillFlowContainer <SpriteText>
            {
                Anchor       = Anchor.Centre,
                Origin       = Anchor.Centre,
                Direction    = FillDirection.Vertical,
                Spacing      = new Vector2(0, 10),
                Padding      = new MarginPadding(10),
                AutoSizeAxes = Axes.Both,
                Children     = new[]
                {
                    new SpriteText
                    {
                        Text     = "Not localisable",
                        TextSize = 48,
                        Colour   = Color4.White
                    },
                    new SpriteText
                    {
                        Current  = engine.GetLocalisedString("localisable"),
                        TextSize = 48,
                        Colour   = Color4.White
                    },
                    new SpriteText
                    {
                        Current  = engine.GetUnicodePreference("Unicode on", "Unicode off"),
                        TextSize = 48,
                        Colour   = Color4.White
                    },
                    new SpriteText
                    {
                        Current  = engine.GetUnicodePreference(null, "I miss unicode"),
                        TextSize = 48,
                        Colour   = Color4.White
                    },
                    new SpriteText
                    {
                        Current  = engine.Format("{0}", DateTime.Now),
                        TextSize = 48,
                        Colour   = Color4.White
                    },
                }
            });

            AddStep("English", () => config.Set(FrameworkSetting.Locale, "en"));
            AddStep("Japanese", () => config.Set(FrameworkSetting.Locale, "ja"));
            AddStep("Simplified Chinese", () => config.Set(FrameworkSetting.Locale, "zh-CHS"));
            AddToggleStep("ShowUnicode", b => config.Set(FrameworkSetting.ShowUnicode, b));
        }
Exemple #3
0
        private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
        {
            coloredBackground.Colour = underscoreLine.Colour = colour.Gray4;

            Stats.Add(new OsuSpriteText
            {
                Text     = $"accuracy: {Score.Accuracy:P2}",
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
                Colour   = colour.GrayA,
                TextSize = 11,
                Font     = "Exo2.0-RegularItalic",
                Depth    = -1,
            });

            metadata.Add(new MetadataContainer(Score.Beatmap.Metadata.Title, Score.Beatmap.Metadata.Artist)
            {
                AutoSizeAxes = Axes.Both,
                Action       = () =>
                {
                    if (Score.Beatmap.OnlineBeatmapSetID.HasValue)
                    {
                        beatmapSetOverlay?.ShowBeatmapSet(Score.Beatmap.OnlineBeatmapSetID.Value);
                    }
                },
                Child = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Current = locale.GetUnicodePreference(
                                $"{Score.Beatmap.Metadata.TitleUnicode ?? Score.Beatmap.Metadata.Title} [{Score.Beatmap.Version}] ",
                                $"{Score.Beatmap.Metadata.Title ?? Score.Beatmap.Metadata.TitleUnicode} [{Score.Beatmap.Version}] "
                                ),
                            TextSize = 15,
                            Font     = "Exo2.0-SemiBoldItalic",
                        },
                        new OsuSpriteText
                        {
                            Current  = locale.GetUnicodePreference(Score.Beatmap.Metadata.ArtistUnicode, Score.Beatmap.Metadata.Artist),
                            TextSize = 12,
                            Padding  = new MarginPadding {
                                Top = 3
                            },
                            Font = "Exo2.0-RegularItalic",
                        },
                    },
                },
            });

            foreach (Mod mod in Score.Mods)
            {
                modsContainer.Add(new ModIcon(mod)
                {
                    Scale = new Vector2(0.5f)
                });
            }
        }
Exemple #4
0
        private void setupConfig()
        {
            Dependencies.Cache(debugConfig  = new FrameworkDebugConfigManager());
            Dependencies.Cache(config       = new FrameworkConfigManager(Storage));
            Dependencies.Cache(Localisation = new LocalisationEngine(config));

            activeGCMode = debugConfig.GetBindable <GCLatencyMode>(DebugSetting.ActiveGCMode);
            activeGCMode.ValueChanged += newMode =>
            {
                GCSettings.LatencyMode = IsActive ? newMode : GCLatencyMode.Interactive;
            };

            frameSyncMode = config.GetBindable <FrameSync>(FrameworkSetting.FrameSync);
            frameSyncMode.ValueChanged += newMode =>
            {
                float refreshRate = DisplayDevice.Default.RefreshRate;

                float drawLimiter   = refreshRate;
                float updateLimiter = drawLimiter * 2;

                setVSyncMode();

                switch (newMode)
                {
                case FrameSync.VSync:
                    drawLimiter    = int.MaxValue;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit2x:
                    drawLimiter   *= 2;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit4x:
                    drawLimiter   *= 4;
                    updateLimiter *= 4;
                    break;

                case FrameSync.Limit8x:
                    drawLimiter   *= 8;
                    updateLimiter *= 8;
                    break;

                case FrameSync.Unlimited:
                    drawLimiter = updateLimiter = int.MaxValue;
                    break;
                }

                if (DrawThread != null)
                {
                    DrawThread.ActiveHz = drawLimiter;
                }
                if (UpdateThread != null)
                {
                    UpdateThread.ActiveHz = updateLimiter;
                }
            };
        }
        private void load(LocalisationEngine localisation, BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay)
        {
            if (localisation == null)
            {
                throw new ArgumentNullException(nameof(localisation));
            }

            restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore);
            dialogOverlay          = overlay;
            if (beatmapOverlay != null)
            {
                viewDetails = beatmapOverlay.FetchAndShowBeatmapSet;
            }

            Children = new Drawable[]
            {
                new DelayedLoadUnloadWrapper(() =>
                                             new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
                {
                    RelativeSizeAxes = Axes.Both,
                    OnLoadComplete   = d => d.FadeInFromZero(1000, Easing.OutQuint),
                }, 300, 5000
                                             ),
                new FillFlowContainer
                {
                    Direction = FillDirection.Vertical,
                    Padding   = new MarginPadding {
                        Top = 5, Left = 18, Right = 10, Bottom = 10
                    },
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Font     = @"Exo2.0-BoldItalic",
                            Current  = localisation.GetUnicodePreference(beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title),
                            TextSize = 22,
                            Shadow   = true,
                        },
                        new OsuSpriteText
                        {
                            Font     = @"Exo2.0-SemiBoldItalic",
                            Current  = localisation.GetUnicodePreference(beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist),
                            TextSize = 17,
                            Shadow   = true,
                        },
                        new FillFlowContainer <FilterableDifficultyIcon>
                        {
                            Margin = new MarginPadding {
                                Top = 5
                            },
                            AutoSizeAxes = Axes.Both,
                            Children     = ((CarouselBeatmapSet)Item).Beatmaps.Select(b => new FilterableDifficultyIcon(b)).ToList()
                        }
                    }
                }
            };
        }
Exemple #6
0
            private void load(OsuColour colours, LocalisationEngine localisation)
            {
                title.Colour         = artist.Colour = colours.BlueDarker;
                versionMapper.Colour = colours.Gray8;

                versionMapper.Text = $"{beatmap.Version} - mapped by {beatmap.Metadata.Author}";
                title.Current      = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
                artist.Current     = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
            }
Exemple #7
0
        private void load(LocalisationEngine localisation)
        {
            if (localisation == null)
            {
                throw new ArgumentNullException(nameof(localisation));
            }

            title.Current  = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
            artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
        }
Exemple #8
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            this.localisation = localisation;
            this.colours      = colours;

            beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9;
            host.Colour            = colours.Blue;

            displayStatus(Room.Status.Value);
        }
Exemple #9
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            BeatmapMetadata metadata = BeatmapSetInfo.Metadata;

            FilterTerms = metadata.SearchableTerms;

            Children = new Drawable[]
            {
                handle = new TextAwesome
                {
                    Anchor   = Anchor.TopLeft,
                    Origin   = Anchor.TopLeft,
                    TextSize = 12,
                    Colour   = colours.Gray5,
                    Icon     = FontAwesome.fa_bars,
                    Alpha    = 0f,
                    Margin   = new MarginPadding {
                        Left = 5
                    },
                    Padding = new MarginPadding {
                        Top = 2
                    },
                },
                new FillFlowContainer <OsuSpriteText>
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Left = 20
                    },
                    Spacing  = new Vector2(5f, 0f),
                    Children = new []
                    {
                        title = new OsuSpriteText
                        {
                            TextSize = 16,
                            Font     = @"Exo2.0-Regular",
                            Current  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title),
                        },
                        new OsuSpriteText
                        {
                            TextSize = 14,
                            Font     = @"Exo2.0-Bold",
                            Colour   = colours.Gray9,
                            Padding  = new MarginPadding {
                                Top = 1
                            },
                            Current = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist),
                        }
                    }
                },
            };

            hoverColour = colours.Yellow;
        }
Exemple #10
0
        public DatabaseController(GameHost host, DependencyContainer dependencies)
        {
            Dependencies = dependencies;
            Connection   = host.Storage.GetDatabase(@"client");

            Dependencies.Cache(debugConfig  = new FrameworkDebugConfigManager());
            Dependencies.Cache(config       = new FrameworkConfigManager(host.Storage));
            Dependencies.Cache(Localisation = new LocalisationEngine(config));

            Dependencies.Cache(RulesetDatabase = new RulesetDatabase(host.Storage, Connection));
            Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(host.Storage, Connection, RulesetDatabase, host));
            Dependencies.Cache(ScoreDatabase   = new ScoreDatabase(host.Storage, Connection, host, BeatmapDatabase));
        }
Exemple #11
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            this.localisation = localisation;
            this.colours      = colours;

            beatmapInfoFlow.Colour = colours.Gray9;

            //binded here instead of ctor because dependencies are needed
            statusBind.ValueChanged  += displayStatus;
            beatmapBind.ValueChanged += displayBeatmap;

            statusBind.TriggerChange();
            beatmapBind.TriggerChange();
        }
Exemple #12
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            this.localisation = localisation;
            this.colours      = colours;

            beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9;
            host.Colour          = colours.Blue;

            //binded here instead of ctor because dependencies are needed
            statusBind.ValueChanged  += displayStatus;
            typeBind.ValueChanged    += displayGameType;
            beatmapBind.ValueChanged += displayBeatmap;

            statusBind.TriggerChange();
            typeBind.TriggerChange();
            beatmapBind.TriggerChange();
        }
Exemple #13
0
        private void load(LocalisationEngine localisation)
        {
            if (localisation == null)
            {
                throw new ArgumentNullException(nameof(localisation));
            }

            Children = new Drawable[]
            {
                new DelayedLoadWrapper(
                    new PanelBackground(beatmap)
                {
                    RelativeSizeAxes = Axes.Both,
                    OnLoadComplete   = d => d.FadeInFromZero(400, Easing.Out),
                }, 300),
                new FillFlowContainer
                {
                    Direction = FillDirection.Vertical,
                    Padding   = new MarginPadding {
                        Top = 5, Left = 18, Right = 10, Bottom = 10
                    },
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Font     = @"Exo2.0-BoldItalic",
                            Current  = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title),
                            TextSize = 22,
                            Shadow   = true,
                        },
                        new OsuSpriteText
                        {
                            Font     = @"Exo2.0-SemiBoldItalic",
                            Current  = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist),
                            TextSize = 17,
                            Shadow   = true,
                        },
                        difficultyIcons
                    }
                }
            };
        }
Exemple #14
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            hoverColour  = colours.Yellow;
            artistColour = colours.Gray9;

            var metadata = BeatmapSetInfo.Metadata;

            FilterTerms = metadata.SearchableTerms;

            Children = new Drawable[]
            {
                handle = new TextAwesome
                {
                    Anchor   = Anchor.TopLeft,
                    Origin   = Anchor.TopLeft,
                    TextSize = 12,
                    Colour   = colours.Gray5,
                    Icon     = FontAwesome.fa_bars,
                    Alpha    = 0f,
                    Margin   = new MarginPadding {
                        Left = 5
                    },
                    Padding = new MarginPadding {
                        Top = 2
                    },
                },
                text = new Paragraph
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Left = 20
                    },
                    ContentIndent = 10f,
                },
            };

            titleBind  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
            artistBind = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);

            artistBind.ValueChanged += newText => recreateText();
            artistBind.TriggerChange();
        }
Exemple #15
0
            private void load(OsuColour colours, LocalisationEngine localisation)
            {
                title.Colour         = artist.Colour = colours.BlueDarker;
                versionMapper.Colour = colours.Gray8;

                var creator = beatmap.Metadata.Author?.Username;

                if (!string.IsNullOrEmpty(creator))
                {
                    versionMapper.Text = $"mapped by {creator}";

                    if (!string.IsNullOrEmpty(beatmap.Version))
                    {
                        versionMapper.Text = $"{beatmap.Version} - " + versionMapper.Text;
                    }
                }

                title.Current  = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
                artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
            }
Exemple #16
0
        private void load(LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
        {
            Action = () =>
            {
                if (beatmap.OnlineBeatmapID != null)
                {
                    beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value);
                }
                else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null)
                {
                    beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value);
                }
            };

            Child = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Children     = new Drawable[]
                {
                    new OsuSpriteText
                    {
                        Current = locale.GetUnicodePreference(
                            $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
                            $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] "
                            ),
                        TextSize = 15,
                        Font     = "Exo2.0-SemiBoldItalic",
                    },
                    new OsuSpriteText
                    {
                        Current  = locale.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist),
                        TextSize = 12,
                        Padding  = new MarginPadding {
                            Top = 3
                        },
                        Font = "Exo2.0-RegularItalic",
                    },
                },
            };
        }
Exemple #17
0
            private void load(LocalisationEngine localisation)
            {
                var beatmapInfo = working.BeatmapInfo;
                var metadata    = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();

                PixelSnapping         = true;
                CacheDrawnFrameBuffer = true;
                RelativeSizeAxes      = Axes.Both;

                titleBinding  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title);
                artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist);

                Children = new Drawable[]
                {
                    // We will create the white-to-black gradient by modulating transparency and having
                    // a black backdrop. This results in an sRGB-space gradient and not linear space,
                    // transitioning from white to black more perceptually uniformly.
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Color4.Black,
                    },
                    // We use a container, such that we can set the colour gradient to go across the
                    // vertices of the masked container instead of the vertices of the (larger) sprite.
                    new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)),
                        Children         = new[]
                        {
                            // Zoomed-in and cropped beatmap background
                            new BeatmapBackgroundSprite(working)
                            {
                                RelativeSizeAxes = Axes.Both,
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                FillMode         = FillMode.Fill,
                            },
                        },
                    },
                    new DifficultyColourBar(beatmapInfo)
                    {
                        RelativeSizeAxes = Axes.Y,
                        Width            = 20,
                    },
                    new FillFlowContainer
                    {
                        Name      = "Top-aligned metadata",
                        Anchor    = Anchor.TopLeft,
                        Origin    = Anchor.TopLeft,
                        Direction = FillDirection.Vertical,
                        Margin    = new MarginPadding {
                            Top = 10, Left = 25, Right = 10, Bottom = 20
                        },
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            VersionLabel = new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                Text     = beatmapInfo.Version,
                                TextSize = 24,
                            },
                        }
                    },
                    new FillFlowContainer
                    {
                        Name      = "Centre-aligned metadata",
                        Anchor    = Anchor.CentreLeft,
                        Origin    = Anchor.TopLeft,
                        Y         = -22,
                        Direction = FillDirection.Vertical,
                        Margin    = new MarginPadding {
                            Top = 15, Left = 25, Right = 10, Bottom = 20
                        },
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            TitleLabel = new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                TextSize = 28,
                            },
                            ArtistLabel = new OsuSpriteText
                            {
                                Font     = @"Exo2.0-MediumItalic",
                                TextSize = 17,
                            },
                            MapperContainer = new FillFlowContainer
                            {
                                Margin = new MarginPadding {
                                    Top = 10
                                },
                                Direction    = FillDirection.Horizontal,
                                AutoSizeAxes = Axes.Both,
                                Children     = getMapper(metadata)
                            },
                            InfoLabelContainer = new FillFlowContainer
                            {
                                Margin = new MarginPadding {
                                    Top = 20
                                },
                                Spacing      = new Vector2(20, 0),
                                AutoSizeAxes = Axes.Both,
                                Children     = getInfoLabels()
                            }
                        }
                    }
                };
                artistBinding.ValueChanged += value => setMetadata(metadata.Source);
                artistBinding.TriggerChange();
            }
Exemple #18
0
            private void load(LocalisationEngine localisation)
            {
                var metadata = beatmap?.BeatmapInfo?.Metadata ?? new BeatmapMetadata();

                AutoSizeAxes = Axes.Both;
                Children     = new Drawable[]
                {
                    new FillFlowContainer
                    {
                        AutoSizeAxes = Axes.Both,
                        Origin       = Anchor.TopCentre,
                        Anchor       = Anchor.TopCentre,
                        Direction    = FillDirection.Vertical,
                        Children     = new Drawable[]
                        {
                            new OsuSpriteText
                            {
                                Current  = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title),
                                TextSize = 36,
                                Font     = @"Exo2.0-MediumItalic",
                                Origin   = Anchor.TopCentre,
                                Anchor   = Anchor.TopCentre,
                            },
                            new OsuSpriteText
                            {
                                Current  = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist),
                                TextSize = 26,
                                Font     = @"Exo2.0-MediumItalic",
                                Origin   = Anchor.TopCentre,
                                Anchor   = Anchor.TopCentre,
                            },
                            new Container
                            {
                                Size         = new Vector2(300, 60),
                                Margin       = new MarginPadding(10),
                                Origin       = Anchor.TopCentre,
                                Anchor       = Anchor.TopCentre,
                                CornerRadius = 10,
                                Masking      = true,
                                Children     = new[]
                                {
                                    new Sprite
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Texture          = beatmap?.Background,
                                        Origin           = Anchor.Centre,
                                        Anchor           = Anchor.Centre,
                                        FillMode         = FillMode.Fill,
                                    },
                                }
                            },
                            new OsuSpriteText
                            {
                                Text     = beatmap?.BeatmapInfo?.Version,
                                TextSize = 26,
                                Font     = @"Exo2.0-MediumItalic",
                                Origin   = Anchor.TopCentre,
                                Anchor   = Anchor.TopCentre,
                                Margin   = new MarginPadding
                                {
                                    Bottom = 40
                                },
                            },
                            new MetadataLine("Source", metadata.Source)
                            {
                                Origin = Anchor.TopCentre,
                                Anchor = Anchor.TopCentre,
                            },
                            new MetadataLine("Composer", string.Empty)
                            {
                                Origin = Anchor.TopCentre,
                                Anchor = Anchor.TopCentre,
                            },
                            new MetadataLine("Mapper", metadata.AuthorString)
                            {
                                Origin = Anchor.TopCentre,
                                Anchor = Anchor.TopCentre,
                            },
                        },
                    }
                };
            }
Exemple #19
0
 private void load(LocalisationEngine localisation)
 {
     this.localisation = localisation;
 }
Exemple #20
0
        private void load(LocalisationEngine localisation)
        {
            Content.CornerRadius = 5;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Current  = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                                    TextSize = 18,
                                    Font     = @"Exo2.0-BoldItalic",
                                },
                                new OsuSpriteText
                                {
                                    Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                                    Font    = @"Exo2.0-BoldItalic",
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.X,
                                    Height       = 20,
                                    Margin       = new MarginPadding {
                                        Top = vertical_padding, Bottom = vertical_padding
                                    },
                                    Children = GetDifficultyIcons(),
                                },
                            },
                        },
                        new FillFlowContainer
                        {
                            Anchor       = Anchor.TopRight,
                            Origin       = Anchor.TopRight,
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Margin       = new MarginPadding {
                                Right = height - vertical_padding * 2 + vertical_padding
                            },
                            Children = new Drawable[]
                            {
                                new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
                                {
                                    Margin = new MarginPadding {
                                        Right = 1
                                    },
                                },
                                new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
                                new FillFlowContainer
                                {
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Children     = new[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Text     = "mapped by ",
                                            TextSize = 14,
                                        },
                                        new OsuSpriteText
                                        {
                                            Text     = SetInfo.Metadata.Author,
                                            TextSize = 14,
                                            Font     = @"Exo2.0-SemiBoldItalic",
                                        },
                                    },
                                },
                                new OsuSpriteText
                                {
                                    Text     = $"from {SetInfo.Metadata.Source}",
                                    Anchor   = Anchor.TopRight,
                                    Origin   = Anchor.TopRight,
                                    TextSize = 14,
                                    Alpha    = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                },
                            },
                        },
                        new DownloadButton
                        {
                            Anchor = Anchor.TopRight,
                            Origin = Anchor.TopRight,
                            Size   = new Vector2(height - vertical_padding * 2),
                            Action = StartDownload
                        },
                    },
                },
            });
        }
Exemple #21
0
        private void setupConfig()
        {
            Dependencies.Cache(debugConfig  = new FrameworkDebugConfigManager());
            Dependencies.Cache(config       = new FrameworkConfigManager(Storage));
            Dependencies.Cache(Localisation = new LocalisationEngine(config));

            activeGCMode = debugConfig.GetBindable <GCLatencyMode>(DebugSetting.ActiveGCMode);
            activeGCMode.ValueChanged += newMode =>
            {
                GCSettings.LatencyMode = IsActive ? newMode : GCLatencyMode.Interactive;
            };

            frameSyncMode = config.GetBindable <FrameSync>(FrameworkSetting.FrameSync);
            frameSyncMode.ValueChanged += newMode =>
            {
                float refreshRate = DisplayDevice.Default.RefreshRate;
                // For invalid refresh rates let's assume 60 Hz as it is most common.
                if (refreshRate <= 0)
                {
                    refreshRate = 60;
                }

                float drawLimiter   = refreshRate;
                float updateLimiter = drawLimiter * 2;

                setVSyncMode();

                switch (newMode)
                {
                case FrameSync.VSync:
                    drawLimiter    = int.MaxValue;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit2x:
                    drawLimiter   *= 2;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit4x:
                    drawLimiter   *= 4;
                    updateLimiter *= 4;
                    break;

                case FrameSync.Limit8x:
                    drawLimiter   *= 8;
                    updateLimiter *= 8;
                    break;

                case FrameSync.Unlimited:
                    drawLimiter = updateLimiter = int.MaxValue;
                    break;
                }

                if (DrawThread != null)
                {
                    DrawThread.ActiveHz = drawLimiter;
                }
                if (UpdateThread != null)
                {
                    UpdateThread.ActiveHz = updateLimiter;
                }
            };

            ignoredInputHandlers = config.GetBindable <string>(FrameworkSetting.IgnoredInputHandlers);
            ignoredInputHandlers.ValueChanged += ignoredString =>
            {
                var configIgnores = ignoredString.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s));

                // for now, we always want at least one handler disabled (don't want raw and non-raw mouse at once).
                bool restoreDefaults = !configIgnores.Any();

                if (restoreDefaults)
                {
                    resetInputHandlers();
                    ignoredInputHandlers.Value = string.Join(" ", AvailableInputHandlers.Where(h => !h.Enabled).Select(h => h.ToString()));
                }
                else
                {
                    foreach (var handler in AvailableInputHandlers)
                    {
                        var handlerType = handler.ToString();
                        handler.Enabled.Value = configIgnores.All(ch => ch != handlerType);
                    }
                }
            };

            cursorSensitivity = config.GetBindable <double>(FrameworkSetting.CursorSensitivity);

            performanceLogging = config.GetBindable <bool>(FrameworkSetting.PerformanceLogging);
            performanceLogging.ValueChanged += enabled => threads.ForEach(t => t.Monitor.EnablePerformanceProfiling = enabled);
            performanceLogging.TriggerChange();
        }
Exemple #22
0
        private void load(OsuGameBase game, OsuColour colours, LocalisationEngine localisation)
        {
            this.localisation = localisation;

            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay
                        {
                            RelativeSizeAxes = Axes.X,
                            Y = player_height + 10,
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(40),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                currentBackground = new Background(),
                                title             = new OsuSpriteText
                                {
                                    Origin   = Anchor.BottomCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 40),
                                    TextSize = 25,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-MediumItalic"
                                },
                                artist = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 45),
                                    TextSize = 15,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-BoldItalic"
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                new IconButton
                                                {
                                                    Action = prev,
                                                    Icon   = FontAwesome.fa_step_backward,
                                                },
                                                playButton = new IconButton
                                                {
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = play,
                                                    Icon      = FontAwesome.fa_play_circle_o,
                                                },
                                                new IconButton
                                                {
                                                    Action = next,
                                                    Icon   = FontAwesome.fa_step_forward,
                                                },
                                            }
                                        },
                                        playlistButton = new IconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.fa_bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new DragBar
                                {
                                    Origin        = Anchor.BottomCentre,
                                    Anchor        = Anchor.BottomCentre,
                                    Height        = progress_height,
                                    Colour        = colours.Yellow,
                                    SeekRequested = seek
                                }
                            },
                        },
                    }
                }
            };

            beatmapBacking.BindTo(game.Beatmap);

            playlist.StateChanged += (c, s) => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, EasingTypes.OutQuint);
        }
Exemple #23
0
        private void setupConfig()
        {
            Dependencies.Cache(debugConfig  = new FrameworkDebugConfigManager());
            Dependencies.Cache(config       = new FrameworkConfigManager(Storage));
            Dependencies.Cache(Localisation = new LocalisationEngine(config));

            activeGCMode = debugConfig.GetBindable <GCLatencyMode>(DebugSetting.ActiveGCMode);
            activeGCMode.ValueChanged += newMode =>
            {
                GCSettings.LatencyMode = IsActive ? newMode : GCLatencyMode.Interactive;
            };

            frameSyncMode = config.GetBindable <FrameSync>(FrameworkSetting.FrameSync);
            frameSyncMode.ValueChanged += newMode =>
            {
                float refreshRate = DisplayDevice.Default.RefreshRate;
                // For invalid refresh rates let's assume 60 Hz as it is most common.
                if (refreshRate <= 0)
                {
                    refreshRate = 60;
                }

                float drawLimiter   = refreshRate;
                float updateLimiter = drawLimiter * 2;

                setVSyncMode();

                switch (newMode)
                {
                case FrameSync.VSync:
                    drawLimiter    = int.MaxValue;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit2x:
                    drawLimiter   *= 2;
                    updateLimiter *= 2;
                    break;

                case FrameSync.Limit4x:
                    drawLimiter   *= 4;
                    updateLimiter *= 4;
                    break;

                case FrameSync.Limit8x:
                    drawLimiter   *= 8;
                    updateLimiter *= 8;
                    break;

                case FrameSync.Unlimited:
                    drawLimiter = updateLimiter = int.MaxValue;
                    break;
                }

                if (DrawThread != null)
                {
                    DrawThread.ActiveHz = drawLimiter;
                }
                if (UpdateThread != null)
                {
                    UpdateThread.ActiveHz = updateLimiter;
                }
            };

            enabledInputHandlers = config.GetBindable <string>(FrameworkSetting.ActiveInputHandlers);
            enabledInputHandlers.ValueChanged += enabledString =>
            {
                var  configHandlers = enabledString.Split(' ').Where(s => !string.IsNullOrWhiteSpace(s));
                bool useDefaults    = !configHandlers.Any();

                // make sure all the handlers in the configuration file are available, else reset to sane defaults.
                foreach (string handler in configHandlers)
                {
                    if (AvailableInputHandlers.All(h => h.ToString() != handler))
                    {
                        useDefaults = true;
                        break;
                    }
                }

                if (useDefaults)
                {
                    resetInputHandlers();
                    enabledInputHandlers.Value = string.Join(" ", AvailableInputHandlers.Where(h => h.Enabled).Select(h => h.ToString()));
                }
                else
                {
                    foreach (var handler in AvailableInputHandlers)
                    {
                        var handlerType = handler.ToString();
                        handler.Enabled.Value = configHandlers.Any(ch => ch == handlerType);
                    }
                }
            };

            cursorSensitivity = config.GetBindable <double>(FrameworkSetting.CursorSensitivity);
        }
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            Box             sideStrip;
            Container       coverContainer;
            OsuSpriteText   name, status, beatmapTitle, beatmapDash, beatmapArtist;
            ParticipantInfo participantInfo;
            ModeTypeInfo    modeTypeInfo;

            Children = new Drawable[]
            {
                selectionBox,
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding(selection_border_width),
                    Child            = new Container
                    {
                        RelativeSizeAxes = Axes.Both,
                        Masking          = true,
                        CornerRadius     = corner_radius,
                        EdgeEffect       = new EdgeEffectParameters
                        {
                            Type   = EdgeEffectType.Shadow,
                            Colour = Color4.Black.Opacity(40),
                            Radius = 5,
                        },
                        Children = new Drawable[]
                        {
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = OsuColour.FromHex(@"212121"),
                            },
                            sideStrip = new Box
                            {
                                RelativeSizeAxes = Axes.Y,
                                Width            = side_strip_width,
                            },
                            new Container
                            {
                                Width            = cover_width,
                                RelativeSizeAxes = Axes.Y,
                                Masking          = true,
                                Margin           = new MarginPadding {
                                    Left = side_strip_width
                                },
                                Children = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4.Black,
                                    },
                                    coverContainer = new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                    },
                                },
                            },
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Vertical = content_padding,
                                    Left     = side_strip_width + cover_width + content_padding,
                                    Right    = content_padding,
                                },
                                Children = new Drawable[]
                                {
                                    new FillFlowContainer
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Spacing          = new Vector2(5f),
                                        Children         = new Drawable[]
                                        {
                                            name = new OsuSpriteText
                                            {
                                                TextSize = 18,
                                            },
                                            participantInfo = new ParticipantInfo(),
                                        },
                                    },
                                    new FillFlowContainer
                                    {
                                        Anchor           = Anchor.BottomLeft,
                                        Origin           = Anchor.BottomLeft,
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Direction        = FillDirection.Vertical,
                                        Children         = new Drawable[]
                                        {
                                            status = new OsuSpriteText
                                            {
                                                TextSize = 14,
                                                Font     = @"Exo2.0-Bold",
                                            },
                                            new FillFlowContainer <OsuSpriteText>
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Colour           = colours.Gray9,
                                                Direction        = FillDirection.Horizontal,
                                                Children         = new[]
                                                {
                                                    beatmapTitle = new OsuSpriteText
                                                    {
                                                        TextSize = 14,
                                                        Font     = @"Exo2.0-BoldItalic",
                                                    },
                                                    beatmapDash = new OsuSpriteText
                                                    {
                                                        TextSize = 14,
                                                        Font     = @"Exo2.0-BoldItalic",
                                                    },
                                                    beatmapArtist = new OsuSpriteText
                                                    {
                                                        TextSize = 14,
                                                        Font     = @"Exo2.0-RegularItalic",
                                                    },
                                                },
                                            },
                                        },
                                    },
                                    modeTypeInfo = new ModeTypeInfo
                                    {
                                        Anchor = Anchor.BottomRight,
                                        Origin = Anchor.BottomRight,
                                    },
                                },
                            },
                        },
                    },
                },
            };

            nameBind.ValueChanged         += n => name.Text = n;
            hostBind.ValueChanged         += h => participantInfo.Host = h;
            typeBind.ValueChanged         += m => modeTypeInfo.Type = m;
            participantsBind.ValueChanged += p => participantInfo.Participants = p;

            statusBind.ValueChanged += s =>
            {
                status.Text = s.Message;

                foreach (Drawable d in new Drawable[] { selectionBox, sideStrip, status })
                {
                    d.FadeColour(s.GetAppropriateColour(colours), 100);
                }
            };

            beatmapBind.ValueChanged += b =>
            {
                modeTypeInfo.Beatmap = b;

                if (b != null)
                {
                    coverContainer.FadeIn(transition_duration);

                    LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet)
                    {
                        Anchor         = Anchor.Centre,
                        Origin         = Anchor.Centre,
                        FillMode       = FillMode.Fill,
                        OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
                    }, coverContainer.Add);

                    beatmapTitle.Current  = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title);
                    beatmapDash.Text      = @" - ";
                    beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist);
                }
                else
                {
                    coverContainer.FadeOut(transition_duration);

                    beatmapTitle.Current  = null;
                    beatmapArtist.Current = null;

                    beatmapTitle.Text = "Changing map";
                    beatmapDash.Text  = beatmapArtist.Text = string.Empty;
                }
            };

            nameBind.BindTo(Room.Name);
            hostBind.BindTo(Room.Host);
            statusBind.BindTo(Room.Status);
            typeBind.BindTo(Room.Type);
            beatmapBind.BindTo(Room.Beatmap);
            participantsBind.BindTo(Room.Participants);
        }
Exemple #25
0
        private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
        {
            stats.Add(new OsuSpriteText
            {
                Text     = $"{Math.Round(score.PP ?? 0)}pp",
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
                TextSize = 18,
                Font     = "Exo2.0-BoldItalic",
            });

            if (weight.HasValue)
            {
                stats.Add(new OsuSpriteText
                {
                    Text     = $"weighted: {Math.Round(score.PP * weight ?? 0)}pp ({weight.Value.ToString("0%", CultureInfo.CurrentCulture)})",
                    Anchor   = Anchor.TopRight,
                    Origin   = Anchor.TopRight,
                    Colour   = colour.GrayA,
                    TextSize = 11,
                    Font     = "Exo2.0-RegularItalic",
                });
            }

            stats.Add(new OsuSpriteText
            {
                Text     = "accuracy: " + score.Accuracy.ToString("0.00%"),
                Anchor   = Anchor.TopRight,
                Origin   = Anchor.TopRight,
                Colour   = colour.GrayA,
                TextSize = 11,
                Font     = "Exo2.0-RegularItalic",
            });

            metadata.Add(new OsuHoverContainer
            {
                AutoSizeAxes = Axes.Both,
                Action       = () =>
                {
                    if (score.Beatmap.OnlineBeatmapSetID.HasValue)
                    {
                        beatmapSetOverlay.ShowBeatmapSet(score.Beatmap.OnlineBeatmapSetID.Value);
                    }
                },
                Child = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Children     = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Current = locale.GetUnicodePreference(
                                $"{score.Beatmap.Metadata.TitleUnicode ?? score.Beatmap.Metadata.Title} [{score.Beatmap.Version}] ",
                                $"{score.Beatmap.Metadata.Title ?? score.Beatmap.Metadata.TitleUnicode} [{score.Beatmap.Version}] "
                                ),
                            TextSize = 15,
                            Font     = "Exo2.0-SemiBoldItalic",
                        },
                        new OsuSpriteText
                        {
                            Current  = locale.GetUnicodePreference(score.Beatmap.Metadata.ArtistUnicode, score.Beatmap.Metadata.Artist),
                            TextSize = 12,
                            Padding  = new MarginPadding {
                                Top = 3
                            },
                            Font = "Exo2.0-RegularItalic",
                        },
                    },
                },
            });

            foreach (Mod mod in score.Mods)
            {
                modContainer.Add(new ModIcon(mod)
                {
                    AutoSizeAxes = Axes.Both,
                    Scale        = new Vector2(0.5f),
                });
            }
        }
Exemple #26
0
        private void load(BindableBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation)
        {
            this.beatmap.BindTo(beatmap);
            this.beatmaps     = beatmaps;
            this.localisation = localisation;

            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Children         = new Drawable[]
                    {
                        playlist = new PlaylistOverlay
                        {
                            RelativeSizeAxes = Axes.X,
                            Y            = player_height + 10,
                            OrderChanged = playlistOrderChanged
                        },
                        playerContainer = new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = player_height,
                            Masking          = true,
                            CornerRadius     = 5,
                            EdgeEffect       = new EdgeEffectParameters
                            {
                                Type   = EdgeEffectType.Shadow,
                                Colour = Color4.Black.Opacity(40),
                                Radius = 5,
                            },
                            Children = new[]
                            {
                                background = new Background(),
                                title      = new OsuSpriteText
                                {
                                    Origin   = Anchor.BottomCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 40),
                                    TextSize = 25,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-MediumItalic"
                                },
                                artist = new OsuSpriteText
                                {
                                    Origin   = Anchor.TopCentre,
                                    Anchor   = Anchor.TopCentre,
                                    Position = new Vector2(0, 45),
                                    TextSize = 15,
                                    Colour   = Color4.White,
                                    Text     = @"Nothing to play",
                                    Font     = @"Exo2.0-BoldItalic"
                                },
                                new Container
                                {
                                    Padding = new MarginPadding {
                                        Bottom = progress_height
                                    },
                                    Height           = bottom_black_area_height,
                                    RelativeSizeAxes = Axes.X,
                                    Origin           = Anchor.BottomCentre,
                                    Anchor           = Anchor.BottomCentre,
                                    Children         = new Drawable[]
                                    {
                                        new FillFlowContainer <IconButton>
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Spacing      = new Vector2(5),
                                            Origin       = Anchor.Centre,
                                            Anchor       = Anchor.Centre,
                                            Children     = new[]
                                            {
                                                prevButton = new IconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = prev,
                                                    Icon   = FontAwesome.fa_step_backward,
                                                },
                                                playButton = new IconButton
                                                {
                                                    Anchor    = Anchor.Centre,
                                                    Origin    = Anchor.Centre,
                                                    Scale     = new Vector2(1.4f),
                                                    IconScale = new Vector2(1.4f),
                                                    Action    = play,
                                                    Icon      = FontAwesome.fa_play_circle_o,
                                                },
                                                nextButton = new IconButton
                                                {
                                                    Anchor = Anchor.Centre,
                                                    Origin = Anchor.Centre,
                                                    Action = () => next(),
                                                    Icon   = FontAwesome.fa_step_forward,
                                                },
                                            }
                                        },
                                        playlistButton = new IconButton
                                        {
                                            Origin   = Anchor.Centre,
                                            Anchor   = Anchor.CentreRight,
                                            Position = new Vector2(-bottom_black_area_height / 2, 0),
                                            Icon     = FontAwesome.fa_bars,
                                            Action   = () => playlist.ToggleVisibility(),
                                        },
                                    }
                                },
                                progressBar = new ProgressBar
                                {
                                    Origin     = Anchor.BottomCentre,
                                    Anchor     = Anchor.BottomCentre,
                                    Height     = progress_height,
                                    FillColour = colours.Yellow,
                                    OnSeek     = progress => current?.Track.Seek(progress)
                                }
                            },
                        },
                    }
                }
            };

            beatmapSets           = beatmaps.GetAllUsableBeatmapSets();
            beatmaps.ItemAdded   += handleBeatmapAdded;
            beatmaps.ItemRemoved += handleBeatmapRemoved;

            playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
        }
Exemple #27
0
        private void load(LocalisationEngine localisation, OsuColour colours)
        {
            Content.CornerRadius = 5;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.25f), Color4.Black.Opacity(0.75f)),
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = vertical_padding, Bottom = vertical_padding, Left = horizontal_padding, Right = vertical_padding
                    },
                    Children = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            Origin         = Anchor.CentreLeft,
                            Anchor         = Anchor.CentreLeft,
                            AutoSizeAxes   = Axes.Both,
                            Direction      = FillDirection.Horizontal,
                            LayoutEasing   = Easing.OutQuint,
                            LayoutDuration = transition_duration,
                            Spacing        = new Vector2(10, 0),
                            Children       = new Drawable[]
                            {
                                playButton = new PlayButton(SetInfo)
                                {
                                    Origin   = Anchor.CentreLeft,
                                    Anchor   = Anchor.CentreLeft,
                                    Size     = new Vector2(height / 2),
                                    FillMode = FillMode.Fit,
                                    Alpha    = 0,
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Vertical,
                                    Children     = new Drawable[]
                                    {
                                        new OsuSpriteText
                                        {
                                            Current  = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                                            TextSize = 18,
                                            Font     = @"Exo2.0-BoldItalic",
                                        },
                                        new OsuSpriteText
                                        {
                                            Current = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                                            Font    = @"Exo2.0-BoldItalic",
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.X,
                                            Height       = 20,
                                            Margin       = new MarginPadding {
                                                Top = vertical_padding, Bottom = vertical_padding
                                            },
                                            Children = GetDifficultyIcons(),
                                        },
                                    },
                                },
                            }
                        },
                        new FillFlowContainer
                        {
                            Anchor         = Anchor.TopRight,
                            Origin         = Anchor.TopRight,
                            AutoSizeAxes   = Axes.Both,
                            Direction      = FillDirection.Horizontal,
                            LayoutEasing   = Easing.OutQuint,
                            LayoutDuration = transition_duration,
                            Children       = new Drawable[]
                            {
                                downloadContainer = new Container
                                {
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    AutoSizeAxes = Axes.Both,
                                    Alpha        = 0,
                                    Child        = new DownloadButton(SetInfo)
                                    {
                                        Size   = new Vector2(height - vertical_padding * 3),
                                        Margin = new MarginPadding {
                                            Left = vertical_padding, Right = vertical_padding
                                        },
                                    },
                                },
                                new FillFlowContainer
                                {
                                    Anchor       = Anchor.TopRight,
                                    Origin       = Anchor.TopRight,
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Vertical,
                                    Children     = new Drawable[]
                                    {
                                        new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
                                        {
                                            Margin = new MarginPadding {
                                                Right = 1
                                            },
                                        },
                                        new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
                                        new FillFlowContainer
                                        {
                                            Anchor       = Anchor.TopRight,
                                            Origin       = Anchor.TopRight,
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Children     = new[]
                                            {
                                                new OsuSpriteText
                                                {
                                                    Text     = "mapped by ",
                                                    TextSize = 14,
                                                },
                                                new OsuSpriteText
                                                {
                                                    Text     = SetInfo.Metadata.Author.Username,
                                                    TextSize = 14,
                                                    Font     = @"Exo2.0-SemiBoldItalic",
                                                },
                                            },
                                        },
                                        new OsuSpriteText
                                        {
                                            Text     = SetInfo.Metadata.Source,
                                            Anchor   = Anchor.TopRight,
                                            Origin   = Anchor.TopRight,
                                            TextSize = 14,
                                            Alpha    = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                        },
                                    },
                                },
                            },
                        },
                    },
                },
                progressBar = new Box
                {
                    Anchor             = Anchor.BottomLeft,
                    Origin             = Anchor.BottomLeft,
                    RelativeSizeAxes   = Axes.X,
                    BypassAutoSizeAxes = Axes.Y,
                    Size   = new Vector2(0, 3),
                    Alpha  = 0,
                    Colour = colours.Yellow,
                },
            });
        }
Exemple #28
0
 private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
 {
     Children = new[]
     {
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = Color4.Black,
         },
         GetBackground(textures),
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = Color4.Black.Opacity(0.5f),
         },
         bottomPanel = new FillFlowContainer
         {
             Anchor           = Anchor.BottomLeft,
             Origin           = Anchor.TopLeft,
             Direction        = FillDirection.Vertical,
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Spacing          = new Vector2(0f, vertical_padding),
             Children         = new Drawable[]
             {
                 new FillFlowContainer
                 {
                     AutoSizeAxes = Axes.Both,
                     Padding      = new MarginPadding {
                         Left = horizontal_padding, Right = horizontal_padding
                     },
                     Direction = FillDirection.Vertical,
                     Children  = new[]
                     {
                         new OsuSpriteText
                         {
                             Text     = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                             TextSize = 18,
                             Font     = @"Exo2.0-BoldItalic",
                         },
                         new OsuSpriteText
                         {
                             Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                             Font = @"Exo2.0-BoldItalic",
                         },
                     },
                 },
                 new Container
                 {
                     RelativeSizeAxes = Axes.X,
                     AutoSizeAxes     = Axes.Y,
                     Children         = new Drawable[]
                     {
                         new Box
                         {
                             RelativeSizeAxes = Axes.Both,
                         },
                         new FillFlowContainer
                         {
                             RelativeSizeAxes = Axes.X,
                             AutoSizeAxes     = Axes.Y,
                             Direction        = FillDirection.Vertical,
                             Padding          = new MarginPadding
                             {
                                 Top    = vertical_padding,
                                 Bottom = vertical_padding,
                                 Left   = horizontal_padding,
                                 Right  = horizontal_padding,
                             },
                             Children = new Drawable[]
                             {
                                 new FillFlowContainer
                                 {
                                     AutoSizeAxes = Axes.Both,
                                     Direction    = FillDirection.Horizontal,
                                     Children     = new[]
                                     {
                                         new OsuSpriteText
                                         {
                                             Text     = "mapped by ",
                                             TextSize = 14,
                                             Shadow   = false,
                                             Colour   = colours.Gray5,
                                         },
                                         new OsuSpriteText
                                         {
                                             Text     = SetInfo.Metadata.Author,
                                             TextSize = 14,
                                             Font     = @"Exo2.0-SemiBoldItalic",
                                             Shadow   = false,
                                             Colour   = colours.BlueDark,
                                         },
                                     },
                                 },
                                 new Container
                                 {
                                     AutoSizeAxes = Axes.X,
                                     Height       = 14,
                                     Children     = new[]
                                     {
                                         new OsuSpriteText
                                         {
                                             Text     = $"from {SetInfo.Metadata.Source}",
                                             TextSize = 14,
                                             Shadow   = false,
                                             Colour   = colours.Gray5,
                                             Alpha    = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                         },
                                     },
                                 },
                                 new FillFlowContainer
                                 {
                                     AutoSizeAxes = Axes.X,
                                     Height       = 20,
                                     Margin       = new MarginPadding {
                                         Top = vertical_padding, Bottom = vertical_padding
                                     },
                                     Children = GetDifficultyIcons(),
                                 },
                             },
                         },
                     },
                 },
             },
         },
         new FillFlowContainer
         {
             Anchor       = Anchor.TopRight,
             Origin       = Anchor.TopRight,
             AutoSizeAxes = Axes.Both,
             Direction    = FillDirection.Vertical,
             Margin       = new MarginPadding {
                 Top = vertical_padding, Right = vertical_padding
             },
             Children = new[]
             {
                 new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
                 {
                     Margin = new MarginPadding {
                         Right = 1
                     },
                 },
                 new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0),
             },
         },
     };
 }
Exemple #29
0
 private void load(LocalisationEngine localisation)
 {
     title.Current  = localisation.GetUnicodePreference(beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title);
     artist.Current = localisation.GetUnicodePreference(beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist);
 }
Exemple #30
0
        private void load(OsuColour colours, LocalisationEngine localisation)
        {
            Content.CornerRadius = 4;

            AddRange(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black.Opacity(0.5f),
                },
                bottomPanel = new FillFlowContainer
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.TopLeft,
                    Direction        = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Spacing          = new Vector2(0f, vertical_padding),
                    Children         = new Drawable[]
                    {
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Padding      = new MarginPadding {
                                Left = horizontal_padding, Right = horizontal_padding
                            },
                            Direction = FillDirection.Vertical,
                            Children  = new[]
                            {
                                new OsuSpriteText
                                {
                                    Text     = localisation.GetUnicodePreference(SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title),
                                    TextSize = 18,
                                    Font     = @"Exo2.0-BoldItalic",
                                },
                                new OsuSpriteText
                                {
                                    Text = localisation.GetUnicodePreference(SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist),
                                    Font = @"Exo2.0-BoldItalic",
                                },
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                new Box
                                {
                                    RelativeSizeAxes = Axes.Both,
                                },
                                progressBar = new Box
                                {
                                    Origin             = Anchor.BottomLeft,
                                    RelativeSizeAxes   = Axes.X,
                                    BypassAutoSizeAxes = Axes.Both,
                                    Size   = new Vector2(0, 3),
                                    Alpha  = 0,
                                    Colour = colours.Yellow,
                                },
                                new FillFlowContainer
                                {
                                    RelativeSizeAxes = Axes.X,
                                    AutoSizeAxes     = Axes.Y,
                                    Direction        = FillDirection.Vertical,
                                    Padding          = new MarginPadding
                                    {
                                        Top    = vertical_padding,
                                        Bottom = vertical_padding,
                                        Left   = horizontal_padding,
                                        Right  = horizontal_padding,
                                    },
                                    Children = new Drawable[]
                                    {
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.Both,
                                            Direction    = FillDirection.Horizontal,
                                            Children     = new[]
                                            {
                                                new OsuSpriteText
                                                {
                                                    Text     = "mapped by ",
                                                    TextSize = 14,
                                                    Shadow   = false,
                                                    Colour   = colours.Gray5,
                                                },
                                                new OsuSpriteText
                                                {
                                                    Text     = SetInfo.Metadata.Author.Username,
                                                    TextSize = 14,
                                                    Font     = @"Exo2.0-SemiBoldItalic",
                                                    Shadow   = false,
                                                    Colour   = colours.BlueDark,
                                                },
                                            },
                                        },
                                        new Container
                                        {
                                            AutoSizeAxes = Axes.X,
                                            Height       = 14,
                                            Children     = new[]
                                            {
                                                new OsuSpriteText
                                                {
                                                    Text     = $"from {SetInfo.Metadata.Source}",
                                                    TextSize = 14,
                                                    Shadow   = false,
                                                    Colour   = colours.Gray5,
                                                    Alpha    = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f,
                                                },
                                            },
                                        },
                                        new FillFlowContainer
                                        {
                                            AutoSizeAxes = Axes.X,
                                            Height       = 20,
                                            Margin       = new MarginPadding {
                                                Top = vertical_padding, Bottom = vertical_padding
                                            },
                                            Children = GetDifficultyIcons(),
                                        },
                                    },
                                },
                                new DownloadButton
                                {
                                    Size   = new Vector2(30),
                                    Margin = new MarginPadding(horizontal_padding),
                                    Anchor = Anchor.CentreRight,
                                    Origin = Anchor.CentreRight,
                                    Colour = colours.Gray5,
                                    Action = StartDownload
                                },
                            },
                        },
                    },
                },
                new FillFlowContainer
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Margin       = new MarginPadding {
                        Top = vertical_padding, Right = vertical_padding
                    },
                    Children = new[]
                    {
                        new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
                        {
                            Margin = new MarginPadding {
                                Right = 1
                            },
                        },
                        new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
                    },
                },
                playButton = new PlayButton(SetInfo)
                {
                    Margin = new MarginPadding {
                        Top = 5, Left = 10
                    },
                    Size  = new Vector2(30),
                    Alpha = 0,
                },
            });
        }