Exemple #1
0
        public void TestSettingsNotCrossPolluting()
        {
            Bindable <IReadOnlyList <Mod> > selectedMods2 = null;
            ModSelectScreen modSelectScreen2 = null;

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

            AddStep("set setting", () => modSelectScreen.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(modSelectScreen2 = new UserModSelectScreen().With(d =>
                {
                    d.Origin = Anchor.TopCentre;
                    d.Anchor = Anchor.TopCentre;
                    d.SelectedMods.BindTarget = selectedMods2;
                }));
            });

            AddStep("show", () => modSelectScreen2.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);
        }
Exemple #2
0
 private void createScreen()
 {
     AddStep("create screen", () => Child = modSelectScreen = new ModSelectScreen
     {
         RelativeSizeAxes = Axes.Both,
         State            = { Value = Visibility.Visible },
         SelectedMods     = { BindTarget = SelectedMods }
     });
     waitForColumnLoad();
 }
Exemple #3
0
        private void load(AudioManager audio)
        {
            sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");

            InternalChild = new PopoverContainer
            {
                RelativeSizeAxes = Axes.Both,
                Children         = new Drawable[]
                {
                    beatmapAvailabilityTracker,
                    new MultiplayerRoomSounds(),
                    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,
                                                            },
                                                        }
                                                    }
                                                }
                                            }
                                        },
                                        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()
                                        },
                                    }
                                }
                            }
                        }
                    }
                }
            };

            LoadComponent(userModsSelectOverlay = new UserModSelectScreen(OverlayColourScheme.Plum)
            {
                SelectedMods = { BindTarget = UserMods },
                IsValidMod   = _ => false
            });
        }