mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:53:21 +08:00
Merge branch 'master' of https://github.com/ppy/osu into better-transforms
This commit is contained in:
commit
b5fbb26f8f
@ -1 +1 @@
|
||||
Subproject commit 46a56e0e11d56c788ff8db089582718a606ed158
|
||||
Subproject commit 991177da4fbed2dd8260c215f2d341ebc858b03e
|
@ -198,7 +198,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size });
|
||||
Add(valueText = new OsuSpriteText() { TextSize = text_size });
|
||||
Add(valueText = new OsuSpriteText { TextSize = text_size });
|
||||
Margin = new MarginPadding(margin);
|
||||
}
|
||||
}
|
||||
|
@ -48,6 +48,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Author = @"RLC",
|
||||
Source = @"",
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Card = @"https://assets.ppy.sh/beatmaps/578332/covers/card.jpg?1494591390",
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/578332/covers/cover.jpg?1494591390",
|
||||
},
|
||||
Preview = @"https://b.ppy.sh/preview/578332.mp3",
|
||||
PlayCount = 97,
|
||||
FavouriteCount = 72,
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
@ -55,13 +66,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -74,6 +78,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Author = @"Sotarks",
|
||||
Source = @"ぎんぎつね",
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Card = @"https://assets.ppy.sh/beatmaps/599627/covers/card.jpg?1494539318",
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/599627/covers/cover.jpg?1494539318",
|
||||
},
|
||||
Preview = @"https//b.ppy.sh/preview/599627.mp3",
|
||||
PlayCount = 3082,
|
||||
FavouriteCount = 14,
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
@ -81,13 +96,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -100,6 +108,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Author = @"Cerulean Veyron",
|
||||
Source = @"",
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Card = @"https://assets.ppy.sh/beatmaps/513268/covers/card.jpg?1494502863",
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/513268/covers/cover.jpg?1494502863",
|
||||
},
|
||||
Preview = @"https//b.ppy.sh/preview/513268.mp3",
|
||||
PlayCount = 2762,
|
||||
FavouriteCount = 15,
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
@ -107,13 +126,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
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
|
||||
{
|
||||
@ -141,6 +153,17 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Author = @"[Kamiya]",
|
||||
Source = @"小林さんちのメイドラゴン",
|
||||
},
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Card = @"https://assets.ppy.sh/beatmaps/586841/covers/card.jpg?1494052741",
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/586841/covers/cover.jpg?1494052741",
|
||||
},
|
||||
Preview = @"https//b.ppy.sh/preview/586841.mp3",
|
||||
PlayCount = 62317,
|
||||
FavouriteCount = 161,
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
{
|
||||
new BeatmapInfo
|
||||
@ -148,13 +171,6 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
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
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ using osu.Game.Screens.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Database;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
@ -15,74 +16,117 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
public override string Description => @"Select your favourite room";
|
||||
|
||||
private RulesetDatabase rulesets;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
DrawableRoom first;
|
||||
DrawableRoom second;
|
||||
Add(new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 500f,
|
||||
Width = 580f,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
first = new DrawableRoom(new Room()),
|
||||
second = new DrawableRoom(new Room()),
|
||||
first = new DrawableRoom(new Room
|
||||
{
|
||||
Name = { Value = @"Great Room Right Here" },
|
||||
Host = { Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } } },
|
||||
Status = { Value = new RoomStatusOpen() },
|
||||
Type = { Value = new GameTypeTeamVersus() },
|
||||
Beatmap =
|
||||
{
|
||||
Value = new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 4.65,
|
||||
Ruleset = rulesets.GetRuleset(3),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Critical Crystal",
|
||||
Artist = @"Seiryu",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh//beatmaps/376340/covers/cover.jpg?1456478455",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Participants =
|
||||
{
|
||||
Value = new[]
|
||||
{
|
||||
new User { GlobalRank = 1355 },
|
||||
new User { GlobalRank = 8756 },
|
||||
},
|
||||
},
|
||||
}),
|
||||
new DrawableRoom(new Room
|
||||
{
|
||||
Name = { Value = @"Relax It's The Weekend" },
|
||||
Host = { Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } } },
|
||||
Status = { Value = new RoomStatusPlaying() },
|
||||
Type = { Value = new GameTypeTagTeam() },
|
||||
Beatmap =
|
||||
{
|
||||
Value = new BeatmapInfo
|
||||
{
|
||||
StarDifficulty = 1.96,
|
||||
Ruleset = rulesets.GetRuleset(0),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Serendipity",
|
||||
Artist = @"ZAQ",
|
||||
},
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh//beatmaps/526839/covers/cover.jpg?1493815706",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Participants =
|
||||
{
|
||||
Value = new[]
|
||||
{
|
||||
new User { GlobalRank = 578975 },
|
||||
new User { GlobalRank = 24554 },
|
||||
},
|
||||
},
|
||||
}),
|
||||
}
|
||||
});
|
||||
|
||||
first.Room.Name.Value = @"Great Room Right Here";
|
||||
first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" } };
|
||||
first.Room.Status.Value = new RoomStatusOpen();
|
||||
first.Room.Beatmap.Value = new BeatmapInfo
|
||||
AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
|
||||
AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
|
||||
AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
|
||||
AddStep(@"change type", () => first.Room.Type.Value = new GameTypeVersus());
|
||||
AddStep(@"change beatmap", () => first.Room.Beatmap.Value = null);
|
||||
AddStep(@"change participants", () => first.Room.Participants.Value = new[]
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Seiryu",
|
||||
Artist = @"Critical Crystal",
|
||||
},
|
||||
};
|
||||
|
||||
second.Room.Name.Value = @"Relax It's The Weekend";
|
||||
second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" } };
|
||||
second.Room.Status.Value = new RoomStatusPlaying();
|
||||
second.Room.Beatmap.Value = new BeatmapInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Serendipity",
|
||||
Artist = @"ZAQ",
|
||||
},
|
||||
};
|
||||
|
||||
AddStep(@"change state", () =>
|
||||
{
|
||||
first.Room.Status.Value = new RoomStatusPlaying();
|
||||
new User { GlobalRank = 1254 },
|
||||
new User { GlobalRank = 123189 },
|
||||
});
|
||||
}
|
||||
|
||||
AddStep(@"change name", () =>
|
||||
{
|
||||
first.Room.Name.Value = @"I Changed Name";
|
||||
});
|
||||
|
||||
AddStep(@"change host", () =>
|
||||
{
|
||||
first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } };
|
||||
});
|
||||
|
||||
AddStep(@"change beatmap", () =>
|
||||
{
|
||||
first.Room.Beatmap.Value = null;
|
||||
});
|
||||
|
||||
AddStep(@"change state", () =>
|
||||
{
|
||||
first.Room.Status.Value = new RoomStatusOpen();
|
||||
});
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
this.rulesets = rulesets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs
Normal file
27
osu.Desktop.VisualTests/Tests/TestCaseMedalOverlay.cs
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseMedalOverlay : TestCase
|
||||
{
|
||||
public override string Description => @"medal get!";
|
||||
|
||||
public TestCaseMedalOverlay()
|
||||
{
|
||||
AddStep(@"display", () =>
|
||||
{
|
||||
LoadComponentAsync(new MedalOverlay(new Medal
|
||||
{
|
||||
Name = @"Animations",
|
||||
InternalName = @"all-intro-doubletime",
|
||||
Description = @"More complex than you think.",
|
||||
}), Add);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -46,7 +46,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
MaxCombo = 123,
|
||||
Rank = ScoreRank.A,
|
||||
Date = DateTimeOffset.Now,
|
||||
Statistics = new Dictionary<string, dynamic>()
|
||||
Statistics = new Dictionary<string, dynamic>
|
||||
{
|
||||
{ "300", 50 },
|
||||
{ "100", 20 },
|
||||
|
@ -39,9 +39,15 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Artist = @"Maaya Sakamoto",
|
||||
Author = @"uwutm8",
|
||||
},
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Covers = new[] { @"https://assets.ppy.sh//beatmaps/560573/covers/cover.jpg?1492722343" },
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/560573/covers/cover.jpg?1492722343",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -96,15 +102,21 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Ruleset = rulesets.GetRuleset(0),
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"xi",
|
||||
Artist = @"FREEDOM DIVE",
|
||||
Title = @"FREEDOM DIVE",
|
||||
Artist = @"xi",
|
||||
Author = @"Nakagawa-Kanon",
|
||||
},
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
BeatmapSet = new BeatmapSetInfo
|
||||
{
|
||||
Covers = new[] { @"https://assets.ppy.sh//beatmaps/39804/covers/cover.jpg?1456506845" },
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = new BeatmapSetOnlineCovers
|
||||
{
|
||||
Cover = @"https://assets.ppy.sh/beatmaps/39804/covers/cover.jpg?1456506845",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
MaxParticipants = { Value = 10 },
|
||||
Participants =
|
||||
|
@ -231,6 +231,7 @@
|
||||
<Compile Include="Tests\TestCaseDirect.cs" />
|
||||
<Compile Include="Tests\TestCaseSocial.cs" />
|
||||
<Compile Include="Tests\TestCaseBreadcrumbs.cs" />
|
||||
<Compile Include="Tests\TestCaseMedalOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseRoomInspector.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Desktop
|
||||
{
|
||||
desktopWindow.CursorState |= CursorState.Hidden;
|
||||
|
||||
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
|
||||
desktopWindow.Icon = new Icon(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico"));
|
||||
desktopWindow.Title = Name;
|
||||
|
||||
desktopWindow.DragEnter += dragEnter;
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Desktop.Overlays
|
||||
{
|
||||
private OsuGame game;
|
||||
|
||||
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
||||
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification
|
||||
{
|
||||
Text = @"Update ready to install. Click to restart!",
|
||||
Activated = () =>
|
||||
|
@ -232,7 +232,7 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="lazer.ico" />
|
||||
<EmbeddedResource Include="lazer.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@ -15,6 +15,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Osu.Scoring;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
@ -119,6 +120,8 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new OsuScoreProcessor();
|
||||
|
||||
public override SettingsSubsection CreateSettings() => new OsuSettings();
|
||||
|
||||
public override int LegacyID => 0;
|
||||
}
|
||||
}
|
||||
|
33
osu.Game.Rulesets.Osu/UI/OsuSettings.cs
Normal file
33
osu.Game.Rulesets.Osu/UI/OsuSettings.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
public class OsuSettings : SettingsSubsection
|
||||
{
|
||||
protected override string Header => "osu!";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking in sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking out sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -78,6 +78,7 @@
|
||||
<Compile Include="OsuDifficulty\Skills\Speed.cs" />
|
||||
<Compile Include="OsuDifficulty\Utils\History.cs" />
|
||||
<Compile Include="OsuKeyConversionInputManager.cs" />
|
||||
<Compile Include="UI\OsuSettings.cs" />
|
||||
<Compile Include="Scoring\OsuScoreProcessor.cs" />
|
||||
<Compile Include="UI\OsuHitRenderer.cs" />
|
||||
<Compile Include="UI\OsuPlayfield.cs" />
|
||||
|
@ -91,7 +91,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
if (time < list[0].Time)
|
||||
return prePoint ?? new T();
|
||||
|
||||
int index = list.BinarySearch(new T() { Time = time });
|
||||
int index = list.BinarySearch(new T { Time = time });
|
||||
|
||||
// Check if we've found an exact match (t == time)
|
||||
if (index >= 0)
|
||||
|
28
osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs
Normal file
28
osu.Game/Beatmaps/Drawables/BeatmapSetCover.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public class BeatmapSetCover : Sprite
|
||||
{
|
||||
private readonly BeatmapSetInfo set;
|
||||
public BeatmapSetCover(BeatmapSetInfo set)
|
||||
{
|
||||
this.set = set;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
string resource = set.OnlineInfo.Covers.Cover;
|
||||
|
||||
if (resource != null)
|
||||
Texture = textures.Get(resource);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using SQLite.Net.Attributes;
|
||||
|
||||
namespace osu.Game.Database
|
||||
@ -17,8 +18,13 @@ namespace osu.Game.Database
|
||||
public string TitleUnicode { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string ArtistUnicode { get; set; }
|
||||
|
||||
[JsonProperty(@"creator")]
|
||||
public string Author { get; set; }
|
||||
|
||||
public string Source { get; set; }
|
||||
|
||||
[JsonProperty(@"tags")]
|
||||
public string Tags { get; set; }
|
||||
public int PreviewTime { get; set; }
|
||||
public string AudioFile { get; set; }
|
||||
@ -35,4 +41,4 @@ namespace osu.Game.Database
|
||||
Tags
|
||||
}.Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
@ -11,28 +10,16 @@ namespace osu.Game.Database
|
||||
/// </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")]
|
||||
[JsonProperty(@"playcount")]
|
||||
public int PlayCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of people who have favourited this map.
|
||||
/// The amount of passes this beatmap has.
|
||||
/// </summary>
|
||||
[JsonProperty(@"favourite_count")]
|
||||
public int FavouriteCount { get; set; }
|
||||
[JsonProperty(@"passcount")]
|
||||
public int PassCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,9 @@ namespace osu.Game.Database
|
||||
[OneToMany(CascadeOperations = CascadeOperation.All)]
|
||||
public List<BeatmapInfo> Beatmaps { get; set; }
|
||||
|
||||
[Ignore]
|
||||
public BeatmapSetOnlineInfo OnlineInfo { get; set; }
|
||||
|
||||
public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
|
||||
|
||||
[Indexed]
|
||||
|
55
osu.Game/Database/BeatmapSetOnlineInfo.cs
Normal file
55
osu.Game/Database/BeatmapSetOnlineInfo.cs
Normal file
@ -0,0 +1,55 @@
|
||||
// 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;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
/// <summary>
|
||||
/// Beatmap set info retrieved for previewing locally without having the set downloaded.
|
||||
/// </summary>
|
||||
public class BeatmapSetOnlineInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The different sizes of cover art for this beatmap set.
|
||||
/// </summary>
|
||||
[JsonProperty(@"covers")]
|
||||
public BeatmapSetOnlineCovers Covers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A small sample clip of this beatmap set's song.
|
||||
/// </summary>
|
||||
[JsonProperty(@"previewUrl")]
|
||||
public string Preview { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of plays this beatmap set has.
|
||||
/// </summary>
|
||||
[JsonProperty(@"play_count")]
|
||||
public int PlayCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of people who have favourited this beatmap set.
|
||||
/// </summary>
|
||||
[JsonProperty(@"favourite_count")]
|
||||
public int FavouriteCount { get; set; }
|
||||
}
|
||||
|
||||
public class BeatmapSetOnlineCovers
|
||||
{
|
||||
public string CoverLowRes { get; set; }
|
||||
|
||||
[JsonProperty(@"cover@2x")]
|
||||
public string Cover { get; set; }
|
||||
|
||||
public string CardLowRes { get; set; }
|
||||
|
||||
[JsonProperty(@"card@2x")]
|
||||
public string Card { get; set; }
|
||||
|
||||
public string ListLowRes { get; set; }
|
||||
|
||||
[JsonProperty(@"list@2x")]
|
||||
public string List { get; set; }
|
||||
}
|
||||
}
|
@ -69,7 +69,7 @@ namespace osu.Game.Database
|
||||
var trackData = getReader()?.GetStream(Metadata.AudioFile);
|
||||
return trackData == null ? null : new TrackBass(trackData);
|
||||
}
|
||||
catch { return null; }
|
||||
catch { return new TrackVirtual(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
}
|
75
osu.Game/Graphics/Containers/OsuScrollContainer.cs
Normal file
75
osu.Game/Graphics/Containers/OsuScrollContainer.cs
Normal file
@ -0,0 +1,75 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
internal class OsuScrollContainer : ScrollContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// Allows controlling the scroll bar from any position in the container using the right mouse button.
|
||||
/// Uses the value of <see cref="DistanceDecayOnRightMouseScrollbar"/> to smoothly scroll to the dragged location.
|
||||
/// </summary>
|
||||
public bool RightMouseScrollbar = false;
|
||||
|
||||
/// <summary>
|
||||
/// Controls the rate with which the target position is approached when performing a relative drag. Default is 0.02.
|
||||
/// </summary>
|
||||
public double DistanceDecayOnRightMouseScrollbar = 0.02;
|
||||
|
||||
private bool shouldPerformRightMouseScroll(InputState state) => RightMouseScrollbar && state.Mouse.IsPressed(MouseButton.Right);
|
||||
|
||||
private void scrollToRelative(float value) => ScrollTo(Clamp((value - Scrollbar.DrawSize[ScrollDim] / 2) / Scrollbar.Size[ScrollDim]), true, DistanceDecayOnRightMouseScrollbar);
|
||||
|
||||
private bool mouseScrollBarDragging;
|
||||
|
||||
protected override bool IsDragging => base.IsDragging || mouseScrollBarDragging;
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(state))
|
||||
{
|
||||
scrollToRelative(state.Mouse.Position[ScrollDim]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnMouseDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
{
|
||||
scrollToRelative(state.Mouse.Position[ScrollDim]);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDrag(state);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
{
|
||||
if (shouldPerformRightMouseScroll(state))
|
||||
{
|
||||
mouseScrollBarDragging = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDragStart(state);
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(InputState state)
|
||||
{
|
||||
if (mouseScrollBarDragging)
|
||||
{
|
||||
mouseScrollBarDragging = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDragEnd(state);
|
||||
}
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
public SectionsContainer()
|
||||
{
|
||||
Add(ScrollContainer = new ScrollContainer()
|
||||
Add(ScrollContainer = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = false,
|
||||
@ -123,6 +123,8 @@ namespace osu.Game.Graphics.Containers
|
||||
originalSectionsMargin = sectionsContainer.Margin;
|
||||
}
|
||||
|
||||
public void ScrollTo(Drawable section) => ScrollContainer.ScrollTo(ScrollContainer.GetChildPosInContent(section) - FixedHeader.BoundingBox.Height);
|
||||
|
||||
private float lastKnownScroll;
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
|
97
osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs
Normal file
97
osu.Game/Online/API/Requests/GetBeatmapSetsRequest.cs
Normal file
@ -0,0 +1,97 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Direct;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetBeatmapSetsRequest : APIRequest<IEnumerable<GetBeatmapSetsResponse>>
|
||||
{
|
||||
private readonly string query;
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly RankStatus rankStatus;
|
||||
private readonly DirectSortCriteria sortCriteria;
|
||||
private readonly SortDirection direction;
|
||||
private string directionString => direction == SortDirection.Descending ? @"desc" : @"asc";
|
||||
|
||||
public GetBeatmapSetsRequest(string query, RulesetInfo ruleset, RankStatus rankStatus = RankStatus.Any, DirectSortCriteria sortCriteria = DirectSortCriteria.Ranked, SortDirection direction = SortDirection.Descending)
|
||||
{
|
||||
this.query = System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
this.rankStatus = rankStatus;
|
||||
this.sortCriteria = sortCriteria;
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)rankStatus}&sort={sortCriteria.ToString().ToLower()}_{directionString}";
|
||||
}
|
||||
|
||||
public class GetBeatmapSetsResponse : BeatmapMetadata
|
||||
{
|
||||
[JsonProperty(@"covers")]
|
||||
private BeatmapSetOnlineCovers covers { get; set; }
|
||||
|
||||
[JsonProperty(@"previewUrl")]
|
||||
private string preview { get; set; }
|
||||
|
||||
[JsonProperty(@"play_count")]
|
||||
private int playCount { get; set; }
|
||||
|
||||
[JsonProperty(@"favourite_count")]
|
||||
private int favouriteCount { get; set; }
|
||||
|
||||
[JsonProperty(@"beatmaps")]
|
||||
private IEnumerable<GetBeatmapSetsBeatmapResponse> beatmaps { get; set; }
|
||||
|
||||
public BeatmapSetInfo ToBeatmapSet(RulesetDatabase rulesets)
|
||||
{
|
||||
return new BeatmapSetInfo
|
||||
{
|
||||
Metadata = this,
|
||||
OnlineInfo = new BeatmapSetOnlineInfo
|
||||
{
|
||||
Covers = covers,
|
||||
Preview = preview,
|
||||
PlayCount = playCount,
|
||||
FavouriteCount = favouriteCount,
|
||||
},
|
||||
Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
private class GetBeatmapSetsBeatmapResponse : BeatmapMetadata
|
||||
{
|
||||
[JsonProperty(@"playcount")]
|
||||
private int playCount { get; set; }
|
||||
|
||||
[JsonProperty(@"passcount")]
|
||||
private int passCount { get; set; }
|
||||
|
||||
[JsonProperty(@"mode_int")]
|
||||
private int ruleset { get; set; }
|
||||
|
||||
[JsonProperty(@"difficulty_rating")]
|
||||
private double starDifficulty { get; set; }
|
||||
|
||||
public BeatmapInfo ToBeatmap(RulesetDatabase rulesets)
|
||||
{
|
||||
return new BeatmapInfo
|
||||
{
|
||||
Metadata = this,
|
||||
Ruleset = rulesets.GetRuleset(ruleset),
|
||||
StarDifficulty = starDifficulty,
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
PlayCount = playCount,
|
||||
PassCount = passCount,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -52,10 +52,32 @@ namespace osu.Game.Online.Multiplayer
|
||||
public override string Name => "Tag Team";
|
||||
public override Drawable GetIcon(OsuColour colours, float size)
|
||||
{
|
||||
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
|
||||
return new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(2f),
|
||||
Children = new[]
|
||||
{
|
||||
new TextAwesome
|
||||
{
|
||||
Icon = FontAwesome.fa_refresh,
|
||||
TextSize = size * 0.75f,
|
||||
Colour = colours.Blue,
|
||||
Shadow = false,
|
||||
UseFullGlyphHeight = false,
|
||||
},
|
||||
new TextAwesome
|
||||
{
|
||||
Icon = FontAwesome.fa_refresh,
|
||||
TextSize = size * 0.75f,
|
||||
Colour = colours.Pink,
|
||||
Shadow = false,
|
||||
UseFullGlyphHeight = false,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ namespace osu.Game
|
||||
}
|
||||
}
|
||||
|
||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||
|
||||
private OsuScreen screenStack;
|
||||
|
||||
private VolumeControl volume;
|
||||
@ -360,7 +362,7 @@ namespace osu.Game
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
mainContent.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
mainContent.Padding = new MarginPadding { Top = ToolbarOffset };
|
||||
|
||||
Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Overlays.Chat
|
||||
Padding = new MarginPadding { Top = 85, Right = WIDTH_PADDING },
|
||||
Children = new[]
|
||||
{
|
||||
new ScrollContainer
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.Chat
|
||||
@ -25,7 +26,7 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scroll = new ScrollContainer
|
||||
scroll = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
|
@ -1,14 +1,12 @@
|
||||
// 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 OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
@ -50,7 +48,7 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
@ -59,7 +57,7 @@ namespace osu.Game.Overlays.Direct
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
GetBackground(textures),
|
||||
CreateBackground(),
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -180,11 +178,11 @@ namespace osu.Game.Overlays.Direct
|
||||
Margin = new MarginPadding { Top = vertical_padding, Right = vertical_padding },
|
||||
Children = new[]
|
||||
{
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
||||
{
|
||||
Margin = new MarginPadding { Right = 1 },
|
||||
},
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0),
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -12,8 +12,6 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Database;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -49,7 +47,7 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LocalisationEngine localisation, TextureStore textures)
|
||||
private void load(LocalisationEngine localisation)
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
@ -58,7 +56,7 @@ namespace osu.Game.Overlays.Direct
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
GetBackground(textures),
|
||||
CreateBackground(),
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -105,11 +103,11 @@ namespace osu.Game.Overlays.Direct
|
||||
Margin = new MarginPadding { Right = height - vertical_padding * 2 + vertical_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
||||
{
|
||||
Margin = new MarginPadding { Right = 1 },
|
||||
},
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.FavouriteCount ?? 0),
|
||||
new Statistic(FontAwesome.fa_heart, SetInfo.OnlineInfo?.FavouriteCount ?? 0),
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
|
@ -2,12 +2,10 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
@ -34,21 +32,25 @@ namespace osu.Game.Overlays.Direct
|
||||
return icons;
|
||||
}
|
||||
|
||||
protected Drawable GetBackground(TextureStore textures)
|
||||
protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetCover(SetInfo)
|
||||
{
|
||||
return new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(SetInfo.Beatmaps.FirstOrDefault(), textures, null))
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
|
||||
}) { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TimeBeforeLoad = 300
|
||||
};
|
||||
|
||||
public class Statistic : FillFlowContainer
|
||||
{
|
||||
private readonly SpriteText text;
|
||||
|
||||
private int value;
|
||||
|
||||
public int Value
|
||||
{
|
||||
get { return value; }
|
||||
|
@ -14,12 +14,13 @@ using osu.Game.Overlays.SearchableList;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class FilterControl : SearchableListFilterControl<DirectSortCritera, RankStatus>
|
||||
public class FilterControl : SearchableListFilterControl<DirectSortCriteria, RankStatus>
|
||||
{
|
||||
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||
private FillFlowContainer<RulesetToggleButton> modeButtons;
|
||||
|
||||
protected override Color4 BackgroundColour => OsuColour.FromHex(@"384552");
|
||||
protected override DirectSortCritera DefaultTab => DirectSortCritera.Title;
|
||||
protected override DirectSortCriteria DefaultTab => DirectSortCriteria.Ranked;
|
||||
protected override Drawable CreateSupplementaryControls()
|
||||
{
|
||||
modeButtons = new FillFlowContainer<RulesetToggleButton>
|
||||
@ -36,10 +37,10 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark;
|
||||
|
||||
var b = new Bindable<RulesetInfo>(); //backup bindable incase the game is null
|
||||
Ruleset.BindTo(game?.Ruleset ?? new Bindable<RulesetInfo> { Value = rulesets.GetRuleset(0) });
|
||||
foreach (var r in rulesets.AllRulesets)
|
||||
{
|
||||
modeButtons.Add(new RulesetToggleButton(game?.Ruleset ?? b, r));
|
||||
modeButtons.Add(new RulesetToggleButton(Ruleset, r));
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,7 +96,7 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
}
|
||||
|
||||
public enum DirectSortCritera
|
||||
public enum DirectSortCriteria
|
||||
{
|
||||
Title,
|
||||
Artist,
|
||||
@ -103,5 +104,6 @@ namespace osu.Game.Overlays.Direct
|
||||
Difficulty,
|
||||
Ranked,
|
||||
Rating,
|
||||
Plays,
|
||||
}
|
||||
}
|
||||
|
@ -30,10 +30,10 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
Search,
|
||||
[Description("Newest Maps")]
|
||||
NewestMaps,
|
||||
NewestMaps = DirectSortCriteria.Ranked,
|
||||
[Description("Top Rated")]
|
||||
TopRated,
|
||||
TopRated = DirectSortCriteria.Rating,
|
||||
[Description("Most Played")]
|
||||
MostPlayed
|
||||
MostPlayed = DirectSortCriteria.Plays,
|
||||
}
|
||||
}
|
||||
|
@ -5,21 +5,28 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Overlays.Direct;
|
||||
using osu.Game.Overlays.SearchableList;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class DirectOverlay : SearchableListOverlay<DirectTab, DirectSortCritera, RankStatus>
|
||||
public class DirectOverlay : SearchableListOverlay<DirectTab, DirectSortCriteria, RankStatus>
|
||||
{
|
||||
private const float panel_padding = 10f;
|
||||
|
||||
private APIAccess api;
|
||||
private RulesetDatabase rulesets;
|
||||
|
||||
private readonly FillFlowContainer resultCountsContainer;
|
||||
private readonly OsuSpriteText resultCountsText;
|
||||
private readonly FillFlowContainer<DirectPanel> panels;
|
||||
@ -29,7 +36,7 @@ namespace osu.Game.Overlays
|
||||
protected override Color4 TrianglesColourDark => OsuColour.FromHex(@"3f5265");
|
||||
|
||||
protected override SearchableListHeader<DirectTab> CreateHeader() => new Header();
|
||||
protected override SearchableListFilterControl<DirectSortCritera, RankStatus> CreateFilterControl() => new FilterControl();
|
||||
protected override SearchableListFilterControl<DirectSortCriteria, RankStatus> CreateFilterControl() => new FilterControl();
|
||||
|
||||
private IEnumerable<BeatmapSetInfo> beatmapSets;
|
||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||
@ -40,6 +47,17 @@ namespace osu.Game.Overlays
|
||||
if (beatmapSets?.Equals(value) ?? false) return;
|
||||
beatmapSets = value;
|
||||
|
||||
if (BeatmapSets == null)
|
||||
{
|
||||
foreach (var p in panels.Children)
|
||||
{
|
||||
p.FadeOut(200);
|
||||
p.Expire();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value);
|
||||
}
|
||||
}
|
||||
@ -98,22 +116,60 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
};
|
||||
|
||||
Header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) Filter.Search.Text = string.Empty; };
|
||||
Filter.Search.Current.ValueChanged += text => { if (text != string.Empty) Header.Tabs.Current.Value = DirectTab.Search; };
|
||||
((FilterControl)Filter).Ruleset.ValueChanged += ruleset => Scheduler.AddOnce(updateSearch);
|
||||
Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels;
|
||||
Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch);
|
||||
|
||||
Header.Tabs.Current.ValueChanged += tab =>
|
||||
{
|
||||
if (tab != DirectTab.Search)
|
||||
{
|
||||
currentQuery.Value = string.Empty;
|
||||
Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value;
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
}
|
||||
};
|
||||
|
||||
currentQuery.ValueChanged += v =>
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (string.IsNullOrEmpty(v))
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
else
|
||||
{
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500);
|
||||
}
|
||||
};
|
||||
|
||||
currentQuery.BindTo(Filter.Search.Current);
|
||||
|
||||
Filter.Tabs.Current.ValueChanged += sortCriteria =>
|
||||
{
|
||||
if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value)
|
||||
Header.Tabs.Current.Value = DirectTab.Search;
|
||||
|
||||
Scheduler.AddOnce(updateSearch);
|
||||
};
|
||||
|
||||
updateResultCounts();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, APIAccess api, RulesetDatabase rulesets)
|
||||
{
|
||||
this.api = api;
|
||||
this.rulesets = rulesets;
|
||||
resultCountsContainer.Colour = colours.Yellow;
|
||||
}
|
||||
|
||||
private void updateResultCounts()
|
||||
{
|
||||
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.Out);
|
||||
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, EasingTypes.OutQuint);
|
||||
if (ResultAmounts == null) return;
|
||||
|
||||
resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " +
|
||||
@ -129,9 +185,68 @@ namespace osu.Game.Overlays
|
||||
private void recreatePanels(PanelDisplayStyle displayStyle)
|
||||
{
|
||||
if (BeatmapSets == null) return;
|
||||
panels.ChildrenEnumerable = BeatmapSets.Select(b => displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } : new DirectListPanel(b));
|
||||
|
||||
panels.ChildrenEnumerable = BeatmapSets.Select<BeatmapSetInfo, DirectPanel>(b =>
|
||||
{
|
||||
switch (displayStyle)
|
||||
{
|
||||
case PanelDisplayStyle.Grid:
|
||||
return new DirectGridPanel(b) { Width = 400 };
|
||||
default:
|
||||
return new DirectListPanel(b);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private GetBeatmapSetsRequest getSetsRequest;
|
||||
|
||||
private readonly Bindable<string> currentQuery = new Bindable<string>();
|
||||
|
||||
private ScheduledDelegate queryChangedDebounce;
|
||||
|
||||
private void updateSearch()
|
||||
{
|
||||
queryChangedDebounce?.Cancel();
|
||||
|
||||
if (!IsLoaded) return;
|
||||
|
||||
BeatmapSets = null;
|
||||
ResultAmounts = null;
|
||||
|
||||
getSetsRequest?.Cancel();
|
||||
|
||||
if (api == null) return;
|
||||
|
||||
if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) return;
|
||||
|
||||
getSetsRequest = new GetBeatmapSetsRequest(currentQuery,
|
||||
((FilterControl)Filter).Ruleset.Value,
|
||||
Filter.DisplayStyleControl.Dropdown.Current.Value,
|
||||
Filter.Tabs.Current.Value); //todo: sort direction (?)
|
||||
|
||||
getSetsRequest.Success += r =>
|
||||
{
|
||||
BeatmapSets = r?.Select(response => response.ToBeatmapSet(rulesets));
|
||||
if (BeatmapSets == null) return;
|
||||
|
||||
var artists = new List<string>();
|
||||
var songs = new List<string>();
|
||||
var tags = new List<string>();
|
||||
foreach (var s in BeatmapSets)
|
||||
{
|
||||
artists.Add(s.Metadata.Artist);
|
||||
songs.Add(s.Metadata.Title);
|
||||
tags.AddRange(s.Metadata.Tags.Split(' '));
|
||||
}
|
||||
|
||||
ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags));
|
||||
};
|
||||
|
||||
api.Queue(getSetsRequest);
|
||||
}
|
||||
|
||||
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||
|
||||
public class ResultCounts
|
||||
{
|
||||
public readonly int Artists;
|
||||
|
304
osu.Game/Overlays/MedalOverlay.cs
Normal file
304
osu.Game/Overlays/MedalOverlay.cs
Normal file
@ -0,0 +1,304 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Overlays.MedalSplash;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using System;
|
||||
using osu.Framework.MathUtils;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class MedalOverlay : FocusedOverlayContainer
|
||||
{
|
||||
public const float DISC_SIZE = 400;
|
||||
|
||||
private const float border_width = 5;
|
||||
|
||||
private readonly Medal medal;
|
||||
private readonly Box background;
|
||||
private readonly Container backgroundStrip, particleContainer;
|
||||
private readonly BackgroundStrip leftStrip, rightStrip;
|
||||
private readonly CircularContainer disc;
|
||||
private readonly Sprite innerSpin, outerSpin;
|
||||
private DrawableMedal drawableMedal;
|
||||
|
||||
private SampleChannel getSample;
|
||||
|
||||
public MedalOverlay(Medal medal)
|
||||
{
|
||||
this.medal = medal;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(60),
|
||||
},
|
||||
outerSpin = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(DISC_SIZE + 500),
|
||||
Alpha = 0f,
|
||||
},
|
||||
backgroundStrip = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = border_width,
|
||||
Alpha = 0f,
|
||||
Children = new[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreRight,
|
||||
Width = 0.5f,
|
||||
Padding = new MarginPadding { Right = DISC_SIZE / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
leftStrip = new BackgroundStrip(0f, 1f)
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
},
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Width = 0.5f,
|
||||
Padding = new MarginPadding { Left = DISC_SIZE / 2 },
|
||||
Children = new[]
|
||||
{
|
||||
rightStrip = new BackgroundStrip(1f, 0f),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
particleContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
},
|
||||
disc = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0f,
|
||||
Masking = true,
|
||||
AlwaysPresent = true,
|
||||
BorderColour = Color4.White,
|
||||
BorderThickness = border_width,
|
||||
Size = new Vector2(DISC_SIZE),
|
||||
Scale = new Vector2(0.8f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"05262f"),
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TriangleScale = 2,
|
||||
ColourDark = OsuColour.FromHex(@"04222b"),
|
||||
ColourLight = OsuColour.FromHex(@"052933"),
|
||||
},
|
||||
innerSpin = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1.05f),
|
||||
Alpha = 0.25f,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures, AudioManager audio)
|
||||
{
|
||||
getSample = audio.Sample.Get(@"MedalSplash/medal-get");
|
||||
innerSpin.Texture = outerSpin.Texture = textures.Get(@"MedalSplash/disc-spin");
|
||||
|
||||
disc.EdgeEffect = leftStrip.EdgeEffect = rightStrip.EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = colours.Blue.Opacity(0.5f),
|
||||
Radius = 50,
|
||||
};
|
||||
|
||||
disc.Add(drawableMedal = new DrawableMedal(medal)
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Show();
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
particleContainer.Add(new MedalParticle(RNG.Next(0, 359)));
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
dismiss();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(InputState state)
|
||||
{
|
||||
if (state.Keyboard.Keys.Contains(Key.Escape)) dismiss();
|
||||
}
|
||||
|
||||
private const double initial_duration = 400;
|
||||
private const double step_duration = 900;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
FadeIn(200);
|
||||
background.FlashColour(Color4.White.Opacity(0.25f), 400);
|
||||
|
||||
getSample.Play();
|
||||
|
||||
using (innerSpin.BeginLoopedSequence())
|
||||
innerSpin.RotateTo(360, 20000);
|
||||
|
||||
using (outerSpin.BeginLoopedSequence())
|
||||
outerSpin.RotateTo(360, 40000);
|
||||
|
||||
using (BeginDelayedSequence(200, true))
|
||||
{
|
||||
disc.FadeIn(initial_duration);
|
||||
particleContainer.FadeIn(initial_duration);
|
||||
outerSpin.FadeTo(0.1f, initial_duration * 2);
|
||||
disc.ScaleTo(1f, initial_duration * 2, EasingTypes.OutElastic);
|
||||
|
||||
using (BeginDelayedSequence(initial_duration + 200, true))
|
||||
{
|
||||
backgroundStrip.FadeIn(step_duration);
|
||||
leftStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint);
|
||||
rightStrip.ResizeWidthTo(1f, step_duration, EasingTypes.OutQuint);
|
||||
Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Icon; });
|
||||
|
||||
using (BeginDelayedSequence(step_duration, true))
|
||||
{
|
||||
Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.MedalUnlocked; });
|
||||
|
||||
using (BeginDelayedSequence(step_duration, true))
|
||||
Schedule(() => { if (drawableMedal.State != DisplayState.Full) drawableMedal.State = DisplayState.Full; });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
FadeOut(200);
|
||||
}
|
||||
|
||||
private void dismiss()
|
||||
{
|
||||
if (drawableMedal.State != DisplayState.Full)
|
||||
{
|
||||
// if we haven't yet, play out the animation fully
|
||||
drawableMedal.State = DisplayState.Full;
|
||||
Flush(true);
|
||||
return;
|
||||
}
|
||||
|
||||
Hide();
|
||||
Expire();
|
||||
}
|
||||
|
||||
private class BackgroundStrip : Container
|
||||
{
|
||||
public BackgroundStrip(float start, float end)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Width = 0f;
|
||||
ColourInfo = ColourInfo.GradientHorizontal(Color4.White.Opacity(start), Color4.White.Opacity(end));
|
||||
Masking = true;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class MedalParticle : CircularContainer
|
||||
{
|
||||
private readonly float direction;
|
||||
|
||||
private Vector2 positionForOffset(float offset) => new Vector2((float)(offset * Math.Sin(direction)), (float)(offset * Math.Cos(direction)));
|
||||
|
||||
public MedalParticle(float direction)
|
||||
{
|
||||
this.direction = direction;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Position = positionForOffset(DISC_SIZE / 2);
|
||||
Masking = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = colours.Blue.Opacity(0.5f),
|
||||
Radius = 5,
|
||||
};
|
||||
|
||||
MoveTo(positionForOffset(DISC_SIZE / 2 + 200), 500);
|
||||
FadeOut(500);
|
||||
Expire();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
183
osu.Game/Overlays/MedalSplash/DrawableMedal.cs
Normal file
183
osu.Game/Overlays/MedalSplash/DrawableMedal.cs
Normal file
@ -0,0 +1,183 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.MedalSplash
|
||||
{
|
||||
public class DrawableMedal : Container, IStateful<DisplayState>
|
||||
{
|
||||
private const float scale_when_unlocked = 0.76f;
|
||||
private const float scale_when_full = 0.6f;
|
||||
|
||||
private readonly Medal medal;
|
||||
private readonly Container medalContainer;
|
||||
private readonly Sprite medalSprite, medalGlow;
|
||||
private readonly OsuSpriteText unlocked, name;
|
||||
private readonly TextFlowContainer description;
|
||||
private readonly FillFlowContainer infoFlow;
|
||||
private DisplayState state;
|
||||
public DrawableMedal(Medal medal)
|
||||
{
|
||||
this.medal = medal;
|
||||
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
medalContainer = new Container
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
medalSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.81f),
|
||||
},
|
||||
medalGlow = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
},
|
||||
},
|
||||
unlocked = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = "Medal Unlocked".ToUpper(),
|
||||
TextSize = 24,
|
||||
Font = @"Exo2.0-Light",
|
||||
Alpha = 0f,
|
||||
Scale = new Vector2(1f / scale_when_unlocked),
|
||||
},
|
||||
infoFlow = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.6f,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0f, 5f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
name = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = medal.Name,
|
||||
TextSize = 20,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Alpha = 0f,
|
||||
Scale = new Vector2(1f / scale_when_full),
|
||||
},
|
||||
description = new TextFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Alpha = 0f,
|
||||
Scale = new Vector2(1f / scale_when_full),
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
description.AddText(medal.Description, s =>
|
||||
{
|
||||
s.Anchor = Anchor.TopCentre;
|
||||
s.Origin = Anchor.TopCentre;
|
||||
s.TextSize = 16;
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, TextureStore textures)
|
||||
{
|
||||
medalSprite.Texture = textures.Get(medal.ImageUrl);
|
||||
medalGlow.Texture = textures.Get(@"MedalSplash/medal-glow");
|
||||
description.Colour = colours.BlueLight;
|
||||
|
||||
unlocked.Position = new Vector2(0f, medalContainer.Size.Y / 2 + 10);
|
||||
infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateState();
|
||||
}
|
||||
|
||||
public DisplayState State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
if (state == value) return;
|
||||
|
||||
state = value;
|
||||
updateState();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
if (!IsLoaded) return;
|
||||
|
||||
const double duration = 900;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case DisplayState.None:
|
||||
medalContainer.ScaleTo(0);
|
||||
break;
|
||||
case DisplayState.Icon:
|
||||
medalContainer.ScaleTo(1, duration, EasingTypes.OutElastic);
|
||||
medalContainer.FadeIn(duration);
|
||||
break;
|
||||
case DisplayState.MedalUnlocked:
|
||||
medalContainer.ScaleTo(1);
|
||||
medalContainer.Show();
|
||||
|
||||
ScaleTo(scale_when_unlocked, duration, EasingTypes.OutExpo);
|
||||
MoveToY(MedalOverlay.DISC_SIZE / 2 - 30, duration, EasingTypes.OutExpo);
|
||||
unlocked.FadeInFromZero(duration);
|
||||
break;
|
||||
case DisplayState.Full:
|
||||
medalContainer.ScaleTo(1);
|
||||
medalContainer.Show();
|
||||
|
||||
ScaleTo(scale_when_full, duration, EasingTypes.OutExpo);
|
||||
MoveToY(MedalOverlay.DISC_SIZE / 2 - 60, duration, EasingTypes.OutExpo);
|
||||
name.FadeInFromZero(duration + 100);
|
||||
description.FadeInFromZero(duration * 2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum DisplayState
|
||||
{
|
||||
None,
|
||||
Icon,
|
||||
MedalUnlocked,
|
||||
Full,
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Music
|
||||
{
|
||||
@ -49,7 +50,7 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ScrollContainer
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
|
@ -59,6 +59,9 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Width = 400;
|
||||
Margin = new MarginPadding(10);
|
||||
|
||||
// required to let MusicController handle beatmap cycling.
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
@ -252,12 +255,16 @@ namespace osu.Game.Overlays
|
||||
|
||||
private void prev()
|
||||
{
|
||||
if (beatmapBacking.Disabled) return;
|
||||
|
||||
queuedDirection = TransformDirection.Prev;
|
||||
playlist.PlayPrevious();
|
||||
}
|
||||
|
||||
private void next()
|
||||
{
|
||||
if (beatmapBacking.Disabled) return;
|
||||
|
||||
queuedDirection = TransformDirection.Next;
|
||||
playlist.PlayNext();
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Overlays
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.6f,
|
||||
},
|
||||
scrollContainer = new ScrollContainer
|
||||
scrollContainer = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
private ProgressNotificationState state;
|
||||
|
||||
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
||||
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification
|
||||
{
|
||||
Activated = CompletionClickAction,
|
||||
Text = $"Task \"{Text}\" has completed!"
|
||||
|
@ -120,6 +120,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
protected override Color4 BackgroundUnfocused => backgroundColour;
|
||||
protected override Color4 BackgroundFocused => backgroundColour;
|
||||
protected override bool AllowCommit => true;
|
||||
|
||||
private Color4 backgroundColour;
|
||||
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
@ -60,7 +61,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new ScrollContainer
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
{
|
||||
public SlimMenu()
|
||||
{
|
||||
Background.Colour = Color4.Black.Opacity(0.25f);
|
||||
Background.Colour = Color4.Black.Opacity(0.7f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,13 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
||||
using osu.Game.Rulesets;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections
|
||||
{
|
||||
@ -20,5 +24,16 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new SongSelectSettings(),
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
foreach(Ruleset ruleset in rulesets.AllRulesets.Select(info => info.CreateInstance()))
|
||||
{
|
||||
SettingsSubsection section = ruleset.CreateSettings();
|
||||
if (section != null)
|
||||
Add(section);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,32 +1,10 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
{
|
||||
public class DetailSettings : SettingsSubsection
|
||||
{
|
||||
protected override string Header => "Detail Settings";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking in sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SnakingInSliders)
|
||||
},
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = "Snaking out sliders",
|
||||
Bindable = config.GetBindable<bool>(OsuSetting.SnakingOutSliders)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Settings
|
||||
if (text == null)
|
||||
{
|
||||
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||
Add(text = new OsuSpriteText() { Depth = 1 });
|
||||
Add(text = new OsuSpriteText { Depth = 1 });
|
||||
}
|
||||
|
||||
text.Text = value;
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Settings
|
||||
where T : struct, IEquatable<T>
|
||||
where U : SliderBar<T>, new()
|
||||
{
|
||||
protected override Drawable CreateControl() => new U()
|
||||
protected override Drawable CreateControl() => new U
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
@ -12,7 +14,7 @@ using osu.Game.Overlays.Toolbar;
|
||||
|
||||
namespace osu.Game.Overlays.Settings
|
||||
{
|
||||
public class Sidebar : Container
|
||||
public class Sidebar : Container, IStateful<ExpandedState>
|
||||
{
|
||||
private readonly FillFlowContainer content;
|
||||
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
||||
@ -47,24 +49,29 @@ namespace osu.Game.Overlays.Settings
|
||||
}
|
||||
|
||||
private ScheduledDelegate expandEvent;
|
||||
private ExpandedState state;
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
expandEvent = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
expandEvent = null;
|
||||
ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 150, EasingTypes.OutQuad);
|
||||
}, 750);
|
||||
queueExpandIfHovering();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
expandEvent?.Cancel();
|
||||
ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 150, EasingTypes.OutQuad);
|
||||
lastHoveredButton = null;
|
||||
State = ExpandedState.Contracted;
|
||||
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(InputState state)
|
||||
{
|
||||
queueExpandIfHovering();
|
||||
return base.OnMouseMove(state);
|
||||
}
|
||||
|
||||
private class SidebarScrollContainer : ScrollContainer
|
||||
{
|
||||
public SidebarScrollContainer()
|
||||
@ -74,5 +81,52 @@ namespace osu.Game.Overlays.Settings
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
}
|
||||
|
||||
public ExpandedState State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
if (state == value) return;
|
||||
|
||||
state = value;
|
||||
|
||||
switch (state)
|
||||
{
|
||||
default:
|
||||
ResizeTo(new Vector2(DEFAULT_WIDTH, Height), 500, EasingTypes.OutQuint);
|
||||
break;
|
||||
case ExpandedState.Expanded:
|
||||
ResizeTo(new Vector2(EXPANDED_WIDTH, Height), 500, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Drawable lastHoveredButton;
|
||||
|
||||
private Drawable hoveredButton => content.Children.FirstOrDefault(c => c.IsHovered);
|
||||
|
||||
private void queueExpandIfHovering()
|
||||
{
|
||||
// only expand when we hover a different button.
|
||||
if (lastHoveredButton == hoveredButton) return;
|
||||
|
||||
if (!IsHovered) return;
|
||||
|
||||
if (State != ExpandedState.Expanded)
|
||||
{
|
||||
expandEvent?.Cancel();
|
||||
expandEvent = Scheduler.AddDelayed(() => State = ExpandedState.Expanded, 750);
|
||||
}
|
||||
|
||||
lastHoveredButton = hoveredButton;
|
||||
}
|
||||
}
|
||||
|
||||
public enum ExpandedState
|
||||
{
|
||||
Contracted,
|
||||
Expanded,
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
// 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.Linq;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -35,6 +36,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
private SearchTextBox searchTextBox;
|
||||
|
||||
private Func<float> getToolbarHeight;
|
||||
|
||||
public SettingsOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
@ -93,7 +96,11 @@ namespace osu.Game.Overlays
|
||||
new SidebarButton
|
||||
{
|
||||
Section = section,
|
||||
Action = b => sectionsContainer.ScrollContainer.ScrollTo(b),
|
||||
Action = s =>
|
||||
{
|
||||
sectionsContainer.ScrollTo(s);
|
||||
sidebar.State = ExpandedState.Contracted;
|
||||
},
|
||||
}
|
||||
).ToArray()
|
||||
}
|
||||
@ -111,7 +118,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
searchTextBox.Current.ValueChanged += newValue => sectionsContainer.SearchContainer.SearchTerm = newValue;
|
||||
|
||||
sectionsContainer.Padding = new MarginPadding { Top = game?.Toolbar.DrawHeight ?? 0 };
|
||||
getToolbarHeight = () => game?.ToolbarOffset ?? 0;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
@ -148,6 +155,14 @@ namespace osu.Game.Overlays
|
||||
base.OnFocus(state);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
sectionsContainer.Margin = new MarginPadding { Left = sidebar.DrawWidth };
|
||||
sectionsContainer.Padding = new MarginPadding { Top = getToolbarHeight() };
|
||||
}
|
||||
|
||||
private class SettingsSectionsContainer : SectionsContainer
|
||||
{
|
||||
public SearchContainer SearchContainer;
|
||||
|
@ -8,6 +8,7 @@ using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
{
|
||||
@ -36,6 +37,8 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public abstract IEnumerable<KeyCounter> CreateGameplayKeys();
|
||||
|
||||
public virtual SettingsSubsection CreateSettings() => null;
|
||||
|
||||
/// <summary>
|
||||
/// Do not override this unless you are a legacy mode.
|
||||
/// </summary>
|
||||
|
@ -4,11 +4,13 @@
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -20,20 +22,25 @@ namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
public class DrawableRoom : OsuClickableContainer
|
||||
{
|
||||
private const float content_padding = 5;
|
||||
private const float height = 90;
|
||||
private const float transition_duration = 100;
|
||||
private const float content_padding = 10;
|
||||
private const float height = 100;
|
||||
private const float side_strip_width = 5;
|
||||
private const float cover_width = 145;
|
||||
|
||||
private readonly Box sideStrip;
|
||||
private readonly UpdateableAvatar avatar;
|
||||
private readonly OsuSpriteText name;
|
||||
private readonly Container flagContainer;
|
||||
private readonly OsuSpriteText host;
|
||||
private readonly OsuSpriteText rankBounds;
|
||||
private readonly OsuSpriteText status;
|
||||
private readonly Container coverContainer;
|
||||
private readonly OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist;
|
||||
private readonly FillFlowContainer<OsuSpriteText> beatmapInfoFlow;
|
||||
private readonly OsuSpriteText beatmapTitle;
|
||||
private readonly OsuSpriteText beatmapDash;
|
||||
private readonly OsuSpriteText beatmapArtist;
|
||||
private readonly ParticipantInfo participantInfo;
|
||||
private readonly ModeTypeInfo modeTypeInfo;
|
||||
|
||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||
private readonly Bindable<User> hostBind = new Bindable<User>();
|
||||
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
|
||||
private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
|
||||
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
|
||||
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
||||
|
||||
private OsuColour colours;
|
||||
private LocalisationEngine localisation;
|
||||
@ -60,24 +67,41 @@ namespace osu.Game.Screens.Multiplayer
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(34),
|
||||
Colour = OsuColour.FromHex(@"212121"),
|
||||
},
|
||||
sideStrip = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = content_padding,
|
||||
Width = side_strip_width,
|
||||
},
|
||||
avatar = new UpdateableAvatar
|
||||
new Container
|
||||
{
|
||||
Size = new Vector2(Height - content_padding * 2),
|
||||
Width = cover_width,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Masking = true,
|
||||
CornerRadius = 5f,
|
||||
Margin = new MarginPadding { Left = content_padding * 2, Top = content_padding },
|
||||
Margin = new MarginPadding { Left = side_strip_width },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
coverContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding },
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Vertical = content_padding,
|
||||
Left = side_strip_width + cover_width + content_padding,
|
||||
Right = content_padding,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
@ -92,56 +116,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
TextSize = 18,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 20f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagContainer = new Container
|
||||
{
|
||||
Width = 30f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Width = 40f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "hosted by",
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
},
|
||||
host = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
},
|
||||
},
|
||||
rankBounds = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Text = "#0 - #0",
|
||||
TextSize = 14,
|
||||
Margin = new MarginPadding { Right = 10 },
|
||||
},
|
||||
},
|
||||
},
|
||||
participantInfo = new ParticipantInfo(),
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
@ -151,7 +126,6 @@ namespace osu.Game.Screens.Multiplayer
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Bottom = content_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
status = new OsuSpriteText
|
||||
@ -174,7 +148,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
beatmapDash = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
beatmapArtist = new OsuSpriteText
|
||||
{
|
||||
@ -185,14 +159,26 @@ namespace osu.Game.Screens.Multiplayer
|
||||
},
|
||||
},
|
||||
},
|
||||
modeTypeInfo = new ModeTypeInfo
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Room.Name.ValueChanged += displayName;
|
||||
Room.Host.ValueChanged += displayUser;
|
||||
Room.Status.ValueChanged += displayStatus;
|
||||
Room.Beatmap.ValueChanged += displayBeatmap;
|
||||
nameBind.ValueChanged += displayName;
|
||||
hostBind.ValueChanged += displayUser;
|
||||
typeBind.ValueChanged += displayGameType;
|
||||
participantsBind.ValueChanged += displayParticipants;
|
||||
|
||||
nameBind.BindTo(Room.Name);
|
||||
hostBind.BindTo(Room.Host);
|
||||
statusBind.BindTo(Room.Status);
|
||||
typeBind.BindTo(Room.Type);
|
||||
beatmapBind.BindTo(Room.Beatmap);
|
||||
participantsBind.BindTo(Room.Participants);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -201,10 +187,14 @@ namespace osu.Game.Screens.Multiplayer
|
||||
this.localisation = localisation;
|
||||
this.colours = colours;
|
||||
|
||||
beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9;
|
||||
host.Colour = colours.Blue;
|
||||
beatmapInfoFlow.Colour = colours.Gray9;
|
||||
|
||||
displayStatus(Room.Status.Value);
|
||||
//binded here instead of ctor because dependencies are needed
|
||||
statusBind.ValueChanged += displayStatus;
|
||||
beatmapBind.ValueChanged += displayBeatmap;
|
||||
|
||||
statusBind.TriggerChange();
|
||||
beatmapBind.TriggerChange();
|
||||
}
|
||||
|
||||
private void displayName(string value)
|
||||
@ -214,9 +204,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
|
||||
private void displayUser(User value)
|
||||
{
|
||||
avatar.User = value;
|
||||
host.Text = value.Username;
|
||||
flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } };
|
||||
participantInfo.Host = value;
|
||||
}
|
||||
|
||||
private void displayStatus(RoomStatus value)
|
||||
@ -228,33 +216,48 @@ namespace osu.Game.Screens.Multiplayer
|
||||
d.FadeColour(value.GetAppropriateColour(colours), 100);
|
||||
}
|
||||
|
||||
private void displayGameType(GameType value)
|
||||
{
|
||||
modeTypeInfo.Type = value;
|
||||
}
|
||||
|
||||
private void displayBeatmap(BeatmapInfo value)
|
||||
{
|
||||
modeTypeInfo.Beatmap = value;
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
coverContainer.FadeIn(transition_duration);
|
||||
coverContainer.Children = new[]
|
||||
{
|
||||
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
|
||||
}) { RelativeSizeAxes = Axes.Both },
|
||||
};
|
||||
|
||||
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
|
||||
beatmapDash.Text = @" - ";
|
||||
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
|
||||
}
|
||||
else
|
||||
{
|
||||
coverContainer.FadeOut(transition_duration);
|
||||
|
||||
beatmapTitle.Current = null;
|
||||
beatmapArtist.Current = null;
|
||||
|
||||
beatmapTitle.Text = @"Changing map";
|
||||
beatmapDash.Text = string.Empty;
|
||||
beatmapArtist.Text = string.Empty;
|
||||
beatmapTitle.Text = "Changing map";
|
||||
beatmapDash.Text = beatmapArtist.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
private void displayParticipants(User[] value)
|
||||
{
|
||||
Room.Name.ValueChanged -= displayName;
|
||||
Room.Host.ValueChanged -= displayUser;
|
||||
Room.Status.ValueChanged -= displayStatus;
|
||||
Room.Beatmap.ValueChanged -= displayBeatmap;
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
participantInfo.Participants = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
82
osu.Game/Screens/Multiplayer/ModeTypeInfo.cs
Normal file
82
osu.Game/Screens/Multiplayer/ModeTypeInfo.cs
Normal file
@ -0,0 +1,82 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
|
||||
namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
public class ModeTypeInfo : Container
|
||||
{
|
||||
private const float height = 30;
|
||||
private const float transition_duration = 100;
|
||||
|
||||
private readonly Container rulesetContainer, gameTypeContainer;
|
||||
|
||||
public BeatmapInfo Beatmap
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
rulesetContainer.FadeIn(transition_duration);
|
||||
rulesetContainer.Children = new[]
|
||||
{
|
||||
new DifficultyIcon(value)
|
||||
{
|
||||
Size = new Vector2(height),
|
||||
},
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
rulesetContainer.FadeOut(transition_duration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GameType Type
|
||||
{
|
||||
set
|
||||
{
|
||||
gameTypeContainer.Children = new[]
|
||||
{
|
||||
new DrawableGameType(value)
|
||||
{
|
||||
Size = new Vector2(height),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public ModeTypeInfo()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new[]
|
||||
{
|
||||
rulesetContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
gameTypeContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
145
osu.Game/Screens/Multiplayer/ParticipantInfo.cs
Normal file
145
osu.Game/Screens/Multiplayer/ParticipantInfo.cs
Normal file
@ -0,0 +1,145 @@
|
||||
// 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 OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
public class ParticipantInfo : Container
|
||||
{
|
||||
private readonly Container flagContainer;
|
||||
private readonly OsuSpriteText host;
|
||||
private readonly FillFlowContainer levelRangeContainer;
|
||||
private readonly OsuSpriteText levelRangeLower;
|
||||
private readonly OsuSpriteText levelRangeHigher;
|
||||
|
||||
public User Host
|
||||
{
|
||||
set
|
||||
{
|
||||
host.Text = value.Username;
|
||||
flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } };
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<User> Participants
|
||||
{
|
||||
set
|
||||
{
|
||||
var ranks = value.Select(u => u.GlobalRank);
|
||||
levelRangeLower.Text = ranks.Min().ToString();
|
||||
levelRangeHigher.Text = ranks.Max().ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public ParticipantInfo(string rankPrefix = null)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 15f;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagContainer = new Container
|
||||
{
|
||||
Width = 22f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new Container //todo: team banners
|
||||
{
|
||||
Width = 38f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
CornerRadius = 2f,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"ad387e"),
|
||||
},
|
||||
},
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "hosted by",
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
},
|
||||
host = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
},
|
||||
},
|
||||
levelRangeContainer = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = rankPrefix,
|
||||
TextSize = 14,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "#",
|
||||
TextSize = 14,
|
||||
},
|
||||
levelRangeLower = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = " - ",
|
||||
TextSize = 14,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "#",
|
||||
TextSize = 14,
|
||||
},
|
||||
levelRangeHigher = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
levelRangeContainer.Colour = colours.Gray9;
|
||||
host.Colour = colours.Blue;
|
||||
}
|
||||
}
|
||||
}
|
@ -12,11 +12,11 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
@ -27,12 +27,13 @@ namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
|
||||
private const float transition_duration = 100;
|
||||
private const float ruleset_height = 30;
|
||||
|
||||
private readonly Box statusStrip;
|
||||
private readonly Container coverContainer, rulesetContainer, gameTypeContainer, flagContainer;
|
||||
private readonly FillFlowContainer topFlow, levelRangeContainer, participantsFlow;
|
||||
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor, host, levelRangeLower, levelRangeHigher;
|
||||
private readonly Container coverContainer;
|
||||
private readonly FillFlowContainer topFlow, participantsFlow;
|
||||
private readonly ModeTypeInfo modeTypeInfo;
|
||||
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor;
|
||||
private readonly ParticipantInfo participantInfo;
|
||||
private readonly ScrollContainer participantsScroll;
|
||||
|
||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||
@ -45,7 +46,6 @@ namespace osu.Game.Screens.Multiplayer
|
||||
|
||||
private OsuColour colours;
|
||||
private LocalisationEngine localisation;
|
||||
private TextureStore textures;
|
||||
|
||||
private Room room;
|
||||
|
||||
@ -190,20 +190,13 @@ namespace osu.Game.Screens.Multiplayer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = ruleset_height,
|
||||
Height = 30,
|
||||
Direction = FillDirection.Horizontal,
|
||||
LayoutDuration = transition_duration,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rulesetContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
gameTypeContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
modeTypeInfo = new ModeTypeInfo(),
|
||||
new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
@ -252,96 +245,12 @@ namespace osu.Game.Screens.Multiplayer
|
||||
Padding = contentPadding,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = 15f,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagContainer = new Container
|
||||
{
|
||||
Width = 22f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new Container //todo: team banners
|
||||
{
|
||||
Width = 38f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
CornerRadius = 2f,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"ad387e"),
|
||||
},
|
||||
},
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "hosted by",
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
},
|
||||
host = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
},
|
||||
},
|
||||
levelRangeContainer = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Rank Range ",
|
||||
TextSize = 14,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "#",
|
||||
TextSize = 14,
|
||||
},
|
||||
levelRangeLower = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = " - ",
|
||||
TextSize = 14,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "#",
|
||||
TextSize = 14,
|
||||
},
|
||||
levelRangeHigher = new OsuSpriteText
|
||||
{
|
||||
Text = "6251",
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
},
|
||||
},
|
||||
participantInfo = new ParticipantInfo(@"Rank Range "),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
participantsScroll = new ScrollContainer
|
||||
participantsScroll = new OsuScrollContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
@ -362,27 +271,24 @@ namespace osu.Game.Screens.Multiplayer
|
||||
|
||||
nameBind.ValueChanged += displayName;
|
||||
hostBind.ValueChanged += displayUser;
|
||||
typeBind.ValueChanged += displayGameType;
|
||||
maxParticipantsBind.ValueChanged += displayMaxParticipants;
|
||||
participantsBind.ValueChanged += displayParticipants;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
||||
{
|
||||
this.localisation = localisation;
|
||||
this.colours = colours;
|
||||
this.textures = textures;
|
||||
|
||||
beatmapAuthor.Colour = levelRangeContainer.Colour = colours.Gray9;
|
||||
host.Colour = colours.Blue;
|
||||
beatmapAuthor.Colour = colours.Gray9;
|
||||
|
||||
//binded here instead of ctor because dependencies are needed
|
||||
statusBind.ValueChanged += displayStatus;
|
||||
typeBind.ValueChanged += displayGameType;
|
||||
beatmapBind.ValueChanged += displayBeatmap;
|
||||
|
||||
statusBind.TriggerChange();
|
||||
typeBind.TriggerChange();
|
||||
beatmapBind.TriggerChange();
|
||||
}
|
||||
|
||||
@ -400,14 +306,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
|
||||
private void displayUser(User value)
|
||||
{
|
||||
host.Text = value.Username;
|
||||
flagContainer.Children = new[]
|
||||
{
|
||||
new DrawableFlag(value.Country?.FlagName ?? @"__")
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
participantInfo.Host = value;
|
||||
}
|
||||
|
||||
private void displayStatus(RoomStatus value)
|
||||
@ -420,39 +319,26 @@ namespace osu.Game.Screens.Multiplayer
|
||||
|
||||
private void displayGameType(GameType value)
|
||||
{
|
||||
gameTypeContainer.Children = new[]
|
||||
{
|
||||
new DrawableGameType(value)
|
||||
{
|
||||
Size = new Vector2(ruleset_height),
|
||||
},
|
||||
};
|
||||
modeTypeInfo.Type = value;
|
||||
}
|
||||
|
||||
private void displayBeatmap(BeatmapInfo value)
|
||||
{
|
||||
modeTypeInfo.Beatmap = value;
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
coverContainer.FadeIn(transition_duration);
|
||||
coverContainer.Children = new[]
|
||||
{
|
||||
new AsyncLoadWrapper(new BeatmapBackgroundSprite(new OnlineWorkingBeatmap(value, textures, null))
|
||||
new AsyncLoadWrapper(new BeatmapSetCover(value.BeatmapSet)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill,
|
||||
OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out),
|
||||
}) { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
|
||||
rulesetContainer.FadeIn(transition_duration);
|
||||
rulesetContainer.Children = new[]
|
||||
{
|
||||
new DifficultyIcon(value)
|
||||
{
|
||||
Size = new Vector2(ruleset_height),
|
||||
}
|
||||
}) { RelativeSizeAxes = Axes.Both },
|
||||
};
|
||||
|
||||
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
|
||||
@ -463,7 +349,6 @@ namespace osu.Game.Screens.Multiplayer
|
||||
else
|
||||
{
|
||||
coverContainer.FadeOut(transition_duration);
|
||||
rulesetContainer.FadeOut(transition_duration);
|
||||
|
||||
beatmapTitle.Current = null;
|
||||
beatmapArtist.Current = null;
|
||||
@ -491,11 +376,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
private void displayParticipants(User[] value)
|
||||
{
|
||||
participants.Text = value.Length.ToString();
|
||||
|
||||
var ranks = value.Select(u => u.GlobalRank);
|
||||
levelRangeLower.Text = ranks.Min().ToString();
|
||||
levelRangeHigher.Text = ranks.Max().ToString();
|
||||
|
||||
participantInfo.Participants = value;
|
||||
participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u));
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,11 @@ namespace osu.Game.Screens
|
||||
|
||||
internal virtual bool HasLocalCursorDisplayed => false;
|
||||
|
||||
internal virtual bool AllowRulesetChange => true;
|
||||
/// <summary>
|
||||
/// Whether the beatmap or ruleset should be allowed to be changed by the user or game.
|
||||
/// Used to mark exclusive areas where this is strongly prohibited, like gameplay.
|
||||
/// </summary>
|
||||
internal virtual bool AllowBeatmapRulesetChange => true;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
@ -85,7 +89,13 @@ namespace osu.Game.Screens
|
||||
{
|
||||
if (!IsCurrentScreen) return;
|
||||
|
||||
ruleset.Disabled = !AllowRulesetChange;
|
||||
if (ParentScreen != null)
|
||||
{
|
||||
// we only want to apply these restrictions when we are inside a screen stack.
|
||||
// the use case for not applying is in visual/unit tests.
|
||||
ruleset.Disabled = !AllowBeatmapRulesetChange;
|
||||
beatmap.Disabled = !AllowBeatmapRulesetChange;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
|
@ -12,16 +12,20 @@ using osu.Game.Rulesets.UI;
|
||||
using OpenTK;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class ModDisplay : Container, IHasCurrentValue<IEnumerable<Mod>>
|
||||
{
|
||||
private const int fade_duration = 1000;
|
||||
|
||||
private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
public Bindable<IEnumerable<Mod>> Current => mods;
|
||||
|
||||
private readonly FillFlowContainer<ModIcon> iconsContainer;
|
||||
private readonly OsuSpriteText unrankedText;
|
||||
|
||||
public ModDisplay()
|
||||
{
|
||||
@ -35,8 +39,9 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Direction = FillDirection.Horizontal,
|
||||
Margin = new MarginPadding { Left = 10, Right = 10 },
|
||||
},
|
||||
new OsuSpriteText
|
||||
unrankedText = new OsuSpriteText
|
||||
{
|
||||
AlwaysPresent = true,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = @"/ UNRANKED /",
|
||||
@ -70,8 +75,13 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private void appearTransform()
|
||||
{
|
||||
if (mods.Value.Any(m => !m.Ranked))
|
||||
unrankedText.FadeInFromZero(fade_duration, EasingTypes.OutQuint);
|
||||
else
|
||||
unrankedText.Hide();
|
||||
|
||||
iconsContainer.Flush();
|
||||
iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint);
|
||||
iconsContainer.FadeInFromZero(fade_duration, EasingTypes.OutQuint);
|
||||
expand();
|
||||
using (iconsContainer.BeginDelayedSequence(1200))
|
||||
contract();
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public Action RestartRequested;
|
||||
|
||||
internal override bool AllowRulesetChange => false;
|
||||
internal override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
public bool HasFailed { get; private set; }
|
||||
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play
|
||||
private bool showOverlays = true;
|
||||
internal override bool ShowOverlays => showOverlays;
|
||||
|
||||
internal override bool AllowRulesetChange => false;
|
||||
internal override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ReplaySliderBar<double>()
|
||||
new ReplaySliderBar<double>
|
||||
{
|
||||
LabelText = "Playback speed",
|
||||
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed)
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play.ReplaySettings
|
||||
public class ReplaySliderBar<T> : SettingsSlider<T>
|
||||
where T : struct, IEquatable<T>
|
||||
{
|
||||
protected override Drawable CreateControl() => new Sliderbar()
|
||||
protected override Drawable CreateControl() => new Sliderbar
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5, Bottom = 5 },
|
||||
RelativeSizeAxes = Axes.X
|
||||
|
@ -277,9 +277,19 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
if (!Enabled)
|
||||
return false;
|
||||
|
||||
box.FlashColour(Color4.White, 500, EasingTypes.OutQuint);
|
||||
aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint);
|
||||
return base.OnClick(state);
|
||||
|
||||
bool result = base.OnClick(state);
|
||||
|
||||
// for now, let's disable the skip button after the first press.
|
||||
// this will likely need to be contextual in the future (bound from external components).
|
||||
Enabled.Value = false;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
private ResultModeTabControl modeChangeButtons;
|
||||
|
||||
internal override bool AllowRulesetChange => false;
|
||||
internal override bool AllowBeatmapRulesetChange => false;
|
||||
|
||||
private Container currentPage;
|
||||
|
||||
|
@ -160,7 +160,7 @@ namespace osu.Game.Screens.Select
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
new FillFlowContainer<MetadataSegment>()
|
||||
new FillFlowContainer<MetadataSegment>
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
|
@ -128,7 +128,7 @@ namespace osu.Game.Screens.Select
|
||||
// Bottom = 5
|
||||
// },
|
||||
//},
|
||||
sortTabs = new OsuTabControl<SortMode>()
|
||||
sortTabs = new OsuTabControl<SortMode>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
|
@ -12,6 +12,7 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Online.API;
|
||||
@ -74,7 +75,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scrollContainer = new ScrollContainer
|
||||
scrollContainer = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
|
13
osu.Game/Users/Medal.cs
Normal file
13
osu.Game/Users/Medal.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Users
|
||||
{
|
||||
public class Medal
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string InternalName { get; set; }
|
||||
public string ImageUrl => $@"https://s.ppy.sh/images/medals-client/{InternalName}@2x.png";
|
||||
public string Description { get; set; }
|
||||
}
|
||||
}
|
@ -78,6 +78,7 @@
|
||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
||||
<Compile Include="Graphics\Cursor\OsuContextMenuContainer.cs" />
|
||||
<Compile Include="Graphics\UserInterface\IconButton.cs" />
|
||||
<Compile Include="Configuration\SelectionRandomType.cs" />
|
||||
@ -473,10 +474,11 @@
|
||||
<Compile Include="Overlays\Direct\DirectPanel.cs" />
|
||||
<Compile Include="Overlays\Direct\DirectGridPanel.cs" />
|
||||
<Compile Include="Overlays\Direct\DirectListPanel.cs" />
|
||||
<Compile Include="Database\OnlineWorkingBeatmap.cs" />
|
||||
<Compile Include="Database\BeatmapOnlineInfo.cs" />
|
||||
<Compile Include="Graphics\Containers\ReverseChildIDFillFlowContainer.cs" />
|
||||
<Compile Include="Database\RankStatus.cs" />
|
||||
<Compile Include="Database\BeatmapSetOnlineInfo.cs" />
|
||||
<Compile Include="Online\API\Requests\GetBeatmapSetsRequest.cs" />
|
||||
<Compile Include="Overlays\SearchableList\SearchableListHeader.cs" />
|
||||
<Compile Include="Overlays\SearchableList\HeaderTabControl.cs" />
|
||||
<Compile Include="Overlays\Social\FilterControl.cs" />
|
||||
@ -488,9 +490,15 @@
|
||||
<Compile Include="Overlays\SearchableList\SlimEnumDropdown.cs" />
|
||||
<Compile Include="Overlays\SearchableList\DisplayStyleControl.cs" />
|
||||
<Compile Include="Graphics\UserInterface\BreadcrumbControl.cs" />
|
||||
<Compile Include="Overlays\MedalOverlay.cs" />
|
||||
<Compile Include="Users\Medal.cs" />
|
||||
<Compile Include="Overlays\MedalSplash\DrawableMedal.cs" />
|
||||
<Compile Include="Screens\Multiplayer\RoomInspector.cs" />
|
||||
<Compile Include="Online\Multiplayer\GameType.cs" />
|
||||
<Compile Include="Screens\Multiplayer\DrawableGameType.cs" />
|
||||
<Compile Include="Screens\Multiplayer\ParticipantInfo.cs" />
|
||||
<Compile Include="Screens\Multiplayer\ModeTypeInfo.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapSetCover.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
@ -66,8 +66,8 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInAttributeList/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInEnumDeclaration/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantCommaInInitializer/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantEmptyObjectCreationArgumentList/@EntryIndexedValue"></s:String>
|
||||
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantEmptyObjectCreationArgumentList/@EntryIndexRemoved">True</s:Boolean>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantEmptyObjectCreationArgumentList/@EntryIndexedValue">WARNING</s:String>
|
||||
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantExplicitParamsArrayCreation/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantImmediateDelegateInvocation/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantLambdaSignatureParentheses/@EntryIndexedValue">WARNING</s:String>
|
||||
|
Loading…
Reference in New Issue
Block a user