示例#1
0
 public void SetUpSteps()
 {
     AddStep("create drawable", () =>
     {
         Child = new PopoverContainer
         {
             RelativeSizeAxes = Axes.Both,
             Children         = new Drawable[]
             {
                 searchTextBox = new SearchTextBox
                 {
                     HoldFocus = true,
                     Anchor    = Anchor.TopCentre,
                     Origin    = Anchor.TopCentre,
                     Margin    = new MarginPadding(50),
                     Width     = 500,
                     Depth     = float.MaxValue
                 },
                 drawableRoom = new DrawableLoungeRoom(room)
                 {
                     Anchor = Anchor.Centre,
                     Origin = Anchor.Centre,
                 }
             }
         };
     });
 }
示例#2
0
        private void load()
        {
            Dependencies.CacheAs(multiplayerClient.Object);
            Dependencies.CacheAs(ongoingOperationTracker = new OngoingOperationTracker());
            Dependencies.CacheAs(availabilityTracker.Object);

            availabilityTracker.SetupGet(a => a.Availability).Returns(beatmapAvailability);

            multiplayerClient.SetupGet(m => m.LocalUser).Returns(() => localUser);
            multiplayerClient.SetupGet(m => m.Room).Returns(() => multiplayerRoom);

            // By default, the local user is to be the host.
            multiplayerClient.SetupGet(m => m.IsHost).Returns(() => ReferenceEquals(multiplayerRoom.Host, localUser));

            // Assume all state changes are accepted by the server.
            multiplayerClient.Setup(m => m.ChangeState(It.IsAny <MultiplayerUserState>()))
            .Callback((MultiplayerUserState r) =>
            {
                Logger.Log($"Changing local user state from {localUser.State} to {r}");
                localUser.State = r;
                raiseRoomUpdated();
            });

            multiplayerClient.Setup(m => m.StartMatch())
            .Callback(() =>
            {
                multiplayerClient.Raise(m => m.LoadRequested -= null);

                // immediately "end" gameplay, as we don't care about that part of the process.
                changeUserState(localUser.UserID, MultiplayerUserState.Idle);
            });

            multiplayerClient.Setup(m => m.SendMatchRequest(It.IsAny <MatchUserRequest>()))
            .Callback((MatchUserRequest request) =>
            {
                switch (request)
                {
                case StartMatchCountdownRequest countdownStart:
                    setRoomCountdown(countdownStart.Duration);
                    break;

                case StopCountdownRequest _:
                    multiplayerRoom.Countdown = null;
                    raiseRoomUpdated();
                    break;
                }
            });

            Children = new Drawable[]
            {
                ongoingOperationTracker,
                content = new PopoverContainer {
                    RelativeSizeAxes = Axes.Both
                }
            };
        }
示例#3
0
 public void SetUp() => Schedule(() =>
 {
     Child = new PopoverContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = beatDivisorControl = new BeatDivisorControl(bindableBeatDivisor = new BindableBeatDivisor(16))
         {
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
             Size   = new Vector2(90, 90)
         }
     };
 });
 public TestSceneFirstRunScreenImportFromStable()
 {
     AddStep("load screen", () =>
     {
         Child = new PopoverContainer
         {
             RelativeSizeAxes = Axes.Both,
             Children         = new Drawable[]
             {
                 new ScreenStack(new ScreenImportFromStable())
             }
         };
     });
 }
示例#5
0
        public void SetUpSteps()
        {
            AddStep("create popover container", () =>
            {
                Child = popoverWrapper = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Masking          = true,
                    BorderThickness  = 5,
                    BorderColour     = Colour4.White,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            AlwaysPresent    = true,
                            Colour           = Colour4.Transparent
                        },
                        popoverContainer = new PopoverContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(5),
                            Child            = gridContainer = new GridContainer
                            {
                                RelativeSizeAxes = Axes.Both
                            }
                        }
                    }
                };

                cells = new Container[3, 3];

                for (int r = 0; r < 3; r++)
                {
                    for (int c = 0; c < 3; c++)
                    {
                        cells[r, c] = new Container {
                            RelativeSizeAxes = Axes.Both
                        }
                    }
                    ;
                }

                gridContainer.Content = cells.ToJagged();
            });
        }
        public new void Setup() => Schedule(() =>
        {
            Child = new PopoverContainer
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                Width            = 0.5f,

                Child = container = new RoomsContainer
                {
                    SelectedRoom = { BindTarget = SelectedRoom }
                }
            };
        });
 public new void Setup() => Schedule(() =>
 {
     Child = new PopoverContainer
     {
         Anchor           = Anchor.Centre,
         Origin           = Anchor.Centre,
         RelativeSizeAxes = Axes.Both,
         Child            = new Container
         {
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.X,
             Height           = 50,
             Child            = new MultiplayerMatchFooter()
         }
     };
 });
        private void createColourPalette(bool hasDescription = false)
        {
            AddStep("create component", () =>
            {
                Child = new PopoverContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    Child            = new OsuContextMenuContainer
                    {
                        RelativeSizeAxes = Axes.Both,
                        Child            = new Container
                        {
                            Anchor       = Anchor.Centre,
                            Origin       = Anchor.Centre,
                            Width        = 500,
                            AutoSizeAxes = Axes.Y,
                            Child        = component = new LabelledColourPalette
                            {
                                Anchor           = Anchor.Centre,
                                Origin           = Anchor.Centre,
                                ColourNamePrefix = "My colour #"
                            }
                        }
                    }
                };

                component.Label       = "a sample component";
                component.Description = hasDescription ? "this text describes the component" : string.Empty;

                component.Colours.AddRange(new[]
                {
                    Colour4.DarkRed,
                    Colour4.Aquamarine,
                    Colour4.Goldenrod,
                    Colour4.Gainsboro
                });
            });
        }
