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

Merge pull request #392 from Tom94/refactor

Fix warnings; add "Async" suffix
This commit is contained in:
Dean Herbert 2017-02-24 11:28:21 +09:00 committed by GitHub
commit a8135332d6
25 changed files with 38 additions and 43 deletions

@ -1 +1 @@
Subproject commit 56535b834cf2329e5abc8ecf698d19ece9ef7b07
Subproject commit 943410e228f704252a803cee75532434c6b5be72

View File

@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests
{
base.LoadComplete();
(new BackgroundScreenDefault() { Depth = 10 }).Preload(this, AddInternal);
(new BackgroundScreenDefault() { Depth = 10 }).LoadAsync(this, AddInternal);
// Have to construct this here, rather than in the constructor, because
// we depend on some dependencies to be loaded within OsuGameBase.load().

View File

@ -34,7 +34,7 @@ namespace osu.Desktop
{
base.LoadComplete();
versionManager.Preload(this);
versionManager.LoadAsync(this);
ModeChanged += m =>
{
if (!versionManager.IsAlive && m is Intro)

View File

@ -104,7 +104,7 @@ namespace osu.Desktop.Overlays
};
if (IsDeployedBuild)
updateChecker();
checkForUpdateAsync();
}
protected override void LoadComplete()
@ -119,7 +119,7 @@ namespace osu.Desktop.Overlays
updateManager?.Dispose();
}
private async void updateChecker(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
{
//should we schedule a retry on completion of this check?
bool scheduleRetry = true;
@ -165,7 +165,7 @@ namespace osu.Desktop.Overlays
{
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
//try again without deltas.
updateChecker(false, notification);
checkForUpdateAsync(false, notification);
scheduleRetry = false;
}
}
@ -180,7 +180,7 @@ namespace osu.Desktop.Overlays
if (scheduleRetry)
{
//check again in 30 minutes.
Scheduler.AddDelayed(() => updateChecker(), 60000 * 30);
Scheduler.AddDelayed(() => checkForUpdateAsync(), 60000 * 30);
if (notification != null)
notification.State = ProgressNotificationState.Cancelled;
}

View File

@ -35,7 +35,7 @@ namespace osu.Desktop
foreach (var file in args)
{
Console.WriteLine(@"Importing {0}", file);
if (!importer.Import(Path.GetFullPath(file)).Wait(3000))
if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
throw new TimeoutException(@"IPC took too long to send");
}
}

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Beatmaps.IO
var osu = loadOsu(host);
var importer = new BeatmapImporter(client);
if (!importer.Import(osz_path).Wait(1000))
if (!importer.ImportAsync(osz_path).Wait(1000))
Assert.Fail(@"IPC took too long to send");
ensureLoaded(osu, 10000);

View File

