mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into fix-countdown-refresh
This commit is contained in:
@ -80,6 +80,10 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
// If an error or server side trigger occurred this screen may have already exited by external means.
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
loadingLayer.Hide();
|
||||
|
||||
if (t.IsFaulted)
|
||||
|
@ -21,7 +21,9 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private uint scheduledPopOutCurrentId;
|
||||
|
||||
private const double pop_out_duration = 150;
|
||||
private const double big_pop_out_duration = 300;
|
||||
|
||||
private const double small_pop_out_duration = 100;
|
||||
|
||||
private const double fade_out_duration = 100;
|
||||
|
||||
@ -65,32 +67,28 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
Margin = new MarginPadding(10);
|
||||
|
||||
Scale = new Vector2(1.2f);
|
||||
Scale = new Vector2(1.28f);
|
||||
|
||||
InternalChildren = new[]
|
||||
{
|
||||
counterContainer = new Container
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AlwaysPresent = true,
|
||||
Children = new[]
|
||||
{
|
||||
popOutCount = new LegacySpriteText(LegacyFont.Combo)
|
||||
{
|
||||
Alpha = 0,
|
||||
Margin = new MarginPadding(0.05f),
|
||||
Blending = BlendingParameters.Additive,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
BypassAutoSizeAxes = Axes.Both,
|
||||
},
|
||||
displayedCountSpriteText = new LegacySpriteText(LegacyFont.Combo)
|
||||
{
|
||||
// Initial text and AlwaysPresent allow the counter to have a size before it first displays a combo.
|
||||
// This is useful for display in the skin editor.
|
||||
Text = formatCount(0),
|
||||
AlwaysPresent = true,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
BypassAutoSizeAxes = Axes.Both,
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -130,8 +128,25 @@ namespace osu.Game.Screens.Play.HUD
|
||||
base.LoadComplete();
|
||||
|
||||
((IHasText)displayedCountSpriteText).Text = formatCount(Current.Value);
|
||||
((IHasText)popOutCount).Text = formatCount(Current.Value);
|
||||
|
||||
Current.BindValueChanged(combo => updateCount(combo.NewValue == 0), true);
|
||||
|
||||
updateLayout();
|
||||
}
|
||||
|
||||
private void updateLayout()
|
||||
{
|
||||
const float font_height_ratio = 0.625f;
|
||||
const float vertical_offset = 9;
|
||||
|
||||
displayedCountSpriteText.OriginPosition = new Vector2(0, font_height_ratio * displayedCountSpriteText.Height + vertical_offset);
|
||||
displayedCountSpriteText.Position = new Vector2(0, -(1 - font_height_ratio) * displayedCountSpriteText.Height + vertical_offset);
|
||||
|
||||
popOutCount.OriginPosition = new Vector2(3, font_height_ratio * popOutCount.Height + vertical_offset); // In stable, the bigger pop out scales a bit to the left
|
||||
popOutCount.Position = new Vector2(0, -(1 - font_height_ratio) * popOutCount.Height + vertical_offset);
|
||||
|
||||
counterContainer.Size = displayedCountSpriteText.Size;
|
||||
}
|
||||
|
||||
private void updateCount(bool rolling)
|
||||
@ -164,27 +179,31 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
((IHasText)popOutCount).Text = formatCount(newValue);
|
||||
|
||||
popOutCount.ScaleTo(1.6f);
|
||||
popOutCount.FadeTo(0.75f);
|
||||
popOutCount.MoveTo(Vector2.Zero);
|
||||
popOutCount.ScaleTo(1.56f)
|
||||
.ScaleTo(1, big_pop_out_duration);
|
||||
|
||||
popOutCount.ScaleTo(1, pop_out_duration);
|
||||
popOutCount.FadeOut(pop_out_duration);
|
||||
popOutCount.MoveTo(displayedCountSpriteText.Position, pop_out_duration);
|
||||
popOutCount.FadeTo(0.6f)
|
||||
.FadeOut(big_pop_out_duration);
|
||||
}
|
||||
|
||||
private void transformNoPopOut(int newValue)
|
||||
{
|
||||
((IHasText)displayedCountSpriteText).Text = formatCount(newValue);
|
||||
|
||||
counterContainer.Size = displayedCountSpriteText.Size;
|
||||
|
||||
displayedCountSpriteText.ScaleTo(1);
|
||||
}
|
||||
|
||||
private void transformPopOutSmall(int newValue)
|
||||
{
|
||||
((IHasText)displayedCountSpriteText).Text = formatCount(newValue);
|
||||
displayedCountSpriteText.ScaleTo(1.1f);
|
||||
displayedCountSpriteText.ScaleTo(1, pop_out_duration);
|
||||
|
||||
counterContainer.Size = displayedCountSpriteText.Size;
|
||||
|
||||
displayedCountSpriteText.ScaleTo(1).Then()
|
||||
.ScaleTo(1.1f, small_pop_out_duration / 2, Easing.In).Then()
|
||||
.ScaleTo(1, small_pop_out_duration / 2, Easing.Out);
|
||||
}
|
||||
|
||||
private void scheduledPopOutSmall(uint id)
|
||||
@ -212,7 +231,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
Scheduler.AddDelayed(delegate
|
||||
{
|
||||
scheduledPopOutSmall(newTaskId);
|
||||
}, pop_out_duration);
|
||||
}, big_pop_out_duration - 140);
|
||||
}
|
||||
|
||||
private void onCountRolling(int currentValue, int newValue)
|
||||
|
@ -287,12 +287,14 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
TitleLabel = new OsuSpriteText
|
||||
{
|
||||
Current = { BindTarget = titleBinding },
|
||||
Font = OsuFont.GetFont(size: 28, italics: true),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
},
|
||||
ArtistLabel = new OsuSpriteText
|
||||
{
|
||||
Current = { BindTarget = artistBinding },
|
||||
Font = OsuFont.GetFont(size: 17, italics: true),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
@ -314,9 +316,6 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
};
|
||||
|
||||
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
|
||||
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
|
||||
|
||||
addInfoLabels();
|
||||
}
|
||||
|
||||
@ -352,12 +351,6 @@ namespace osu.Game.Screens.Select
|
||||
}, true);
|
||||
}
|
||||
|
||||
private void setMetadata(string source)
|
||||
{
|
||||
ArtistLabel.Text = artistBinding.Value;
|
||||
TitleLabel.Text = string.IsNullOrEmpty(source) ? titleBinding.Value : source + " — " + titleBinding.Value;
|
||||
}
|
||||
|
||||
private void addInfoLabels()
|
||||
{
|
||||
if (working.Beatmap?.HitObjects?.Any() != true)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -14,13 +15,13 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Utils;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class PlaySongSelect : SongSelect
|
||||
{
|
||||
private bool removeAutoModOnResume;
|
||||
private OsuScreen playerLoader;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
@ -43,25 +44,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
||||
|
||||
private ModAutoplay getAutoplayMod() => Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
playerLoader = null;
|
||||
|
||||
if (removeAutoModOnResume)
|
||||
{
|
||||
var autoType = getAutoplayMod()?.GetType();
|
||||
|
||||
if (autoType != null)
|
||||
Mods.Value = Mods.Value.Where(m => m.GetType() != autoType).ToArray();
|
||||
|
||||
removeAutoModOnResume = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
switch (e.Key)
|
||||
@ -77,10 +59,16 @@ namespace osu.Game.Screens.Select
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
private IReadOnlyList<Mod> modsAtGameplayStart;
|
||||
|
||||
private ModAutoplay getAutoplayMod() => Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||
|
||||
protected override bool OnStart()
|
||||
{
|
||||
if (playerLoader != null) return false;
|
||||
|
||||
modsAtGameplayStart = Mods.Value;
|
||||
|
||||
// Ctrl+Enter should start map with autoplay enabled.
|
||||
if (GetContainingInputManager().CurrentState?.Keyboard.ControlPressed == true)
|
||||
{
|
||||
@ -95,13 +83,12 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
}
|
||||
|
||||
var mods = Mods.Value;
|
||||
var mods = Mods.Value.Append(autoInstance).ToArray();
|
||||
|
||||
if (mods.All(m => m.GetType() != autoInstance.GetType()))
|
||||
{
|
||||
Mods.Value = mods.Append(autoInstance).ToArray();
|
||||
removeAutoModOnResume = true;
|
||||
}
|
||||
if (!ModUtils.CheckCompatibleSet(mods, out var invalid))
|
||||
mods = mods.Except(invalid).Append(autoInstance).ToArray();
|
||||
|
||||
Mods.Value = mods;
|
||||
}
|
||||
|
||||
SampleConfirm?.Play();
|
||||
@ -118,5 +105,16 @@ namespace osu.Game.Screens.Select
|
||||
return new SoloPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
if (playerLoader != null)
|
||||
{
|
||||
Mods.Value = modsAtGameplayStart;
|
||||
playerLoader = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user