Esempio n. 1
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            RoomId.BindValueChanged(id =>
            {
                if (id.NewValue == 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.Show();
                }
                else
                {
                    mainContent.Show();
                    settingsOverlay.Hide();
                }
            }, true);

            SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged));
            UserMods.BindValueChanged(_ => Scheduler.AddOnce(UpdateMods));

            beatmapAvailabilityTracker.SelectedItem.BindTo(SelectedItem);
            beatmapAvailabilityTracker.Availability.BindValueChanged(_ => updateWorkingBeatmap());

            userModsSelectOverlayRegistration = overlayManager?.RegisterBlockingOverlay(userModsSelectOverlay);
        }
Esempio 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);
        }