Merge branch 'master' into combo-colour-brightness-limit

This commit is contained in:
Dan Balasescu
2022-11-11 15:31:28 +09:00
296 changed files with 1230 additions and 1203 deletions

View File

@ -111,8 +111,6 @@ namespace osu.Game.Graphics.Backgrounds
private void load(LargeTextureStore textures)
{
Sprite.Texture = textures.Get(url) ?? textures.Get(fallback_texture_name);
// ensure we're not loading in without a transition.
this.FadeInFromZero(200, Easing.InOutSine);
}
public override bool Equals(Background other)

View File

@ -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 osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -46,15 +44,20 @@ namespace osu.Game.Graphics.Containers
/// </summary>
public bool ContentDisplayed { get; private set; }
protected Bindable<double> UserDimLevel { get; private set; }
protected Bindable<double> UserDimLevel { get; private set; } = null!;
protected Bindable<bool> LightenDuringBreaks { get; private set; }
/// <summary>
/// The amount of dim to be used when <see cref="IgnoreUserSettings"/> is <c>true</c>.
/// </summary>
public Bindable<float> DimWhenUserSettingsIgnored { get; set; } = new Bindable<float>();
protected Bindable<bool> ShowStoryboard { get; private set; }
protected Bindable<bool> LightenDuringBreaks { get; private set; } = null!;
protected Bindable<bool> ShowStoryboard { get; private set; } = null!;
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
protected float DimLevel => Math.Max(!IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : 0, 0);
protected float DimLevel => Math.Max(!IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : DimWhenUserSettingsIgnored.Value, 0);
protected override Container<Drawable> Content => dimContent;
@ -76,6 +79,7 @@ namespace osu.Game.Graphics.Containers
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
UserDimLevel.ValueChanged += _ => UpdateVisuals();
DimWhenUserSettingsIgnored.ValueChanged += _ => UpdateVisuals();
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
IsBreakTime.ValueChanged += _ => UpdateVisuals();
ShowStoryboard.ValueChanged += _ => UpdateVisuals();

View File

@ -70,7 +70,8 @@ namespace osu.Game.Graphics.Cursor
private OsuGame? game { get; set; }
private readonly IBindable<bool> lastInputWasMouse = new BindableBool();
private readonly IBindable<bool> isIdle = new BindableBool();
private readonly IBindable<bool> gameActive = new BindableBool(true);
private readonly IBindable<bool> gameIdle = new BindableBool();
protected override void LoadComplete()
{
@ -81,8 +82,11 @@ namespace osu.Game.Graphics.Cursor
if (game != null)
{
isIdle.BindTo(game.IsIdle);
isIdle.BindValueChanged(_ => updateState());
gameIdle.BindTo(game.IsIdle);
gameIdle.BindValueChanged(_ => updateState());
gameActive.BindTo(game.IsActive);
gameActive.BindValueChanged(_ => updateState());
}
}
@ -90,7 +94,7 @@ namespace osu.Game.Graphics.Cursor
private void updateState()
{
bool combinedVisibility = State.Value == Visibility.Visible && (lastInputWasMouse.Value || !hideCursorOnNonMouseInput) && !isIdle.Value;
bool combinedVisibility = getCursorVisibility();
if (visible == combinedVisibility)
return;
@ -103,6 +107,27 @@ namespace osu.Game.Graphics.Cursor
PopOut();
}
private bool getCursorVisibility()
{
// do not display when explicitly set to hidden state.
if (State.Value == Visibility.Hidden)
return false;
// only hide cursor when game is focused, otherwise it should always be displayed.
if (gameActive.Value)
{
// do not display when last input is not mouse.
if (hideCursorOnNonMouseInput && !lastInputWasMouse.Value)
return false;
// do not display when game is idle.
if (gameIdle.Value)
return false;
}
return true;
}
protected override void Update()
{
base.Update();