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