Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osu!direct (basic logic and layout) #805

Merged
merged 72 commits into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
9ba356f
Added osu!direct header and filter control
DrabWeb May 17, 2017
5fb445e
Basic direct panel, minor cleanups
DrabWeb May 17, 2017
cabfe72
Changed DirectPanel to a base class for DirectGridPanel and DirectLis…
DrabWeb May 17, 2017
b3ef8b8
Design updates
DrabWeb May 17, 2017
b26c8dd
Added temporary difficulties on the panels
DrabWeb May 17, 2017
9f36a39
More cleanup
DrabWeb May 18, 2017
ab14010
Added result counts (visually)
DrabWeb May 18, 2017
c3fb1ab
Mapper -> Author, use BeatmapSetInfo for metadata
DrabWeb May 18, 2017
c288067
Added displaying sets
DrabWeb May 18, 2017
0b480fe
ModeToggleButton -> RulesetToggleButton
DrabWeb May 18, 2017
065f4fa
Fix ruleset toggle buttons not updating when changing from the toolbar
DrabWeb May 18, 2017
c8102db
Fix visual test crash
DrabWeb May 18, 2017
ca6826f
Fix incorrect height between sort tabs and ruleset toggle buttons
DrabWeb May 18, 2017
1d1375c
Remove commented line
DrabWeb May 18, 2017
a5fa7e1
Result counts displaying
DrabWeb May 18, 2017
3b8cadd
Clean up DirectPanel and it's subclasses
DrabWeb May 19, 2017
e1c4c36
+BeatmapOnlineInfo, +OnlineWorkingBeatmap, minor cleanups, panel beat…
DrabWeb May 19, 2017
c6320c0
BeatmapBackgroundSprite public -> internal
DrabWeb May 19, 2017
a86d07c
Remove enclosing background container
DrabWeb May 19, 2017
c3d753a
DifficultyIcons -> GetDifficultyIcons()
DrabWeb May 19, 2017
6eac19e
Move constructor above methods in DirectPanel
DrabWeb May 19, 2017
74ed4cf
More cleanup
DrabWeb May 19, 2017
1bd13a8
Indentation
DrabWeb May 19, 2017
5b2c74b
Remove Direct folder from csproj
DrabWeb May 19, 2017
1d61fc8
Remove duplicate code in SettingsEnumDropdown
DrabWeb May 19, 2017
05b8fc5
Added switching between grid/list and little transitions for the panels
DrabWeb May 19, 2017
2f10b72
Proper dropdown expansion, DisplayModeToggleButton -> DisplayStyleTog…
DrabWeb May 19, 2017
649fc83
Fix ranked status dropdown expanding below the panels
DrabWeb May 19, 2017
6cc7602
Added download button animations
DrabWeb May 19, 2017
57115f4
Remove todo comment
DrabWeb May 19, 2017
7a60aa6
Reword comment
DrabWeb May 19, 2017
c2ea2bb
Proper search tab changing logic
DrabWeb May 19, 2017
0a90965
CI formatting
DrabWeb May 19, 2017
0a96aaf
Whitespace
DrabWeb May 19, 2017
c981a4a
Formatting
DrabWeb May 19, 2017
83c81c0
Cleanup (again)
DrabWeb May 19, 2017
e7a6412
Formatting and remove magic number
DrabWeb May 19, 2017
cdd2b54
Move SlimEnumDropdown into it's own file
DrabWeb May 19, 2017
503ee97
Fix license header
DrabWeb May 19, 2017
ffb3450
Remove <U+FEFF> character
DrabWeb May 19, 2017
6e7a09f
Line endings, use ToString for statistic value
DrabWeb May 19, 2017
68cb237
Fade in background when loaded
DrabWeb May 19, 2017
e030573
Add ReverseDepthFillFlowContainer to remove code duplication
DrabWeb May 20, 2017
0c5fec9
Change ModDisplay to use ReverseDepthFillFlowContainer
DrabWeb May 20, 2017
1eb96e0
Remove unused using directive
DrabWeb May 20, 2017
0b987be
Merge branch 'master' into osu-direct
peppy May 20, 2017
49eb096
Fix visual test mode toggle buttons activation state
DrabWeb May 20, 2017
87ace2d
@"" -> string.Empty
DrabWeb May 20, 2017
eb77c94
Fix search field losing focus
DrabWeb May 21, 2017
8c77f85
Fix DirectOverlay expanding under the Toolbar
DrabWeb May 21, 2017
4e2126d
Fix nullref when changing display mode without any BeatmapSets added
DrabWeb May 21, 2017
6bf0ca5
Make FilterControl not scroll with the panels
DrabWeb May 22, 2017
3c35bad
Unused using
DrabWeb May 22, 2017
77affc1
Split onto multiple lines
DrabWeb May 22, 2017
bdab545
Use BeatmapBackgroundSprite
DrabWeb May 22, 2017
0634a3a
Merge branch 'master' into osu-direct
peppy May 23, 2017
4f17a4f
Make result counts scroll with the panels
DrabWeb May 23, 2017
fbbcc80
Merge branch 'osu-direct' of https://github.com/DrabWeb/osu into osu-…
DrabWeb May 23, 2017
7b9eacc
CI fixes
DrabWeb May 23, 2017
aa9a636
Indentation
DrabWeb May 23, 2017
7a4b476
Tab character
DrabWeb May 23, 2017
be1ae2b
Remove ??, value can never be null
DrabWeb May 23, 2017
4ee1176
Merge branch 'master' into osu-direct
peppy May 24, 2017
15ee2b8
Hide direct overlay when requested
peppy May 24, 2017
5e01940
Compare with private field
peppy May 24, 2017
b08668b
Remove @ from to-be-localized strings
DrabWeb May 24, 2017
4490596
Keep one object per file
DrabWeb May 24, 2017
e59c187
Remove tabs
DrabWeb May 24, 2017
ba2627d
Merge branch 'osu-direct' of https://github.com/DrabWeb/osu into osu-…
DrabWeb May 24, 2017
72c9959
resultCounts -> ResultAmounts
DrabWeb May 24, 2017
a25c504
CI fixes
DrabWeb May 24, 2017
45a964c
Merge branch 'master' into osu-direct
peppy May 24, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions osu.Desktop.VisualTests/Tests/TestCaseDirect.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.Overlays;
using osu.Game.Overlays.Direct;

