mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Merge branch 'master' into remove-dragbar
This commit is contained in:
@ -2,16 +2,38 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
|
||||
namespace osu.Game.Screens.Backgrounds
|
||||
{
|
||||
public class BackgroundScreenDefault : BackgroundScreen
|
||||
{
|
||||
private int currentDisplay;
|
||||
private const int background_count = 5;
|
||||
|
||||
private string backgroundName => $@"Menu/menu-background-{currentDisplay % background_count + 1}";
|
||||
|
||||
private Background current;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Add(new Background(@"Backgrounds/bg1"));
|
||||
display(new Background(backgroundName));
|
||||
}
|
||||
|
||||
private void display(Background newBackground)
|
||||
{
|
||||
current?.FadeOut(800, EasingTypes.OutQuint);
|
||||
current?.Expire();
|
||||
|
||||
Add(current = newBackground);
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
currentDisplay++;
|
||||
LoadComponentAsync(new Background(backgroundName) { Depth = currentDisplay }, display);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
@ -20,9 +19,9 @@ namespace osu.Game.Screens
|
||||
private void load(OsuGame game)
|
||||
{
|
||||
if (game.IsDeployedBuild)
|
||||
LoadComponentAsync(new Disclaimer(), d => Push((Screen)d));
|
||||
LoadComponentAsync(new Disclaimer(), d => Push(d));
|
||||
else
|
||||
LoadComponentAsync(new Intro(), d => Push((Screen)d));
|
||||
LoadComponentAsync(new Intro(), d => Push(d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,16 +30,17 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly Container box;
|
||||
private readonly Box boxHoverLayer;
|
||||
private readonly TextAwesome icon;
|
||||
private readonly string internalName;
|
||||
private readonly string sampleName;
|
||||
private readonly Action clickAction;
|
||||
private readonly Key triggerKey;
|
||||
private SampleChannel sampleClick;
|
||||
private SampleChannel sampleHover;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
||||
public Button(string text, string sampleName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
||||
{
|
||||
this.internalName = internalName;
|
||||
this.sampleName = sampleName;
|
||||
this.clickAction = clickAction;
|
||||
this.triggerKey = triggerKey;
|
||||
|
||||
@ -120,8 +121,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
if (State != ButtonState.Expanded) return true;
|
||||
|
||||
//if (OsuGame.Instance.IsActive)
|
||||
// Game.Audio.PlaySamplePositional($@"menu-{internalName}-hover", @"menuclick");
|
||||
sampleHover?.Play();
|
||||
|
||||
box.ScaleTo(new Vector2(1.5f, 1), 500, EasingTypes.OutElastic);
|
||||
|
||||
@ -222,7 +222,9 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get($@"Menu/menu-{internalName}-click") ?? audio.Sample.Get(internalName.Contains(@"back") ? @"Menu/menuback" : @"Menu/menuhit");
|
||||
sampleHover = audio.Sample.Get(@"Menu/hover");
|
||||
if (!string.IsNullOrEmpty(sampleName))
|
||||
sampleClick = audio.Sample.Get($@"Menu/{sampleName}");
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
@ -259,7 +261,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private void trigger()
|
||||
{
|
||||
sampleClick.Play();
|
||||
sampleClick?.Play();
|
||||
|
||||
clickAction?.Invoke();
|
||||
|
||||
|
@ -15,6 +15,8 @@ using osu.Game.Overlays.Toolbar;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -51,6 +53,8 @@ namespace osu.Game.Screens.Menu
|
||||
private readonly List<Button> buttonsTopLevel = new List<Button>();
|
||||
private readonly List<Button> buttonsPlay = new List<Button>();
|
||||
|
||||
private SampleChannel sampleBack;
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
@ -82,8 +86,8 @@ namespace osu.Game.Screens.Menu
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
settingsButton = new Button(@"settings", @"settings", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
|
||||
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
|
||||
settingsButton = new Button(@"settings", string.Empty, FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
|
||||
backButton = new Button(@"back", string.Empty, FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
|
||||
iconFacade = new Container //need a container to make the osu! icon flow properly.
|
||||
{
|
||||
Size = new Vector2(0, BUTTON_AREA_HEIGHT)
|
||||
@ -101,23 +105,24 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
};
|
||||
|
||||
buttonsPlay.Add(new Button(@"solo", @"freeplay", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
||||
buttonsPlay.Add(new Button(@"multi", @"multiplayer", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M));
|
||||
buttonsPlay.Add(new Button(@"chart", @"charts", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
|
||||
buttonsPlay.Add(new Button(@"solo", @"select-6", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P));
|
||||
buttonsPlay.Add(new Button(@"multi", @"select-5", FontAwesome.fa_users, new Color4(94, 63, 186, 255), () => OnMulti?.Invoke(), 0, Key.M));
|
||||
buttonsPlay.Add(new Button(@"chart", @"select-5", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke()));
|
||||
|
||||
buttonsTopLevel.Add(new Button(@"play", @"play", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P));
|
||||
buttonsTopLevel.Add(new Button(@"osu!editor", @"edit", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
|
||||
buttonsTopLevel.Add(new Button(@"osu!direct", @"direct", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
|
||||
buttonsTopLevel.Add(new Button(@"exit", @"exit", FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q));
|
||||
buttonsTopLevel.Add(new Button(@"play", @"select-1", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), onPlay, WEDGE_WIDTH, Key.P));
|
||||
buttonsTopLevel.Add(new Button(@"osu!editor", @"select-5", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E));
|
||||
buttonsTopLevel.Add(new Button(@"osu!direct", string.Empty, FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D));
|
||||
buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), onExit, 0, Key.Q));
|
||||
|
||||
buttonFlow.Add(buttonsPlay);
|
||||
buttonFlow.Add(buttonsTopLevel);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuGame game = null)
|
||||
private void load(AudioManager audio, OsuGame game = null)
|
||||
{
|
||||
toolbar = game?.Toolbar;
|
||||
sampleBack = audio.Sample.Get(@"Menu/select-4");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -167,6 +172,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private void onBack()
|
||||
{
|
||||
sampleBack?.Play();
|
||||
State = MenuState.TopLevel;
|
||||
}
|
||||
|
||||
@ -231,6 +237,8 @@ namespace osu.Game.Screens.Menu
|
||||
osuLogo.RotateTo(20, EXIT_DELAY * 1.5f);
|
||||
osuLogo.FadeOut(EXIT_DELAY);
|
||||
}
|
||||
else if (lastState == MenuState.TopLevel)
|
||||
sampleBack?.Play();
|
||||
break;
|
||||
case MenuState.TopLevel:
|
||||
buttonArea.Flush(true);
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Charts;
|
||||
@ -24,7 +25,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
private readonly BackgroundScreen background;
|
||||
private readonly BackgroundScreenDefault background;
|
||||
private Screen songSelect;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => background;
|
||||
@ -66,6 +67,12 @@ namespace osu.Game.Screens.Menu
|
||||
preloadSongSelect();
|
||||
}
|
||||
|
||||
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
||||
{
|
||||
base.OnBeatmapChanged(beatmap);
|
||||
background.Next();
|
||||
}
|
||||
|
||||
private void preloadSongSelect()
|
||||
{
|
||||
if (songSelect == null)
|
||||
@ -111,6 +118,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
background.Next();
|
||||
|
||||
//we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu
|
||||
set { colourAndTriangles.Alpha = value ? 1 : 0; }
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => logoContainer.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public bool Ripple
|
||||
{
|
||||
@ -72,11 +72,11 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private const float default_size = 480;
|
||||
|
||||
private const double beat_in_time = 60;
|
||||
private const double early_activation = 60;
|
||||
|
||||
public OsuLogo()
|
||||
{
|
||||
EarlyActivationMilliseconds = beat_in_time;
|
||||
EarlyActivationMilliseconds = early_activation;
|
||||
|
||||
Size = new Vector2(default_size);
|
||||
|
||||
@ -215,8 +215,9 @@ namespace osu.Game.Screens.Menu
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures, AudioManager audio)
|
||||
{
|
||||
sampleClick = audio.Sample.Get(@"Menu/menuhit");
|
||||
sampleClick = audio.Sample.Get(@"Menu/select-2");
|
||||
sampleBeat = audio.Sample.Get(@"Menu/heartbeat");
|
||||
|
||||
logo.Texture = textures.Get(@"Menu/logo");
|
||||
ripple.Texture = textures.Get(@"Menu/logo");
|
||||
}
|
||||
@ -227,9 +228,6 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||
|
||||
if (Hovering)
|
||||
sampleBeat.Play();
|
||||
|
||||
lastBeatIndex = beatIndex;
|
||||
|
||||
var beatLength = timingPoint.BeatLength;
|
||||
@ -238,8 +236,14 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
if (beatIndex < 0) return;
|
||||
|
||||
logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
|
||||
using (logoBeatContainer.BeginDelayedSequence(beat_in_time))
|
||||
if (Hovering)
|
||||
{
|
||||
using (BeginDelayedSequence(early_activation))
|
||||
Schedule(() => sampleBeat.Play());
|
||||
}
|
||||
|
||||
logoBeatContainer.ScaleTo(1 - 0.02f * amplitudeAdjust, early_activation, EasingTypes.Out);
|
||||
using (logoBeatContainer.BeginDelayedSequence(early_activation))
|
||||
logoBeatContainer.ScaleTo(1, beatLength * 2, EasingTypes.OutQuint);
|
||||
|
||||
ripple.ClearTransforms();
|
||||
@ -255,11 +259,11 @@ namespace osu.Game.Screens.Menu
|
||||
flashLayer.ClearTransforms();
|
||||
visualizer.ClearTransforms();
|
||||
|
||||
flashLayer.FadeTo(0.2f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
|
||||
visualizer.FadeTo(0.9f * amplitudeAdjust, beat_in_time, EasingTypes.Out);
|
||||
using (flashLayer.BeginDelayedSequence(beat_in_time))
|
||||
flashLayer.FadeTo(0.2f * amplitudeAdjust, early_activation, EasingTypes.Out);
|
||||
visualizer.FadeTo(0.9f * amplitudeAdjust, early_activation, EasingTypes.Out);
|
||||
using (flashLayer.BeginDelayedSequence(early_activation))
|
||||
flashLayer.FadeOut(beatLength);
|
||||
using (visualizer.BeginDelayedSequence(beat_in_time))
|
||||
using (visualizer.BeginDelayedSequence(early_activation))
|
||||
visualizer.FadeTo(0.5f, beatLength);
|
||||
}
|
||||
}
|
||||
|
@ -11,13 +11,14 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
public class DrawableRoom : ClickableContainer
|
||||
public class DrawableRoom : OsuClickableContainer
|
||||
{
|
||||
private const float content_padding = 5;
|
||||
private const float height = 90;
|
||||
|
@ -495,7 +495,7 @@ namespace osu.Game.Screens.Multiplayer
|
||||
levelRangeLower.Text = ranks.Min().ToString();
|
||||
levelRangeHigher.Text = ranks.Max().ToString();
|
||||
|
||||
participantsFlow.Children = value.Select(u => new UserTile(u));
|
||||
participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u));
|
||||
}
|
||||
|
||||
private class UserTile : Container, IHasTooltip
|
||||
|
@ -8,6 +8,8 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio;
|
||||
|
||||
namespace osu.Game.Screens
|
||||
{
|
||||
@ -33,6 +35,8 @@ namespace osu.Game.Screens
|
||||
|
||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private SampleChannel sampleExit;
|
||||
|
||||
public WorkingBeatmap Beatmap
|
||||
{
|
||||
get
|
||||
@ -46,7 +50,7 @@ namespace osu.Game.Screens
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuGameBase game, OsuGame osuGame)
|
||||
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
|
||||
{
|
||||
if (game != null)
|
||||
{
|
||||
@ -59,6 +63,8 @@ namespace osu.Game.Screens
|
||||
|
||||
if (osuGame != null)
|
||||
ruleset.BindTo(osuGame.Ruleset);
|
||||
|
||||
sampleExit = audio.Sample.Get(@"UI/melodic-1");
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -82,6 +88,12 @@ namespace osu.Game.Screens
|
||||
ruleset.Disabled = !AllowRulesetChange;
|
||||
}
|
||||
|
||||
protected override void OnResuming(Screen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
sampleExit?.Play();
|
||||
}
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
{
|
||||
OsuScreen lastOsu = last as OsuScreen;
|
||||
|
@ -4,8 +4,6 @@
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Audio;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
@ -18,7 +16,6 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public Action Action;
|
||||
|
||||
private SampleChannel retrySample;
|
||||
private Box overlay;
|
||||
|
||||
private const int activate_delay = 400;
|
||||
@ -27,9 +24,8 @@ namespace osu.Game.Screens.Play
|
||||
private bool fired;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private void load()
|
||||
{
|
||||
retrySample = audio.Sample.Get(@"Menu/menuback");
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
AlwaysPresent = true;
|
||||
|
||||
@ -74,7 +70,6 @@ namespace osu.Game.Screens.Play
|
||||
if (!fired && overlay.Alpha == 1)
|
||||
{
|
||||
fired = true;
|
||||
retrySample.Play();
|
||||
Action?.Invoke();
|
||||
}
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
public override bool HandleInput => true;
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play
|
||||
Button = button;
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
private static string getStringRepresentation(MouseButton button)
|
||||
{
|
||||
|
@ -11,7 +11,6 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
@ -191,12 +190,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public class Button : DialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ using osu.Framework.Threading;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Framework.Audio.Sample;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -61,6 +62,8 @@ namespace osu.Game.Screens.Play
|
||||
private Bindable<bool> mouseWheelDisabled;
|
||||
private Bindable<double> userAudioOffset;
|
||||
|
||||
private SampleChannel sampleRestart;
|
||||
|
||||
#endregion
|
||||
|
||||
private HUDOverlay hudOverlay;
|
||||
@ -72,6 +75,8 @@ namespace osu.Game.Screens.Play
|
||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||
|
||||
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
||||
|
||||
Ruleset rulesetInstance;
|
||||
|
||||
try
|
||||
@ -215,6 +220,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
sampleRestart?.Play();
|
||||
ValidForResume = false;
|
||||
RestartRequested?.Invoke();
|
||||
Exit();
|
||||
|
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
@ -16,8 +15,8 @@ using osu.Game.Screens.Ranking;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -175,16 +174,14 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
private class Button : Container
|
||||
private class Button : OsuClickableContainer
|
||||
{
|
||||
public Action Action;
|
||||
private Color4 colourNormal;
|
||||
private Color4 colourHover;
|
||||
private Box box;
|
||||
private FillFlowContainer flow;
|
||||
private Box background;
|
||||
private AspectContainer aspect;
|
||||
private SampleChannel activationSound;
|
||||
|
||||
public Button()
|
||||
{
|
||||
@ -192,10 +189,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
activationSound = audio.Sample.Get(@"Menu/menuhit");
|
||||
|
||||
colourNormal = colours.Yellow;
|
||||
colourHover = colours.YellowDark;
|
||||
|
||||
@ -282,13 +277,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
Action?.Invoke();
|
||||
|
||||
activationSound.Play();
|
||||
|
||||
box.FlashColour(Color4.White, 500, EasingTypes.OutQuint);
|
||||
aspect.ScaleTo(1.2f, 2000, EasingTypes.OutQuint);
|
||||
return true;
|
||||
return base.OnClick(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,12 @@ namespace osu.Game.Screens.Play
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
layout.Refresh(recreateGraph);
|
||||
|
||||
if (!layout.IsValid)
|
||||
{
|
||||
recreateGraph();
|
||||
layout.Validate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
};
|
||||
|
||||
statisticsContainer.Children = Score.Statistics.Select(s => new DrawableScoreStatistic(s));
|
||||
statisticsContainer.ChildrenEnumerable = Score.Statistics.Select(s => new DrawableScoreStatistic(s));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -11,8 +11,6 @@ using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -196,12 +194,6 @@ namespace osu.Game.Screens
|
||||
Anchor = Anchor.BottomRight;
|
||||
Origin = Anchor.BottomRight;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
ActivationSound = audio.Sample.Get(@"Menu/menuhit");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,8 +77,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly List<Panel> panels = new List<Panel>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
private readonly Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>> randomSelectedBeatmaps = new Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
private BeatmapPanel selectedPanel;
|
||||
|
||||
public BeatmapCarousel()
|
||||
@ -170,16 +171,21 @@ namespace osu.Game.Screens.Select
|
||||
} while (index != startIndex);
|
||||
}
|
||||
|
||||
public void SelectRandom()
|
||||
private IEnumerable<BeatmapGroup> getVisibleGroups() => groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
|
||||
|
||||
public void SelectNextRandom()
|
||||
{
|
||||
IEnumerable<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
|
||||
randomSelectedBeatmaps.Push(new KeyValuePair<BeatmapGroup, BeatmapPanel>(selectedGroup, selectedGroup.SelectedPanel));
|
||||
|
||||
var visibleGroups = getVisibleGroups();
|
||||
if (!visibleGroups.Any())
|
||||
return;
|
||||
|
||||
BeatmapGroup group;
|
||||
|
||||
if (randomType == SelectionRandomType.RandomPermutation)
|
||||
{
|
||||
IEnumerable<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups);
|
||||
var notSeenGroups = visibleGroups.Except(seenGroups);
|
||||
if (!notSeenGroups.Any())
|
||||
{
|
||||
seenGroups.Clear();
|
||||
@ -197,6 +203,27 @@ namespace osu.Game.Screens.Select
|
||||
selectGroup(group, panel);
|
||||
}
|
||||
|
||||
public void SelectPreviousRandom()
|
||||
{
|
||||
if (!randomSelectedBeatmaps.Any())
|
||||
return;
|
||||
|
||||
var visibleGroups = getVisibleGroups();
|
||||
if (!visibleGroups.Any())
|
||||
return;
|
||||
|
||||
while (randomSelectedBeatmaps.Any())
|
||||
{
|
||||
var beatmapCoordinates = randomSelectedBeatmaps.Pop();
|
||||
var group = beatmapCoordinates.Key;
|
||||
if (visibleGroups.Contains(group))
|
||||
{
|
||||
selectGroup(group, beatmapCoordinates.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FilterCriteria criteria = new FilterCriteria();
|
||||
|
||||
private ScheduledDelegate filterTask;
|
||||
|
@ -439,7 +439,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
Show();
|
||||
if (header.Text == "Tags")
|
||||
content.Children = value.Split(' ').Select(text => new OsuSpriteText
|
||||
content.ChildrenEnumerable = value.Split(' ').Select(text => new OsuSpriteText
|
||||
{
|
||||
Text = text,
|
||||
Font = "Exo2.0-Regular",
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly SearchTextBox searchTextBox;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public FilterControl()
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select
|
||||
updateModeLight();
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || StartButton.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || StartButton.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
||||
|
@ -6,15 +6,15 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class FooterButton : ClickableContainer
|
||||
public class FooterButton : OsuClickableContainer
|
||||
{
|
||||
private static readonly Vector2 shearing = new Vector2(0.15f, 0);
|
||||
|
||||
|
@ -13,10 +13,11 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class LeaderboardScore : ClickableContainer, IStateful<Visibility>
|
||||
public class LeaderboardScore : OsuClickableContainer, IStateful<Visibility>
|
||||
{
|
||||
public static readonly float HEIGHT = 60;
|
||||
|
||||
|
@ -11,10 +11,11 @@ using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsButton : ClickableContainer
|
||||
public class BeatmapOptionsButton : OsuClickableContainer
|
||||
{
|
||||
private const float width = 130;
|
||||
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public BeatmapOptionsButton()
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsOverlay : FocusedOverlayContainer
|
||||
public class BeatmapOptionsOverlay : OsuFocusedOverlayContainer
|
||||
{
|
||||
private const float transition_duration = 500;
|
||||
private const float x_position = 0.2f;
|
||||
|
@ -154,11 +154,11 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input)
|
||||
{
|
||||
if (Footer != null)
|
||||
{
|
||||
Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2);
|
||||
Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2);
|
||||
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);
|
||||
|
||||
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
|
||||
@ -209,7 +209,13 @@ namespace osu.Game.Screens.Select
|
||||
OnSelected();
|
||||
}
|
||||
|
||||
public void SelectRandom() => carousel.SelectRandom();
|
||||
private void triggerRandom(UserInputManager input)
|
||||
{
|
||||
if (input.CurrentState.Keyboard.ShiftPressed)
|
||||
carousel.SelectPreviousRandom();
|
||||
else
|
||||
carousel.SelectNextRandom();
|
||||
}
|
||||
|
||||
protected abstract void OnSelected();
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Screens.Tournament.Components
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
while (Children.Count() < 3)
|
||||
while (Children.Count < 3)
|
||||
addLine();
|
||||
|
||||
float pos = leftPos;
|
||||
|
Reference in New Issue
Block a user