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

Basic score flow.

This commit is contained in:
Dean Herbert 2016-11-29 15:41:48 +09:00
parent bb37e5d955
commit 9871960112
12 changed files with 57 additions and 0 deletions

View File

@ -17,6 +17,8 @@ namespace osu.Game.Modes.Osu
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
public override Score CreateScore() => new OsuScore();
protected override PlayMode PlayMode => PlayMode.Osu;
}
}

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Modes.Osu
{
class OsuScore : Score
{
}
}

View File

@ -53,6 +53,7 @@
<Compile Include="Objects\Drawables\Pieces\RingPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\Triangles.cs" />
<Compile Include="Objects\OsuHitObjectParser.cs" />
<Compile Include="OsuScore.cs" />
<Compile Include="UI\OsuComboCounter.cs" />
<Compile Include="UI\OsuHitRenderer.cs" />
<Compile Include="UI\OsuPlayfield.cs" />

View File

@ -18,6 +18,8 @@ namespace osu.Game.Modes.Catch
protected override PlayMode PlayMode => PlayMode.Catch;
public override Score CreateScore() => new Score();
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
}
}

View File

@ -19,6 +19,8 @@ namespace osu.Game.Modes.Mania
protected override PlayMode PlayMode => PlayMode.Mania;
public override Score CreateScore() => new Score();
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
}
}

View File

@ -1,6 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Osu.Objects;
@ -18,6 +19,8 @@ namespace osu.Game.Modes.Taiko
protected override PlayMode PlayMode => PlayMode.Taiko;
public override Score CreateScore() => new Score();
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
}
}

View File

@ -18,6 +18,8 @@ namespace osu.Game.Modes
public abstract ScoreOverlay CreateScoreOverlay();
public abstract Score CreateScore();
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);
public abstract HitObjectParser CreateHitObjectParser();

17
osu.Game/Modes/Score.cs Normal file
View File

@ -0,0 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Modes
{
public class Score
{
public double TotalScore { get; }
public double Accuracy { get; }
}
}

View File

@ -15,6 +15,7 @@ namespace osu.Game.Modes.UI
public ComboCounter ComboCounter;
public ScoreCounter ScoreCounter;
public PercentageCounter AccuracyCounter;
public Score Score { get; set; }
protected abstract KeyCounterCollection CreateKeyCounter();
protected abstract ComboCounter CreateComboCounter();

View File

@ -19,6 +19,7 @@ using OpenTK.Input;
using MouseState = osu.Framework.Input.MouseState;
using OpenTK;
using osu.Framework.GameModes;
using osu.Game.Screens.Ranking;
namespace osu.Game.Screens.Play
{
@ -36,6 +37,8 @@ namespace osu.Game.Screens.Play
private IAdjustableClock sourceClock;
private Score score;
private Ruleset ruleset;
[BackgroundDependencyLoader]
@ -84,6 +87,8 @@ namespace osu.Game.Screens.Play
ruleset = Ruleset.GetRuleset(usablePlayMode);
var scoreOverlay = ruleset.CreateScoreOverlay();
scoreOverlay.Score = (score = ruleset.CreateScore());
var hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
hitRenderer.OnHit += delegate (HitObject h) { scoreOverlay.OnHit(h); };
@ -117,6 +122,12 @@ namespace osu.Game.Screens.Play
{
base.Update();
Clock.ProcessFrame();
if (Beatmap.Track.HasCompleted)
Push(new Results
{
Score = score
});
}
class PlayerInputManager : UserInputManager

View File

@ -2,6 +2,7 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.GameModes;
using osu.Game.Modes;
using osu.Game.Screens.Backgrounds;
using OpenTK.Graphics;
@ -22,5 +23,7 @@ namespace osu.Game.Screens.Ranking
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
return base.OnExiting(next);
}
public Score Score { get; set; }
}
}

View File

@ -66,6 +66,7 @@
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
<Compile Include="Modes\Objects\HitObjectParser.cs" />
<Compile Include="Modes\Score.cs" />
<Compile Include="Overlays\DragBar.cs" />
<Compile Include="Overlays\MusicController.cs" />
<Compile Include="Beatmaps\Beatmap.cs" />