示例#1
0
 protected RoomSubScreen()
 {
     AddRangeInternal(new Drawable[]
     {
         BeatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker
         {
             SelectedItem = { BindTarget = SelectedItem }
         },
         new Container
         {
             Anchor           = Anchor.BottomLeft,
             Origin           = Anchor.BottomLeft,
             Depth            = float.MinValue,
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Padding          = new MarginPadding {
                 Horizontal = HORIZONTAL_OVERFLOW_PADDING
             },
             Child = userModsSelectOverlay = new UserModSelectOverlay
             {
                 SelectedMods = { BindTarget = UserMods },
                 IsValidMod   = _ => false
             }
         },
     });
 }
示例#2
0
        public override void Reset()
        {
            base.Reset();

            Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
            });

            Add(modDisplay = new ModDisplay
            {
                Anchor       = Anchor.TopRight,
                Origin       = Anchor.TopRight,
                AutoSizeAxes = Axes.Both,
                Position     = new Vector2(0, 25),
            });

            modDisplay.Current.BindTo(modSelect.SelectedMods);

            AddStep("Toggle", modSelect.ToggleVisibility);

            foreach (var ruleset in rulesets.AllRulesets)
            {
                AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset);
            }
        }
示例#3
0
        public void TestSettingsNotCrossPolluting()
        {
            Bindable <IReadOnlyList <Mod> > selectedMods2 = null;
            ModSelectOverlay modSelectOverlay2            = null;

            createScreen();
            AddStep("select diff adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() });

            AddStep("set setting", () => modSelectOverlay.ChildrenOfType <SettingsSlider <float> >().First().Current.Value = 8);

            AddAssert("ensure setting is propagated", () => SelectedMods.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == 8);

            AddStep("create second bindable", () => selectedMods2 = new Bindable <IReadOnlyList <Mod> >(new Mod[] { new OsuModDifficultyAdjust() }));

            AddStep("create second overlay", () =>
            {
                Add(modSelectOverlay2 = new UserModSelectOverlay().With(d =>
                {
                    d.Origin = Anchor.TopCentre;
                    d.Anchor = Anchor.TopCentre;
                    d.SelectedMods.BindTarget = selectedMods2;
                }));
            });

            AddStep("show", () => modSelectOverlay2.Show());

            AddAssert("ensure first is unchanged", () => SelectedMods.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == 8);
            AddAssert("ensure second is default", () => selectedMods2.Value.OfType <OsuModDifficultyAdjust>().Single().CircleSize.Value == null);
        }
示例#4
0
        protected RoomSubScreen()
        {
            Padding = new MarginPadding {
                Top = Header.HEIGHT
            };

            AddRangeInternal(new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4Extensions.FromHex(@"3e3a44") // This is super temporary.
                },
                BeatmapAvailabilityTracker = new OnlinePlayBeatmapAvailabilityTracker
                {
                    SelectedItem = { BindTarget = SelectedItem }
                },
                new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    Depth            = float.MinValue,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Horizontal = HORIZONTAL_OVERFLOW_PADDING
                    },
                    Child = userModsSelectOverlay = new UserModSelectOverlay
                    {
                        SelectedMods = { BindTarget = UserMods },
                        IsValidMod   = _ => false
                    }
                },
            });
        }
示例#5
0
 public PlaySongSelect()
 {
     Add(modSelect = new ModSelectOverlay
     {
         RelativeSizeAxes = Axes.X,
         Origin           = Anchor.BottomCentre,
         Anchor           = Anchor.BottomCentre,
         Margin           = new MarginPadding {
             Bottom = 50
         }
     });
 }
示例#6
0
        public override void Reset()
        {
            base.Reset();

            Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
            });

            AddStep("Toggle", modSelect.ToggleVisibility);
            AddStep("osu!", () => modSelect.PlayMode.Value      = PlayMode.Osu);
            AddStep("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko);
            AddStep("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch);
            AddStep("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania);
        }
示例#7
0
        public PlaySongSelect()
        {
            Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
                Margin           = new MarginPadding {
                    Bottom = 50
                }
            });

            LeftContent.Add(leaderboard = new Leaderboard
            {
                RelativeSizeAxes = Axes.Both,
            });
        }
