mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:02:55 +08:00
Merge branch 'master' into skip-button
# Conflicts: # osu.Game/Graphics/UserInterface/BackButton.cs # osu.Game/Screens/Play/Player.cs # osu.Game/osu.Game.csproj
This commit is contained in:
commit
7ce5fc08ee
@ -1 +1 @@
|
||||
Subproject commit 2f03fae533293bf255a942569c07396f853378f3
|
||||
Subproject commit 2e74df0a1bca294cad2094c86bf25d1833df7a14
|
44
osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs
Normal file
44
osu.Desktop.VisualTests/Tests/TestCasePauseOverlay.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Pause;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.GameModes.Testing;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCasePauseOverlay : TestCase
|
||||
{
|
||||
public override string Name => @"PauseOverlay";
|
||||
|
||||
public override string Description => @"Tests the pause overlay";
|
||||
|
||||
private PauseOverlay pauseOverlay;
|
||||
private int retryCount;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(pauseOverlay = new PauseOverlay
|
||||
{
|
||||
Depth = -1,
|
||||
OnResume = () => Logger.Log(@"Resume"),
|
||||
OnRetry = () => Logger.Log(@"Retry"),
|
||||
OnQuit = () => Logger.Log(@"Quit")
|
||||
});
|
||||
AddButton("Pause", pauseOverlay.Show);
|
||||
AddButton("Add Retry", delegate
|
||||
{
|
||||
retryCount++;
|
||||
pauseOverlay.Retries = retryCount;
|
||||
});
|
||||
|
||||
retryCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -187,6 +187,7 @@
|
||||
<Compile Include="VisualTestGame.cs" />
|
||||
<Compile Include="Platform\TestStorage.cs" />
|
||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||
<Compile Include="Tests\TestCasePauseOverlay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup />
|
||||
|
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Catch.UI;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Osu.Objects;
|
||||
@ -18,6 +19,8 @@ namespace osu.Game.Modes.Catch
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Catch;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Mania.UI;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Osu;
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Modes.Mania
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Mania;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
@ -2,6 +2,9 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Osu.Objects;
|
||||
using osu.Game.Modes.Osu.UI;
|
||||
@ -15,6 +18,24 @@ namespace osu.Game.Modes.Osu
|
||||
|
||||
public override HitRenderer CreateHitRendererWith(List<HitObject> objects) => new OsuHitRenderer { Objects = objects };
|
||||
|
||||
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
|
||||
{
|
||||
new BeatmapStatistic
|
||||
{
|
||||
Name = @"Circle count",
|
||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is HitCircle).ToString(),
|
||||
Icon = FontAwesome.fa_dot_circle_o
|
||||
},
|
||||
new BeatmapStatistic
|
||||
{
|
||||
Name = @"Slider count",
|
||||
Content = beatmap.Beatmap.HitObjects.Count(h => h is Slider).ToString(),
|
||||
Icon = FontAwesome.fa_circle_o
|
||||
}
|
||||
};
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => new OsuScoreProcessor(hitObjectCount);
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Osu.Objects;
|
||||
using osu.Game.Modes.Osu.UI;
|
||||
@ -19,6 +20,8 @@ namespace osu.Game.Modes.Taiko
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Taiko;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor(int hitObjectCount) => null;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Database;
|
||||
@ -16,6 +17,14 @@ namespace osu.Game.Beatmaps
|
||||
public List<HitObject> HitObjects { get; set; }
|
||||
public List<ControlPoint> ControlPoints { get; set; }
|
||||
public List<Color4> ComboColors { get; set; }
|
||||
public double BPMMaximum => 60000 / ControlPoints.Where(c => c.BeatLength != 0).OrderBy(c => c.BeatLength).First().BeatLength;
|
||||
public double BPMMinimum => 60000 / ControlPoints.Where(c => c.BeatLength != 0).OrderByDescending(c => c.BeatLength).First().BeatLength;
|
||||
public double BPMMode => BPMAt(ControlPoints.Where(c => c.BeatLength != 0).GroupBy(c => c.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time);
|
||||
|
||||
public double BPMAt(double time)
|
||||
{
|
||||
return 60000 / BeatLengthAt(time);
|
||||
}
|
||||
|
||||
public double BeatLengthAt(double time, bool applyMultipliers = false)
|
||||
{
|
||||
|
@ -1,42 +1,42 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
class BeatmapGroup : IStateful<BeatmapGroupState>
|
||||
{
|
||||
public BeatmapPanel SelectedPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Fires when one of our difficulties was selected. Will fire on first expand.
|
||||
/// </summary>
|
||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
||||
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
class BeatmapGroup : IStateful<BeatmapGroupState>
|
||||
{
|
||||
public BeatmapPanel SelectedPanel;
|
||||
|
||||
/// <summary>
|
||||
/// Fires when one of our difficulties was selected. Will fire on first expand.
|
||||
/// </summary>
|
||||
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
|
||||
/// </summary>
|
||||
public Action<BeatmapInfo> StartRequested;
|
||||
|
||||
public BeatmapSetHeader Header;
|
||||
|
||||
/// </summary>
|
||||
public Action<BeatmapInfo> StartRequested;
|
||||
|
||||
public BeatmapSetHeader Header;
|
||||
|
||||
private BeatmapGroupState state;
|
||||
|
||||
public List<BeatmapPanel> BeatmapPanels;
|
||||
|
||||
public BeatmapGroupState State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
public List<BeatmapPanel> BeatmapPanels;
|
||||
|
||||
public BeatmapGroupState State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
switch (state)
|
||||
{
|
||||
case BeatmapGroupState.Expanded:
|
||||
@ -56,28 +56,30 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
panel.FadeOut(300, EasingTypes.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
|
||||
{
|
||||
Header = new BeatmapSetHeader(beatmap)
|
||||
{
|
||||
GainedSelection = headerGainedSelection,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
|
||||
{
|
||||
Header = new BeatmapSetHeader(beatmap)
|
||||
{
|
||||
GainedSelection = headerGainedSelection,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
};
|
||||
|
||||
BeatmapPanels = beatmap.BeatmapSetInfo.Beatmaps.Select(b => new BeatmapPanel(b)
|
||||
{
|
||||
Alpha = 0,
|
||||
GainedSelection = panelGainedSelection,
|
||||
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
|
||||
RelativeSizeAxes = Axes.X,
|
||||
}).ToList();
|
||||
}).ToList();
|
||||
|
||||
Header.AddDifficultyIcons(BeatmapPanels);
|
||||
}
|
||||
|
||||
private void headerGainedSelection(BeatmapSetHeader panel)
|
||||
{
|
||||
private void headerGainedSelection(BeatmapSetHeader panel)
|
||||
{
|
||||
State = BeatmapGroupState.Expanded;
|
||||
|
||||
//we want to make sure one of our children is selected in the case none have been selected yet.
|
||||
@ -85,10 +87,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
BeatmapPanels.First().State = PanelSelectedState.Selected;
|
||||
else
|
||||
SelectionChanged?.Invoke(this, SelectedPanel.Beatmap);
|
||||
}
|
||||
|
||||
private void panelGainedSelection(BeatmapPanel panel)
|
||||
{
|
||||
}
|
||||
|
||||
private void panelGainedSelection(BeatmapPanel panel)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SelectedPanel == panel) return;
|
||||
@ -96,18 +98,18 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
if (SelectedPanel != null)
|
||||
SelectedPanel.State = PanelSelectedState.NotSelected;
|
||||
SelectedPanel = panel;
|
||||
}
|
||||
finally
|
||||
}
|
||||
finally
|
||||
{
|
||||
State = BeatmapGroupState.Expanded;
|
||||
SelectionChanged?.Invoke(this, panel.Beatmap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum BeatmapGroupState
|
||||
{
|
||||
Collapsed,
|
||||
Expanded,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
@ -27,6 +28,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
public Action<BeatmapPanel> GainedSelection;
|
||||
public Action<BeatmapPanel> StartRequested;
|
||||
private Triangles triangles;
|
||||
|
||||
protected override void Selected()
|
||||
{
|
||||
@ -36,6 +38,8 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
background.ColourInfo = ColourInfo.GradientVertical(
|
||||
new Color4(20, 43, 51, 255),
|
||||
new Color4(40, 86, 102, 255));
|
||||
|
||||
triangles.Colour = Color4.White;
|
||||
}
|
||||
|
||||
protected override void Deselected()
|
||||
@ -43,6 +47,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
base.Deselected();
|
||||
|
||||
background.Colour = new Color4(20, 43, 51, 255);
|
||||
triangles.Colour = OsuColour.Gray(0.5f);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
@ -64,15 +69,11 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Triangles
|
||||
triangles = new Triangles
|
||||
{
|
||||
// The border is drawn in the shader of the children. Being additive, triangles would over-emphasize
|
||||
// the border wherever they cross it, and thus they get their own masking container without a border.
|
||||
Masking = true,
|
||||
CornerRadius = Content.CornerRadius,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Colour = new Color4(20, 43, 51, 255),
|
||||
ColourLight = OsuColour.FromHex(@"3a7285"),
|
||||
ColourDark = OsuColour.FromHex(@"123744")
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
Origin = Anchor.CentreLeft,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255))
|
||||
new DifficultyIcon(beatmap)
|
||||
{
|
||||
Scale = new Vector2(1.8f),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
@ -130,7 +131,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
},
|
||||
}
|
||||
},
|
||||
new StarCounter { Count = beatmap.BaseDifficulty?.OverallDifficulty ?? 5, StarSize = 8 }
|
||||
new StarCounter { Count = beatmap.StarDifficulty, StarSize = 8 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -23,6 +24,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
private OsuConfigManager config;
|
||||
private Bindable<bool> preferUnicode;
|
||||
private WorkingBeatmap beatmap;
|
||||
private FlowContainer difficultyIcons;
|
||||
|
||||
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
||||
{
|
||||
@ -56,15 +58,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
new FlowContainer
|
||||
difficultyIcons = new FlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(159, 198, 0, 255)),
|
||||
new DifficultyIcon(FontAwesome.fa_dot_circle_o, new Color4(246, 101, 166, 255)),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -177,5 +174,11 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void AddDifficultyIcons(IEnumerable<BeatmapPanel> panels)
|
||||
{
|
||||
foreach (var p in panels)
|
||||
difficultyIcons.Add(new DifficultyIcon(p.Beatmap));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,14 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -11,20 +16,76 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
class DifficultyIcon : Container
|
||||
{
|
||||
public DifficultyIcon(FontAwesome icon, Color4 color)
|
||||
private readonly BeatmapInfo beatmap;
|
||||
private OsuColour palette;
|
||||
|
||||
public DifficultyIcon(BeatmapInfo beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
const float size = 20;
|
||||
Size = new Vector2(size);
|
||||
Children = new[]
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour palette)
|
||||
{
|
||||
this.palette = palette;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
TextSize = size,
|
||||
Colour = color,
|
||||
Icon = icon
|
||||
TextSize = Size.X,
|
||||
Colour = getColour(beatmap),
|
||||
Icon = FontAwesome.fa_circle
|
||||
},
|
||||
new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
TextSize = Size.X,
|
||||
Colour = Color4.White,
|
||||
Icon = Ruleset.GetRuleset(beatmap.Mode).Icon
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
enum DifficultyRating
|
||||
{
|
||||
Easy,
|
||||
Normal,
|
||||
Hard,
|
||||
Insane,
|
||||
Expert
|
||||
}
|
||||
|
||||
private DifficultyRating getDifficultyRating(BeatmapInfo beatmap)
|
||||
{
|
||||
var rating = beatmap.StarDifficulty;
|
||||
|
||||
if (rating < 1.5) return DifficultyRating.Easy;
|
||||
if (rating < 2.25) return DifficultyRating.Normal;
|
||||
if (rating < 3.75) return DifficultyRating.Hard;
|
||||
if (rating < 5.25) return DifficultyRating.Insane;
|
||||
return DifficultyRating.Expert;
|
||||
}
|
||||
|
||||
private Color4 getColour(BeatmapInfo beatmap)
|
||||
{
|
||||
switch (getDifficultyRating(beatmap))
|
||||
{
|
||||
case DifficultyRating.Easy:
|
||||
return palette.Green;
|
||||
default:
|
||||
case DifficultyRating.Normal:
|
||||
return palette.Yellow;
|
||||
case DifficultyRating.Hard:
|
||||
return palette.Pink;
|
||||
case DifficultyRating.Insane:
|
||||
return palette.Purple;
|
||||
case DifficultyRating.Expert:
|
||||
return palette.Gray0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,6 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.MouseSpeed, 1.0);
|
||||
|
||||
Set(OsuConfig.Username, string.Empty);
|
||||
Set(OsuConfig.Password, string.Empty);
|
||||
Set(OsuConfig.Token, string.Empty);
|
||||
|
||||
Set(OsuConfig.PlayMode, PlayMode.Osu);
|
||||
@ -144,8 +143,6 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.HiddenShowFirstApproach, true);
|
||||
Set(OsuConfig.ComboColourSliderBall, true);
|
||||
Set(OsuConfig.AlternativeChatFont, false);
|
||||
Set(OsuConfig.Password, string.Empty);
|
||||
Set(OsuConfig.Username, string.Empty);
|
||||
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0);
|
||||
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0);
|
||||
Set(OsuConfig.AudioDevice, string.Empty);
|
||||
@ -171,6 +168,16 @@ namespace osu.Game.Configuration
|
||||
Set(OsuConfig.CanForceOptimusCompatibility, true);
|
||||
Set(OsuConfig.ConfineMouse, Get<bool>(OsuConfig.ConfineMouseToFullscreen) ?
|
||||
ConfineMouseMode.Fullscreen : ConfineMouseMode.Never);
|
||||
|
||||
|
||||
GetBindable<bool>(OsuConfig.SavePassword).ValueChanged += delegate
|
||||
{
|
||||
if (Get<bool>(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true);
|
||||
};
|
||||
GetBindable<bool>(OsuConfig.SaveUsername).ValueChanged += delegate
|
||||
{
|
||||
if (!Get<bool>(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false);
|
||||
};
|
||||
#pragma warning restore CS0612 // Type or member is obsolete
|
||||
}
|
||||
|
||||
@ -314,7 +321,6 @@ namespace osu.Game.Configuration
|
||||
HiddenShowFirstApproach,
|
||||
ComboColourSliderBall,
|
||||
AlternativeChatFont,
|
||||
Password,
|
||||
Username,
|
||||
DisplayStarsMaximum,
|
||||
DisplayStarsMinimum,
|
||||
|
@ -73,6 +73,8 @@ namespace osu.Game.Database
|
||||
// Metadata
|
||||
public string Version { get; set; }
|
||||
|
||||
public float StarDifficulty => BaseDifficulty?.OverallDifficulty ?? 5; //todo: implement properly
|
||||
|
||||
public bool Equals(BeatmapInfo other)
|
||||
{
|
||||
return ID == other?.ID;
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.MathUtils;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
@ -17,10 +18,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
public override bool HandleInput => false;
|
||||
|
||||
public Triangles()
|
||||
{
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
public Color4 ColourLight = Color4.White;
|
||||
public Color4 ColourDark = Color4.Black;
|
||||
|
||||
private float triangleScale = 1;
|
||||
|
||||
@ -65,12 +64,14 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Scale = new Vector2(scale),
|
||||
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
|
||||
Colour = GetTriangleShade(),
|
||||
Size = new Vector2(size, 0.866f * size),
|
||||
Alpha = RNG.NextSingle(),
|
||||
Depth = scale,
|
||||
};
|
||||
}
|
||||
|
||||
protected virtual Color4 GetTriangleShade() => Interpolation.ValueAt(RNG.NextSingle(), ColourDark, ColourLight, 0, 1);
|
||||
|
||||
private void addTriangle(bool randomX)
|
||||
{
|
||||
var sprite = CreateTriangle();
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
|
||||
@ -15,17 +16,28 @@ namespace osu.Game.Graphics
|
||||
public static Color4 Gray(float amt) => new Color4(amt, amt, amt, 1f);
|
||||
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
|
||||
|
||||
private static Color4 FromHex(string hex)
|
||||
public static Color4 FromHex(string hex)
|
||||
{
|
||||
return new Color4(
|
||||
Convert.ToByte(hex.Substring(0, 2), 16),
|
||||
Convert.ToByte(hex.Substring(2, 2), 16),
|
||||
Convert.ToByte(hex.Substring(4, 2), 16),
|
||||
255);
|
||||
switch (hex.Length)
|
||||
{
|
||||
default:
|
||||
throw new Exception(@"Invalid hex string length!");
|
||||
case 3:
|
||||
return new Color4(
|
||||
(byte)(Convert.ToByte(hex.Substring(0, 1), 16) * 17),
|
||||
(byte)(Convert.ToByte(hex.Substring(1, 1), 16) * 17),
|
||||
(byte)(Convert.ToByte(hex.Substring(2, 1), 16) * 17),
|
||||
255);
|
||||
case 6:
|
||||
return new Color4(
|
||||
Convert.ToByte(hex.Substring(0, 2), 16),
|
||||
Convert.ToByte(hex.Substring(2, 2), 16),
|
||||
Convert.ToByte(hex.Substring(4, 2), 16),
|
||||
255);
|
||||
}
|
||||
}
|
||||
|
||||
// See https://github.com/ppy/osu-web/blob/master/resources/assets/less/colors.less
|
||||
|
||||
public Color4 PurpleLighter = FromHex(@"eeeeff");
|
||||
public Color4 PurpleLight = FromHex(@"aa88ff");
|
||||
public Color4 Purple = FromHex(@"8866ee");
|
||||
@ -56,6 +68,23 @@ namespace osu.Game.Graphics
|
||||
public Color4 GreenDark = FromHex(@"668800");
|
||||
public Color4 GreenDarker = FromHex(@"445500");
|
||||
|
||||
public Color4 Gray0 = FromHex(@"000");
|
||||
public Color4 Gray1 = FromHex(@"111");
|
||||
public Color4 Gray2 = FromHex(@"222");
|
||||
public Color4 Gray3 = FromHex(@"333");
|
||||
public Color4 Gray4 = FromHex(@"444");
|
||||
public Color4 Gray5 = FromHex(@"555");
|
||||
public Color4 Gray6 = FromHex(@"666");
|
||||
public Color4 Gray7 = FromHex(@"777");
|
||||
public Color4 Gray8 = FromHex(@"888");
|
||||
public Color4 Gray9 = FromHex(@"999");
|
||||
public Color4 GrayA = FromHex(@"aaa");
|
||||
public Color4 GrayB = FromHex(@"bbb");
|
||||
public Color4 GrayC = FromHex(@"ccc");
|
||||
public Color4 GrayD = FromHex(@"ddd");
|
||||
public Color4 GrayE = FromHex(@"eee");
|
||||
public Color4 GrayF = FromHex(@"fff");
|
||||
|
||||
public Color4 Red = FromHex(@"fc4549");
|
||||
}
|
||||
}
|
||||
|
@ -2,23 +2,34 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuButton : Button
|
||||
{
|
||||
public OsuButton()
|
||||
{
|
||||
Height = 25;
|
||||
Height = 40;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.BlueDark;
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
Add(new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourDark = colours.BlueDarker,
|
||||
ColourLight = colours.Blue,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal file
48
osu.Game/Graphics/UserInterface/OsuTextBox.cs
Normal file
@ -0,0 +1,48 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class OsuTextBox : TextBox
|
||||
{
|
||||
public OsuTextBox()
|
||||
{
|
||||
Height = 40;
|
||||
TextContainer.Height = 0.6f;
|
||||
CornerRadius = 5;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
BorderColour = colour.Yellow;
|
||||
}
|
||||
|
||||
protected override bool OnFocus(InputState state)
|
||||
{
|
||||
BorderThickness = 3;
|
||||
|
||||
return base.OnFocus(state);
|
||||
}
|
||||
|
||||
protected override void OnFocusLost(InputState state)
|
||||
{
|
||||
BorderThickness = 0;
|
||||
|
||||
base.OnFocusLost(state);
|
||||
}
|
||||
}
|
||||
|
||||
public class OsuPasswordTextBox : OsuTextBox
|
||||
{
|
||||
protected virtual char MaskCharacter => '*';
|
||||
|
||||
protected override Drawable AddCharacterToFlow(char c) => base.AddCharacterToFlow(MaskCharacter);
|
||||
}
|
||||
}
|
@ -4,20 +4,28 @@
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.UI;
|
||||
using System.Reflection;
|
||||
using osu.Framework.Extensions;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes
|
||||
{
|
||||
public class BeatmapStatistic
|
||||
{
|
||||
public FontAwesome Icon;
|
||||
public string Content;
|
||||
public string Name;
|
||||
}
|
||||
|
||||
public abstract class Ruleset
|
||||
{
|
||||
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>();
|
||||
|
||||
public abstract ScoreOverlay CreateScoreOverlay();
|
||||
|
||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount);
|
||||
|
||||
public abstract HitRenderer CreateHitRendererWith(List<HitObject> objects);
|
||||
@ -28,6 +36,8 @@ namespace osu.Game.Modes
|
||||
|
||||
protected abstract PlayMode PlayMode { get; }
|
||||
|
||||
public virtual FontAwesome Icon => FontAwesome.fa_question_circle;
|
||||
|
||||
public static Ruleset GetRuleset(PlayMode mode)
|
||||
{
|
||||
Type type;
|
||||
|
@ -70,7 +70,6 @@ namespace osu.Game
|
||||
Dependencies.Cache(API = new APIAccess
|
||||
{
|
||||
Username = LocalConfig.Get<string>(OsuConfig.Username),
|
||||
Password = LocalConfig.Get<string>(OsuConfig.Password),
|
||||
Token = LocalConfig.Get<string>(OsuConfig.Token)
|
||||
});
|
||||
|
||||
@ -83,7 +82,6 @@ namespace osu.Game
|
||||
{
|
||||
case APIState.Online:
|
||||
LocalConfig.Set(OsuConfig.Username, LocalConfig.Get<bool>(OsuConfig.SaveUsername) ? API.Username : string.Empty);
|
||||
LocalConfig.Set(OsuConfig.Password, LocalConfig.Get<bool>(OsuConfig.SavePassword) ? API.Password : string.Empty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -119,7 +117,7 @@ namespace osu.Game
|
||||
//refresh token may have changed.
|
||||
if (LocalConfig != null && API != null)
|
||||
{
|
||||
LocalConfig.Set(OsuConfig.Token, API.Token);
|
||||
LocalConfig.Set(OsuConfig.Token, LocalConfig.Get<bool>(OsuConfig.SavePassword) ? API.Token : string.Empty);
|
||||
LocalConfig.Save();
|
||||
}
|
||||
|
||||
|
@ -11,20 +11,18 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Configuration;
|
||||
|
||||
namespace osu.Game.Overlays.Options.General
|
||||
{
|
||||
public class LoginOptions : OptionsSubsection, IOnlineComponent
|
||||
{
|
||||
private Container loginForm;
|
||||
|
||||
private Action performLogout;
|
||||
protected override string Header => "Sign In";
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(APIAccess api)
|
||||
{
|
||||
api?.Register(this);
|
||||
{
|
||||
api?.Register(this);
|
||||
}
|
||||
|
||||
public void APIStateChanged(APIAccess api, APIState state)
|
||||
@ -79,27 +77,8 @@ namespace osu.Game.Overlays.Options.General
|
||||
private TextBox password;
|
||||
private APIAccess api;
|
||||
|
||||
public LoginForm()
|
||||
{
|
||||
Direction = FlowDirection.VerticalOnly;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Spacing = new Vector2(0, 5);
|
||||
// TODO: Wire things up
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "Username" },
|
||||
username = new TextBox { Height = 20, RelativeSizeAxes = Axes.X, Text = api?.Username ?? string.Empty },
|
||||
new SpriteText { Text = "Password" },
|
||||
password = new PasswordTextBox { Height = 20, RelativeSizeAxes = Axes.X },
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Log in",
|
||||
Action = performLogin
|
||||
}
|
||||
};
|
||||
}
|
||||
private CheckBoxOption saveUsername;
|
||||
private CheckBoxOption savePassword;
|
||||
|
||||
private void performLogin()
|
||||
{
|
||||
@ -107,10 +86,50 @@ namespace osu.Game.Overlays.Options.General
|
||||
api.Login(username.Text, password.Text);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(APIAccess api)
|
||||
{
|
||||
this.api = api;
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(APIAccess api, OsuConfigManager config)
|
||||
{
|
||||
this.api = api;
|
||||
Direction = FlowDirection.VerticalOnly;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "Username" },
|
||||
username = new OsuTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = api?.Username ?? string.Empty
|
||||
},
|
||||
new SpriteText { Text = "Password" },
|
||||
password = new OsuPasswordTextBox
|
||||
{
|
||||
RelativeSizeAxes = Axes.X
|
||||
},
|
||||
saveUsername = new CheckBoxOption
|
||||
{
|
||||
LabelText = "Remember Username",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SaveUsername),
|
||||
},
|
||||
savePassword = new CheckBoxOption
|
||||
{
|
||||
LabelText = "Remember Password",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.SavePassword),
|
||||
},
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Log in",
|
||||
Action = performLogin
|
||||
},
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Register",
|
||||
//Action = registerLink
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,13 +43,11 @@ namespace osu.Game.Overlays.Options.Online
|
||||
},
|
||||
new SpriteText { Text = "Chat ignore list (space-seperated list)" },
|
||||
chatIgnoreList = new TextBoxOption {
|
||||
Height = 20,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Bindable = config.GetBindable<string>(OsuConfig.IgnoreList)
|
||||
},
|
||||
new SpriteText { Text = "Chat highlight words (space-seperated list)" },
|
||||
chatHighlightWords = new TextBoxOption {
|
||||
Height = 20,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Bindable = config.GetBindable<string>(OsuConfig.HighlightWords)
|
||||
},
|
||||
|
@ -2,12 +2,13 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class TextBoxOption : TextBox
|
||||
public class TextBoxOption : OsuTextBox
|
||||
{
|
||||
private Bindable<string> bindable;
|
||||
|
||||
|
233
osu.Game/Overlays/Pause/PauseButton.cs
Normal file
233
osu.Game/Overlays/Pause/PauseButton.cs
Normal file
@ -0,0 +1,233 @@
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseButton : ClickableContainer
|
||||
{
|
||||
private const float hoverWidth = 0.9f;
|
||||
private const float hoverDuration = 500;
|
||||
private const float glowFadeDuration = 250;
|
||||
private const float clickDuration = 200;
|
||||
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
|
||||
private Color4 buttonColour;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return buttonColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
buttonColour = value;
|
||||
updateGlow();
|
||||
if (colourContainer == null) return;
|
||||
colourContainer.Colour = ButtonColour;
|
||||
}
|
||||
}
|
||||
|
||||
private string text;
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text;
|
||||
}
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
if (spriteText == null) return;
|
||||
spriteText.Text = Text;
|
||||
}
|
||||
}
|
||||
|
||||
public AudioSample SampleClick, SampleHover;
|
||||
|
||||
private Container backgroundContainer, colourContainer, glowContainer;
|
||||
private Box leftGlow, centerGlow, rightGlow;
|
||||
private SpriteText spriteText;
|
||||
|
||||
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
|
||||
|
||||
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
didClick = true;
|
||||
colourContainer.ResizeTo(new Vector2(1.5f, 1f), clickDuration, EasingTypes.In);
|
||||
flash();
|
||||
SampleClick?.Play();
|
||||
Action?.Invoke();
|
||||
|
||||
Delay(clickDuration);
|
||||
Schedule(delegate {
|
||||
colourContainer.ResizeTo(new Vector2(0.8f, 1f), 0, EasingTypes.None);
|
||||
spriteText.Spacing = Vector2.Zero;
|
||||
glowContainer.FadeOut();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnClick(Framework.Input.InputState state) => false;
|
||||
|
||||
protected override bool OnHover(Framework.Input.InputState state)
|
||||
{
|
||||
colourContainer.ResizeTo(new Vector2(hoverWidth, 1f), hoverDuration, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hoverDuration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeIn(glowFadeDuration, EasingTypes.Out);
|
||||
SampleHover?.Play();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(Framework.Input.InputState state)
|
||||
{
|
||||
if (!didClick)
|
||||
{
|
||||
colourContainer.ResizeTo(new Vector2(0.8f, 1f), hoverDuration, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(Vector2.Zero, hoverDuration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeOut(glowFadeDuration, EasingTypes.Out);
|
||||
}
|
||||
|
||||
didClick = false;
|
||||
}
|
||||
|
||||
private void flash()
|
||||
{
|
||||
var flash = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
|
||||
colourContainer.Add(flash);
|
||||
|
||||
flash.Colour = ButtonColour;
|
||||
flash.BlendingMode = BlendingMode.Additive;
|
||||
flash.Alpha = 0.3f;
|
||||
flash.FadeOutFromOne(clickDuration);
|
||||
flash.Expire();
|
||||
}
|
||||
|
||||
private void updateGlow()
|
||||
{
|
||||
leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f), ButtonColour);
|
||||
centerGlow.Colour = ButtonColour;
|
||||
rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f));
|
||||
}
|
||||
|
||||
public PauseButton()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
backgroundContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 1f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = backgroundColour
|
||||
}
|
||||
}
|
||||
},
|
||||
glowContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 1f,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leftGlow = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Width = 0.125f
|
||||
},
|
||||
centerGlow = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = 0.75f
|
||||
},
|
||||
rightGlow = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Width = 0.125f
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
colourContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = 0.8f,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Radius = 5
|
||||
},
|
||||
Colour = ButtonColour,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TriangleScale = 4,
|
||||
Alpha = 0.05f,
|
||||
Shear = new Vector2(-0.2f, 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
spriteText = new SpriteText
|
||||
{
|
||||
Text = Text,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 28,
|
||||
Font = "Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.1f),
|
||||
Colour = Color4.White
|
||||
}
|
||||
};
|
||||
|
||||
updateGlow();
|
||||
}
|
||||
}
|
||||
}
|
212
osu.Game/Overlays/Pause/PauseOverlay.cs
Normal file
212
osu.Game/Overlays/Pause/PauseOverlay.cs
Normal file
@ -0,0 +1,212 @@
|
||||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseOverlay : OverlayContainer
|
||||
{
|
||||
private const int transition_duration = 200;
|
||||
private const int button_height = 70;
|
||||
private const float background_alpha = 0.75f;
|
||||
|
||||
public Action OnResume;
|
||||
public Action OnRetry;
|
||||
public Action OnQuit;
|
||||
|
||||
public int Retries
|
||||
{
|
||||
set
|
||||
{
|
||||
if (retryCounterContainer != null)
|
||||
{
|
||||
// "You've retried 1,065 times in this session"
|
||||
// "You've retried 1 time in this session"
|
||||
|
||||
retryCounterContainer.Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = "You've retried ",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = String.Format("{0:n0}", value),
|
||||
Font = @"Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = $" time{((value == 1) ? "" : "s")} in this session",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f),
|
||||
TextSize = 18
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FlowContainer retryCounterContainer;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool HandleInput => State == Visibility.Visible;
|
||||
|
||||
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
|
||||
protected override void PopOut() => FadeOut(transition_duration, EasingTypes.In);
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (args.Key == Key.Escape)
|
||||
{
|
||||
if (State == Visibility.Hidden) return false;
|
||||
resume();
|
||||
return true;
|
||||
}
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = background_alpha,
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Spacing = new Vector2(0f, 50f),
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Spacing = new Vector2(0f, 20f),
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
Text = @"paused",
|
||||
Font = @"Exo2.0-Medium",
|
||||
Spacing = new Vector2(5, 0),
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
TextSize = 30,
|
||||
Colour = colours.Yellow,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Text = @"you're not going to do what i think you're going to do, are ya?",
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.25f)
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.6f),
|
||||
Radius = 50
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ResumeButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
Action = resume
|
||||
},
|
||||
new RetryButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
Action = delegate
|
||||
{
|
||||
OnRetry?.Invoke();
|
||||
Hide();
|
||||
}
|
||||
},
|
||||
new QuitButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
Action = delegate
|
||||
{
|
||||
OnQuit?.Invoke();
|
||||
Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
retryCounterContainer = new FlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre
|
||||
}
|
||||
}
|
||||
},
|
||||
new PauseProgressBar
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Width = 1f
|
||||
}
|
||||
};
|
||||
|
||||
Retries = 0;
|
||||
}
|
||||
|
||||
private void resume()
|
||||
{
|
||||
OnResume?.Invoke();
|
||||
Hide();
|
||||
}
|
||||
|
||||
public PauseOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
}
|
||||
}
|
147
osu.Game/Overlays/Pause/PauseProgressBar.cs
Normal file
147
osu.Game/Overlays/Pause/PauseProgressBar.cs
Normal file
@ -0,0 +1,147 @@
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseProgressBar : Container
|
||||
{
|
||||
private Color4 fillColour = new Color4(221, 255, 255, 255);
|
||||
private Color4 glowColour = new Color4(221, 255, 255, 150);
|
||||
|
||||
private Container fill;
|
||||
private WorkingBeatmap current;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase osuGame)
|
||||
{
|
||||
current = osuGame.Beatmap.Value;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (current?.TrackLoaded ?? false)
|
||||
{
|
||||
fill.Width = (float)(current.Track.CurrentTime / current.Track.Length);
|
||||
}
|
||||
}
|
||||
|
||||
public PauseProgressBar()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 60;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PauseProgressGraph
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Height = 35,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 5
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 5,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f
|
||||
}
|
||||
}
|
||||
},
|
||||
fill = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Width = 0,
|
||||
Height = 60,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 5,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = glowColour,
|
||||
Radius = 5
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = fillColour
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Width = 2,
|
||||
Height = 35,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Width = 14,
|
||||
Height = 25,
|
||||
CornerRadius = 5,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
9
osu.Game/Overlays/Pause/PauseProgressGraph.cs
Normal file
9
osu.Game/Overlays/Pause/PauseProgressGraph.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class PauseProgressGraph : Container
|
||||
{
|
||||
// TODO: Implement the pause progress graph
|
||||
}
|
||||
}
|
23
osu.Game/Overlays/Pause/QuitButton.cs
Normal file
23
osu.Game/Overlays/Pause/QuitButton.cs
Normal file
@ -0,0 +1,23 @@
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class QuitButton : PauseButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
ButtonColour = new Color4(170, 27, 39, 255); // The red from the design isn't in the palette so it's used directly
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||
}
|
||||
|
||||
public QuitButton()
|
||||
{
|
||||
Text = @"Quit to Main Menu";
|
||||
}
|
||||
}
|
||||
}
|
22
osu.Game/Overlays/Pause/ResumeButton.cs
Normal file
22
osu.Game/Overlays/Pause/ResumeButton.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class ResumeButton : PauseButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
ButtonColour = colours.Green;
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||
}
|
||||
|
||||
public ResumeButton()
|
||||
{
|
||||
Text = @"Continue";
|
||||
}
|
||||
}
|
||||
}
|
22
osu.Game/Overlays/Pause/RetryButton.cs
Normal file
22
osu.Game/Overlays/Pause/RetryButton.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
public class RetryButton : PauseButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
||||
{
|
||||
ButtonColour = colours.YellowDark;
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
|
||||
}
|
||||
|
||||
public RetryButton()
|
||||
{
|
||||
Text = @"Retry";
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -20,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
mode = value;
|
||||
TooltipMain = mode.GetDescription();
|
||||
TooltipSub = $"Play some {mode.GetDescription()}";
|
||||
Icon = getModeIcon(mode);
|
||||
Icon = Ruleset.GetRuleset(mode).Icon;
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,17 +47,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
|
||||
private FontAwesome getModeIcon(PlayMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
default: return FontAwesome.fa_osu_osu_o;
|
||||
case PlayMode.Taiko: return FontAwesome.fa_osu_taiko_o;
|
||||
case PlayMode.Catch: return FontAwesome.fa_osu_fruits_o;
|
||||
case PlayMode.Mania: return FontAwesome.fa_osu_mania_o;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
@ -249,6 +249,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
sampleClick.Play();
|
||||
|
||||
box.FlashColour(Color4.White, 500, EasingTypes.OutExpo);
|
||||
|
||||
clickAction?.Invoke();
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -23,6 +24,8 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public partial class OsuLogo : Container
|
||||
{
|
||||
public Color4 OsuPink = OsuColour.FromHex(@"e967a1");
|
||||
|
||||
private Sprite logo;
|
||||
private CircularContainer logoContainer;
|
||||
private Container logoBounceContainer;
|
||||
@ -62,6 +65,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
public bool Interactive = true;
|
||||
private Box flashLayer;
|
||||
|
||||
public OsuLogo()
|
||||
{
|
||||
@ -104,15 +108,24 @@ namespace osu.Game.Screens.Menu
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(233, 103, 161, 255),
|
||||
Colour = OsuPink,
|
||||
},
|
||||
new OsuLogoTriangles
|
||||
new Triangles
|
||||
{
|
||||
TriangleScale = 4,
|
||||
ColourLight = OsuColour.FromHex(@"ff7db7"),
|
||||
ColourDark = OsuColour.FromHex(@"de5b95"),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
flashLayer = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Colour = Color4.White,
|
||||
Alpha = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
logo = new Sprite
|
||||
@ -189,6 +202,10 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
if (!Interactive) return false;
|
||||
|
||||
flashLayer.ClearTransformations();
|
||||
flashLayer.Alpha = 0.4f;
|
||||
flashLayer.FadeOut(1500, EasingTypes.OutExpo);
|
||||
|
||||
Action?.Invoke();
|
||||
return true;
|
||||
}
|
||||
@ -204,31 +221,5 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
logoHoverContainer.ScaleTo(1, 500, EasingTypes.OutElastic);
|
||||
}
|
||||
|
||||
class OsuLogoTriangles : Triangles
|
||||
{
|
||||
public OsuLogoTriangles()
|
||||
{
|
||||
TriangleScale = 4;
|
||||
Alpha = 1;
|
||||
}
|
||||
|
||||
protected override Triangle CreateTriangle()
|
||||
{
|
||||
var triangle = base.CreateTriangle();
|
||||
triangle.Alpha = 1;
|
||||
triangle.Colour = getTriangleShade();
|
||||
return triangle;
|
||||
}
|
||||
|
||||
private Color4 getTriangleShade()
|
||||
{
|
||||
float val = RNG.NextSingle();
|
||||
return Interpolation.ValueAt(val,
|
||||
new Color4(222, 91, 149, 255),
|
||||
new Color4(255, 125, 183, 255),
|
||||
0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -16,11 +16,13 @@ using osu.Framework.GameModes;
|
||||
using osu.Game.Modes.UI;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays.Pause;
|
||||
using osu.Framework.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -35,7 +37,23 @@ namespace osu.Game.Screens.Play
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public PlayMode PreferredPlayMode;
|
||||
|
||||
|
||||
private bool isPaused;
|
||||
public bool IsPaused
|
||||
{
|
||||
get
|
||||
{
|
||||
return isPaused;
|
||||
}
|
||||
}
|
||||
|
||||
public int RestartCount;
|
||||
|
||||
private double pauseCooldown = 1000;
|
||||
private double lastPauseActionTime = 0;
|
||||
|
||||
private bool canPause => Time.Current >= (lastPauseActionTime + pauseCooldown);
|
||||
|
||||
private IAdjustableClock sourceClock;
|
||||
|
||||
private Ruleset ruleset;
|
||||
@ -45,6 +63,10 @@ namespace osu.Game.Screens.Play
|
||||
private Bindable<int> dimLevel;
|
||||
private SkipButton skipButton;
|
||||
|
||||
private ScoreOverlay scoreOverlay;
|
||||
private PauseOverlay pauseOverlay;
|
||||
private PlayerInputManager playerInputManager;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game, OsuConfigManager config)
|
||||
{
|
||||
@ -89,9 +111,20 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
ruleset = Ruleset.GetRuleset(usablePlayMode);
|
||||
|
||||
var scoreOverlay = ruleset.CreateScoreOverlay();
|
||||
scoreOverlay = ruleset.CreateScoreOverlay();
|
||||
scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count));
|
||||
|
||||
pauseOverlay = new PauseOverlay
|
||||
{
|
||||
Depth = -1,
|
||||
OnResume = delegate {
|
||||
Delay(400);
|
||||
Schedule(Resume);
|
||||
},
|
||||
OnRetry = Restart,
|
||||
OnQuit = Exit
|
||||
};
|
||||
|
||||
hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects);
|
||||
|
||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||
@ -106,7 +139,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PlayerInputManager(game.Host)
|
||||
playerInputManager = new PlayerInputManager(game.Host)
|
||||
{
|
||||
Clock = new InterpolatingFramedClock(sourceClock),
|
||||
PassThrough = false,
|
||||
@ -117,6 +150,7 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
},
|
||||
scoreOverlay,
|
||||
pauseOverlay
|
||||
};
|
||||
}
|
||||
|
||||
@ -147,6 +181,58 @@ namespace osu.Game.Screens.Play
|
||||
skipButton.Expire();
|
||||
}
|
||||
|
||||
public void Pause(bool force = false)
|
||||
{
|
||||
if (canPause || force)
|
||||
{
|
||||
lastPauseActionTime = Time.Current;
|
||||
playerInputManager.PassThrough = true;
|
||||
scoreOverlay.KeyCounter.IsCounting = false;
|
||||
pauseOverlay.Retries = RestartCount;
|
||||
pauseOverlay.Show();
|
||||
sourceClock.Stop();
|
||||
isPaused = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
isPaused = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Resume()
|
||||
{
|
||||
lastPauseActionTime = Time.Current;
|
||||
playerInputManager.PassThrough = false;
|
||||
scoreOverlay.KeyCounter.IsCounting = true;
|
||||
pauseOverlay.Hide();
|
||||
sourceClock.Start();
|
||||
isPaused = false;
|
||||
}
|
||||
|
||||
public void TogglePaused()
|
||||
{
|
||||
isPaused = !IsPaused;
|
||||
if (IsPaused) Pause(); else Resume();
|
||||
}
|
||||
|
||||
public void Restart()
|
||||
{
|
||||
sourceClock.Stop(); // If the clock is running and Restart is called the game will lag until relaunch
|
||||
|
||||
var newPlayer = new Player();
|
||||
|
||||
newPlayer.Preload(Game, delegate
|
||||
{
|
||||
newPlayer.RestartCount = RestartCount + 1;
|
||||
ValidForResume = false;
|
||||
|
||||
if (!Push(newPlayer))
|
||||
{
|
||||
// Error(?)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
@ -202,9 +288,19 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
dimLevel.ValueChanged -= dimChanged;
|
||||
Background?.FadeTo(1f, 200);
|
||||
return base.OnExiting(next);
|
||||
if (pauseOverlay.State != Visibility.Visible && !canPause) return true;
|
||||
|
||||
if (!IsPaused && sourceClock.IsRunning) // For if the user presses escape quickly when entering the map
|
||||
{
|
||||
Pause();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
dimLevel.ValueChanged -= dimChanged;
|
||||
Background?.FadeTo(1f, 200);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
|
||||
private void dimChanged(object sender, EventArgs e)
|
||||
|
@ -2,6 +2,7 @@
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using OpenTK;
|
||||
@ -14,7 +15,12 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -24,7 +30,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private Container beatmapInfoContainer;
|
||||
|
||||
private BaseGame game;
|
||||
private OsuGameBase game;
|
||||
|
||||
public BeatmapInfoWedge()
|
||||
{
|
||||
@ -42,7 +48,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BaseGame game)
|
||||
private void load(OsuGameBase game)
|
||||
{
|
||||
this.game = game;
|
||||
}
|
||||
@ -59,6 +65,28 @@ namespace osu.Game.Screens.Select
|
||||
BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo;
|
||||
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
|
||||
|
||||
List<InfoLabel> labels = new List<InfoLabel>();
|
||||
|
||||
if (beatmap.Beatmap != null)
|
||||
{
|
||||
labels.Add(new InfoLabel(new BeatmapStatistic
|
||||
{
|
||||
Name = "Length",
|
||||
Icon = FontAwesome.fa_clock_o,
|
||||
Content = TimeSpan.FromMilliseconds(beatmap.Beatmap.HitObjects.Last().EndTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"),
|
||||
}));
|
||||
|
||||
labels.Add(new InfoLabel(new BeatmapStatistic
|
||||
{
|
||||
Name = "BPM",
|
||||
Icon = FontAwesome.fa_circle,
|
||||
Content = getBPMRange(beatmap.Beatmap),
|
||||
}));
|
||||
|
||||
//get statistics fromt he current ruleset.
|
||||
Ruleset.GetRuleset(beatmap.BeatmapInfo.Mode).GetBeatmapStatistics(beatmap).ForEach(s => labels.Add(new InfoLabel(s)));
|
||||
}
|
||||
|
||||
(beatmapInfoContainer = new BufferedContainer
|
||||
{
|
||||
Depth = newDepth,
|
||||
@ -99,9 +127,9 @@ namespace osu.Game.Screens.Select
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Direction = FlowDirection.VerticalOnly,
|
||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 },
|
||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText
|
||||
{
|
||||
@ -139,11 +167,18 @@ namespace osu.Game.Screens.Select
|
||||
Shadow = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = 20 },
|
||||
Spacing = new Vector2(40,0),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = labels
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}).Preload(game, delegate(Drawable d)
|
||||
}).Preload(game, delegate (Drawable d)
|
||||
{
|
||||
FadeIn(250);
|
||||
|
||||
@ -153,5 +188,47 @@ namespace osu.Game.Screens.Select
|
||||
Add(d);
|
||||
});
|
||||
}
|
||||
|
||||
private string getBPMRange(Beatmap beatmap)
|
||||
{
|
||||
double bpmMax = beatmap.BPMMaximum;
|
||||
double bpmMin = beatmap.BPMMinimum;
|
||||
|
||||
if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm";
|
||||
|
||||
return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(beatmap.BPMMode) + "bpm)";
|
||||
}
|
||||
|
||||
public class InfoLabel : Container
|
||||
{
|
||||
public InfoLabel(BeatmapStatistic statistic)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new[]
|
||||
{
|
||||
new TextAwesome
|
||||
{
|
||||
Icon = FontAwesome.fa_square,
|
||||
Colour = new Color4(68, 17, 136, 255),
|
||||
Rotation = 45
|
||||
},
|
||||
new TextAwesome
|
||||
{
|
||||
Icon = statistic.Icon,
|
||||
Colour = new Color4(255, 221, 85, 255),
|
||||
Scale = new Vector2(0.8f)
|
||||
},
|
||||
new SpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Left = 13 },
|
||||
Font = @"Exo2.0-Bold",
|
||||
Colour = new Color4(255, 221, 85, 255),
|
||||
Text = statistic.Content,
|
||||
TextSize = 17,
|
||||
Origin = Anchor.CentreLeft
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Screens.Select
|
||||
private static float offsetX(float dist, float halfHeight)
|
||||
{
|
||||
// The radius of the circle the carousel moves on.
|
||||
const float CIRCLE_RADIUS = 4;
|
||||
const float CIRCLE_RADIUS = 3;
|
||||
double discriminant = Math.Max(0, CIRCLE_RADIUS * CIRCLE_RADIUS - dist * dist);
|
||||
float x = (CIRCLE_RADIUS - (float)Math.Sqrt(discriminant)) * halfHeight;
|
||||
|
||||
|
@ -310,7 +310,7 @@ namespace osu.Game.Screens.Select
|
||||
if (b.Metadata == null) b.Metadata = beatmapSet.Metadata;
|
||||
});
|
||||
|
||||
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
||||
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList();
|
||||
|
||||
var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);
|
||||
|
||||
|
@ -67,6 +67,7 @@
|
||||
<Compile Include="Graphics\Backgrounds\Triangles.cs" />
|
||||
<Compile Include="Graphics\Cursor\CursorTrail.cs" />
|
||||
<Compile Include="Graphics\UserInterface\BackButton.cs" />
|
||||
<Compile Include="Graphics\UserInterface\OsuTextBox.cs" />
|
||||
<Compile Include="Graphics\UserInterface\TwoLayerButton.cs" />
|
||||
<Compile Include="Modes\Objects\HitObjectParser.cs" />
|
||||
<Compile Include="Modes\Score.cs" />
|
||||
@ -238,6 +239,13 @@
|
||||
<Compile Include="Graphics\OsuColour.cs" />
|
||||
<Compile Include="Screens\Select\FooterButton.cs" />
|
||||
<Compile Include="Screens\Select\Footer.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseButton.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseOverlay.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseProgressBar.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" />
|
||||
<Compile Include="Overlays\Pause\ResumeButton.cs" />
|
||||
<Compile Include="Overlays\Pause\RetryButton.cs" />
|
||||
<Compile Include="Overlays\Pause\QuitButton.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
Loading…
Reference in New Issue
Block a user