namespace osu.Desktop.VisualTests.Tests
{
public class TestCaseDirect : TestCase
{
public override string Description => @"osu!direct overlay";

private DirectOverlay direct;
private RulesetDatabase rulesets;

public override void Reset()
{
base.Reset();

Add(direct = new DirectOverlay());
newBeatmaps();
direct.ResultCounts = new ResultCounts(1, 432, 3);

AddStep(@"Toggle", direct.ToggleVisibility);
}

[BackgroundDependencyLoader]
private void load(RulesetDatabase rulesets)
{
this.rulesets = rulesets;
}

private void newBeatmaps()
{
var ruleset = rulesets.GetRuleset(0);

direct.BeatmapSets = new[]
{
new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
{
Title = @"OrVid",
Artist = @"An",
Author = @"RLC",
Source = @"",
},
Beatmaps = new List<BeatmapInfo>
{
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 5.35f,
Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/578332/covers/cover.jpg?1494591390" },
Preview = @"https://b.ppy.sh/preview/578332.mp3",
PlayCount = 97,
FavouriteCount = 72,
},
},
},
},
new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
{
Title = @"tiny lamp",
Artist = @"fhana",
Author = @"Sotarks",
Source = @"ぎんぎつね",
},
Beatmaps = new List<BeatmapInfo>
{
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 5.81f,
Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/599627/covers/cover.jpg?1494539318" },
Preview = @"https//b.ppy.sh/preview/599627.mp3",
PlayCount = 3082,
FavouriteCount = 14,
},
},
},
},
new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
{
Title = @"At Gwanghwamun",
Artist = @"KYUHYUN",
Author = @"Cerulean Veyron",
Source = @"",
},
Beatmaps = new List<BeatmapInfo>
{
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 0.9f,
Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/513268/covers/cover.jpg?1494502863" },
Preview = @"https//b.ppy.sh/preview/513268.mp3",
PlayCount = 2762,
FavouriteCount = 15,
},
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 1.1f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 2.02f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 3.49f,
},
},
},
new BeatmapSetInfo
{
Metadata = new BeatmapMetadata
{
Title = @"RHAPSODY OF BLUE SKY",
Artist = @"fhana",
Author = @"[Kamiya]",
Source = @"小林さんちのメイドラゴン",
},
Beatmaps = new List<BeatmapInfo>
{
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 1.26f,
Metadata = new BeatmapMetadata(),
OnlineInfo = new BeatmapOnlineInfo
{
Covers = new[] { @"https://assets.ppy.sh//beatmaps/586841/covers/cover.jpg?1494052741" },
Preview = @"https//b.ppy.sh/preview/586841.mp3",
PlayCount = 62317,
FavouriteCount = 161,
},
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 2.01f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 2.87f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 3.76f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 3.93f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 4.37f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 5.13f,
},
new BeatmapInfo
{
Ruleset = ruleset,
StarDifficulty = 5.42f,
},
},
},
};
}
}
}
1 change: 1 addition & 0 deletions osu.Desktop.VisualTests/osu.Desktop.VisualTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
<Compile Include="Tests\TestCaseLeaderboard.cs" />
<Compile Include="Beatmaps\TestWorkingBeatmap.cs" />
<Compile Include="Tests\TestCaseBeatmapDetailArea.cs" />
<Compile Include="Tests\TestCaseDirect.cs" />
</ItemGroup>
<ItemGroup />
<ItemGroup />
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace osu.Game.Beatmaps.Drawables
{
internal class DifficultyColouredContainer : Container, IHasAccentColour
public class DifficultyColouredContainer : Container, IHasAccentColour
{
public Color4 AccentColour { get; set; }

Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Beatmaps/Drawables/DifficultyIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace osu.Game.Beatmaps.Drawables
{

internal class DifficultyIcon : DifficultyColouredContainer
public class DifficultyIcon : DifficultyColouredContainer
{
private readonly BeatmapInfo beatmap;

Expand Down
3 changes: 3 additions & 0 deletions osu.Game/Database/BeatmapInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public class BeatmapInfo : IEquatable<BeatmapInfo>, IJsonSerializable
[Ignore]
public BeatmapMetrics Metrics { get; set; }

[Ignore]
public BeatmapOnlineInfo OnlineInfo { get; set; }

public string Path { get; set; }

[JsonProperty("file_md5")]
Expand Down
38 changes: 38 additions & 0 deletions osu.Game/Database/BeatmapOnlineInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using Newtonsoft.Json;
using System.Collections.Generic;

namespace osu.Game.Database
{
/// <summary>
/// Beatmap info retrieved for previewing locally without having the beatmap downloaded.
/// </summary>
public class BeatmapOnlineInfo
{
/// <summary>
/// The different sizes of cover art for this beatmap: cover, cover@2x, card, card@2x, list, list@2x.
/// </summary>
[JsonProperty(@"covers")]
public IEnumerable<string> Covers { get; set; }

/// <summary>
/// A small sample clip of this beatmap's song.
/// </summary>
[JsonProperty(@"previewUrl")]
public string Preview { get; set; }

/// <summary>
/// The amount of plays this beatmap has.
/// </summary>
[JsonProperty(@"play_count")]
public int PlayCount { get; set; }

/// <summary>
/// The amount of people who have favourited this map.
/// </summary>
[JsonProperty(@"favourite_count")]
public int FavouriteCount { get; set; }
}
}
37 changes: 37 additions & 0 deletions osu.Game/Database/OnlineWorkingBeatmap.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Linq;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;

namespace osu.Game.Database
{
internal class OnlineWorkingBeatmap : WorkingBeatmap
{
private readonly TextureStore textures;
private readonly TrackManager tracks;

public OnlineWorkingBeatmap(BeatmapInfo beatmapInfo, TextureStore textures, TrackManager tracks) : base(beatmapInfo)
{
this.textures = textures;
this.tracks = tracks;
}

protected override Beatmap GetBeatmap()
{
return new Beatmap();
}

protected override Texture GetBackground()
{
return textures.Get(BeatmapInfo.OnlineInfo.Covers.FirstOrDefault());
}

protected override Track GetTrack()
{
return tracks.Get(BeatmapInfo.OnlineInfo.Preview);
}
}
}
16 changes: 16 additions & 0 deletions osu.Game/Graphics/Containers/ReverseDepthFillFlowContainer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using System.Linq;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

namespace osu.Game.Graphics.Containers
{
public class ReverseDepthFillFlowContainer<T> : FillFlowContainer<T> where T : Drawable
{
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<T> FlowingChildren => base.FlowingChildren.Reverse();
}
}
2 changes: 1 addition & 1 deletion osu.Game/Graphics/UserInterface/OsuDropdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ private void load(OsuColour colours)
}
}

protected class OsuDropdownHeader : DropdownHeader
public class OsuDropdownHeader : DropdownHeader
{
private readonly SpriteText label;
protected override string Label
Expand Down
32 changes: 32 additions & 0 deletions osu.Game/Graphics/UserInterface/OsuEnumDropdown.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using System.ComponentModel;
using System.Reflection;
using System.Collections.Generic;

namespace osu.Game.Graphics.UserInterface
{
public class OsuEnumDropdown<T> : OsuDropdown<T>
{
public OsuEnumDropdown()
{
if (!typeof(T).IsEnum)
throw new InvalidOperationException("OsuEnumDropdown only supports enums as the generic type argument");

List<KeyValuePair<string, T>> items = new List<KeyValuePair<string, T>>();
foreach(var val in (T[])Enum.GetValues(typeof(T)))
{
var field = typeof(T).GetField(Enum.GetName(typeof(T), val));
items.Add(
new KeyValuePair<string, T>(
field.GetCustomAttribute<DescriptionAttribute>()?.Description ?? Enum.GetName(typeof(T), val),
val
)
);
}
Items = items;
}
}
}
Loading