private void load(OsuGameBase osu, APIAccess api, RulesetStore rulesets)
        {
            Bindable <BeatmapInfo> beatmapBindable = new Bindable <BeatmapInfo>();

            var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);

            Child = backgroundSprite = new UpdateableBeatmapBackgroundSprite {
                RelativeSizeAxes = Axes.Both
            };

            backgroundSprite.Beatmap.BindTo(beatmapBindable);

            var req = new GetBeatmapSetRequest(1);

            api.Queue(req);

            AddStep("null", () => beatmapBindable.Value = null);

            AddStep("imported", () => beatmapBindable.Value = imported.Beatmaps.First());

            if (api.IsLoggedIn)
            {
                AddUntilStep(() => req.Result != null, "wait for api response");

                AddStep("online", () => beatmapBindable.Value = new BeatmapInfo
                {
                    BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
                });
            }
            else
            {
                AddStep("online (login first)", () => { });
            }
        }
Esempio n. 2
0
 private void load()
 {
     InternalChild = sprite = new UpdateableBeatmapBackgroundSprite(BeatmapSetCoverType)
     {
         RelativeSizeAxes = Axes.Both
     };
 }
Esempio n. 3
0
        private void load()
        {
            InternalChild = sprite = CreateBackgroundSprite();

            Playlist.CollectionChanged += (_, __) => updateBeatmap();

            updateBeatmap();
        }
Esempio n. 4
0
        private void load()
        {
            InternalChild = sprite = CreateBackgroundSprite();

            CurrentPlaylistItem.BindValueChanged(_ => updateBeatmap());
            Playlist.CollectionChanged += (_, __) => updateBeatmap();

            updateBeatmap();
        }
        private void load()
        {
            InternalChild = sprite = CreateBackgroundSprite();

            Playlist.ItemsAdded   += _ => updateBeatmap();
            Playlist.ItemsRemoved += _ => updateBeatmap();

            updateBeatmap();
        }
Esempio n. 6
0
            public PanelBackground()
            {
                UpdateableBeatmapBackgroundSprite backgroundSprite;

                InternalChildren = new Drawable[]
                {
                    backgroundSprite = new UpdateableBeatmapBackgroundSprite
                    {
                        RelativeSizeAxes = Axes.Both,
                        FillMode         = FillMode.Fill,
                    },
                    new FillFlowContainer
                    {
                        Depth            = -1,
                        RelativeSizeAxes = Axes.Both,
                        Direction        = FillDirection.Horizontal,
                        // This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
                        Shear    = new Vector2(0.8f, 0),
                        Alpha    = 0.5f,
                        Children = new[]
                        {
                            // The left half with no gradient applied
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = Color4.Black,
                                Width            = 0.4f,
                            },
                            // Piecewise-linear gradient with 2 segments to make it appear smoother
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.7f)),
                                Width            = 0.4f,
                            },
                            new Box
                            {
                                RelativeSizeAxes = Axes.Both,
                                Colour           = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.7f), new Color4(0, 0, 0, 0.4f)),
                                Width            = 0.4f,
                            },
                        }
                    }
                };

                // manual binding required as playlists don't expose IBeatmapInfo currently.
                // may be removed in the future if this changes.
                Beatmap.BindValueChanged(beatmap => backgroundSprite.Beatmap.Value = beatmap.NewValue);
            }
