1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:07:25 +08:00

Merge remote-tracking branch 'upstream/master' into less-mods-enum

# Conflicts:
#	osu.Game.Modes.Mania/ManiaMod.cs
#	osu.Game.Modes.Osu/OsuMod.cs
#	osu.Game/Modes/Mod.cs
This commit is contained in:
Dean Herbert 2017-03-07 13:42:50 +09:00
commit 3e4cd0dc7c
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
177 changed files with 666 additions and 526 deletions

@ -1 +1 @@
Subproject commit 169f0a758c6b565ee42832f99bf4b5303f4413a6 Subproject commit 476c8792ee6b42cf4e5f0362b4eb09c0230807d8

@ -1 +1 @@
Subproject commit 93eb5bf99bb642bf339d7dce09c2d946412dadd6 Subproject commit 9533590f839aa6e27ed7f8b9064a0e7dc08ad861

View File

@ -40,7 +40,7 @@ namespace osu.Desktop.Deploy
/// <summary> /// <summary>
/// How many previous build deltas we want to keep when publishing. /// How many previous build deltas we want to keep when publishing.
/// </summary> /// </summary>
const int keep_delta_count = 3; private const int keep_delta_count = 3;
private static string codeSigningCmd => string.IsNullOrEmpty(codeSigningPassword) ? "" : $"-n \"/a /f {codeSigningCertPath} /p {codeSigningPassword} /t http://timestamp.comodoca.com/authenticode\""; private static string codeSigningCmd => string.IsNullOrEmpty(codeSigningPassword) ? "" : $"-n \"/a /f {codeSigningCertPath} /p {codeSigningPassword} /t http://timestamp.comodoca.com/authenticode\"";
@ -172,10 +172,10 @@ namespace osu.Desktop.Deploy
} }
//remove excess deltas //remove excess deltas
var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")); var deltas = releaseLines.Where(l => l.Filename.Contains("-delta")).ToArray();
if (deltas.Count() > keep_delta_count) if (deltas.Length > keep_delta_count)
{ {
foreach (var l in deltas.Take(deltas.Count() - keep_delta_count)) foreach (var l in deltas.Take(deltas.Length - keep_delta_count))
{ {
write($"- Removing old delta {l.Filename}", ConsoleColor.Yellow); write($"- Removing old delta {l.Filename}", ConsoleColor.Yellow);
File.Delete(Path.Combine(ReleasesFolder, l.Filename)); File.Delete(Path.Combine(ReleasesFolder, l.Filename));
@ -342,8 +342,9 @@ namespace osu.Desktop.Deploy
}; };
Process p = Process.Start(psi); Process p = Process.Start(psi);
if (p == null || p.ExitCode == 0) return true;
string output = p.StandardOutput.ReadToEnd(); string output = p.StandardOutput.ReadToEnd();
if (p.ExitCode == 0) return true;
write(output); write(output);
error($"Command {command} {args} failed!"); error($"Command {command} {args} failed!");

View File

@ -23,7 +23,7 @@ namespace osu.Desktop.VisualTests.Platform
platform = new SQLitePlatformWin32(); platform = new SQLitePlatformWin32();
else else
platform = new SQLitePlatformGeneric(); platform = new SQLitePlatformGeneric();
return new SQLiteConnection(platform, $@":memory:"); return new SQLiteConnection(platform, @":memory:");
} }
} }
} }

View File