示例#8
0
        public PlaySongSelect()
        {
            FooterPanels.Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
            });

            LeftContent.Add(beatmapDetails = new BeatmapDetailArea
            {
                RelativeSizeAxes = Axes.Both,
                Padding          = new MarginPadding {
                    Top = 10, Right = 5
                },
            });
        }
示例#9
0
        public override void Reset()
        {
            base.Reset();

            Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
            });

            AddStep("Toggle", modSelect.ToggleVisibility);

            foreach (var ruleset in rulesets.AllRulesets)
            {
                AddStep(ruleset.CreateInstance().Description, () => modSelect.Ruleset.Value = ruleset);
            }
        }
示例#10
0
        public PlaySongSelect()
        {
            FooterPanels.Add(modSelect = new ModSelectOverlay
            {
                RelativeSizeAxes = Axes.X,
                Origin           = Anchor.BottomCentre,
                Anchor           = Anchor.BottomCentre,
            });

            LeftContent.Add(BeatmapDetails = new BeatmapDetailArea
            {
                RelativeSizeAxes = Axes.Both,
                Padding          = new MarginPadding {
                    Top = 10, Right = 5
                },
            });

            BeatmapDetails.Leaderboard.ScoreSelected += s => Push(new Results(s));
        }
示例#11
0
        private void load()
        {
            AddRangeInternal(new Drawable[]
            {
                mainContent = new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Content          = new[]
                    {
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Horizontal = HORIZONTAL_OVERFLOW_PADDING + 55,
                                    Vertical   = 20
                                },
                                Child = new GridContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    RowDimensions    = new[]
                                    {
                                        new Dimension(GridSizeMode.AutoSize),
                                        new Dimension(),
                                    },
                                    Content = new[]
                                    {
                                        new Drawable[]
                                        {
                                            new MultiplayerMatchHeader
                                            {
                                                OpenSettings = () => settingsOverlay.Show()
                                            }
                                        },
                                        new Drawable[]
                                        {
                                            new Container
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                Padding          = new MarginPadding {
                                                    Horizontal = 5, Vertical = 10
                                                },
                                                Child = new GridContainer
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    ColumnDimensions = new[]
                                                    {
                                                        new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 400),
                                                        new Dimension(),
                                                        new Dimension(GridSizeMode.Relative, size: 0.5f, maxSize: 600),
                                                    },
                                                    Content = new[]
                                                    {
                                                        new Drawable[]
                                                        {
                                                            // Main left column
                                                            new GridContainer
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                RowDimensions    = new[]
                                                                {
                                                                    new Dimension(GridSizeMode.AutoSize)
                                                                },
                                                                Content = new[]
                                                                {
                                                                    new Drawable[] { new ParticipantsListHeader() },
                                                                    new Drawable[]
                                                                    {
                                                                        new ParticipantsList
                                                                        {
                                                                            RelativeSizeAxes = Axes.Both
                                                                        },
                                                                    }
                                                                }
                                                            },
                                                            // Spacer
                                                            null,
                                                            // Main right column
                                                            new FillFlowContainer
                                                            {
                                                                RelativeSizeAxes = Axes.X,
                                                                AutoSizeAxes     = Axes.Y,
                                                                Children         = new[]
                                                                {
                                                                    new FillFlowContainer
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        Children         = new Drawable[]
                                                                        {
                                                                            new OverlinedHeader("Beatmap"),
                                                                            new BeatmapSelectionControl {
                                                                                RelativeSizeAxes = Axes.X
                                                                            }
                                                                        }
                                                                    },
                                                                    userModsSection = new FillFlowContainer
                                                                    {
                                                                        RelativeSizeAxes = Axes.X,
                                                                        AutoSizeAxes     = Axes.Y,
                                                                        Margin           = new MarginPadding {
                                                                            Top = 10
                                                                        },
                                                                        Children = new Drawable[]
                                                                        {
                                                                            new OverlinedHeader("Extra mods"),
                                                                            new FillFlowContainer
                                                                            {
                                                                                AutoSizeAxes = Axes.Both,
                                                                                Direction    = FillDirection.Horizontal,
                                                                                Spacing      = new Vector2(10, 0),
                                                                                Children     = new Drawable[]
                                                                                {
                                                                                    new PurpleTriangleButton
                                                                                    {
                                                                                        Anchor = Anchor.CentreLeft,
                                                                                        Origin = Anchor.CentreLeft,
                                                                                        Width  = 90,
                                                                                        Text   = "Select",
                                                                                        Action = () => userModsSelectOverlay.Show()
                                                                                    },
                                                                                    new ModDisplay
                                                                                    {
                                                                                        Anchor = Anchor.CentreLeft,
                                                                                        Origin = Anchor.CentreLeft,
                                                                                        DisplayUnrankedText = false,
                                                                                        Current             = UserMods,
                                                                                        Scale = new Vector2(0.8f),
                                                                                    },
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        new Drawable[]
                                        {
                                            new GridContainer
                                            {
                                                RelativeSizeAxes = Axes.Both,
                                                RowDimensions    = new[]
                                                {
                                                    new Dimension(GridSizeMode.AutoSize)
                                                },
                                                Content = new[]
                                                {
                                                    new Drawable[] { new OverlinedHeader("Chat") },
                                                    new Drawable[] { new MatchChatDisplay {
                                                                         RelativeSizeAxes = Axes.Both
                                                                     } }
                                                }
                                            }
                                        }
                                    },
                                }
                            }
                        },
                        new Drawable[]
                        {
                            new MultiplayerMatchFooter
                            {
                                OnReadyClick = onReadyClick
                            }
                        }
                    },
                    RowDimensions = new[]
                    {
                        new Dimension(),
                        new Dimension(GridSizeMode.AutoSize),
                    }
                },
                new Container
                {
                    Anchor           = Anchor.BottomLeft,
                    Origin           = Anchor.BottomLeft,
                    RelativeSizeAxes = Axes.Both,
                    Height           = 0.5f,
                    Padding          = new MarginPadding {
                        Horizontal = HORIZONTAL_OVERFLOW_PADDING
                    },
                    Child = userModsSelectOverlay = new UserModSelectOverlay
                    {
                        SelectedMods = { BindTarget = UserMods },
                        IsValidMod   = _ => false
                    }
                },
                settingsOverlay = new MultiplayerMatchSettingsOverlay
                {
                    RelativeSizeAxes = Axes.Both,
                    State            = { Value = client.Room == null ? Visibility.Visible : Visibility.Hidden }
                }
            });

            if (client.Room == null)
            {
                // A new room is being created.
                // The main content should be hidden until the settings overlay is hidden, signaling the room is ready to be displayed.
                mainContent.Hide();

                settingsOverlay.State.BindValueChanged(visibility =>
                {
                    if (visibility.NewValue == Visibility.Hidden)
                    {
                        mainContent.Show();
                    }
                }, true);
            }
        }
示例#12
0
        private void load(AudioManager audio)
        {
            sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");

            InternalChildren = new Drawable[]
            {
                beatmapAvailabilityTracker,
                new GridContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    RowDimensions    = new[]
                    {
                        new Dimension(),
                        new Dimension(GridSizeMode.Absolute, 50)
                    },
                    Content = new[]
                    {
                        // Padded main content (drawable room + main content)
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Padding          = new MarginPadding
                                {
                                    Horizontal = WaveOverlayContainer.WIDTH_PADDING,
                                    Bottom     = 30
                                },
                                Children = new[]
                                {
                                    mainContent = new GridContainer
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        RowDimensions    = new[]
                                        {
                                            new Dimension(GridSizeMode.AutoSize),
                                            new Dimension(GridSizeMode.Absolute, 10)
                                        },
                                        Content = new[]
                                        {
                                            new Drawable[]
                                            {
                                                new DrawableMatchRoom(Room, allowEdit)
                                                {
                                                    OnEdit       = () => settingsOverlay.Show(),
                                                    SelectedItem = { BindTarget = SelectedItem }
                                                }
                                            },
                                            null,
                                            new Drawable[]
                                            {
                                                new Container
                                                {
                                                    RelativeSizeAxes = Axes.Both,
                                                    Children         = new[]
                                                    {
                                                        new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Masking          = true,
                                                            CornerRadius     = 10,
                                                            Child            = new Box
                                                            {
                                                                RelativeSizeAxes = Axes.Both,
                                                                Colour           = Color4Extensions.FromHex(@"3e3a44") // Temporary.
                                                            },
                                                        },
                                                        new Container
                                                        {
                                                            RelativeSizeAxes = Axes.Both,
                                                            Padding          = new MarginPadding(20),
                                                            Child            = CreateMainContent(),
                                                        },
                                                        new Container
                                                        {
                                                            Anchor           = Anchor.BottomLeft,
                                                            Origin           = Anchor.BottomLeft,
                                                            RelativeSizeAxes = Axes.X,
                                                            AutoSizeAxes     = Axes.Y,
                                                            Child            = userModsSelectOverlay = new UserModSelectOverlay
                                                            {
                                                                SelectedMods = { BindTarget = UserMods },
                                                                IsValidMod   = _ => false
                                                            }
                                                        },
                                                    }
                                                }
                                            }
                                        }
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        // Resolves 1px masking errors between the settings overlay and the room panel.
                                        Padding = new MarginPadding(-1),
                                        Child   = settingsOverlay = CreateRoomSettingsOverlay(Room)
                                    }
                                },
                            },
                        },
                        // Footer
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                                Children         = new Drawable[]
                                {
                                    new Box
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Colour           = Color4Extensions.FromHex(@"28242d") // Temporary.
                                    },
                                    new Container
                                    {
                                        RelativeSizeAxes = Axes.Both,
                                        Padding          = new MarginPadding(5),
                                        Child            = CreateFooter()
                                    },
                                }
                            }
                        }
                    }
                }
            };
        }
