1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-24 11:07:20 +08:00

Initial commit

This commit is contained in:
EVAST9919 2017-04-28 04:56:34 +03:00
parent 5e76f02b4f
commit eacf2045f0
3 changed files with 103 additions and 1 deletions

View File

@ -28,6 +28,7 @@ namespace osu.Game.Screens.Play
private readonly SongProgressBar bar;
private readonly SongProgressGraph graph;
private readonly SongProgressInfo info;
public Action<double> OnSeek;
@ -62,6 +63,14 @@ namespace osu.Game.Screens.Play
Children = new Drawable[]
{
info = new SongProgressInfo
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Y = -(bottom_bar_height + graph_height),
},
graph = new SongProgressGraph
{
RelativeSizeAxes = Axes.X,
@ -130,10 +139,15 @@ namespace osu.Game.Screens.Play
if (objects == null)
return;
double progress = ((AudioClock?.CurrentTime ?? Time.Current) - firstHitTime) / lastHitTime;
double currentTime = (AudioClock?.CurrentTime ?? Time.Current);
double progress = (currentTime - firstHitTime) / lastHitTime;
bar.UpdatePosition((float)progress);
graph.Progress = (int)(graph.ColumnCount * progress);
info.TimeCurrent = TimeSpan.FromMilliseconds(currentTime).ToString(@"m\:ss");
info.TimeLeft = TimeSpan.FromMilliseconds(lastHitTime - currentTime).ToString(@"m\:ss");
info.Progress = ((int)(currentTime / lastHitTime * 100)).ToString();
}
}
}

View File

@ -0,0 +1,87 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play
{
public class SongProgressInfo : Container
{
private InfoText timeCurrent;
private InfoText timeLeft;
private InfoText progress;
private const int margin = 10;
public string TimeCurrent
{
set
{
timeCurrent.Text = value;
}
}
public string TimeLeft
{
set
{
timeLeft.Text = @"-" + value;
}
}
public string Progress
{
set
{
progress.Text = value + @"%";
}
}
public SongProgressInfo()
{
Children = new Drawable[]
{
timeCurrent = new InfoText
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Margin = new MarginPadding
{
Left = margin,
},
},
progress = new InfoText
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
},
timeLeft = new InfoText
{
Origin = Anchor.BottomRight,
Anchor = Anchor.BottomRight,
Margin = new MarginPadding
{
Right = margin,
}
}
};
}
private class InfoText : OsuSpriteText
{
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.BlueLighter;
Font = @"Venera";
EdgeEffect = new EdgeEffect
{
Colour = colours.BlueDarker,
Type = EdgeEffectType.Glow,
Radius = 5,
};
}
}
}
}

View File

@ -224,6 +224,7 @@
<Compile Include="Screens\Charts\ChartInfo.cs" />
<Compile Include="Screens\Edit\Editor.cs" />
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
<Compile Include="Screens\Play\SongProgressInfo.cs" />
<Compile Include="Screens\Play\SquareGraph.cs" />
<Compile Include="Screens\Ranking\ResultsPage.cs" />
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />