mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
SongProgress in HudOverlay
This commit is contained in:
parent
333008e26d
commit
818bdd8e88
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
@ -34,15 +35,13 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
private void displayNewValues()
|
||||
{
|
||||
var random = new Random();
|
||||
|
||||
List<int> newValues = new List<int>();
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
newValues.Add(random.Next(0, 11));
|
||||
newValues.Add(RNG.Next(0, 11));
|
||||
}
|
||||
|
||||
progress.DisplayValues(newValues);
|
||||
progress.DisplayValues(newValues.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Modes.UI
|
||||
public readonly ScoreCounter ScoreCounter;
|
||||
public readonly PercentageCounter AccuracyCounter;
|
||||
public readonly HealthDisplay HealthDisplay;
|
||||
public readonly SongProgress Progress;
|
||||
|
||||
private Bindable<bool> showKeyCounter;
|
||||
|
||||
@ -27,6 +28,7 @@ namespace osu.Game.Modes.UI
|
||||
protected abstract PercentageCounter CreateAccuracyCounter();
|
||||
protected abstract ScoreCounter CreateScoreCounter();
|
||||
protected abstract HealthDisplay CreateHealthDisplay();
|
||||
protected abstract SongProgress CreateProgress();
|
||||
|
||||
protected HudOverlay()
|
||||
{
|
||||
@ -39,6 +41,7 @@ namespace osu.Game.Modes.UI
|
||||
ScoreCounter = CreateScoreCounter(),
|
||||
AccuracyCounter = CreateAccuracyCounter(),
|
||||
HealthDisplay = CreateHealthDisplay(),
|
||||
Progress = CreateProgress(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -50,5 +50,17 @@ namespace osu.Game.Modes.UI
|
||||
Position = new Vector2(0, 30),
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
};
|
||||
|
||||
protected override SongProgress CreateProgress()
|
||||
{
|
||||
var p = new SongProgress()
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
|
||||
return p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ namespace osu.Game.Screens.Play
|
||||
Depth = -1,
|
||||
OnResume = delegate
|
||||
{
|
||||
hudOverlay.Progress.State = Visibility.Visible;
|
||||
Delay(400);
|
||||
Schedule(Resume);
|
||||
},
|
||||
@ -212,6 +213,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
lastPauseActionTime = Time.Current;
|
||||
hudOverlay.KeyCounter.IsCounting = true;
|
||||
hudOverlay.Progress.State = Visibility.Hidden;
|
||||
pauseOverlay.Hide();
|
||||
sourceClock.Start();
|
||||
IsPaused = false;
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osuGame)
|
||||
{
|
||||
current = osuGame.Beatmap.Value;
|
||||
current = osuGame.Beatmap.Value;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public void DisplayValues(List<int> values)
|
||||
public void DisplayValues(int[] values)
|
||||
{
|
||||
graph.Values = values;
|
||||
}
|
||||
|
@ -32,8 +32,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
private List<int> calculatedValues = new List<int>(); // values but adjusted to fit the amount of columns
|
||||
private List<int> values;
|
||||
public List<int> Values
|
||||
private int[] values;
|
||||
public int[] Values
|
||||
{
|
||||
get
|
||||
{
|
||||
@ -84,8 +84,8 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
}
|
||||
|
||||
float step = values.Count / ColumnCount;
|
||||
for (float i = 0; i < values.Count; i += step)
|
||||
float step = values.Length / (float)ColumnCount;
|
||||
for (float i = 0; i < values.Length; i += step)
|
||||
{
|
||||
calculatedValues.Add(values[(int)i]);
|
||||
}
|
||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SongProgressGraphColumn : Container
|
||||
{
|
||||
private int rows = 11;
|
||||
private readonly Color4 emptyColour = Color4.White.Opacity(50);
|
||||
private readonly int rows = 11;
|
||||
private readonly Color4 emptyColour = Color4.White.Opacity(100);
|
||||
private readonly Color4 litColour = SongProgress.FILL_COLOUR;
|
||||
private readonly Color4 dimmedColour = Color4.White.Opacity(175);
|
||||
|
||||
@ -90,6 +90,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public enum ColumnState
|
||||
{
|
||||
Lit, Dimmed
|
||||
Lit,
|
||||
Dimmed
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user