protected override void LoadComplete() { base.LoadComplete(); roomId.BindValueChanged(id => { if (id.NewValue == null) { settingsOverlay.Show(); } else { settingsOverlay.Hide(); // Set the first playlist item. // This is scheduled since updating the room and playlist may happen in an arbitrary order (via Room.CopyFrom()). Schedule(() => SelectedItem.Value = playlist.FirstOrDefault()); } }, true); SelectedItem.BindValueChanged(_ => Scheduler.AddOnce(selectedItemChanged)); SelectedItem.Value = playlist.FirstOrDefault(); managerUpdated = beatmapManager.ItemUpdated.GetBoundCopy(); managerUpdated.BindValueChanged(beatmapUpdated); }
protected override void LoadComplete() { base.LoadComplete(); roomId.BindValueChanged(id => { if (id.NewValue == null) { settingsOverlay.Show(); } else { settingsOverlay.Hide(); // Set the first playlist item. // This is scheduled since updating the room and playlist may happen in an arbitrary order (via Room.CopyFrom()). Schedule(() => SelectedItem.Value = Playlist.FirstOrDefault()); } }, true); }
public MatchSubScreen(Room room, Action <Screen> pushGameplayScreen) { this.room = room; this.pushGameplayScreen = pushGameplayScreen; bindings.Room = room; MatchChatDisplay chat; Components.Header header; Info info; GridContainer bottomRow; MatchSettingsOverlay settings; Children = new Drawable[] { new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { header = new Components.Header(room) { Depth = -1 } }, new Drawable[] { info = new Info(room) { OnStart = onStart } }, new Drawable[] { bottomRow = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { leaderboard = new MatchLeaderboard { Padding = new MarginPadding(10), RelativeSizeAxes = Axes.Both, Room = room }, new Container { Padding = new MarginPadding(10), RelativeSizeAxes = Axes.Both, Child = chat = new MatchChatDisplay(room) { RelativeSizeAxes = Axes.Both } }, }, }, } }, }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), } }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Components.Header.HEIGHT }, Child = settings = new MatchSettingsOverlay(room) { RelativeSizeAxes = Axes.Both }, }, }; header.OnRequestSelectBeatmap = () => Push(new MatchSongSelect { Selected = addPlaylistItem }); header.Tabs.Current.ValueChanged += t => { const float fade_duration = 500; if (t is SettingsMatchPage) { settings.Show(); info.FadeOut(fade_duration, Easing.OutQuint); bottomRow.FadeOut(fade_duration, Easing.OutQuint); } else { settings.Hide(); info.FadeIn(fade_duration, Easing.OutQuint); bottomRow.FadeIn(fade_duration, Easing.OutQuint); } }; chat.Exit += Exit; }
private void load() { MatchChatDisplay chat; Components.Header header; Info info; GridContainer bottomRow; MatchSettingsOverlay settings; InternalChildren = new Drawable[] { new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { header = new Components.Header { Depth = -1, RequestBeatmapSelection = () => { this.Push(new MatchSongSelect { Selected = item => { Playlist.Clear(); Playlist.Add(item); } }); } } }, new Drawable[] { info = new Info { OnStart = onStart } }, new Drawable[] { bottomRow = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { leaderboard = new MatchLeaderboard { Padding = new MarginPadding { Left = 10 + HORIZONTAL_OVERFLOW_PADDING, Right = 10, Vertical = 10, }, RelativeSizeAxes = Axes.Both }, new Container { Padding = new MarginPadding { Left = 10, Right = 10 + HORIZONTAL_OVERFLOW_PADDING, Vertical = 10, }, RelativeSizeAxes = Axes.Both, Child = chat = new MatchChatDisplay { RelativeSizeAxes = Axes.Both } }, }, }, } }, }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), } }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Components.Header.HEIGHT }, Child = settings = new MatchSettingsOverlay { RelativeSizeAxes = Axes.Both }, }, }; header.Tabs.Current.BindValueChanged(tab => { const float fade_duration = 500; if (tab.NewValue is SettingsMatchPage) { settings.Show(); info.FadeOut(fade_duration, Easing.OutQuint); bottomRow.FadeOut(fade_duration, Easing.OutQuint); } else { settings.Hide(); info.FadeIn(fade_duration, Easing.OutQuint); bottomRow.FadeIn(fade_duration, Easing.OutQuint); } }, true); chat.Exit += () => { if (this.IsCurrentScreen()) { this.Exit(); } }; beatmapManager.ItemAdded += beatmapAdded; }