@ -162,7 +162,7 @@ namespace osu.Game.Beatmaps.Drawables
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fill,
}.Preload(game, (bg) =>
}.LoadAsync(game, (bg) =>
{
Add(bg);
ForceRedraw();

View File

@ -5,8 +5,6 @@ namespace osu.Game.Beatmaps.Timing
{
class TimingChange : ControlPoint
{
public double BeatLength;
public TimingChange(double beatLength)
{
BeatLength = beatLength;

View File

@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface
private void load(AudioManager audio, OsuColour colours)
{
ActivationSound = audio.Sample.Get(@"Menu/menuback");
Colour = colours.Pink;
BackgroundColour = colours.Pink;
HoverColour = colours.PinkDark;
}
}

View File

@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
private Container c1;
private Container c2;
public Color4 Colour
public Color4 BackgroundColour
{
set
{

View File

@ -21,13 +21,13 @@ namespace osu.Game.IPC
channel.MessageReceived += messageReceived;
}
public async Task Import(string path)
public async Task ImportAsync(string path)
{
if (beatmaps != null)
beatmaps.Import(path);
else
{
await channel.SendMessage(new BeatmapImportMessage { Path = path });
await channel.SendMessageAsync(new BeatmapImportMessage { Path = path });
}
}
@ -35,7 +35,7 @@ namespace osu.Game.IPC
{
Debug.Assert(beatmaps != null);
Import(msg.Path);
ImportAsync(msg.Path);
}
}

View File

@ -116,7 +116,7 @@ namespace osu.Game
}
});
(screenStack = new Loader()).Preload(this, d =>
(screenStack = new Loader()).LoadAsync(this, d =>
{
screenStack.ModePushed += screenAdded;
screenStack.Exited += screenRemoved;
@ -124,22 +124,22 @@ namespace osu.Game
});
//overlay elements
(chat = new ChatOverlay { Depth = 0 }).Preload(this, overlayContent.Add);
(options = new OptionsOverlay { Depth = -1 }).Preload(this, overlayContent.Add);
(chat = new ChatOverlay { Depth = 0 }).LoadAsync(this, overlayContent.Add);
(options = new OptionsOverlay { Depth = -1 }).LoadAsync(this, overlayContent.Add);
(musicController = new MusicController()
{
Depth = -2,
Position = new Vector2(0, Toolbar.HEIGHT),
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}).Preload(this, overlayContent.Add);
}).LoadAsync(this, overlayContent.Add);
(notificationManager = new NotificationManager
{
Depth = -2,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
}).Preload(this, overlayContent.Add);
}).LoadAsync(this, overlayContent.Add);
Logger.NewEntry += entry =>
{
@ -160,7 +160,7 @@ namespace osu.Game
Depth = -3,
OnHome = delegate { intro?.ChildScreen?.MakeCurrent(); },
OnPlayModeChange = delegate (PlayMode m) { PlayMode.Value = m; },
}).Preload(this, t =>
}).LoadAsync(this, t =>
{
PlayMode.ValueChanged += delegate { Toolbar.SetGameMode(PlayMode.Value); };
PlayMode.TriggerChange();

View File

@ -322,10 +322,10 @@ namespace osu.Game.Overlays
updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev);
}
protected override void PerformLoad(Framework.Game game)
protected override void Load(Framework.Game game)
{
this.game = game;
base.PerformLoad(game);
base.Load(game);
}
Action pendingBeatmapSwitch;
@ -349,7 +349,7 @@ namespace osu.Game.Overlays
MusicControllerBackground newBackground;
(newBackground = new MusicControllerBackground(beatmap)).Preload(game, delegate
(newBackground = new MusicControllerBackground(beatmap)).LoadAsync(game, delegate
{
dragContainer.Add(newBackground);

View File

@ -102,7 +102,7 @@ namespace osu.Game.Overlays.Toolbar
newSprite.FillMode = FillMode.Fit;
newSprite.Preload(game, s =>
newSprite.LoadAsync(game, s =>
{
Sprite?.FadeOut();
Sprite?.Expire();
@ -120,7 +120,6 @@ namespace osu.Game.Overlays.Toolbar
public class OnlineSprite : Sprite
{
private readonly string url;
private readonly int userId;
public OnlineSprite(string url)
{

View File

@ -43,7 +43,7 @@ namespace osu.Game.Screens
// once it's done.
if (screen.LoadState == LoadState.NotLoaded)
{
screen.Preload(game, d => Push((BackgroundScreen)d));
screen.LoadAsync(game, d => Push((BackgroundScreen)d));
return true;
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Backgrounds
else
newBackground = new BeatmapBackground(beatmap);
newBackground.Preload(Game, delegate
newBackground.LoadAsync(Game, delegate
{
float newDepth = 0;
if (background != null)

View File

@ -20,9 +20,9 @@ namespace osu.Game.Screens
private void load(OsuGame game)
{
if (game.IsDeployedBuild)
new Disclaimer().Preload(game, d => Push((Screen)d));
new Disclaimer().LoadAsync(game, d => Push((Screen)d));
else
new Intro().Preload(game, d => Push((Screen)d));
new Intro().LoadAsync(game, d => Push((Screen)d));
}
}
}

View File

@ -93,7 +93,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader]
private void load(OsuGame game, OsuColour colours)
{
(intro = new Intro()).Preload(game);
(intro = new Intro()).LoadAsync(game);
iconColour = colours.Yellow;
}

View File

@ -77,7 +77,7 @@ namespace osu.Game.Screens.Menu
{
bgm.Start();
(mainMenu = new MainMenu()).Preload(Game);
(mainMenu = new MainMenu()).LoadAsync(Game);
Scheduler.AddDelayed(delegate
{

View File

@ -56,7 +56,7 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader]
private void load(OsuGame game)
{
background.Preload(game);
background.LoadAsync(game);
buttons.OnSettings = game.ToggleOptions;
}

View File

@ -229,7 +229,7 @@ namespace osu.Game.Screens.Play
var newPlayer = new Player();
newPlayer.Preload(Game, delegate
newPlayer.LoadAsync(Game, delegate
{
newPlayer.RestartCount = RestartCount + 1;
ValidForResume = false;

View File

@ -57,7 +57,7 @@ namespace osu.Game.Screens.Play
Origin = Anchor.Centre,
});
player.Preload(Game);
player.LoadAsync(Game);
}
protected override void OnEntering(Screen last)

View File

@ -13,8 +13,6 @@ namespace osu.Game.Screens.Play
{
public class SkipButton : TwoLayerButton
{
private readonly double skipDestination;
public SkipButton()
{
Text = @"Skip";
@ -27,7 +25,7 @@ namespace osu.Game.Screens.Play
private void load(AudioManager audio, OsuColour colours)
{
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
Colour = colours.Yellow;
BackgroundColour = colours.Yellow;
HoverColour = colours.YellowDark;
}

View File

@ -179,7 +179,7 @@ namespace osu.Game.Screens.Select
}
},
}
}).Preload(game, delegate (Drawable d)
}).LoadAsync(game, delegate (Drawable d)
{
FadeIn(250);

View File

@ -122,7 +122,7 @@ namespace osu.Game.Screens.Select
{
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
PreferredPlayMode = playMode.Value
})).Preload(Game, l => Push(player));
})).LoadAsync(Game, l => Push(player));
}
}
};
@ -340,7 +340,7 @@ namespace osu.Game.Screens.Select
//for the time being, let's completely load the difficulty panels in the background.
//this likely won't scale so well, but allows us to completely async the loading flow.
Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate
Task.WhenAll(group.BeatmapPanels.Select(panel => panel.LoadAsync(game))).ContinueWith(task => Schedule(delegate
{
beatmapGroups.Add(group);