Exemplo n.º 1
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
            });
        }
Exemplo n.º 2
0
        public Match(Room room)
        {
            this.room = room;
            Header header;
            RoomSettingsOverlay settings;
            Info info;

            Children = new Drawable[]
            {
                header = new Header
                {
                    Depth = -1,
                },
                info = new Info
                {
                    Margin = new MarginPadding {
                        Top = Header.HEIGHT
                    },
                },
                participants = new Participants
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = Header.HEIGHT + Info.HEIGHT
                    },
                },
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    Padding          = new MarginPadding {
                        Top = Header.HEIGHT
                    },
                    Child = settings = new RoomSettingsOverlay(room)
                    {
                        RelativeSizeAxes = Axes.Both,
                        Height           = 0.9f,
                    },
                },
            };

            header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect());

            beatmapBind.BindTo(room.Beatmap);
            beatmapBind.BindValueChanged(b =>
            {
                header.BeatmapSet = b?.BeatmapSet;
                info.Beatmap      = b;
            }, true);

            header.Tabs.Current.ValueChanged += t =>
            {
                if (t == MatchHeaderPage.Settings)
                {
                    settings.Show();
                }
                else
                {
                    settings.Hide();
                }
            };

            settings.StateChanged += s =>
            {
                if (s == Visibility.Hidden)
                {
                    header.Tabs.Current.Value = MatchHeaderPage.Room;
                }
            };

            nameBind.BindTo(room.Name);
            nameBind.BindValueChanged(n => info.Name = n, true);

            statusBind.BindTo(room.Status);
            statusBind.BindValueChanged(s => info.Status = s, true);

            availabilityBind.BindTo(room.Availability);
            availabilityBind.BindValueChanged(a => info.Availability = a, true);

            typeBind.BindTo(room.Type);
            typeBind.BindValueChanged(t => info.Type = t, true);

            maxParticipantsBind.BindTo(room.MaxParticipants);
            maxParticipantsBind.BindValueChanged(m => { participants.Max = m; }, true);

            participantsBind.BindTo(room.Participants);
            participantsBind.BindValueChanged(p => participants.Users = p, true);
        }