private void recreatePanels(PanelDisplayStyle displayStyle) { if (BeatmapSets == null) { return; } panels.Children = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel) new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b)); }
private void recreatePanels(PanelDisplayStyle displayStyle) { clearPanels(); if (Users == null) { return; } var newPanels = new FillFlowContainer <SocialPanel> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(10f), Margin = new MarginPadding { Top = 10 }, ChildrenEnumerable = Users.Select(u => { SocialPanel panel; switch (displayStyle) { case PanelDisplayStyle.Grid: panel = new SocialGridPanel(u) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }; break; default: panel = new SocialListPanel(u); break; } panel.Status.BindTo(u.Status); return(panel); }) }; LoadComponentAsync(newPanels, f => { if (panels != null) { ScrollFlow.Remove(panels); } ScrollFlow.Add(panels = newPanels); }); }
private void recreatePanels(PanelDisplayStyle displayStyle) { if (panels != null) { panels.FadeOut(200); panels.Expire(); panels = null; } if (BeatmapSets == null) { return; } var newPanels = new FillFlowContainer <DirectPanel> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(panel_padding), Margin = new MarginPadding { Top = 10 }, ChildrenEnumerable = BeatmapSets.Select <BeatmapSetInfo, DirectPanel>(b => { switch (displayStyle) { case PanelDisplayStyle.Grid: return(new DirectGridPanel(b) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }); default: return(new DirectListPanel(b)); } }) }; LoadComponentAsync(newPanels, p => { if (panels != null) { ScrollFlow.Remove(panels); } ScrollFlow.Add(panels = newPanels); }); }
public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable <PanelDisplayStyle> bindable) { this.bindable = bindable; this.style = style; Size = new Vector2(25f); Children = new Drawable[] { this.icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = icon, Size = new Vector2(18), Alpha = 0.5f, }, }; bindable.ValueChanged += Bindable_ValueChanged; Bindable_ValueChanged(new ValueChangedEvent <PanelDisplayStyle>(bindable.Value, bindable.Value)); Action = () => bindable.Value = this.style; }
private void recreatePanels(PanelDisplayStyle displayStyle) { if (BeatmapSets == null) { return; } panels.ChildrenEnumerable = BeatmapSets.Select <BeatmapSetInfo, DirectPanel>(b => { switch (displayStyle) { case PanelDisplayStyle.Grid: return(new DirectGridPanel(b) { Width = 400 }); default: return(new DirectListPanel(b)); } }); }
public DisplayStyleToggleButton(FontAwesome icon, PanelDisplayStyle style, Bindable <PanelDisplayStyle> bindable) { this.bindable = bindable; this.style = style; Size = new Vector2(25f); Children = new Drawable[] { this.icon = new TextAwesome { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = icon, TextSize = 18, UseFullGlyphHeight = false, Alpha = 0.5f, }, }; bindable.ValueChanged += Bindable_ValueChanged; Bindable_ValueChanged(bindable.Value); Action = () => bindable.Value = this.style; }
private void Bindable_ValueChanged(PanelDisplayStyle style) { icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); }
private void recreatePanels(PanelDisplayStyle displayStyle) { if (panels != null) { panels.FadeOut(200); panels.Expire(); panels = null; if (playing != null) { playing.PreviewPlaying.Value = false; playing = null; } } if (BeatmapSets == null) { return; } var newPanels = new FillFlowContainer <DirectPanel> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(panel_padding), Margin = new MarginPadding { Top = 10 }, ChildrenEnumerable = BeatmapSets.Select <BeatmapSetInfo, DirectPanel>(b => { switch (displayStyle) { case PanelDisplayStyle.Grid: return(new DirectGridPanel(b) { Width = 400 }); default: return(new DirectListPanel(b)); } }) }; LoadComponentAsync(newPanels, p => { if (panels != null) { ScrollFlow.Remove(panels); } ScrollFlow.Add(panels = newPanels); foreach (DirectPanel panel in p.Children) { panel.PreviewPlaying.ValueChanged += newValue => { if (newValue) { if (playing != null && playing != panel) { playing.PreviewPlaying.Value = false; } playing = panel; } } } ; }); }