示例#13
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
                          OsuGame osu, OsuColour colours)
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Children      = new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Right = carousel_width * 0.76f
                            },
                        },
                    }
                },
                carousel = new CarouselContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(carousel_width, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                },
                filter = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = () => filterChanged(),
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = 20,
                        Right = 20,
                    },
                },
                beatmapOptions = new BeatmapOptionsOverlay
                {
                    OnRemoveFromUnplayed = null,
                    OnClearLocalScores   = null,
                    OnEdit   = null,
                    OnDelete = promptDelete,
                    Margin   = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                modSelect = new ModSelectOverlay
                {
                    RelativeSizeAxes = Axes.X,
                    Origin           = Anchor.BottomCentre,
                    Anchor           = Anchor.BottomCentre,
                    Margin           = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () =>
                    {
                        if (player != null || Beatmap == null)
                        {
                            return;
                        }

                        (player = new PlayerLoader(new Player
                        {
                            BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
                            PreferredPlayMode = playMode.Value
                        })).LoadAsync(Game, l => Push(player));
                    }
                },
            };

            footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility);
            footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
            footer.AddButton(@"options", colours.Blue, beatmapOptions.ToggleVisibility);

            if (osu != null)
            {
                playMode.BindTo(osu.PlayMode);
            }
            playMode.ValueChanged += playMode_ValueChanged;

            if (database == null)
            {
                database = beatmaps;
            }

            database.BeatmapSetAdded   += onBeatmapSetAdded;
            database.BeatmapSetRemoved += onBeatmapSetRemoved;

            trackManager  = audio.Track;
            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Sample.Get(@"SongSelect/select-expand");

            initialAddSetsTask = new CancellationTokenSource();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }