mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge branch 'master' into fix_progress_bar_info
This commit is contained in:
@ -14,9 +14,8 @@ using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Allocation;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics.Batches;
|
||||
using osu.Framework.Graphics.OpenGL.Buffers;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Rendering.Vertices;
|
||||
using osu.Framework.Lists;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
@ -88,7 +87,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
private Random stableRandom;
|
||||
private IShader shader;
|
||||
private readonly Texture texture;
|
||||
private Texture texture;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new triangle visualisation.
|
||||
@ -98,13 +97,12 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
if (seed != null)
|
||||
stableRandom = new Random(seed.Value);
|
||||
|
||||
texture = Texture.WhitePixel;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ShaderManager shaders)
|
||||
private void load(IRenderer renderer, ShaderManager shaders)
|
||||
{
|
||||
texture = renderer.WhitePixel;
|
||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||
}
|
||||
|
||||
@ -184,8 +182,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
private void addTriangles(bool randomY)
|
||||
{
|
||||
// limited by the maximum size of QuadVertexBuffer for safety.
|
||||
const int max_triangles = QuadVertexBuffer<TexturedVertex2D>.MAX_QUADS;
|
||||
// Limited by the maximum size of QuadVertexBuffer for safety.
|
||||
const int max_triangles = ushort.MaxValue / (IRenderer.VERTICES_PER_QUAD + 2);
|
||||
|
||||
AimCount = (int)Math.Min(max_triangles, (DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio));
|
||||
|
||||
@ -251,7 +249,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||
private Vector2 size;
|
||||
|
||||
private QuadBatch<TexturedVertex2D> vertexBatch;
|
||||
private IVertexBatch<TexturedVertex2D> vertexBatch;
|
||||
|
||||
public TrianglesDrawNode(Triangles source)
|
||||
: base(source)
|
||||
@ -270,14 +268,14 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
parts.AddRange(Source.parts);
|
||||
}
|
||||
|
||||
public override void Draw(Action<TexturedVertex2D> vertexAction)
|
||||
public override void Draw(IRenderer renderer)
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
base.Draw(renderer);
|
||||
|
||||
if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
|
||||
{
|
||||
vertexBatch?.Dispose();
|
||||
vertexBatch = new QuadBatch<TexturedVertex2D>(Source.AimCount, 1);
|
||||
vertexBatch = renderer.CreateQuadBatch<TexturedVertex2D>(Source.AimCount, 1);
|
||||
}
|
||||
|
||||
shader.Bind();
|
||||
@ -297,7 +295,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
ColourInfo colourInfo = DrawColourInfo.Colour;
|
||||
colourInfo.ApplyChild(particle.Colour);
|
||||
|
||||
DrawTriangle(
|
||||
renderer.DrawTriangle(
|
||||
texture,
|
||||
triangle,
|
||||
colourInfo,
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -10,13 +8,12 @@ using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
/// <summary>
|
||||
/// A container which fires a callback when a new beat is reached.
|
||||
/// Consumes a parent <see cref="GameplayClock"/> or <see cref="Beatmap"/> (whichever is first available).
|
||||
/// Consumes a parent <see cref="IBeatSyncProvider"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This container does not set its own clock to the source used for beat matching.
|
||||
@ -28,8 +25,10 @@ namespace osu.Game.Graphics.Containers
|
||||
public class BeatSyncedContainer : Container
|
||||
{
|
||||
private int lastBeat;
|
||||
protected TimingControlPoint LastTimingPoint { get; private set; }
|
||||
protected EffectControlPoint LastEffectPoint { get; private set; }
|
||||
|
||||
private TimingControlPoint? lastTimingPoint { get; set; }
|
||||
|
||||
protected bool IsKiaiTime { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of time before a beat we should fire <see cref="OnNewBeat(int, TimingControlPoint, EffectControlPoint, ChannelAmplitudes)"/>.
|
||||
@ -71,12 +70,12 @@ namespace osu.Game.Graphics.Containers
|
||||
public double MinimumBeatLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this container is currently tracking a beatmap's timing data.
|
||||
/// Whether this container is currently tracking a beat sync provider.
|
||||
/// </summary>
|
||||
protected bool IsBeatSyncedWithTrack { get; private set; }
|
||||
|
||||
[Resolved]
|
||||
protected IBeatSyncProvider BeatSyncSource { get; private set; }
|
||||
protected IBeatSyncProvider BeatSyncSource { get; private set; } = null!;
|
||||
|
||||
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||
{
|
||||
@ -87,19 +86,18 @@ namespace osu.Game.Graphics.Containers
|
||||
TimingControlPoint timingPoint;
|
||||
EffectControlPoint effectPoint;
|
||||
|
||||
IsBeatSyncedWithTrack = BeatSyncSource.Clock?.IsRunning == true && BeatSyncSource.ControlPoints != null;
|
||||
IsBeatSyncedWithTrack = BeatSyncSource.CheckBeatSyncAvailable() && BeatSyncSource.Clock?.IsRunning == true;
|
||||
|
||||
double currentTrackTime;
|
||||
|
||||
if (IsBeatSyncedWithTrack)
|
||||
{
|
||||
Debug.Assert(BeatSyncSource.ControlPoints != null);
|
||||
Debug.Assert(BeatSyncSource.Clock != null);
|
||||
|
||||
currentTrackTime = BeatSyncSource.Clock.CurrentTime + EarlyActivationMilliseconds;
|
||||
|
||||
timingPoint = BeatSyncSource.ControlPoints.TimingPointAt(currentTrackTime);
|
||||
effectPoint = BeatSyncSource.ControlPoints.EffectPointAt(currentTrackTime);
|
||||
timingPoint = BeatSyncSource.ControlPoints?.TimingPointAt(currentTrackTime) ?? TimingControlPoint.DEFAULT;
|
||||
effectPoint = BeatSyncSource.ControlPoints?.EffectPointAt(currentTrackTime) ?? EffectControlPoint.DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -128,7 +126,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
TimeSinceLastBeat = beatLength - TimeUntilNextBeat;
|
||||
|
||||
if (ReferenceEquals(timingPoint, LastTimingPoint) && beatIndex == lastBeat)
|
||||
if (ReferenceEquals(timingPoint, lastTimingPoint) && beatIndex == lastBeat)
|
||||
return;
|
||||
|
||||
// as this event is sometimes used for sound triggers where `BeginDelayedSequence` has no effect, avoid firing it if too far away from the beat.
|
||||
@ -136,12 +134,13 @@ namespace osu.Game.Graphics.Containers
|
||||
if (AllowMistimedEventFiring || Math.Abs(TimeSinceLastBeat) < MISTIMED_ALLOWANCE)
|
||||
{
|
||||
using (BeginDelayedSequence(-TimeSinceLastBeat))
|
||||
OnNewBeat(beatIndex, timingPoint, effectPoint, BeatSyncSource.Amplitudes ?? ChannelAmplitudes.Empty);
|
||||
OnNewBeat(beatIndex, timingPoint, effectPoint, BeatSyncSource.CurrentAmplitudes);
|
||||
}
|
||||
|
||||
lastBeat = beatIndex;
|
||||
LastTimingPoint = timingPoint;
|
||||
LastEffectPoint = effectPoint;
|
||||
lastTimingPoint = timingPoint;
|
||||
|
||||
IsKiaiTime = effectPoint.KiaiMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Rendering.Vertices;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Graphics.ES30;
|
||||
|
@ -137,6 +137,9 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case BeatmapOnlineStatus.LocallyModified:
|
||||
return Color4.OrangeRed;
|
||||
|
||||
case BeatmapOnlineStatus.Ranked:
|
||||
case BeatmapOnlineStatus.Approved:
|
||||
return Color4Extensions.FromHex(@"b3ff66");
|
||||
|
@ -6,8 +6,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Utils;
|
||||
@ -89,7 +89,7 @@ namespace osu.Game.Graphics
|
||||
currentTime = source.Time.Current;
|
||||
}
|
||||
|
||||
protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
||||
protected override void Blit(IRenderer renderer)
|
||||
{
|
||||
double time = currentTime - startTime;
|
||||
|
||||
@ -112,9 +112,9 @@ namespace osu.Game.Graphics
|
||||
Vector2Extensions.Transform(rect.BottomRight, DrawInfo.Matrix)
|
||||
);
|
||||
|
||||
DrawQuad(Texture, quad, DrawColourInfo.Colour.MultiplyAlpha(alpha), null, vertexAction,
|
||||
new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height),
|
||||
null, TextureCoords);
|
||||
renderer.DrawQuad(Texture, quad, DrawColourInfo.Colour.MultiplyAlpha(alpha),
|
||||
inflationPercentage: new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height),
|
||||
textureCoords: TextureCoords);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ using System;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Utils;
|
||||
@ -107,7 +107,7 @@ namespace osu.Game.Graphics
|
||||
sourceSize = Source.DrawSize;
|
||||
}
|
||||
|
||||
protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
||||
protected override void Blit(IRenderer renderer)
|
||||
{
|
||||
foreach (var p in particles)
|
||||
{
|
||||
@ -136,9 +136,9 @@ namespace osu.Game.Graphics
|
||||
transformPosition(rect.BottomRight, rect.Centre, angle)
|
||||
);
|
||||
|
||||
DrawQuad(Texture, quad, DrawColourInfo.Colour.MultiplyAlpha(alpha), null, vertexAction,
|
||||
new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height),
|
||||
null, TextureCoords);
|
||||
renderer.DrawQuad(Texture, quad, DrawColourInfo.Colour.MultiplyAlpha(alpha),
|
||||
inflationPercentage: new Vector2(InflationAmount.X / DrawRectangle.Width, InflationAmount.Y / DrawRectangle.Height),
|
||||
textureCoords: TextureCoords);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,10 +3,9 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Rendering;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
@ -57,11 +56,11 @@ namespace osu.Game.Graphics.Sprites
|
||||
progress = source.animationProgress;
|
||||
}
|
||||
|
||||
protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
||||
protected override void Blit(IRenderer renderer)
|
||||
{
|
||||
Shader.GetUniform<float>("progress").UpdateValue(ref progress);
|
||||
GetAppropriateShader(renderer).GetUniform<float>("progress").UpdateValue(ref progress);
|
||||
|
||||
base.Blit(vertexAction);
|
||||
base.Blit(renderer);
|
||||
}
|
||||
|
||||
protected override bool CanDrawOpaqueInterior => false;
|
||||
|
@ -167,6 +167,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.Update();
|
||||
|
||||
// If the game goes into a suspended state (ie. debugger attached or backgrounded on a mobile device)
|
||||
// we want to ignore really long periods of no processing.
|
||||
if (updateClock.ElapsedFrameTime > 10000)
|
||||
return;
|
||||
|
||||
mainContent.Width = Math.Max(mainContent.Width, counters.DrawWidth);
|
||||
|
||||
// Handle the case where the window has become inactive or the user changed the
|
||||
@ -177,15 +182,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
// use elapsed frame time rather then FramesPerSecond to better catch stutter frames.
|
||||
bool hasDrawSpike = displayedFpsCount > (1000 / spike_time_ms) && drawClock.ElapsedFrameTime > spike_time_ms;
|
||||
|
||||
// note that we use an elapsed time here of 1 intentionally.
|
||||
// this weights all updates equally. if we passed in the elapsed time, longer frames would be weighted incorrectly lower.
|
||||
displayedFrameTime = Interpolation.DampContinuously(displayedFrameTime, updateClock.ElapsedFrameTime, hasUpdateSpike ? 0 : 100, 1);
|
||||
const float damp_time = 100;
|
||||
|
||||
displayedFrameTime = Interpolation.DampContinuously(displayedFrameTime, updateClock.ElapsedFrameTime, hasUpdateSpike ? 0 : damp_time, updateClock.ElapsedFrameTime);
|
||||
|
||||
if (hasDrawSpike)
|
||||
// show spike time using raw elapsed value, to account for `FramesPerSecond` being so averaged spike frames don't show.
|
||||
displayedFpsCount = 1000 / drawClock.ElapsedFrameTime;
|
||||
else
|
||||
displayedFpsCount = Interpolation.DampContinuously(displayedFpsCount, drawClock.FramesPerSecond, 100, Time.Elapsed);
|
||||
displayedFpsCount = Interpolation.DampContinuously(displayedFpsCount, drawClock.FramesPerSecond, damp_time, Time.Elapsed);
|
||||
|
||||
if (Time.Current - lastUpdate > min_time_between_updates)
|
||||
{
|
||||
@ -203,7 +208,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
if (hasSignificantChanges)
|
||||
requestDisplay();
|
||||
else if (isDisplayed && Time.Current - lastDisplayRequiredTime > 2000)
|
||||
else if (isDisplayed && Time.Current - lastDisplayRequiredTime > 2000 && !IsHovered)
|
||||
{
|
||||
mainContent.FadeTo(0, 300, Easing.OutQuint);
|
||||
isDisplayed = false;
|
||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public class LoadingLayer : LoadingSpinner
|
||||
{
|
||||
private readonly bool blockInput;
|
||||
|
||||
[CanBeNull]
|
||||
protected Box BackgroundDimLayer { get; }
|
||||
|
||||
@ -28,9 +30,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
/// <param name="dimBackground">Whether the full background area should be dimmed while loading.</param>
|
||||
/// <param name="withBox">Whether the spinner should have a surrounding black box for visibility.</param>
|
||||
public LoadingLayer(bool dimBackground = false, bool withBox = true)
|
||||
/// <param name="blockInput">Whether to block input of components behind the loading layer.</param>
|
||||
public LoadingLayer(bool dimBackground = false, bool withBox = true, bool blockInput = true)
|
||||
: base(withBox)
|
||||
{
|
||||
this.blockInput = blockInput;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Size = new Vector2(1);
|
||||
|
||||
@ -52,6 +56,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool Handle(UIEvent e)
|
||||
{
|
||||
if (!blockInput)
|
||||
return false;
|
||||
|
||||
switch (e)
|
||||
{
|
||||
// blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer.
|
||||
@ -83,7 +90,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.Update();
|
||||
|
||||
MainContents.Size = new Vector2(Math.Clamp(Math.Min(DrawWidth, DrawHeight) * 0.25f, 30, 100));
|
||||
MainContents.Size = new Vector2(Math.Clamp(Math.Min(DrawWidth, DrawHeight) * 0.25f, 20, 100));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,15 +49,15 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Active.BindDisabledChanged(disabled => Action = disabled ? null : Active.Toggle, true);
|
||||
Active.BindValueChanged(_ =>
|
||||
{
|
||||
updateActiveState();
|
||||
UpdateActiveState();
|
||||
playSample();
|
||||
});
|
||||
|
||||
updateActiveState();
|
||||
UpdateActiveState();
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
private void updateActiveState()
|
||||
protected virtual void UpdateActiveState()
|
||||
{
|
||||
DarkerColour = Active.Value ? ColourProvider.Highlight1 : ColourProvider.Background3;
|
||||
LighterColour = Active.Value ? ColourProvider.Colour0 : ColourProvider.Background1;
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
@ -26,9 +27,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
{
|
||||
public BindableList<Colour4> Colours { get; } = new BindableList<Colour4>();
|
||||
|
||||
private string colourNamePrefix = "Colour";
|
||||
private LocalisableString colourNamePrefix = "Colour";
|
||||
|
||||
public string ColourNamePrefix
|
||||
public LocalisableString ColourNamePrefix
|
||||
{
|
||||
get => colourNamePrefix;
|
||||
set
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterfaceV2
|
||||
{
|
||||
@ -17,7 +18,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
|
||||
public BindableList<Colour4> Colours => Component.Colours;
|
||||
|
||||
public string ColourNamePrefix
|
||||
public LocalisableString ColourNamePrefix
|
||||
{
|
||||
get => Component.ColourNamePrefix;
|
||||
set => Component.ColourNamePrefix = value;
|
||||
|
Reference in New Issue
Block a user