1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 17:13:06 +08:00

Merge branch 'master' into MissingSource

This commit is contained in:
Dean Herbert 2019-02-26 15:38:51 +09:00 committed by GitHub
commit 2fc34496fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 51 additions and 48 deletions

View File

@ -28,6 +28,7 @@ namespace osu.Game.Audio
private void load() private void load()
{ {
track = GetTrack(); track = GetTrack();
track.Completed += Stop;
} }
/// <summary> /// <summary>
@ -50,15 +51,6 @@ namespace osu.Game.Audio
/// </summary> /// </summary>
public bool IsRunning => track?.IsRunning ?? false; public bool IsRunning => track?.IsRunning ?? false;
protected override void Update()
{
base.Update();
// Todo: Track currently doesn't signal its completion, so we have to handle it manually
if (hasStarted && track.HasCompleted)
Stop();
}
private ScheduledDelegate startDelegate; private ScheduledDelegate startDelegate;
/// <summary> /// <summary>

View File

@ -14,7 +14,7 @@ namespace osu.Game.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); .HasAnnotation("ProductVersion", "2.2.1-servicing-10028");
modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b =>
{ {
@ -336,7 +336,7 @@ namespace osu.Game.Migrations
b.Property<string>("StatisticsJson") b.Property<string>("StatisticsJson")
.HasColumnName("Statistics"); .HasColumnName("Statistics");
b.Property<int>("TotalScore"); b.Property<long>("TotalScore");
b.Property<string>("UserString") b.Property<string>("UserString")
.HasColumnName("User"); .HasColumnName("User");

View File

@ -258,9 +258,6 @@ namespace osu.Game.Overlays
progressBar.CurrentTime = track.CurrentTime; progressBar.CurrentTime = track.CurrentTime;
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
if (track.HasCompleted && !track.Looping && !beatmap.Disabled && beatmapSets.Any())
next();
} }
else else
{ {
@ -315,13 +312,13 @@ namespace osu.Game.Overlays
private WorkingBeatmap current; private WorkingBeatmap current;
private TransformDirection? queuedDirection; private TransformDirection? queuedDirection;
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e) private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
{ {
TransformDirection direction = TransformDirection.None; TransformDirection direction = TransformDirection.None;
if (current != null) if (current != null)
{ {
bool audioEquals = e.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
if (audioEquals) if (audioEquals)
direction = TransformDirection.None; direction = TransformDirection.None;
@ -334,13 +331,18 @@ namespace osu.Game.Overlays
{ {
//figure out the best direction based on order in playlist. //figure out the best direction based on order in playlist.
var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != e.NewValue.BeatmapSetInfo?.ID).Count(); var next = beatmap.NewValue == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count();
direction = last > next ? TransformDirection.Prev : TransformDirection.Next; direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
} }
current.Track.Completed -= currentTrackCompleted;
} }
current = e.NewValue; current = beatmap.NewValue;
if (current != null)
current.Track.Completed += currentTrackCompleted;
progressBar.CurrentTime = 0; progressBar.CurrentTime = 0;
@ -349,6 +351,12 @@ namespace osu.Game.Overlays
queuedDirection = null; queuedDirection = null;
} }
private void currentTrackCompleted()
{
if (!beatmap.Disabled && beatmapSets.Any())
next();
}
private ScheduledDelegate pendingBeatmapSwitch; private ScheduledDelegate pendingBeatmapSwitch;
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)

View File

@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Scoring
/// </summary> /// </summary>
public virtual void PopulateScore(ScoreInfo score) public virtual void PopulateScore(ScoreInfo score)
{ {
score.TotalScore = (int)Math.Round(TotalScore.Value); score.TotalScore = (long)Math.Round(TotalScore.Value);
score.Combo = Combo.Value; score.Combo = Combo.Value;
score.MaxCombo = HighestCombo.Value; score.MaxCombo = HighestCombo.Value;
score.Accuracy = Math.Round(Accuracy.Value, 4); score.Accuracy = Math.Round(Accuracy.Value, 4);

View File

@ -25,7 +25,7 @@ namespace osu.Game.Scoring
public ScoreRank Rank { get; set; } public ScoreRank Rank { get; set; }
[JsonProperty("total_score")] [JsonProperty("total_score")]
public int TotalScore { get; set; } public long TotalScore { get; set; }
[JsonProperty("accuracy")] [JsonProperty("accuracy")]
[Column(TypeName="DECIMAL(1,4)")] [Column(TypeName="DECIMAL(1,4)")]

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings; using osu.Framework.Input.Bindings;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Input; using osu.Game.Input;
@ -90,19 +91,6 @@ namespace osu.Game.Screens.Menu
}); });
buttonArea.Flow.CentreTarget = iconFacade; buttonArea.Flow.CentreTarget = iconFacade;
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q));
buttonArea.AddRange(buttonsPlay);
buttonArea.AddRange(buttonsTopLevel);
} }
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
@ -115,8 +103,23 @@ namespace osu.Game.Screens.Menu
private NotificationOverlay notifications { get; set; } private NotificationOverlay notifications { get; set; }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(AudioManager audio, IdleTracker idleTracker) private void load(AudioManager audio, IdleTracker idleTracker, GameHost host)
{ {
buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M));
buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play);
buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P));
buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
if (host.CanExit)
buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q));
buttonArea.AddRange(buttonsPlay);
buttonArea.AddRange(buttonsTopLevel);
isIdle.ValueChanged += idle => updateIdleState(idle.NewValue); isIdle.ValueChanged += idle => updateIdleState(idle.NewValue);
if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle);

View File

@ -19,33 +19,37 @@ using osu.Game.Screens.Edit;
using osu.Game.Screens.Multi; using osu.Game.Screens.Multi;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament;
using osu.Framework.Platform;
namespace osu.Game.Screens.Menu namespace osu.Game.Screens.Menu
{ {
public class MainMenu : OsuScreen public class MainMenu : OsuScreen
{ {
private readonly ButtonSystem buttons; private ButtonSystem buttons;
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial; public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial; protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
public override bool AllowExternalScreenChange => true; public override bool AllowExternalScreenChange => true;
private Screen songSelect; private Screen songSelect;
private readonly MenuSideFlashes sideFlashes; private MenuSideFlashes sideFlashes;
[Resolved]
private GameHost host { get; set; }
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
public MainMenu() [BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
{ {
InternalChildren = new Drawable[] if (host.CanExit)
AddInternal(new ExitConfirmOverlay { Action = this.Exit });
AddRangeInternal(new Drawable[]
{ {
new ExitConfirmOverlay
{
Action = this.Exit,
},
new ParallaxContainer new ParallaxContainer
{ {
ParallaxAmount = 0.01f, ParallaxAmount = 0.01f,
@ -63,7 +67,7 @@ namespace osu.Game.Screens.Menu
} }
}, },
sideFlashes = new MenuSideFlashes(), sideFlashes = new MenuSideFlashes(),
}; });
buttons.StateChanged += state => buttons.StateChanged += state =>
{ {
@ -78,11 +82,7 @@ namespace osu.Game.Screens.Menu
break; break;
} }
}; };
}
[BackgroundDependencyLoader(true)]
private void load(OsuGame game = null)
{
if (game != null) if (game != null)
{ {
buttons.OnSettings = game.ToggleSettings; buttons.OnSettings = game.ToggleSettings;