@ -4,9 +4,9 @@
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Game.Screens.Select.Options; using osu.Game.Screens.Select.Options;
namespace osu.Desktop.VisualTests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseBeatmapOptionsOverlay : TestCase internal class TestCaseBeatmapOptionsOverlay : TestCase
{ {
public override string Description => @"Beatmap options in song select"; public override string Description => @"Beatmap options in song select";

View File

@ -8,7 +8,7 @@ using osu.Game.Overlays;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseChatDisplay : TestCase internal class TestCaseChatDisplay : TestCase
{ {
private ScheduledDelegate messageRequest; private ScheduledDelegate messageRequest;
@ -18,7 +18,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
base.Reset(); base.Reset();
Add(new ChatOverlay() Add(new ChatOverlay
{ {
State = Visibility.Visible State = Visibility.Visible
}); });

View File

@ -8,11 +8,11 @@ using osu.Game.Overlays.Dialog;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseDialogOverlay : TestCase internal class TestCaseDialogOverlay : TestCase
{ {
public override string Description => @"Display dialogs"; public override string Description => @"Display dialogs";
DialogOverlay overlay; private DialogOverlay overlay;
public override void Reset() public override void Reset()
{ {

View File

@ -2,23 +2,16 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic; using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Platform;
using osu.Framework.Screens.Testing; using osu.Framework.Screens.Testing;
using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament;
using osu.Game.Screens.Tournament.Teams; using osu.Game.Screens.Tournament.Teams;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseDrawings : TestCase internal class TestCaseDrawings : TestCase
{ {
public override string Description => "Tournament drawings"; public override string Description => "Tournament drawings";
[BackgroundDependencyLoader]
private void load(Storage storage)
{
}
public override void Reset() public override void Reset()
{ {
base.Reset(); base.Reset();
@ -29,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests
}); });
} }
class TestTeamList : ITeamList private class TestTeamList : ITeamList
{ {
public IEnumerable<Team> Teams { get; } = new[] public IEnumerable<Team> Teams { get; } = new[]
{ {

View File

@ -18,7 +18,7 @@ using OpenTK;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseGamefield : TestCase internal class TestCaseGamefield : TestCase
{ {
public override string Description => @"Showing hitobjects and what not."; public override string Description => @"Showing hitobjects and what not.";
@ -31,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
int time = 500; int time = 500;
for (int i = 0; i < 100; i++) for (int i = 0; i < 100; i++)
{ {
objects.Add(new HitCircle() objects.Add(new HitCircle
{ {
StartTime = time, StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)), Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)),

View File

@ -17,12 +17,12 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseHitObjects : TestCase internal class TestCaseHitObjects : TestCase
{ {
private StopwatchClock rateAdjustClock; private StopwatchClock rateAdjustClock;
private FramedClock framedClock; private FramedClock framedClock;
bool auto = false; private bool auto;
public TestCaseHitObjects() public TestCaseHitObjects()
{ {
@ -31,9 +31,9 @@ namespace osu.Desktop.VisualTests.Tests
playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; }; playbackSpeed.ValueChanged += delegate { rateAdjustClock.Rate = playbackSpeed.Value; };
} }
HitObjectType mode = HitObjectType.Slider; private HitObjectType mode = HitObjectType.Slider;
BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; private BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
private Container playfieldContainer; private Container playfieldContainer;
private Container approachContainer; private Container approachContainer;
@ -61,7 +61,7 @@ namespace osu.Desktop.VisualTests.Tests
add(new DrawableSlider(new Slider add(new DrawableSlider(new Slider
{ {
StartTime = framedClock.CurrentTime + 600, StartTime = framedClock.CurrentTime + 600,
ControlPoints = new List<Vector2>() ControlPoints = new List<Vector2>
{ {
new Vector2(-200, 0), new Vector2(-200, 0),
new Vector2(400, 0), new Vector2(400, 0),
@ -93,7 +93,7 @@ namespace osu.Desktop.VisualTests.Tests
AddButton(@"slider", () => load(HitObjectType.Slider)); AddButton(@"slider", () => load(HitObjectType.Slider));
AddButton(@"spinner", () => load(HitObjectType.Spinner)); AddButton(@"spinner", () => load(HitObjectType.Spinner));
AddToggle(@"auto", (state) => { auto = state; load(mode); }); AddToggle(@"auto", state => { auto = state; load(mode); });
ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" }); ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" });
ButtonsContainer.Add(new BasicSliderBar<double> ButtonsContainer.Add(new BasicSliderBar<double>
@ -122,8 +122,9 @@ namespace osu.Desktop.VisualTests.Tests
load(mode); load(mode);
} }
int depth; private int depth;
void add(DrawableHitObject h)
private void add(DrawableHitObject h)
{ {
h.Anchor = Anchor.Centre; h.Anchor = Anchor.Centre;
h.Depth = depth++; h.Depth = depth++;

View File

@ -15,7 +15,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseKeyCounter : TestCase internal class TestCaseKeyCounter : TestCase
{ {
public override string Description => @"Tests key counter"; public override string Description => @"Tests key counter";

View File

@ -9,7 +9,7 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseMenuButtonSystem : TestCase internal class TestCaseMenuButtonSystem : TestCase
{ {
public override string Description => @"Main menu button system"; public override string Description => @"Main menu button system";

View File

@ -8,7 +8,7 @@ using osu.Game.Modes;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseModSelectOverlay : TestCase internal class TestCaseModSelectOverlay : TestCase
{ {
public override string Description => @"Tests the mod select overlay"; public override string Description => @"Tests the mod select overlay";

View File

@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseMusicController : TestCase internal class TestCaseMusicController : TestCase
{ {
public override string Description => @"Tests music controller ui."; public override string Description => @"Tests music controller ui.";
@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests
Anchor = Anchor.Centre Anchor = Anchor.Centre
}; };
Add(mc); Add(mc);
AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden); AddToggle(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
} }
} }
} }

View File

@ -12,11 +12,11 @@ using osu.Framework.Graphics.Containers;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseNotificationManager : TestCase internal class TestCaseNotificationManager : TestCase
{ {
public override string Description => @"I handle notifications"; public override string Description => @"I handle notifications";
NotificationManager manager; private NotificationManager manager;
public override void Reset() public override void Reset()
{ {
@ -30,7 +30,7 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}); });
AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden); AddToggle(@"show", state => manager.State = state ? Visibility.Visible : Visibility.Hidden);
AddButton(@"simple #1", sendNotification1); AddButton(@"simple #1", sendNotification1);
AddButton(@"simple #2", sendNotification2); AddButton(@"simple #2", sendNotification2);
@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
progressingNotifications.Add(n); progressingNotifications.Add(n);
} }
List<ProgressNotification> progressingNotifications = new List<ProgressNotification>(); private List<ProgressNotification> progressingNotifications = new List<ProgressNotification>();
private void sendProgress1() private void sendProgress1()
{ {

View File

@ -6,7 +6,7 @@ using osu.Game.Overlays;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseOptions : TestCase internal class TestCaseOptions : TestCase
{ {
public override string Description => @"Tests the options overlay"; public override string Description => @"Tests the options overlay";

View File

@ -7,7 +7,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCasePauseOverlay : TestCase internal class TestCasePauseOverlay : TestCase
{ {
public override string Description => @"Tests the pause overlay"; public override string Description => @"Tests the pause overlay";

View File

@ -11,7 +11,7 @@ using osu.Game.Screens.Select;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCasePlaySongSelect : TestCase internal class TestCasePlaySongSelect : TestCase
{ {
private BeatmapDatabase db, oldDb; private BeatmapDatabase db, oldDb;
private TestStorage storage; private TestStorage storage;

View File

@ -18,7 +18,7 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCasePlayer : TestCase internal class TestCasePlayer : TestCase
{ {
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
@ -27,6 +27,7 @@ namespace osu.Desktop.VisualTests.Tests
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapDatabase db) private void load(BeatmapDatabase db)
{ {
// ReSharper disable once ReplaceWithSingleCallToFirstOrDefault (TableQuery doesn't have correct LINQ implementation for First/FirstOrDefault).
var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault(); var beatmapInfo = db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault();
if (beatmapInfo != null) if (beatmapInfo != null)
beatmap = db.GetWorkingBeatmap(beatmapInfo); beatmap = db.GetWorkingBeatmap(beatmapInfo);
@ -43,7 +44,7 @@ namespace osu.Desktop.VisualTests.Tests
int time = 1500; int time = 1500;
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
{ {
objects.Add(new HitCircle() objects.Add(new HitCircle
{ {
StartTime = time, StartTime = time,
Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512, Position = new Vector2(i % 4 == 0 || i % 4 == 2 ? 0 : 512,
@ -91,7 +92,7 @@ namespace osu.Desktop.VisualTests.Tests
}); });
} }
class TestWorkingBeatmap : WorkingBeatmap private class TestWorkingBeatmap : WorkingBeatmap
{ {
public TestWorkingBeatmap(Beatmap beatmap) public TestWorkingBeatmap(Beatmap beatmap)
: base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet) : base(beatmap.BeatmapInfo, beatmap.BeatmapInfo.BeatmapSet)

View File

@ -18,7 +18,7 @@ using osu.Framework.Graphics.Primitives;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseScoreCounter : TestCase internal class TestCaseScoreCounter : TestCase
{ {
public override string Description => @"Tests multiple counters"; public override string Description => @"Tests multiple counters";

View File

@ -12,7 +12,7 @@ using OpenTK.Graphics;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseTextAwesome : TestCase internal class TestCaseTextAwesome : TestCase
{ {
public override string Description => @"Tests display of icons"; public override string Description => @"Tests display of icons";
@ -22,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests
FillFlowContainer flow; FillFlowContainer flow;
Add(flow = new FillFlowContainer() Add(flow = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.5f), Size = new Vector2(0.5f),

View File

@ -7,7 +7,7 @@ using osu.Game.Screens.Play;
namespace osu.Desktop.VisualTests.Tests namespace osu.Desktop.VisualTests.Tests
{ {
class TestCaseTwoLayerButton : TestCase internal class TestCaseTwoLayerButton : TestCase
{ {
public override string Description => @"Back and skip and what not"; public override string Description => @"Back and skip and what not";

View File

@ -7,13 +7,13 @@ using osu.Game.Screens.Backgrounds;
namespace osu.Desktop.VisualTests namespace osu.Desktop.VisualTests
{ {
class VisualTestGame : OsuGameBase internal class VisualTestGame : OsuGameBase
{ {
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
(new BackgroundScreenDefault() { Depth = 10 }).LoadAsync(this, AddInternal); new BackgroundScreenDefault { Depth = 10 }.LoadAsync(this, AddInternal);
// Have to construct this here, rather than in the constructor, because // Have to construct this here, rather than in the constructor, because
// we depend on some dependencies to be loaded within OsuGameBase.load(). // we depend on some dependencies to be loaded within OsuGameBase.load().

View File

@ -17,16 +17,16 @@ namespace osu.Desktop.Beatmaps.IO
{ {
public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path)); public static void Register() => AddReader<LegacyFilesystemReader>((storage, path) => Directory.Exists(path));
private string basePath { get; set; } private string basePath { get; }
private Beatmap firstMap { get; set; } private Beatmap firstMap { get; }
public LegacyFilesystemReader(string path) public LegacyFilesystemReader(string path)
{ {
basePath = path; basePath = path;
BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray(); BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray();
if (BeatmapFilenames.Length == 0) if (BeatmapFilenames.Length == 0)
throw new FileNotFoundException(@"This directory contains no beatmaps"); throw new FileNotFoundException(@"This directory contains no beatmaps");
StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(f => Path.GetFileName(f)).FirstOrDefault(); StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault();
using (var stream = new StreamReader(GetStream(BeatmapFilenames[0]))) using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
{ {
var decoder = BeatmapDecoder.GetDecoder(stream); var decoder = BeatmapDecoder.GetDecoder(stream);

View File

@ -13,12 +13,10 @@ using osu.Game.Screens.Menu;
namespace osu.Desktop namespace osu.Desktop
{ {
class OsuGameDesktop : OsuGame internal class OsuGameDesktop : OsuGame
{ {
private VersionManager versionManager; private VersionManager versionManager;
public override bool IsDeployedBuild => versionManager.IsDeployedBuild;
public OsuGameDesktop(string[] args = null) public OsuGameDesktop(string[] args = null)
: base(args) : base(args)
{ {
@ -44,7 +42,7 @@ namespace osu.Desktop
if (desktopWindow != null) if (desktopWindow != null)
{ {
desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location); desktopWindow.Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location);
desktopWindow.Title = @"osu!lazer"; desktopWindow.Title = Name;
desktopWindow.DragEnter += dragEnter; desktopWindow.DragEnter += dragEnter;
desktopWindow.DragDrop += dragDrop; desktopWindow.DragDrop += dragDrop;
@ -66,10 +64,7 @@ namespace osu.Desktop
if (isFile) if (isFile)
{ {
var paths = (e.Data.GetData(DataFormats.FileDrop) as object[]).Select(f => f.ToString()).ToArray(); var paths = (e.Data.GetData(DataFormats.FileDrop) as object[]).Select(f => f.ToString()).ToArray();
if (paths.Any(p => !p.EndsWith(".osz"))) e.Effect = paths.Any(p => !p.EndsWith(".osz")) ? DragDropEffects.None : DragDropEffects.Copy;
e.Effect = DragDropEffects.None;
else
e.Effect = DragDropEffects.Copy;
} }
} }
} }

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Diagnostics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
@ -11,7 +10,6 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
using Squirrel; using Squirrel;
using System.Reflection;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -19,6 +17,7 @@ using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using System.Net.Http; using System.Net.Http;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game;
namespace osu.Desktop.Overlays namespace osu.Desktop.Overlays
{ {
@ -27,16 +26,12 @@ namespace osu.Desktop.Overlays
private UpdateManager updateManager; private UpdateManager updateManager;
private NotificationManager notificationManager; private NotificationManager notificationManager;
AssemblyName assembly = Assembly.GetEntryAssembly().GetName();
public bool IsDeployedBuild => assembly.Version.Major > 0;
protected override bool HideOnEscape => false; protected override bool HideOnEscape => false;
public override bool HandleInput => false; public override bool HandleInput => false;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(NotificationManager notification, OsuColour colours, TextureStore textures) private void load(NotificationManager notification, OsuColour colours, TextureStore textures, OsuGameBase game)
{ {
notificationManager = notification; notificationManager = notification;
@ -45,17 +40,6 @@ namespace osu.Desktop.Overlays
Origin = Anchor.BottomCentre; Origin = Anchor.BottomCentre;
Alpha = 0; Alpha = 0;
bool isDebug = false;
Debug.Assert(isDebug = true);
string version;
if (!IsDeployedBuild)
{
version = @"local " + (isDebug ? @"debug" : @"release");
}
else
version = $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}";
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
@ -76,12 +60,12 @@ namespace osu.Desktop.Overlays
new OsuSpriteText new OsuSpriteText
{ {
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
Text = $@"osu!lazer" Text = game.Name
}, },
new OsuSpriteText new OsuSpriteText
{ {
Colour = isDebug ? colours.Red : Color4.White, Colour = game.IsDebug ? colours.Red : Color4.White,
Text = version Text = game.Version
}, },
} }
}, },
@ -92,7 +76,7 @@ namespace osu.Desktop.Overlays
TextSize = 12, TextSize = 12,
Colour = colours.Yellow, Colour = colours.Yellow,
Font = @"Venera", Font = @"Venera",
Text = $@"Development Build" Text = @"Development Build"
}, },
new Sprite new Sprite
{ {
@ -104,7 +88,7 @@ namespace osu.Desktop.Overlays
} }
}; };
if (IsDeployedBuild) if (game.IsDeployedBuild)
checkForUpdateAsync(); checkForUpdateAsync();
} }
@ -203,7 +187,7 @@ namespace osu.Desktop.Overlays
{ {
} }
class UpdateProgressNotification : ProgressNotification private class UpdateProgressNotification : ProgressNotification
{ {
protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this) protected override Notification CreateCompletionNotification() => new ProgressCompletionNotification(this)
{ {
@ -228,6 +212,7 @@ namespace osu.Desktop.Overlays
new TextAwesome new TextAwesome
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.fa_upload, Icon = FontAwesome.fa_upload,
Colour = Color4.White, Colour = Color4.White,
} }

View File

@ -8,7 +8,7 @@ using osu.Game.Beatmaps;
namespace osu.Game.Modes.Catch.Objects namespace osu.Game.Modes.Catch.Objects
{ {
class CatchConverter : HitObjectConverter<CatchBaseHit> internal class CatchConverter : HitObjectConverter<CatchBaseHit>
{ {
public override List<CatchBaseHit> Convert(Beatmap beatmap) public override List<CatchBaseHit> Convert(Beatmap beatmap)
{ {

View File

@ -10,7 +10,7 @@ using OpenTK;
namespace osu.Game.Modes.Catch.Objects.Drawable namespace osu.Game.Modes.Catch.Objects.Drawable
{ {
class DrawableFruit : Sprite internal class DrawableFruit : Sprite
{ {
private CatchBaseHit h; private CatchBaseHit h;

View File

@ -26,8 +26,8 @@ namespace osu.Game.Modes.Mania.Objects.Drawable
{ {
Texture = textures.Get(@"Menu/logo"); Texture = textures.Get(@"Menu/logo");
Transforms.Add(new TransformPositionY() { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f }); Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
Transforms.Add(new TransformAlpha() { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 }); Transforms.Add(new TransformAlpha { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });
Expire(true); Expire(true);
} }
} }

View File

@ -9,7 +9,7 @@ using osu.Game.Beatmaps;
namespace osu.Game.Modes.Mania.Objects namespace osu.Game.Modes.Mania.Objects
{ {
class ManiaConverter : HitObjectConverter<ManiaBaseHit> internal class ManiaConverter : HitObjectConverter<ManiaBaseHit>
{ {
private readonly int columns; private readonly int columns;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Modes.Mania.UI
/// </summary> /// </summary>
public class ManiaComboCounter : TaikoComboCounter public class ManiaComboCounter : TaikoComboCounter
{ {
protected ushort KeysHeld = 0; protected ushort KeysHeld;
protected Color4 OriginalColour; protected Color4 OriginalColour;

View File

@ -11,11 +11,8 @@ namespace osu.Game.Modes.Mania.UI
{ {
public class ManiaPlayfield : Playfield public class ManiaPlayfield : Playfield
{ {
private readonly int columns;
public ManiaPlayfield(int columns) public ManiaPlayfield(int columns)
{ {
this.columns = columns;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Size = new Vector2(columns / 20f, 1f); Size = new Vector2(columns / 20f, 1f);
Anchor = Anchor.BottomCentre; Anchor = Anchor.BottomCentre;
@ -24,7 +21,7 @@ namespace osu.Game.Modes.Mania.UI
Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f }); Add(new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f });
for (int i = 0; i < columns; i++) for (int i = 0; i < columns; i++)
Add(new Box() Add(new Box
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Size = new Vector2(2, 1), Size = new Vector2(2, 1),

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
public double EndTime; public double EndTime;
public Vector2 EndPosition; public Vector2 EndPosition;
const float width = 8; private const float width = 8;
public FollowPoint() public FollowPoint()
{ {

View File

@ -74,13 +74,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance) for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance)
{ {
float fraction = ((float)d / distance); float fraction = (float)d / distance;
Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector; Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector;
Vector2 pointEndPosition = startPosition + fraction * distanceVector; Vector2 pointEndPosition = startPosition + fraction * distanceVector;
double fadeOutTime = startTime + fraction * duration; double fadeOutTime = startTime + fraction * duration;
double fadeInTime = fadeOutTime - PreEmpt; double fadeInTime = fadeOutTime - PreEmpt;
Add(new FollowPoint() Add(new FollowPoint
{ {
StartTime = fadeInTime, StartTime = fadeInTime,
EndTime = fadeOutTime, EndTime = fadeOutTime,

View File

@ -49,7 +49,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
return true; return true;
}, },
}, },
number = new NumberPiece() number = new NumberPiece
{ {
Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(), Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(),
}, },
@ -59,7 +59,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
Colour = osuObject.Colour, Colour = osuObject.Colour,
}, },
ApproachCircle = new ApproachCircle() ApproachCircle = new ApproachCircle
{ {
Colour = osuObject.Colour, Colour = osuObject.Colour,
} }
@ -69,9 +69,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Size = circle.DrawSize; Size = circle.DrawSize;
} }
double hit50 = 150; private double hit50 = 150;
double hit100 = 80; private double hit100 = 80;
double hit300 = 30; private double hit300 = 30;
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
{ {
@ -84,7 +84,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
double hitOffset = Math.Abs(Judgement.TimeOffset); double hitOffset = Math.Abs(Judgement.TimeOffset);
OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo; OsuJudgementInfo osuJudgement = (OsuJudgementInfo)Judgement;
if (hitOffset < hit50) if (hitOffset < hit50)
{ {

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel; using System.ComponentModel;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Drawables; using osu.Game.Modes.Objects.Drawables;
namespace osu.Game.Modes.Osu.Objects.Drawables namespace osu.Game.Modes.Osu.Objects.Drawables
@ -18,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
} }
public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 }; protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };
protected override void UpdateState(ArmedState state) protected override void UpdateState(ArmedState state)
{ {

View File

@ -21,10 +21,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private Container<DrawableSliderTick> ticks; private Container<DrawableSliderTick> ticks;
SliderBody body; private SliderBody body;
SliderBall ball; private SliderBall ball;
SliderBouncer bouncer1, bouncer2; private SliderBouncer bouncer1, bouncer2;
public DrawableSlider(Slider s) : base(s) public DrawableSlider(Slider s) : base(s)
{ {
@ -94,7 +94,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
// pass all input through. // pass all input through.
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
int currentRepeat; private int currentRepeat;
protected override void Update() protected override void Update()
{ {
@ -103,7 +103,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1); double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
int repeat = (int)(progress * slider.RepeatCount); int repeat = (int)(progress * slider.RepeatCount);
progress = (progress * slider.RepeatCount) % 1; progress = progress * slider.RepeatCount % 1;
if (repeat > currentRepeat) if (repeat > currentRepeat)
{ {

View File

@ -26,7 +26,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick }; protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick };
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
{ {
@ -71,7 +71,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
protected override void CheckJudgement(bool userTriggered) protected override void CheckJudgement(bool userTriggered)
{ {
var j = Judgement as OsuJudgementInfo; var j = (OsuJudgementInfo)Judgement;
if (Judgement.TimeOffset >= 0) if (Judgement.TimeOffset >= 0)
{ {

View File

@ -75,7 +75,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
if (Time.Current < HitObject.StartTime) return; if (Time.Current < HitObject.StartTime) return;
var j = Judgement as OsuJudgementInfo; var j = (OsuJudgementInfo)Judgement;
disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100); disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100);
@ -108,9 +108,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
} }
} }
private Vector2 scaleToCircle => (circle.Scale * circle.DrawWidth / DrawWidth) * 0.95f; private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f;
private float spinsPerMinuteNeeded = 100 + (5 * 15); //TODO: read per-map OD and place it on the 5 private float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5
private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f);

View File

@ -15,7 +15,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
private readonly Slider slider; private readonly Slider slider;
private Box follow; private Box follow;
const float width = 128; private const float width = 128;
public SliderBall(Slider slider) public SliderBall(Slider slider)
{ {
@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
return base.OnMouseMove(state); return base.OnMouseMove(state);
} }
bool tracking; private bool tracking;
public bool Tracking public bool Tracking
{ {
get { return tracking; } get { return tracking; }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
set { Disc.Colour = value; } set { Disc.Colour = value; }
} }
Color4 completeColour; private Color4 completeColour;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
@ -37,7 +37,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
completeColour = colours.YellowLight.Opacity(0.8f); completeColour = colours.YellowLight.Opacity(0.8f);
} }
class SpinnerBorder : Container private class SpinnerBorder : Container
{ {
public SpinnerBorder() public SpinnerBorder()
{ {
@ -116,7 +116,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
}; };
} }
bool tracking; private bool tracking;
public bool Tracking public bool Tracking
{ {
get { return tracking; } get { return tracking; }
@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
} }
} }
bool complete; private bool complete;
public bool Complete public bool Complete
{ {
get { return complete; } get { return complete; }

View File

@ -8,7 +8,7 @@ using System.Linq;
namespace osu.Game.Modes.Osu.Objects namespace osu.Game.Modes.Osu.Objects
{ {
class OsuHitObjectDifficulty internal class OsuHitObjectDifficulty
{ {
/// <summary> /// <summary>
/// Factor by how much speed / aim strain decays per second. /// Factor by how much speed / aim strain decays per second.
@ -63,7 +63,7 @@ namespace osu.Game.Modes.Osu.Objects
MaxCombo += slider.Ticks.Count(); MaxCombo += slider.Ticks.Count();
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
scalingFactor = (52.0f / circleRadius); scalingFactor = 52.0f / circleRadius;
if (circleRadius < 30) if (circleRadius < 30)
{ {
float smallCircleBonus = Math.Min(30.0f - circleRadius, 5.0f) / 50.0f; float smallCircleBonus = Math.Min(30.0f - circleRadius, 5.0f) / 50.0f;
@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects
else if (distance > almost_diameter) else if (distance > almost_diameter)
return 1.2 + 0.4 * (distance - almost_diameter) / (stream_spacing_threshold - almost_diameter); return 1.2 + 0.4 * (distance - almost_diameter) / (stream_spacing_threshold - almost_diameter);
else if (distance > almost_diameter / 2) else if (distance > almost_diameter / 2)
return 0.95 + 0.25 * (distance - (almost_diameter / 2)) / (almost_diameter / 2); return 0.95 + 0.25 * (distance - almost_diameter / 2) / (almost_diameter / 2);
else else
return 0.95; return 0.95;

View File

@ -30,11 +30,8 @@ namespace osu.Game.Modes.Osu.Objects
break; break;
case HitObjectType.Slider: case HitObjectType.Slider:
CurveTypes curveType = CurveTypes.Catmull; CurveTypes curveType = CurveTypes.Catmull;
int repeatCount;
double length = 0; double length = 0;
List<Vector2> points = new List<Vector2>(); List<Vector2> points = new List<Vector2> { new Vector2(int.Parse(split[0]), int.Parse(split[1])) };
points.Add(new Vector2(int.Parse(split[0]), int.Parse(split[1])));
string[] pointsplit = split[5].Split('|'); string[] pointsplit = split[5].Split('|');
for (int i = 0; i < pointsplit.Length; i++) for (int i = 0; i < pointsplit.Length; i++)
@ -67,12 +64,10 @@ namespace osu.Game.Modes.Osu.Objects
points.Add(v); points.Add(v);
} }
repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture); int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
if (repeatCount > 9000) if (repeatCount > 9000)
{ throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
throw new ArgumentOutOfRangeException("wacky man");
}
if (split.Length > 7) if (split.Length > 7)
length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture); length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture);

View File

@ -59,10 +59,9 @@ namespace osu.Game.Modes.Osu.Objects
if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1]) if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1])
{ {
List<Vector2> subpath = calculateSubpath(subControlPoints); List<Vector2> subpath = calculateSubpath(subControlPoints);
for (int j = 0; j < subpath.Count; ++j) foreach (Vector2 t in subpath)
// Only add those vertices that add a new segment to the path. if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
if (calculatedPath.Count == 0 || calculatedPath.Last() != subpath[j]) calculatedPath.Add(t);
calculatedPath.Add(subpath[j]);
subControlPoints.Clear(); subControlPoints.Clear();
} }
@ -175,7 +174,7 @@ namespace osu.Game.Modes.Osu.Objects
path.Clear(); path.Clear();
int i = 0; int i = 0;
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) ; for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) { }
path.Add(interpolateVertices(i, d0) + Offset); path.Add(interpolateVertices(i, d0) + Offset);

View File

@ -100,22 +100,23 @@ namespace osu.Game.Modes.Osu
protected bool CalculateStrainValues() protected bool CalculateStrainValues()
{ {
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
List<OsuHitObjectDifficulty>.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator(); using (List<OsuHitObjectDifficulty>.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator())
if (!hitObjectsEnumerator.MoveNext()) return false;
OsuHitObjectDifficulty currentHitObject = hitObjectsEnumerator.Current;
OsuHitObjectDifficulty nextHitObject;
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
while (hitObjectsEnumerator.MoveNext())
{ {
nextHitObject = hitObjectsEnumerator.Current;
nextHitObject.CalculateStrains(currentHitObject, TimeRate);
currentHitObject = nextHitObject;
}
return true; if (!hitObjectsEnumerator.MoveNext()) return false;
OsuHitObjectDifficulty current = hitObjectsEnumerator.Current;
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
while (hitObjectsEnumerator.MoveNext())
{
var next = hitObjectsEnumerator.Current;
next?.CalculateStrains(current, TimeRate);
current = next;
}
return true;
}
} }
/// <summary> /// <summary>
@ -184,7 +185,7 @@ namespace osu.Game.Modes.Osu
} }
// Those values are used as array indices. Be careful when changing them! // Those values are used as array indices. Be careful when changing them!
public enum DifficultyType : int public enum DifficultyType
{ {
Speed = 0, Speed = 0,
Aim, Aim,

View File

@ -3,7 +3,7 @@
namespace osu.Game.Modes.Osu namespace osu.Game.Modes.Osu
{ {
class OsuScore : Score internal class OsuScore : Score
{ {
} }
} }

View File

@ -6,7 +6,7 @@ using osu.Game.Modes.Osu.Objects.Drawables;
namespace osu.Game.Modes.Osu namespace osu.Game.Modes.Osu
{ {
class OsuScoreProcessor : ScoreProcessor internal class OsuScoreProcessor : ScoreProcessor
{ {
public OsuScoreProcessor(int hitObjectCount) public OsuScoreProcessor(int hitObjectCount)
: base(hitObjectCount) : base(hitObjectCount)
@ -35,8 +35,9 @@ namespace osu.Game.Modes.Osu
int score = 0; int score = 0;
int maxScore = 0; int maxScore = 0;
foreach (OsuJudgementInfo j in Judgements) foreach (var judgementInfo in Judgements)
{ {
var j = (OsuJudgementInfo)judgementInfo;
score += j.ScoreValue; score += j.ScoreValue;
maxScore += j.MaxScoreValue; maxScore += j.MaxScoreValue;
} }

View File

@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.UI
/// </summary> /// </summary>
public class OsuComboCounter : ComboCounter public class OsuComboCounter : ComboCounter
{ {
protected uint ScheduledPopOutCurrentId = 0; protected uint ScheduledPopOutCurrentId;
protected virtual float PopOutSmallScale => 1.1f; protected virtual float PopOutSmallScale => 1.1f;
protected virtual bool CanPopOutWhileRolling => false; protected virtual bool CanPopOutWhileRolling => false;

View File

@ -17,12 +17,17 @@ namespace osu.Game.Modes.Osu.UI
protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h)
{ {
if (h is HitCircle) var circle = h as HitCircle;
return new DrawableHitCircle(h as HitCircle); if (circle != null)
if (h is Slider) return new DrawableHitCircle(circle);
return new DrawableSlider(h as Slider);
if (h is Spinner) var slider = h as Slider;
return new DrawableSpinner(h as Spinner); if (slider != null)
return new DrawableSlider(slider);
var spinner = h as Spinner;
if (spinner != null)
return new DrawableSpinner(spinner);
return null; return null;
} }
} }

View File

@ -22,7 +22,7 @@ namespace osu.Game.Modes.Osu.UI
Margin = new MarginPadding { Right = 5 }, Margin = new MarginPadding { Right = 5 },
}; };
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter() protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
@ -31,7 +31,7 @@ namespace osu.Game.Modes.Osu.UI
Margin = new MarginPadding { Right = 5 }, Margin = new MarginPadding { Right = 5 },
}; };
protected override ComboCounter CreateComboCounter() => new OsuComboCounter() protected override ComboCounter CreateComboCounter() => new OsuComboCounter
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,

View File

@ -10,7 +10,7 @@ using OpenTK;
namespace osu.Game.Modes.Taiko.Objects.Drawable namespace osu.Game.Modes.Taiko.Objects.Drawable
{ {
class DrawableTaikoHit : Sprite internal class DrawableTaikoHit : Sprite
{ {
private TaikoBaseHit h; private TaikoBaseHit h;

View File

@ -8,7 +8,7 @@ using osu.Game.Beatmaps;
namespace osu.Game.Modes.Taiko.Objects namespace osu.Game.Modes.Taiko.Objects
{ {
class TaikoConverter : HitObjectConverter<TaikoBaseHit> internal class TaikoConverter : HitObjectConverter<TaikoBaseHit>
{ {
public override List<TaikoBaseHit> Convert(Beatmap beatmap) public override List<TaikoBaseHit> Convert(Beatmap beatmap)
{ {

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[TestFixture] [TestFixture]
public class ImportBeatmapTest public class ImportBeatmapTest
{ {
const string osz_path = @"../../../osu-resources/osu.Game.Resources/Beatmaps/241526 Soleily - Renatus.osz"; private const string osz_path = @"../../../osu-resources/osu.Game.Resources/Beatmaps/241526 Soleily - Renatus.osz";
[OneTimeSetUp] [OneTimeSetUp]
public void SetUp() public void SetUp()
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Beatmaps.IO
Assert.IsTrue(File.Exists(temp)); Assert.IsTrue(File.Exists(temp));
using (FileStream stream = File.OpenRead(temp)) using (File.OpenRead(temp))
osu.Dependencies.Get<BeatmapDatabase>().Import(temp); osu.Dependencies.Get<BeatmapDatabase>().Import(temp);
ensureLoaded(osu); ensureLoaded(osu);
@ -107,7 +107,7 @@ namespace osu.Game.Tests.Beatmaps.IO
private string prepareTempCopy(string path) private string prepareTempCopy(string path)
{ {
var temp = Path.GetTempFileName(); var temp = Path.GetTempFileName();
return new FileInfo(osz_path).CopyTo(temp, true).FullName; return new FileInfo(path).CopyTo(temp, true).FullName;
} }
private OsuGameBase loadOsu(GameHost host) private OsuGameBase loadOsu(GameHost host)
@ -130,13 +130,13 @@ namespace osu.Game.Tests.Beatmaps.IO
Action waitAction = () => Action waitAction = () =>
{ {
while ((resultSets = osu.Dependencies.Get<BeatmapDatabase>() while (!(resultSets = osu.Dependencies.Get<BeatmapDatabase>()
.Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Count() == 0) .Query<BeatmapSetInfo>().Where(s => s.OnlineBeatmapSetID == 241526)).Any())
Thread.Sleep(50); Thread.Sleep(50);
}; };
Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout), Assert.IsTrue(waitAction.BeginInvoke(null, null).AsyncWaitHandle.WaitOne(timeout),
$@"BeatmapSet did not import to the database in allocated time."); @"BeatmapSet did not import to the database in allocated time.");
//ensure we were stored to beatmap database backing... //ensure we were stored to beatmap database backing...
@ -168,7 +168,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var beatmap = osu.Dependencies.Get<BeatmapDatabase>().GetWorkingBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu))?.Beatmap; var beatmap = osu.Dependencies.Get<BeatmapDatabase>().GetWorkingBeatmap(set.Beatmaps.First(b => b.Mode == PlayMode.Osu))?.Beatmap;
Assert.IsTrue(beatmap.HitObjects.Count > 0); Assert.IsTrue(beatmap?.HitObjects.Count > 0);
} }
} }
} }

View File

@ -77,7 +77,7 @@ namespace osu.Game.Tests.Beatmaps.IO
using (var stream = new StreamReader( using (var stream = new StreamReader(
reader.GetStream("Soleily - Renatus (Deif) [Platter].osu"))) reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
{ {
Assert.AreEqual("osu file format v13", stream.ReadLine().Trim()); Assert.AreEqual("osu file format v13", stream.ReadLine()?.Trim());
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace osu.Game.Beatmaps
protected abstract HitObjectConverter<T> Converter { get; } protected abstract HitObjectConverter<T> Converter { get; }
public DifficultyCalculator(Beatmap beatmap) protected DifficultyCalculator(Beatmap beatmap)
{ {
Objects = Converter.Convert(beatmap); Objects = Converter.Convert(beatmap);
PreprocessHitObjects(); PreprocessHitObjects();

View File

@ -6,7 +6,7 @@ using osu.Framework.Graphics.Sprites;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class BeatmapBackgroundSprite : Sprite internal class BeatmapBackgroundSprite : Sprite
{ {
private readonly WorkingBeatmap working; private readonly WorkingBeatmap working;

View File

@ -10,7 +10,7 @@ using osu.Game.Database;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class BeatmapGroup : IStateful<BeatmapGroupState> internal class BeatmapGroup : IStateful<BeatmapGroupState>
{ {
public BeatmapPanel SelectedPanel; public BeatmapPanel SelectedPanel;

View File

@ -18,7 +18,7 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class BeatmapPanel : Panel internal class BeatmapPanel : Panel
{ {
public BeatmapInfo Beatmap; public BeatmapInfo Beatmap;
private Sprite background; private Sprite background;

View File

@ -17,7 +17,7 @@ using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class BeatmapSetHeader : Panel internal class BeatmapSetHeader : Panel
{ {
public Action<BeatmapSetHeader> GainedSelection; public Action<BeatmapSetHeader> GainedSelection;
private SpriteText title, artist; private SpriteText title, artist;
@ -96,7 +96,7 @@ namespace osu.Game.Beatmaps.Drawables
base.Dispose(isDisposing); base.Dispose(isDisposing);
} }
class PanelBackground : BufferedContainer private class PanelBackground : BufferedContainer
{ {
private readonly WorkingBeatmap working; private readonly WorkingBeatmap working;
@ -160,7 +160,7 @@ namespace osu.Game.Beatmaps.Drawables
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
}.LoadAsync(game, (bg) => }.LoadAsync(game, bg =>
{ {
Add(bg); Add(bg);
ForceRedraw(); ForceRedraw();

View File

@ -12,7 +12,7 @@ using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class DifficultyIcon : Container internal class DifficultyIcon : Container
{ {
private readonly BeatmapInfo beatmap; private readonly BeatmapInfo beatmap;
private OsuColour palette; private OsuColour palette;
@ -34,6 +34,7 @@ namespace osu.Game.Beatmaps.Drawables
new TextAwesome new TextAwesome
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = Size.X, TextSize = Size.X,
Colour = getColour(beatmap), Colour = getColour(beatmap),
Icon = FontAwesome.fa_circle Icon = FontAwesome.fa_circle
@ -41,6 +42,7 @@ namespace osu.Game.Beatmaps.Drawables
new TextAwesome new TextAwesome
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = Size.X, TextSize = Size.X,
Colour = Color4.White, Colour = Color4.White,
Icon = Ruleset.GetRuleset(beatmap.Mode).Icon Icon = Ruleset.GetRuleset(beatmap.Mode).Icon
@ -48,7 +50,7 @@ namespace osu.Game.Beatmaps.Drawables
}; };
} }
enum DifficultyRating private enum DifficultyRating
{ {
Easy, Easy,
Normal, Normal,

View File

@ -12,7 +12,7 @@ using osu.Framework.Extensions.Color4Extensions;
namespace osu.Game.Beatmaps.Drawables namespace osu.Game.Beatmaps.Drawables
{ {
class Panel : Container, IStateful<PanelSelectedState> internal class Panel : Container, IStateful<PanelSelectedState>
{ {
public const float MAX_HEIGHT = 80; public const float MAX_HEIGHT = 80;
@ -115,7 +115,7 @@ namespace osu.Game.Beatmaps.Drawables
} }
} }
enum PanelSelectedState internal enum PanelSelectedState
{ {
Hidden, Hidden,
NotSelected, NotSelected,

View File

@ -17,8 +17,9 @@ namespace osu.Game.Beatmaps.Formats
public static BeatmapDecoder GetDecoder(TextReader stream) public static BeatmapDecoder GetDecoder(TextReader stream)
{ {
var line = stream.ReadLine().Trim(); var line = stream.ReadLine()?.Trim();
if (!decoders.ContainsKey(line))
if (line == null || !decoders.ContainsKey(line))
throw new IOException(@"Unknown file format"); throw new IOException(@"Unknown file format");
return (BeatmapDecoder)Activator.CreateInstance(decoders[line]); return (BeatmapDecoder)Activator.CreateInstance(decoders[line]);
} }

View File

@ -197,7 +197,7 @@ namespace osu.Game.Beatmaps.Formats
if (split.Length > 2) if (split.Length > 2)
{ {
int kiaiFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0; //int kiaiFlags = split.Length > 7 ? Convert.ToInt32(split[7], NumberFormatInfo.InvariantInfo) : 0;
double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo); double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo);
cp = new ControlPoint cp = new ControlPoint
{ {
@ -219,15 +219,18 @@ namespace osu.Game.Beatmaps.Formats
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {val}"); throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {val}");
byte r, g, b; byte r, g, b;
if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b)) if (!byte.TryParse(split[0], out r) || !byte.TryParse(split[1], out g) || !byte.TryParse(split[2], out b))
throw new InvalidOperationException($@"Color must be specified with 8-bit integer components"); throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
// Note: the combo index specified in the beatmap is discarded // Note: the combo index specified in the beatmap is discarded
beatmap.ComboColors.Add(new Color4 if (key.StartsWith(@"Combo"))
{ {
R = r / 255f, beatmap.ComboColors.Add(new Color4
G = g / 255f, {
B = b / 255f, R = r / 255f,
A = 1f, G = g / 255f,
}); B = b / 255f,
A = 1f,
});
}
} }
protected override void ParseFile(TextReader stream, Beatmap beatmap) protected override void ParseFile(TextReader stream, Beatmap beatmap)
@ -235,10 +238,9 @@ namespace osu.Game.Beatmaps.Formats
HitObjectParser parser = null; HitObjectParser parser = null;
var section = Section.None; var section = Section.None;
string line;
while (true) while (true)
{ {
line = stream.ReadLine(); var line = stream.ReadLine();
if (line == null) if (line == null)
break; break;
if (string.IsNullOrEmpty(line)) if (string.IsNullOrEmpty(line))

View File

@ -15,7 +15,8 @@ namespace osu.Game.Beatmaps.Timing
public double BeatLength; public double BeatLength;
public double VelocityAdjustment; public double VelocityAdjustment;
public bool TimingChange; public bool TimingChange;
public bool KiaiMode;
} }
internal enum TimeSignatures internal enum TimeSignatures

View File

@ -3,7 +3,7 @@
namespace osu.Game.Beatmaps.Timing namespace osu.Game.Beatmaps.Timing
{ {
class TimingChange : ControlPoint internal class TimingChange : ControlPoint
{ {
public TimingChange(double beatLength) public TimingChange(double beatLength)
{ {

View File

@ -20,11 +20,12 @@ namespace osu.Game.Database
{ {
public class BeatmapDatabase public class BeatmapDatabase
{ {
private SQLiteConnection connection { get; set; } private SQLiteConnection connection { get; }
private Storage storage; private Storage storage;
public event Action<BeatmapSetInfo> BeatmapSetAdded; public event Action<BeatmapSetInfo> BeatmapSetAdded;
public event Action<BeatmapSetInfo> BeatmapSetRemoved; public event Action<BeatmapSetInfo> BeatmapSetRemoved;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private BeatmapImporter ipc; private BeatmapImporter ipc;
public BeatmapDatabase(Storage storage, GameHost importHost = null) public BeatmapDatabase(Storage storage, GameHost importHost = null)
@ -73,7 +74,7 @@ namespace osu.Game.Database
} }
catch (Exception e) catch (Exception e)
{ {
Logger.Error(e, $@"Could not delete beatmap {b.ToString()}"); Logger.Error(e, $@"Could not delete beatmap {b}");
} }
} }
@ -149,7 +150,7 @@ namespace osu.Game.Database
catch (Exception e) catch (Exception e)
{ {
e = e.InnerException ?? e; e = e.InnerException ?? e;
Logger.Error(e, $@"Could not import beatmap set"); Logger.Error(e, @"Could not import beatmap set");
} }
// Batch commit with multiple sets to database // Batch commit with multiple sets to database
@ -318,8 +319,7 @@ namespace osu.Game.Database
return item; return item;
} }
readonly Type[] validTypes = new[] private readonly Type[] validTypes = {
{
typeof(BeatmapSetInfo), typeof(BeatmapSetInfo),
typeof(BeatmapInfo), typeof(BeatmapInfo),
typeof(BeatmapMetadata), typeof(BeatmapMetadata),
@ -329,7 +329,7 @@ namespace osu.Game.Database
public void Update<T>(T record, bool cascade = true) where T : class public void Update<T>(T record, bool cascade = true) where T : class
{ {
if (validTypes.All(t => t != typeof(T))) if (validTypes.All(t => t != typeof(T)))
throw new ArgumentException(nameof(T), "Must be a type managed by BeatmapDatabase"); throw new ArgumentException("Must be a type managed by BeatmapDatabase", nameof(T));
if (cascade) if (cascade)
connection.UpdateWithChildren(record); connection.UpdateWithChildren(record);
else else

View File

@ -15,9 +15,9 @@ namespace osu.Game.Database
[PrimaryKey, AutoIncrement] [PrimaryKey, AutoIncrement]
public int ID { get; set; } public int ID { get; set; }
public int? OnlineBeatmapID { get; set; } = null; public int? OnlineBeatmapID { get; set; }
public int? OnlineBeatmapSetID { get; set; } = null; public int? OnlineBeatmapSetID { get; set; }
[ForeignKey(typeof(BeatmapSetInfo))] [ForeignKey(typeof(BeatmapSetInfo))]
public int BeatmapSetInfoID { get; set; } public int BeatmapSetInfoID { get; set; }
@ -57,7 +57,7 @@ namespace osu.Game.Database
{ {
get get
{ {
return StoredBookmarks.Split(',').Select(b => int.Parse(b)).ToArray(); return StoredBookmarks.Split(',').Select(int.Parse).ToArray();
} }
set set
{ {
@ -77,7 +77,7 @@ namespace osu.Game.Database
{ {
get get
{ {
return (starDifficulty < 0) ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty; return starDifficulty < 0 ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty;
} }
set { starDifficulty = value; } set { starDifficulty = value; }

View File

@ -10,7 +10,7 @@ namespace osu.Game.Database
[PrimaryKey, AutoIncrement] [PrimaryKey, AutoIncrement]
public int ID { get; set; } public int ID { get; set; }
public int? OnlineBeatmapSetID { get; set; } = null; public int? OnlineBeatmapSetID { get; set; }
public string Title { get; set; } public string Title { get; set; }
public string TitleUnicode { get; set; } public string TitleUnicode { get; set; }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Database
[PrimaryKey, AutoIncrement] [PrimaryKey, AutoIncrement]
public int ID { get; set; } public int ID { get; set; }
public int? OnlineBeatmapSetID { get; set; } = null; public int? OnlineBeatmapSetID { get; set; }
[OneToOne(CascadeOperations = CascadeOperation.All)] [OneToOne(CascadeOperations = CascadeOperation.All)]
public BeatmapMetadata Metadata { get; set; } public BeatmapMetadata Metadata { get; set; }

View File

@ -14,7 +14,7 @@ namespace osu.Game.Graphics.Backgrounds
{ {
public Sprite Sprite; public Sprite Sprite;
string textureName; private string textureName;
public Background(string textureName = @"") public Background(string textureName = @"")
{ {

View File

@ -117,7 +117,7 @@ namespace osu.Game.Graphics.Backgrounds
private void addTriangle(bool randomY) private void addTriangle(bool randomY)
{ {
var sprite = CreateTriangle(); var sprite = CreateTriangle();
float triangleHeight = (sprite.DrawHeight / DrawHeight); float triangleHeight = sprite.DrawHeight / DrawHeight;
sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1); sprite.Position = new Vector2(RNG.NextSingle(), randomY ? RNG.NextSingle() * (1 + triangleHeight) - triangleHeight : 1);
Add(sprite); Add(sprite);
} }

View File

@ -12,7 +12,7 @@ using osu.Framework.Configuration;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
class ParallaxContainer : Container internal class ParallaxContainer : Container
{ {
public float ParallaxAmount = 0.02f; public float ParallaxAmount = 0.02f;
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Containers
}; };
} }
bool firstUpdate = true; private bool firstUpdate = true;
protected override void Update() protected override void Update()
{ {

View File

@ -16,8 +16,7 @@ using osu.Framework.Graphics.Colour;
namespace osu.Game.Graphics.Cursor namespace osu.Game.Graphics.Cursor
{ {
internal class CursorTrail : Drawable
class CursorTrail : Drawable
{ {
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
public override bool HandleInput => true; public override bool HandleInput => true;
@ -46,7 +45,7 @@ namespace osu.Game.Graphics.Cursor
{ {
base.ApplyDrawNode(node); base.ApplyDrawNode(node);
TrailDrawNode tNode = node as TrailDrawNode; TrailDrawNode tNode = (TrailDrawNode)node;
tNode.Shader = shader; tNode.Shader = shader;
tNode.Texture = texture; tNode.Texture = texture;
tNode.Size = size; tNode.Size = size;
@ -117,7 +116,7 @@ namespace osu.Game.Graphics.Cursor
float distance = diff.Length; float distance = diff.Length;
Vector2 direction = diff / distance; Vector2 direction = diff / distance;
float interval = (size.X / 2) * 0.9f; float interval = size.X / 2 * 0.9f;
for (float d = interval; d < distance; d += interval) for (float d = interval; d < distance; d += interval)
{ {
@ -137,7 +136,7 @@ namespace osu.Game.Graphics.Cursor
currentIndex = (currentIndex + 1) % max_sprites; currentIndex = (currentIndex + 1) % max_sprites;
} }
struct TrailPart private struct TrailPart
{ {
public Vector2 Position; public Vector2 Position;
public float Time; public float Time;
@ -145,12 +144,12 @@ namespace osu.Game.Graphics.Cursor
public bool WasUpdated; public bool WasUpdated;
} }
class TrailDrawNodeSharedData private class TrailDrawNodeSharedData
{ {
public VertexBuffer<TexturedVertex2D> VertexBuffer; public VertexBuffer<TexturedVertex2D> VertexBuffer;
} }
class TrailDrawNode : DrawNode private class TrailDrawNode : DrawNode
{ {
public Shader Shader; public Shader Shader;
public Texture Texture; public Texture Texture;

View File

@ -17,7 +17,7 @@ using System;
namespace osu.Game.Graphics.Cursor namespace osu.Game.Graphics.Cursor
{ {
class OsuCursorContainer : CursorContainer internal class OsuCursorContainer : CursorContainer
{ {
protected override Drawable CreateCursor() => new OsuCursor(); protected override Drawable CreateCursor() => new OsuCursor();
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Cursor
return base.OnMouseUp(state, args); return base.OnMouseUp(state, args);
} }
class OsuCursor : Container private class OsuCursor : Container
{ {
private Container cursorContainer; private Container cursorContainer;
private Bindable<double> cursorScale; private Bindable<double> cursorScale;

View File

@ -8,7 +8,7 @@ using osu.Framework.Graphics;
namespace osu.Game.Graphics.Processing namespace osu.Game.Graphics.Processing
{ {
class RatioAdjust : Container internal class RatioAdjust : Container
{ {
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;

View File

@ -26,11 +26,6 @@ namespace osu.Game.Graphics
Text = ((char)icon).ToString(); Text = ((char)icon).ToString();
} }
} }
public TextAwesome()
{
Origin = Framework.Graphics.Anchor.Centre;
}
} }
public enum FontAwesome public enum FontAwesome

View File

@ -100,7 +100,7 @@ namespace osu.Game.Graphics.UserInterface
Delay(click_duration); Delay(click_duration);
Schedule(delegate { Schedule(delegate {
colourContainer.ResizeTo(new Vector2(0.8f, 1f), 0, EasingTypes.None); colourContainer.ResizeTo(new Vector2(0.8f, 1f));
spriteText.Spacing = Vector2.Zero; spriteText.Spacing = Vector2.Zero;
glowContainer.FadeOut(); glowContainer.FadeOut();
}); });

View File

@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface
private Box fill; private Box fill;
const float border_width = 3; private const float border_width = 3;
private Color4 glowingColour, idleColour; private Color4 glowingColour, idleColour;
public Nub() public Nub()

View File

@ -36,10 +36,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void UpdateContentHeight() protected override void UpdateContentHeight()
{ {
if (State == DropDownMenuState.Opened) ContentContainer.ResizeTo(State == DropDownMenuState.Opened ? new Vector2(1, ContentHeight) : new Vector2(1, 0), 300, EasingTypes.OutQuint);
ContentContainer.ResizeTo(new Vector2(1, ContentHeight), 300, EasingTypes.OutQuint);
else
ContentContainer.ResizeTo(new Vector2(1, 0), 300, EasingTypes.OutQuint);
} }
} }
} }

View File

@ -49,7 +49,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Apply(Drawable d) public override void Apply(Drawable d)
{ {
base.Apply(d); base.Apply(d);
(d as PercentageCounter).DisplayedCount = CurrentValue; ((PercentageCounter)d).DisplayedCount = CurrentValue;
} }
} }
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
/// Type of the Transform to use. /// Type of the Transform to use.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// Must be a subclass of Transform<T> /// Must be a subclass of Transform(T)
/// </remarks> /// </remarks>
protected virtual Type TransformType => typeof(Transform<T>); protected virtual Type TransformType => typeof(Transform<T>);
@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
DisplayedCountSpriteText = new OsuSpriteText() DisplayedCountSpriteText = new OsuSpriteText
{ {
Font = @"Venera" Font = @"Venera"
}, },

View File

@ -66,7 +66,7 @@ namespace osu.Game.Graphics.UserInterface
public override void Apply(Drawable d) public override void Apply(Drawable d)
{ {
base.Apply(d); base.Apply(d);
(d as ScoreCounter).DisplayedCount = CurrentValue; ((ScoreCounter)d).DisplayedCount = CurrentValue;
} }
} }
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.Graphics.UserInterface
private float minStarAlpha => 0.5f; private float minStarAlpha => 0.5f;
private const float star_size = 20; private const float star_size = 20;
private float star_spacing = 4; private const float star_spacing = 4;
private float count; private float count;
@ -145,7 +145,7 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
class Star : Container private class Star : Container
{ {
public TextAwesome Icon; public TextAwesome Icon;
public Star() public Star()

View File

@ -98,6 +98,7 @@ namespace osu.Game.Graphics.UserInterface
icon = new TextAwesome icon = new TextAwesome
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 25, TextSize = 25,
}, },
} }

View File

@ -87,7 +87,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack); volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack);
} }
ScheduledDelegate popOutDelegate; private ScheduledDelegate popOutDelegate;
private VolumeMeter volumeMeterEffect; private VolumeMeter volumeMeterEffect;
private VolumeMeter volumeMeterMusic; private VolumeMeter volumeMeterMusic;

View File

@ -8,7 +8,7 @@ using OpenTK.Input;
namespace osu.Game.Graphics.UserInterface.Volume namespace osu.Game.Graphics.UserInterface.Volume
{ {
class VolumeControlReceptor : Container internal class VolumeControlReceptor : Container
{ {
public Action<InputState> ActionRequested; public Action<InputState> ActionRequested;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
internal class VolumeMeter : Container internal class VolumeMeter : Container
{ {
private Box meterFill; private Box meterFill;
public BindableDouble Bindable { get; private set; } = new BindableDouble(); public BindableDouble Bindable { get; } = new BindableDouble();
public VolumeMeter(string meterName) public VolumeMeter(string meterName)
{ {

View File

@ -1,19 +1,21 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Database; using osu.Game.Database;
namespace osu.Game.IPC namespace osu.Game.IPC
{ {
public class BeatmapImporter public class BeatmapImporter : IDisposable
{ {
private IpcChannel<BeatmapImportMessage> channel; private IpcChannel<BeatmapImportMessage> channel;
private BeatmapDatabase beatmaps; private BeatmapDatabase beatmaps;
public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null) public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null)
{ {
this.beatmaps = beatmaps; this.beatmaps = beatmaps;
@ -35,7 +37,12 @@ namespace osu.Game.IPC
{ {
Debug.Assert(beatmaps != null); Debug.Assert(beatmaps != null);
ImportAsync(msg.Path); ImportAsync(msg.Path).ContinueWith(t => Logger.Error(t.Exception, @"error during async import"), TaskContinuationOptions.OnlyOnFaulted);
}
public void Dispose()
{
throw new NotImplementedException();
} }
} }

View File

@ -24,11 +24,11 @@ namespace osu.Game.Modes.Objects.Drawables
public JudgementInfo Judgement; public JudgementInfo Judgement;
public abstract JudgementInfo CreateJudgementInfo(); protected abstract JudgementInfo CreateJudgementInfo();
public HitObject HitObject; public HitObject HitObject;
public DrawableHitObject(HitObject hitObject) protected DrawableHitObject(HitObject hitObject)
{ {
HitObject = hitObject; HitObject = hitObject;
} }
@ -52,12 +52,15 @@ namespace osu.Game.Modes.Objects.Drawables
} }
} }
SampleChannel sample; private SampleChannel sample;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
string hitType = ((HitObject.Sample?.Type ?? SampleType.None) == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower(); SampleType type = HitObject.Sample?.Type ?? SampleType.None;
if (type == SampleType.None)
type = SampleType.Normal;
string hitType = type.ToString().ToLower();
string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower(); string sampleSet = (HitObject.Sample?.Set ?? SampleSet.Normal).ToString().ToLower();
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}"); sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
@ -98,7 +101,6 @@ namespace osu.Game.Modes.Objects.Drawables
/// <summary> /// <summary>
/// Process a hit of this hitobject. Carries out judgement. /// Process a hit of this hitobject. Carries out judgement.
/// </summary> /// </summary>
/// <param name="judgement">Preliminary judgement information provided by the hit source.</param>
/// <returns>Whether a hit was processed.</returns> /// <returns>Whether a hit was processed.</returns>
protected bool UpdateJudgement(bool userTriggered) protected bool UpdateJudgement(bool userTriggered)
{ {

View File

@ -10,7 +10,7 @@ namespace osu.Game.Modes
{ {
public abstract class ScoreProcessor public abstract class ScoreProcessor
{ {
public virtual Score GetScore() => new Score() public virtual Score GetScore() => new Score
{ {
TotalScore = TotalScore, TotalScore = TotalScore,
Combo = Combo, Combo = Combo,
@ -51,7 +51,7 @@ namespace osu.Game.Modes
/// Initializes a new instance of the <see cref="ScoreProcessor"/> class. /// Initializes a new instance of the <see cref="ScoreProcessor"/> class.
/// </summary> /// </summary>
/// <param name="hitObjectCount">Number of HitObjects. It is used for specifying Judgements collection Capacity</param> /// <param name="hitObjectCount">Number of HitObjects. It is used for specifying Judgements collection Capacity</param>
public ScoreProcessor(int hitObjectCount = 0) protected ScoreProcessor(int hitObjectCount = 0)
{ {
Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); }; Combo.ValueChanged += delegate { HighestCombo.Value = Math.Max(HighestCombo.Value, Combo.Value); };
Judgements = new List<JudgementInfo>(hitObjectCount); Judgements = new List<JudgementInfo>(hitObjectCount);

View File

@ -260,7 +260,7 @@ namespace osu.Game.Modes.UI
public override void Apply(Drawable d) public override void Apply(Drawable d)
{ {
base.Apply(d); base.Apply(d);
(d as ComboCounter).DisplayedCount = CurrentValue; ((ComboCounter)d).DisplayedCount = CurrentValue;
} }
} }

View File

@ -51,7 +51,7 @@ namespace osu.Game.Modes.UI
public override void Apply(Drawable d) public override void Apply(Drawable d)
{ {
base.Apply(d); base.Apply(d);
(d as ComboResultCounter).DisplayedCount = CurrentValue; ((ComboResultCounter)d).DisplayedCount = CurrentValue;
} }
} }
} }

View File

@ -17,10 +17,9 @@ namespace osu.Game.Modes.UI
{ {
public class HealthDisplay : Container public class HealthDisplay : Container
{ {
private Box background;
private Container fill; private Container fill;
public BindableDouble Current = new BindableDouble() public BindableDouble Current = new BindableDouble
{ {
MinValue = 0, MinValue = 0,
MaxValue = 1 MaxValue = 1
@ -30,7 +29,7 @@ namespace osu.Game.Modes.UI
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
background = new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = Color4.Black, Colour = Color4.Black,

View File

@ -54,7 +54,7 @@ namespace osu.Game.Modes.UI
protected virtual List<T> Convert(Beatmap beatmap) => Converter.Convert(beatmap); protected virtual List<T> Convert(Beatmap beatmap) => Converter.Convert(beatmap);
public HitRenderer() protected HitRenderer()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Modes.UI
} }
private Color4 backgroundColour; private Color4 backgroundColour;
new public Color4 Colour public new Color4 Colour
{ {
get get
{ {

View File

@ -11,17 +11,16 @@ namespace osu.Game.Modes.UI
public abstract class Playfield : Container public abstract class Playfield : Container
{ {
public HitObjectContainer HitObjects; public HitObjectContainer HitObjects;
private Container<Drawable> content;
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content { get; }
public Playfield() protected Playfield()
{ {
AddInternal(content = new ScaledContainer() AddInternal(Content = new ScaledContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}); });

View File

@ -50,7 +50,7 @@ namespace osu.Game.Modes.UI
AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f); AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f);
} }
public ScoreOverlay() protected ScoreOverlay()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;

View File

@ -20,10 +20,10 @@ namespace osu.Game.Online.API
private OAuth authentication; private OAuth authentication;
public string Endpoint = @"https://new.ppy.sh"; public string Endpoint = @"https://new.ppy.sh";
const string client_id = @"5"; private const string client_id = @"5";
const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk"; private const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
ConcurrentQueue<APIRequest> queue = new ConcurrentQueue<APIRequest>(); private ConcurrentQueue<APIRequest> queue = new ConcurrentQueue<APIRequest>();
public Scheduler Scheduler = new Scheduler(); public Scheduler Scheduler = new Scheduler();
@ -38,22 +38,15 @@ namespace osu.Game.Online.API
public string Token public string Token
{ {
get { return authentication.Token?.ToString(); } get { return authentication.Token?.ToString(); }
set { authentication.Token = string.IsNullOrEmpty(value) ? null : OAuthToken.Parse(value); }
set
{
if (string.IsNullOrEmpty(value))
authentication.Token = null;
else
authentication.Token = OAuthToken.Parse(value);
}
} }
protected bool HasLogin => Token != null || (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password)); protected bool HasLogin => Token != null || (!string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password));
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable (should dispose of this or at very least keep a reference).
private Thread thread; private Thread thread;
Logger log; private Logger log;
public APIAccess() public APIAccess()
{ {
@ -88,22 +81,22 @@ namespace osu.Game.Online.API
/// <summary> /// <summary>
/// Number of consecutive requests which failed due to network issues. /// Number of consecutive requests which failed due to network issues.
/// </summary> /// </summary>
int failureCount = 0; private int failureCount;
private void run() private void run()
{ {
while (true) while (thread.IsAlive)
{ {
switch (State) switch (State)
{ {
case APIState.Failing: case APIState.Failing:
//todo: replace this with a ping request. //todo: replace this with a ping request.
log.Add($@"In a failing state, waiting a bit before we try again..."); log.Add(@"In a failing state, waiting a bit before we try again...");
Thread.Sleep(5000); Thread.Sleep(5000);
if (queue.Count == 0) if (queue.Count == 0)
{ {
log.Add($@"Queueing a ping request"); log.Add(@"Queueing a ping request");
Queue(new ListChannelsRequest() { Timeout = 5000 }); Queue(new ListChannelsRequest { Timeout = 5000 });
} }
break; break;
case APIState.Offline: case APIState.Offline:
@ -131,7 +124,7 @@ namespace osu.Game.Online.API
var userReq = new GetUserRequest(); var userReq = new GetUserRequest();
userReq.Success += (u) => { userReq.Success += u => {
LocalUser.Value = u; LocalUser.Value = u;
//we're connected! //we're connected!
State = APIState.Online; State = APIState.Online;
@ -291,7 +284,7 @@ namespace osu.Game.Online.API
if (failOldRequests) if (failOldRequests)
{ {
APIRequest req; APIRequest req;
while (queue.TryDequeue(out req)) while (oldQueue.TryDequeue(out req))
req.Fail(new Exception(@"Disconnected from server")); req.Fail(new Exception(@"Disconnected from server"));
} }
} }

View File

@ -22,7 +22,7 @@ namespace osu.Game.Online.API
private void onSuccess() private void onSuccess()
{ {
Success?.Invoke((WebRequest as JsonWebRequest<T>).ResponseObject); Success?.Invoke(((JsonWebRequest<T>)WebRequest).ResponseObject);
} }
public new event APISuccessHandler<T> Success; public new event APISuccessHandler<T> Success;

View File

@ -48,7 +48,7 @@ namespace osu.Game.Online.API
try try
{ {
string[] parts = value.Split('/'); string[] parts = value.Split('/');
return new OAuthToken() return new OAuthToken
{ {
AccessToken = parts[0], AccessToken = parts[0],
AccessTokenExpiry = long.Parse(parts[1], NumberFormatInfo.InvariantInfo), AccessTokenExpiry = long.Parse(parts[1], NumberFormatInfo.InvariantInfo),

Some files were not shown because too many files have changed in this diff Show More