mirror of
https://github.com/osukey/osukey.git
synced 2025-05-05 05:37:18 +09:00
Initial commit
This commit is contained in:
parent
5e76f02b4f
commit
eacf2045f0
@ -28,6 +28,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly SongProgressBar bar;
|
private readonly SongProgressBar bar;
|
||||||
private readonly SongProgressGraph graph;
|
private readonly SongProgressGraph graph;
|
||||||
|
private readonly SongProgressInfo info;
|
||||||
|
|
||||||
public Action<double> OnSeek;
|
public Action<double> OnSeek;
|
||||||
|
|
||||||
@ -62,6 +63,14 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
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
|
graph = new SongProgressGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -130,10 +139,15 @@ namespace osu.Game.Screens.Play
|
|||||||
if (objects == null)
|
if (objects == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double progress = ((AudioClock?.CurrentTime ?? Time.Current) - firstHitTime) / lastHitTime;
|
double currentTime = (AudioClock?.CurrentTime ?? Time.Current);
|
||||||
|
double progress = (currentTime - firstHitTime) / lastHitTime;
|
||||||
|
|
||||||
bar.UpdatePosition((float)progress);
|
bar.UpdatePosition((float)progress);
|
||||||
graph.Progress = (int)(graph.ColumnCount * 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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
87
osu.Game/Screens/Play/SongProgressInfo.cs
Normal file
87
osu.Game/Screens/Play/SongProgressInfo.cs
Normal 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,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -224,6 +224,7 @@
|
|||||||
<Compile Include="Screens\Charts\ChartInfo.cs" />
|
<Compile Include="Screens\Charts\ChartInfo.cs" />
|
||||||
<Compile Include="Screens\Edit\Editor.cs" />
|
<Compile Include="Screens\Edit\Editor.cs" />
|
||||||
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
||||||
|
<Compile Include="Screens\Play\SongProgressInfo.cs" />
|
||||||
<Compile Include="Screens\Play\SquareGraph.cs" />
|
<Compile Include="Screens\Play\SquareGraph.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultsPage.cs" />
|
<Compile Include="Screens\Ranking\ResultsPage.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
|
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user