mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Get some more of the design's layout in place
This commit is contained in:
parent
e13374ed23
commit
7a22c60c7c
@ -12,10 +12,14 @@ using osu.Game.GameModes.Backgrounds;
|
|||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.Drawables;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
class BeatmapButton : FlowContainer
|
class BeatmapButton : AutoSizeContainer
|
||||||
{
|
{
|
||||||
private BeatmapSet beatmapSet;
|
private BeatmapSet beatmapSet;
|
||||||
private Beatmap beatmap;
|
private Beatmap beatmap;
|
||||||
@ -24,9 +28,41 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
this.beatmapSet = set;
|
this.beatmapSet = set;
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
Children = new[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SpriteText { Text = beatmap.Version },
|
new Box
|
||||||
|
{
|
||||||
|
Colour = new Color4(40, 86, 102, 255), // TODO: texture
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(1),
|
||||||
|
},
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding(5),
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Padding = new MarginPadding { Left = 10 },
|
||||||
|
Direction = FlowDirection.HorizontalOnly,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = beatmap.Version,
|
||||||
|
TextSize = 20,
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = string.Format(" mapped by {0}", beatmap.Version),
|
||||||
|
TextSize = 16,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,11 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.GameModes.Backgrounds;
|
|
||||||
using osu.Framework;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -23,7 +19,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
class BeatmapGroup : AutoSizeContainer
|
class BeatmapGroup : AutoSizeContainer
|
||||||
{
|
{
|
||||||
private const float collapsedAlpha = 0.75f;
|
private const float collapsedAlpha = 0.3f;
|
||||||
|
|
||||||
public event Action<BeatmapSet> SetSelected;
|
public event Action<BeatmapSet> SetSelected;
|
||||||
public event Action<BeatmapSet, Beatmap> BeatmapSelected;
|
public event Action<BeatmapSet, Beatmap> BeatmapSelected;
|
||||||
@ -64,29 +60,14 @@ namespace osu.Game.GameModes.Play
|
|||||||
topContainer = new FlowContainer
|
topContainer = new FlowContainer
|
||||||
{
|
{
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Children = new[]
|
Children = new[] { new BeatmapSetBox(beatmapSet) }
|
||||||
{
|
|
||||||
new AutoSizeContainer
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = new Color4(0, 0, 0, 0.75f),
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Size = new Vector2(1),
|
|
||||||
},
|
|
||||||
new SpriteText { Text = this.BeatmapSet.Metadata.Title, TextSize = 25 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
difficulties = new FlowContainer // Deliberately not added to children
|
difficulties = new FlowContainer // Deliberately not added to children
|
||||||
{
|
{
|
||||||
Margin = new MarginPadding { Top = 10 },
|
Margin = new MarginPadding { Top = 5 },
|
||||||
Padding = new MarginPadding { Left = 50 },
|
Padding = new MarginPadding { Left = 25 },
|
||||||
Spacing = new Vector2(0, 10),
|
Spacing = new Vector2(0, 5),
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Children = this.BeatmapSet.Beatmaps.Select(b => new BeatmapButton(this.BeatmapSet, b))
|
Children = this.BeatmapSet.Beatmaps.Select(b => new BeatmapButton(this.BeatmapSet, b))
|
||||||
};
|
};
|
||||||
@ -99,4 +80,71 @@ namespace osu.Game.GameModes.Play
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BeatmapSetBox : AutoSizeContainer
|
||||||
|
{
|
||||||
|
private BeatmapSet beatmapSet;
|
||||||
|
|
||||||
|
public BeatmapSetBox(BeatmapSet beatmapSet)
|
||||||
|
{
|
||||||
|
this.beatmapSet = beatmapSet;
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = new Color4(85, 85, 85, 255), // TODO: Gradient, and beatmap texture
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Size = new Vector2(1),
|
||||||
|
},
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Direction = FlowDirection.VerticalOnly,
|
||||||
|
Spacing = new Vector2(0, 2),
|
||||||
|
Padding = new MarginPadding { Top = 3, Left = 20, Right = 20, Bottom = 3 },
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
// TODO: Make these italic
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = this.beatmapSet.Metadata.TitleUnicode ?? this.beatmapSet.Metadata.Title,
|
||||||
|
TextSize = 20
|
||||||
|
},
|
||||||
|
new SpriteText
|
||||||
|
{
|
||||||
|
Text = this.beatmapSet.Metadata.ArtistUnicode ?? this.beatmapSet.Metadata.Artist,
|
||||||
|
TextSize = 16
|
||||||
|
},
|
||||||
|
new FlowContainer
|
||||||
|
{
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
|
||||||
|
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(246, 101, 166, 255)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DifficultyIcon : Container
|
||||||
|
{
|
||||||
|
public DifficultyIcon(FontAwesome icon, Color4 color)
|
||||||
|
{
|
||||||
|
const float size = 20;
|
||||||
|
Size = new Vector2(size);
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
TextSize = size,
|
||||||
|
Size = new Vector2(size),
|
||||||
|
Colour = color,
|
||||||
|
Icon = icon
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
{
|
{
|
||||||
private Bindable<PlayMode> playMode;
|
private Bindable<PlayMode> playMode;
|
||||||
private BeatmapDatabase beatmaps;
|
private BeatmapDatabase beatmaps;
|
||||||
|
private BeatmapSet selectedBeatmapSet;
|
||||||
|
|
||||||
// TODO: use currently selected track as bg
|
// TODO: use currently selected track as bg
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
@ -30,17 +31,20 @@ namespace osu.Game.GameModes.Play
|
|||||||
private ScrollContainer scrollContainer;
|
private ScrollContainer scrollContainer;
|
||||||
private FlowContainer setList;
|
private FlowContainer setList;
|
||||||
|
|
||||||
|
private void selectBeatmapSet(BeatmapSet beatmapSet)
|
||||||
|
{
|
||||||
|
selectedBeatmapSet = beatmapSet;
|
||||||
|
foreach (var child in setList.Children)
|
||||||
|
{
|
||||||
|
var childGroup = child as BeatmapGroup;
|
||||||
|
childGroup.Collapsed = childGroup.BeatmapSet != beatmapSet;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addBeatmapSet(BeatmapSet beatmapSet)
|
private void addBeatmapSet(BeatmapSet beatmapSet)
|
||||||
{
|
{
|
||||||
var group = new BeatmapGroup(beatmapSet);
|
var group = new BeatmapGroup(beatmapSet);
|
||||||
group.SetSelected += (selectedSet) =>
|
group.SetSelected += (selectedSet) => selectBeatmapSet(selectedSet);
|
||||||
{
|
|
||||||
foreach (var child in setList.Children)
|
|
||||||
{
|
|
||||||
var childGroup = child as BeatmapGroup;
|
|
||||||
childGroup.Collapsed = childGroup.BeatmapSet != selectedSet;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
setList.Add(group);
|
setList.Add(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +110,9 @@ namespace osu.Game.GameModes.Play
|
|||||||
beatmaps = (game as OsuGameBase).Beatmaps;
|
beatmaps = (game as OsuGameBase).Beatmaps;
|
||||||
beatmaps.BeatmapSetAdded += bset => Scheduler.Add(() => addBeatmapSet(bset));
|
beatmaps.BeatmapSetAdded += bset => Scheduler.Add(() => addBeatmapSet(bset));
|
||||||
addBeatmapSets();
|
addBeatmapSets();
|
||||||
(setList.Children.First() as BeatmapGroup).Collapsed = false;
|
var first = setList.Children.First() as BeatmapGroup;
|
||||||
|
first.Collapsed = false;
|
||||||
|
selectedBeatmapSet = first.BeatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user