mirror of
https://github.com/ppy/osu
synced 2025-02-21 13:07:18 +00:00
Added switching between grid/list and little transitions for the panels
This commit is contained in:
parent
1d61fc84c7
commit
05b8fc5126
@ -22,11 +22,14 @@ namespace osu.Game.Overlays.Direct
|
|||||||
private readonly float horizontal_padding = 10;
|
private readonly float horizontal_padding = 10;
|
||||||
private readonly float vertical_padding = 5;
|
private readonly float vertical_padding = 5;
|
||||||
|
|
||||||
|
private FillFlowContainer bottomPanel;
|
||||||
|
|
||||||
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||||
{
|
{
|
||||||
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
||||||
CornerRadius = 4;
|
CornerRadius = 4;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffect
|
EdgeEffect = new EdgeEffect
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
@ -36,6 +39,16 @@ namespace osu.Game.Overlays.Direct
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
FadeInFromZero(200, EasingTypes.Out);
|
||||||
|
bottomPanel.LayoutDuration = 200;
|
||||||
|
bottomPanel.LayoutEasing = EasingTypes.Out;
|
||||||
|
bottomPanel.Origin = Anchor.BottomLeft;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
||||||
{
|
{
|
||||||
@ -52,10 +65,10 @@ namespace osu.Game.Overlays.Direct
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black.Opacity(0.5f),
|
Colour = Color4.Black.Opacity(0.5f),
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
bottomPanel = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
|
@ -39,6 +39,13 @@ namespace osu.Game.Overlays.Direct
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
FadeInFromZero(200, EasingTypes.Out);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation, TextureStore textures)
|
private void load(LocalisationEngine localisation, TextureStore textures)
|
||||||
{
|
{
|
||||||
|
@ -31,15 +31,16 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
private readonly Box tabStrip;
|
private readonly Box tabStrip;
|
||||||
private readonly FillFlowContainer<RulesetToggleButton> modeButtons;
|
private readonly FillFlowContainer<RulesetToggleButton> modeButtons;
|
||||||
private FillFlowContainer resultCountsContainer;
|
private readonly FillFlowContainer resultCountsContainer;
|
||||||
private OsuSpriteText resultCountsText;
|
private readonly OsuSpriteText resultCountsText;
|
||||||
|
|
||||||
public readonly SearchTextBox Search;
|
public readonly SearchTextBox Search;
|
||||||
public readonly SortTabControl SortTabs;
|
public readonly SortTabControl SortTabs;
|
||||||
public readonly OsuEnumDropdown<RankStatus> RankStatusDropdown;
|
public readonly OsuEnumDropdown<RankStatus> RankStatusDropdown;
|
||||||
|
public readonly Bindable<PanelDisplayStyle> DisplayStyle = new Bindable<PanelDisplayStyle>();
|
||||||
|
|
||||||
private ResultCounts resultCounts;
|
private ResultCounts resultCounts;
|
||||||
public ResultCounts ResultCounts
|
public ResultCounts ResultCounts
|
||||||
{
|
{
|
||||||
get { return resultCounts; }
|
get { return resultCounts; }
|
||||||
set { resultCounts = value; updateResultCounts(); }
|
set { resultCounts = value; updateResultCounts(); }
|
||||||
@ -49,6 +50,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
DisplayStyle.Value = PanelDisplayStyle.Grid;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -90,13 +92,33 @@ namespace osu.Game.Overlays.Direct
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
RankStatusDropdown = new SlimEnumDropdown<RankStatus>
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
RelativeSizeAxes = Axes.None,
|
Spacing = new Vector2(10f, 0f),
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
Margin = new MarginPadding { Bottom = 5, Right = DirectOverlay.WIDTH_PADDING },
|
Margin = new MarginPadding { Bottom = 5, Right = DirectOverlay.WIDTH_PADDING },
|
||||||
Width = 160f,
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Spacing = new Vector2(5f, 0f),
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DisplayModeToggleButton(FontAwesome.fa_th_large, PanelDisplayStyle.Grid, DisplayStyle),
|
||||||
|
new DisplayModeToggleButton(FontAwesome.fa_list_ul, PanelDisplayStyle.List, DisplayStyle),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
RankStatusDropdown = new SlimEnumDropdown<RankStatus>
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.None,
|
||||||
|
Width = 160f,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
resultCountsContainer = new FillFlowContainer
|
resultCountsContainer = new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -117,7 +139,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
TextSize = 15,
|
TextSize = 15,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -221,6 +243,47 @@ namespace osu.Game.Overlays.Direct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class DisplayModeToggleButton : ClickableContainer
|
||||||
|
{
|
||||||
|
private readonly TextAwesome icon;
|
||||||
|
private readonly PanelDisplayStyle mode;
|
||||||
|
private readonly Bindable<PanelDisplayStyle> bindable;
|
||||||
|
|
||||||
|
public DisplayModeToggleButton(FontAwesome icon, PanelDisplayStyle mode, Bindable<PanelDisplayStyle> bindable)
|
||||||
|
{
|
||||||
|
this.bindable = bindable;
|
||||||
|
this.mode = mode;
|
||||||
|
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.mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Bindable_ValueChanged(PanelDisplayStyle mode)
|
||||||
|
{
|
||||||
|
icon.FadeTo(mode == this.mode ? 1.0f : 0.5f, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
bindable.ValueChanged -= Bindable_ValueChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SlimEnumDropdown<T> : OsuEnumDropdown<T>
|
private class SlimEnumDropdown<T> : OsuEnumDropdown<T>
|
||||||
{
|
{
|
||||||
protected override DropdownHeader CreateHeader() => new SlimDropdownHeader { AccentColour = AccentColour };
|
protected override DropdownHeader CreateHeader() => new SlimDropdownHeader { AccentColour = AccentColour };
|
||||||
@ -257,7 +320,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
public readonly int Artists;
|
public readonly int Artists;
|
||||||
public readonly int Songs;
|
public readonly int Songs;
|
||||||
public readonly int Tags;
|
public readonly int Tags;
|
||||||
|
|
||||||
public ResultCounts(int artists, int songs, int tags)
|
public ResultCounts(int artists, int songs, int tags)
|
||||||
{
|
{
|
||||||
Artists = artists;
|
Artists = artists;
|
||||||
@ -281,4 +344,10 @@ namespace osu.Game.Overlays.Direct
|
|||||||
[Description("My Maps")]
|
[Description("My Maps")]
|
||||||
MyMaps,
|
MyMaps,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PanelDisplayStyle
|
||||||
|
{
|
||||||
|
Grid,
|
||||||
|
List,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,16 +22,16 @@ namespace osu.Game.Overlays
|
|||||||
private readonly FilterControl filter;
|
private readonly FilterControl filter;
|
||||||
private readonly FillFlowContainer<DirectPanel> panels;
|
private readonly FillFlowContainer<DirectPanel> panels;
|
||||||
|
|
||||||
|
private IEnumerable<BeatmapSetInfo> beatmapSets;
|
||||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||||
{
|
{
|
||||||
|
get { return beatmapSets; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
var p = new List<DirectPanel>();
|
if (beatmapSets == value) return;
|
||||||
|
beatmapSets = value;
|
||||||
|
|
||||||
foreach (BeatmapSetInfo b in value)
|
recreatePanels(filter.DisplayStyle.Value);
|
||||||
p.Add(new DirectListPanel(b)); //todo: proper switching between grid/list
|
|
||||||
|
|
||||||
panels.Children = p;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +110,18 @@ namespace osu.Game.Overlays
|
|||||||
};
|
};
|
||||||
|
|
||||||
filter.Search.Exit = Hide;
|
filter.Search.Exit = Hide;
|
||||||
|
filter.DisplayStyle.ValueChanged += recreatePanels;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recreatePanels(PanelDisplayStyle displayStyle)
|
||||||
|
{
|
||||||
|
var p = new List<DirectPanel>();
|
||||||
|
|
||||||
|
foreach (BeatmapSetInfo b in BeatmapSets)
|
||||||
|
p.Add(displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)(new DirectGridPanel(b) { Width = 400}) :
|
||||||
|
(DirectPanel)(new DirectListPanel(b)));
|
||||||
|
|
||||||
|
panels.Children = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
Loading…
Reference in New Issue
Block a user