示例#9
0
        public new void Setup() => Schedule(() =>
        {
            AvailabilityTracker.SelectedItem.BindTo(selectedItem);

            importedSet        = beatmaps.GetAllUsableBeatmapSets().First();
            Beatmap.Value      = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());
            selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
            {
                RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID,
            };

            Child = new PopoverContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = new FillFlowContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Vertical,
                    Children     = new Drawable[]
                    {
                        spectateButton = new MultiplayerSpectateButton
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(200, 50),
                        },
                        startControl = new MatchStartControl
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(200, 50),
                        }
                    }
                }
            };
        });
示例#10
0
        public new void Setup() => Schedule(() =>
        {
            AvailabilityTracker.SelectedItem.BindTo(selectedItem);

            beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely();
            importedSet   = beatmaps.GetAllUsableBeatmapSets().First();
            Beatmap.Value = beatmaps.GetWorkingBeatmap(importedSet.Beatmaps.First());

            selectedItem.Value = new PlaylistItem(Beatmap.Value.BeatmapInfo)
            {
                RulesetID = Beatmap.Value.BeatmapInfo.Ruleset.OnlineID
            };

            Child = new PopoverContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = control = new MatchStartControl
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size   = new Vector2(250, 50),
                }
            };
        });
示例#11
0
        private void load([CanBeNull] IdleTracker idleTracker)
        {
            const float controls_area_height = 25f;

            if (idleTracker != null)
            {
                isIdle.BindTo(idleTracker.IsIdle);
            }

            OsuScrollContainer scrollContainer;

            InternalChildren = new Drawable[]
            {
                ListingPollingComponent = CreatePollingComponent().With(c => c.Filter.BindTarget = filter),
                popoverContainer        = new PopoverContainer
                {
                    Name             = @"Rooms area",
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding
                    {
                        Horizontal = WaveOverlayContainer.WIDTH_PADDING,
                        Top        = Header.HEIGHT + controls_area_height + 20,
                    },
                    Child = scrollContainer = new OsuScrollContainer
                    {
                        RelativeSizeAxes         = Axes.Both,
                        ScrollbarOverlapsContent = false,
                        Child = roomsContainer = new RoomsContainer
                        {
                            Filter       = { BindTarget = filter },
                            SelectedRoom = { BindTarget = SelectedRoom }
                        }
                    },
                },
                loadingLayer = new LoadingLayer(true),
                new FillFlowContainer
                {
                    Name             = @"Header area flow",
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Padding          = new MarginPadding {
                        Horizontal = WaveOverlayContainer.WIDTH_PADDING
                    },
                    Direction = FillDirection.Vertical,
                    Children  = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = Header.HEIGHT,
                            Child            = searchTextBox = new SearchTextBox
                            {
                                Anchor           = Anchor.CentreRight,
                                Origin           = Anchor.CentreRight,
                                RelativeSizeAxes = Axes.X,
                                Width            = 0.6f,
                            },
                        },
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = controls_area_height,
                            Children         = new Drawable[]
                            {
                                Buttons.WithChild(CreateNewRoomButton().With(d =>
                                {
                                    d.Anchor = Anchor.BottomLeft;
                                    d.Origin = Anchor.BottomLeft;
                                    d.Size   = new Vector2(150, 37.5f);
                                    d.Action = () => Open();
                                })),
                                new FillFlowContainer
                                {
                                    Anchor             = Anchor.TopRight,
                                    Origin             = Anchor.TopRight,
                                    AutoSizeAxes       = Axes.Both,
                                    Direction          = FillDirection.Horizontal,
                                    Spacing            = new Vector2(10),
                                    ChildrenEnumerable = CreateFilterControls().Select(f => f.With(d =>
                                    {
                                        d.Anchor = Anchor.TopRight;
                                        d.Origin = Anchor.TopRight;
                                    }))
                                }
                            }
                        }
                    },
                },
            };

            // scroll selected room into view on selection.
            SelectedRoom.BindValueChanged(val =>
            {
                var drawable = roomsContainer.Rooms.FirstOrDefault(r => r.Room == val.NewValue);
                if (drawable != null)
                {
                    scrollContainer.ScrollIntoView(drawable);
                }
            });
        }