Esempio n. 7
0
        private void load(OsuColour colours)
        {
            this.colours = colours;

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = OsuColour.FromHex(@"343138"),
                },
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.Distributed),
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            new FillFlowContainer
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Vertical,
                                Children         = new Drawable[]
                                {
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 200,
                                        Masking          = true,
                                        Children         = new Drawable[]
                                        {
                                            background = new UpdateableBeatmapBackgroundSprite {
                                                RelativeSizeAxes = Axes.Both
                                            },
                                            new Box
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Colour           = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)),
                                            },
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding(20),
                                                Children         = new Drawable[]
                                                {
                                                    participantCount = new ParticipantCountDisplay
                                                    {
                                                        Anchor = Anchor.TopRight,
                                                        Origin = Anchor.TopRight,
                                                    },
                                                    name = new OsuSpriteText
                                                    {
                                                        Anchor   = Anchor.BottomLeft,
                                                        Origin   = Anchor.BottomLeft,
                                                        TextSize = 30,
                                                    },
                                                },
                                            },
                                        },
                                    },
                                    statusStrip = new Box
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        Height           = 5,
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Children         = new Drawable[]
                                        {
                                            new Box
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Colour           = OsuColour.FromHex(@"28242d"),
                                            },
                                            new FillFlowContainer
                                            {
                                                RelativeSizeAxes = Axes.X,
                                                AutoSizeAxes     = Axes.Y,
                                                Direction        = FillDirection.Vertical,
                                                LayoutDuration   = transition_duration,
                                                Padding          = contentPadding,
                                                Spacing          = new Vector2(0f, 5f),
                                                Children         = new Drawable[]
                                                {
                                                    status = new OsuSpriteText
                                                    {
                                                        TextSize = 14,
                                                        Font     = @"Exo2.0-Bold",
                                                    },
                                                    beatmapTypeInfo = new BeatmapTypeInfo(),
                                                },
                                            },
                                        },
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.X,
                                        AutoSizeAxes     = Axes.Y,
                                        Padding          = contentPadding,
                                        Children         = new Drawable[]
                                        {
                                            participantInfo = new ParticipantInfo(),
                                        },
                                    },
                                },
                            },
                        },
                        new Drawable[]
                        {
                            participants = new MatchParticipants
                            {
                                RelativeSizeAxes = Axes.Both,
                            }
                        }
                    }
                }
            };

            participantInfo.Host.BindTo(bindings.Host);
            participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);
            participantInfo.Participants.BindTo(bindings.Participants);
            participantCount.Participants.BindTo(bindings.Participants);
            participantCount.ParticipantCount.BindTo(bindings.ParticipantCount);
            participantCount.MaxParticipants.BindTo(bindings.MaxParticipants);
            beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
            beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
            beatmapTypeInfo.Type.BindTo(bindings.Type);
            background.Beatmap.BindTo(bindings.CurrentBeatmap);
            bindings.Status.BindValueChanged(displayStatus);
            bindings.Name.BindValueChanged(n => name.Text = n);
            Room.BindValueChanged(updateRoom, true);
        }
Esempio n. 8
0
        private void load(OsuColour colours)
        {
            Box             sideStrip;
            ParticipantInfo participantInfo;
            OsuSpriteText   name;

            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
                            {
                                RelativeSizeAxes = Axes.Y,
                                Width            = cover_width,
                                Masking          = true,
                                Margin           = new MarginPadding {
                                    Left = side_strip_width
                                },
                                Child = background = new UpdateableBeatmapBackgroundSprite {
                                    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,
                                        Spacing          = new Vector2(0, 5),
                                        Children         = new Drawable[]
                                        {
                                            new RoomStatusInfo(Room),
                                            beatmapTitle = new BeatmapTitle {
                                                TextSize = 14
                                            },
                                        },
                                    },
                                    modeTypeInfo = new ModeTypeInfo
                                    {
                                        Anchor = Anchor.BottomRight,
                                        Origin = Anchor.BottomRight,
                                    },
                                },
                            },
                        },
                    },
                },
            };

            background.Beatmap.BindTo(bindings.CurrentBeatmap);
            modeTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
            modeTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
            modeTypeInfo.Type.BindTo(bindings.Type);
            beatmapTitle.Beatmap.BindTo(bindings.CurrentBeatmap);
            participantInfo.Host.BindTo(bindings.Host);
            participantInfo.Participants.BindTo(bindings.Participants);
            participantInfo.ParticipantCount.BindTo(bindings.ParticipantCount);

            bindings.Name.BindValueChanged(n => name.Text = n, true);
            bindings.Status.BindValueChanged(s =>
            {
                foreach (Drawable d in new Drawable[] { selectionBox, sideStrip })
                {
                    d.FadeColour(s.GetAppropriateColour(colours), transition_duration);
                }
            }, true);
        }