示例#12
0
        protected OsuManualInputManagerTestScene()
        {
            MenuCursorContainer cursorContainer;

            CompositeDrawable mainContent = new PopoverContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = cursorContainer = new MenuCursorContainer {
                    RelativeSizeAxes = Axes.Both,
                }
            };

            cursorContainer.Child = content = new OsuTooltipContainer(cursorContainer.Cursor)
            {
                RelativeSizeAxes = Axes.Both
            };

            if (CreateNestedActionContainer)
            {
                mainContent = new GlobalActionContainer(null).WithChild(mainContent);
            }

            base.Content.AddRange(new Drawable[]
            {
                InputManager = new ManualInputManager
                {
                    UseParentInput = true,
                    Child          = mainContent
                },
                new Container
                {
                    AutoSizeAxes = Axes.Both,
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    Margin       = new MarginPadding(5),
                    CornerRadius = 5,
                    Masking      = true,
                    Children     = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = Color4.Black,
                            RelativeSizeAxes = Axes.Both,
                            Alpha            = 0.5f,
                        },
                        new FillFlowContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Direction    = FillDirection.Vertical,
                            Margin       = new MarginPadding(5),
                            Spacing      = new Vector2(5),
                            Children     = new Drawable[]
                            {
                                new OsuSpriteText
                                {
                                    Anchor = Anchor.TopCentre,
                                    Origin = Anchor.TopCentre,
                                    Text   = "Input Priority"
                                },
                                new FillFlowContainer
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Anchor       = Anchor.TopCentre,
                                    Origin       = Anchor.TopCentre,
                                    Margin       = new MarginPadding(5),
                                    Spacing      = new Vector2(5),
                                    Direction    = FillDirection.Horizontal,

                                    Children = new Drawable[]
                                    {
                                        buttonLocal = new TriangleButton
                                        {
                                            Text   = "local",
                                            Size   = new Vector2(50, 30),
                                            Action = returnUserInput
                                        },
                                        buttonTest = new TriangleButton
                                        {
                                            Text   = "test",
                                            Size   = new Vector2(50, 30),
                                            Action = returnTestInput
                                        },
                                    }
                                },
                            }
                        },
                    }
                },
            });
        }
示例#13
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 UserModSelectOverlay(OverlayColourScheme.Plum)
            {
                SelectedMods = { BindTarget = UserMods },
                IsValidMod   = _ => false
            });
        }
        public void SetUpSteps()
        {
            AddStep("create popover container", () =>
            {
                Child = popoverWrapper = new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Anchor           = Anchor.Centre,
                    Origin           = Anchor.Centre,
                    Masking          = true,
                    BorderThickness  = 5,
                    BorderColour     = Colour4.White,
                    Children         = new Drawable[]
                    {
                        new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            AlwaysPresent    = true,
                            Colour           = Colour4.Transparent
                        },
                        popoverContainer = new PopoverContainer
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding(5),
                            Children         = new Drawable[]
                            {
                                new ClickableContainer
                                {
                                    RelativeSizeAxes = Axes.Both,
                                    Size             = new Vector2(0.5f),
                                    Children         = new Drawable[]
                                    {
                                        new Box
                                        {
                                            Colour           = Color4.Blue,
                                            RelativeSizeAxes = Axes.Both,
                                        },
                                        new TextFlowContainer
                                        {
                                            AutoSizeAxes = Axes.X,
                                            TextAnchor   = Anchor.TopCentre,
                                            Anchor       = Anchor.Centre,
                                            Origin       = Anchor.Centre,
                                            Text         = "click blocking container between\nPopover creator and PopoverContainer"
                                        }
                                    }
                                },
                                gridContainer = new GridContainer
                                {
                                    RelativeSizeAxes = Axes.Both
                                }
                            }
                        }
                    }
                };

                cells = new Container[3, 3];

                for (int r = 0; r < 3; r++)
                {
                    for (int c = 0; c < 3; c++)
                    {
                        cells[r, c] = new Container {
                            RelativeSizeAxes = Axes.Both
                        }
                    }
                    ;
                }

                gridContainer.Content = cells.ToJagged();
            });
        }