mirror of
https://github.com/osukey/osukey.git
synced 2025-07-22 19:00:05 +09:00
Merge branch 'master' into fixes
This commit is contained in:
Submodule osu-framework updated: 991177da4f...2d2e2fe698
@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
|
|||||||
public class TestWorkingBeatmap : WorkingBeatmap
|
public class TestWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
public TestWorkingBeatmap(Beatmap beatmap)
|
public TestWorkingBeatmap(Beatmap beatmap)
|
||||||
: base(beatmap.BeatmapInfo)
|
: base(beatmap.BeatmapInfo, true)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,8 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
|
|
||||||
private int calculateBeatCount(TimingControlPoint current)
|
private int calculateBeatCount(TimingControlPoint current)
|
||||||
{
|
{
|
||||||
|
if (timingPoints.Count == 0) return 0;
|
||||||
|
|
||||||
if (timingPoints[timingPoints.Count - 1] == current)
|
if (timingPoints[timingPoints.Count - 1] == current)
|
||||||
return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength);
|
return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
return new Player
|
return new Player
|
||||||
{
|
{
|
||||||
Beatmap = beatmap
|
InitialBeatmap = beatmap
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
Beatmap = beatmap
|
InitialBeatmap = beatmap
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
{
|
{
|
||||||
base.ApplyBeatmap();
|
base.ApplyBeatmap();
|
||||||
|
|
||||||
PreferredColumns = (int)Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize);
|
PreferredColumns = (int)Math.Max(1, Math.Round(Beatmap.BeatmapInfo.Difficulty.CircleSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ApplySpeedAdjustments()
|
protected override void ApplySpeedAdjustments()
|
||||||
|
@ -5,7 +5,7 @@ using System;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.ControlPoints
|
namespace osu.Game.Beatmaps.ControlPoints
|
||||||
{
|
{
|
||||||
public class ControlPoint : IComparable<ControlPoint>
|
public class ControlPoint : IComparable<ControlPoint>, IEquatable<ControlPoint>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The time at which the control point takes effect.
|
/// The time at which the control point takes effect.
|
||||||
@ -13,5 +13,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
public double Time;
|
public double Time;
|
||||||
|
|
||||||
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time);
|
||||||
|
|
||||||
|
public bool Equals(ControlPoint other) => Time.Equals(other?.Time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
82
osu.Game/Beatmaps/DummyWorkingBeatmap.cs
Normal file
82
osu.Game/Beatmaps/DummyWorkingBeatmap.cs
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
// Copyright (c) 2007-2017 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 osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
internal class DummyWorkingBeatmap : WorkingBeatmap
|
||||||
|
{
|
||||||
|
private readonly OsuGameBase game;
|
||||||
|
|
||||||
|
public DummyWorkingBeatmap(OsuGameBase game)
|
||||||
|
: base(new BeatmapInfo
|
||||||
|
{
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "please load a beatmap!",
|
||||||
|
Title = "no beatmaps available!",
|
||||||
|
Author = "no one",
|
||||||
|
},
|
||||||
|
BeatmapSet = new BeatmapSetInfo(),
|
||||||
|
Difficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
DrainRate = 0,
|
||||||
|
CircleSize = 0,
|
||||||
|
OverallDifficulty = 0,
|
||||||
|
ApproachRate = 0,
|
||||||
|
SliderMultiplier = 0,
|
||||||
|
SliderTickRate = 0,
|
||||||
|
},
|
||||||
|
Ruleset = new DummyRulesetInfo()
|
||||||
|
})
|
||||||
|
{
|
||||||
|
this.game = game;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Beatmap GetBeatmap() => new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = new List<HitObject>(),
|
||||||
|
};
|
||||||
|
|
||||||
|
protected override Texture GetBackground() => game.Textures.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
|
protected override Track GetTrack() => new TrackVirtual();
|
||||||
|
|
||||||
|
private class DummyRulesetInfo : RulesetInfo
|
||||||
|
{
|
||||||
|
public override Ruleset CreateInstance() => new DummyRuleset();
|
||||||
|
|
||||||
|
private class DummyRuleset : Ruleset
|
||||||
|
{
|
||||||
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };
|
||||||
|
|
||||||
|
public override HitRenderer CreateHitRendererWith(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap) => null;
|
||||||
|
|
||||||
|
public override ScoreProcessor CreateScoreProcessor()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string Description => "dummy";
|
||||||
|
|
||||||
|
public override IEnumerable<KeyCounter> CreateGameplayKeys() => new List<KeyCounter>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ namespace osu.Game.Beatmaps.IO
|
|||||||
AddReader<OszArchiveReader>((storage, path) =>
|
AddReader<OszArchiveReader>((storage, path) =>
|
||||||
{
|
{
|
||||||
using (var stream = storage.GetStream(path))
|
using (var stream = storage.GetStream(path))
|
||||||
return ZipFile.IsZipFile(stream, false);
|
return stream != null && ZipFile.IsZipFile(stream, false);
|
||||||
});
|
});
|
||||||
OsuLegacyDecoder.Register();
|
OsuLegacyDecoder.Register();
|
||||||
}
|
}
|
||||||
|
@ -22,14 +22,17 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
||||||
|
|
||||||
public readonly bool WithStoryboard;
|
/// <summary>
|
||||||
|
/// Denotes whether extras like storyboards have been loaded for this <see cref="WorkingBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
public bool FullyLoaded { get; protected set; }
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false)
|
||||||
{
|
{
|
||||||
BeatmapInfo = beatmapInfo;
|
BeatmapInfo = beatmapInfo;
|
||||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
||||||
WithStoryboard = withStoryboard;
|
FullyLoaded = fullyLoaded;
|
||||||
|
|
||||||
Mods.ValueChanged += mods => applyRateAdjustments();
|
Mods.ValueChanged += mods => applyRateAdjustments();
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,11 @@ namespace osu.Game.Database
|
|||||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
||||||
private BeatmapIPCChannel ipc;
|
private BeatmapIPCChannel ipc;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
||||||
|
/// </summary>
|
||||||
|
public WorkingBeatmap DefaultBeatmap { private get; set; }
|
||||||
|
|
||||||
public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection)
|
public BeatmapDatabase(Storage storage, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) : base(storage, connection)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
@ -144,7 +149,11 @@ namespace osu.Game.Database
|
|||||||
public void Import(params string[] paths)
|
public void Import(params string[] paths)
|
||||||
{
|
{
|
||||||
foreach (string p in paths)
|
foreach (string p in paths)
|
||||||
Import(p);
|
{
|
||||||
|
//In case the file was imported twice and deleted after the first time
|
||||||
|
if (File.Exists(p))
|
||||||
|
Import(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -178,6 +187,8 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
|
GetChildren(existing);
|
||||||
|
|
||||||
if (existing.DeletePending)
|
if (existing.DeletePending)
|
||||||
{
|
{
|
||||||
existing.DeletePending = false;
|
existing.DeletePending = false;
|
||||||
@ -268,6 +279,9 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null, bool withStoryboard = false)
|
||||||
{
|
{
|
||||||
|
if (beatmapInfo == null || beatmapInfo == DefaultBeatmap?.BeatmapInfo)
|
||||||
|
return DefaultBeatmap;
|
||||||
|
|
||||||
if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
|
if (beatmapInfo.BeatmapSet == null || beatmapInfo.Ruleset == null)
|
||||||
beatmapInfo = GetChildren(beatmapInfo, true);
|
beatmapInfo = GetChildren(beatmapInfo, true);
|
||||||
|
|
||||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
private readonly BeatmapDatabase database;
|
private readonly BeatmapDatabase database;
|
||||||
|
|
||||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false)
|
||||||
: base(beatmapInfo, withStoryboard)
|
: base(beatmapInfo, fullyLoaded)
|
||||||
{
|
{
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ namespace osu.Game.Database
|
|||||||
beatmap = decoder.Decode(stream);
|
beatmap = decoder.Decode(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null)
|
if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null)
|
||||||
return beatmap;
|
return beatmap;
|
||||||
|
|
||||||
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
|
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
|
||||||
|
@ -21,6 +21,6 @@ namespace osu.Game.Database
|
|||||||
[Indexed]
|
[Indexed]
|
||||||
public bool Available { get; set; }
|
public bool Available { get; set; }
|
||||||
|
|
||||||
public Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
|
public virtual Ruleset CreateInstance() => (Ruleset)Activator.CreateInstance(Type.GetType(InstantiationInfo));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -35,10 +35,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
if (Beatmap.Value?.Track == null)
|
var track = Beatmap.Value.Track;
|
||||||
|
|
||||||
|
if (track == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double currentTrackTime = Beatmap.Value.Track.CurrentTime + EarlyActivationMilliseconds;
|
double currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime;
|
||||||
|
|
||||||
TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
TimingControlPoint timingPoint = Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
||||||
EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
EffectControlPoint effectPoint = Beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
||||||
@ -58,7 +60,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
TimeSinceLastBeat = timingPoint.BeatLength - TimeUntilNextBeat;
|
TimeSinceLastBeat = timingPoint.BeatLength - TimeUntilNextBeat;
|
||||||
|
|
||||||
if (timingPoint == lastTimingPoint && beatIndex == lastBeat)
|
if (timingPoint.Equals(lastTimingPoint) && beatIndex == lastBeat)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
using (BeginDelayedSequence(-TimeSinceLastBeat, true))
|
using (BeginDelayedSequence(-TimeSinceLastBeat, true))
|
||||||
|
@ -83,6 +83,8 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
instantMovement |= !IsPresent;
|
instantMovement |= !IsPresent;
|
||||||
|
|
||||||
|
ClearTransforms();
|
||||||
FadeIn(500, EasingTypes.OutQuint);
|
FadeIn(500, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,6 +177,7 @@ namespace osu.Game
|
|||||||
LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add);
|
LoadComponentAsync(social = new SocialOverlay { Depth = -1 }, mainContent.Add);
|
||||||
LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add);
|
LoadComponentAsync(chat = new ChatOverlay { Depth = -1 }, mainContent.Add);
|
||||||
LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add);
|
LoadComponentAsync(settings = new SettingsOverlay { Depth = -1 }, overlayContent.Add);
|
||||||
|
LoadComponentAsync(userProfile = new UserProfileOverlay { Depth = -2 }, mainContent.Add);
|
||||||
LoadComponentAsync(musicController = new MusicController
|
LoadComponentAsync(musicController = new MusicController
|
||||||
{
|
{
|
||||||
Depth = -3,
|
Depth = -3,
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected MenuCursor Cursor;
|
protected MenuCursor Cursor;
|
||||||
|
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
private Bindable<bool> fpsDisplayVisible;
|
private Bindable<bool> fpsDisplayVisible;
|
||||||
|
|
||||||
@ -121,6 +121,10 @@ namespace osu.Game
|
|||||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
|
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera"));
|
||||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
|
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
|
||||||
|
|
||||||
|
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
||||||
|
Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
||||||
|
BeatmapDatabase.DefaultBeatmap = defaultBeatmap;
|
||||||
|
|
||||||
OszArchiveReader.Register();
|
OszArchiveReader.Register();
|
||||||
|
|
||||||
Dependencies.Cache(API = new APIAccess
|
Dependencies.Cache(API = new APIAccess
|
||||||
@ -129,9 +133,27 @@ namespace osu.Game
|
|||||||
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
Token = LocalConfig.Get<string>(OsuSetting.Token)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += b =>
|
||||||
|
{
|
||||||
|
// compare to last baetmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
||||||
|
if (lastBeatmap?.Track != b.Track)
|
||||||
|
{
|
||||||
|
// this disposal is done to stop the audio track.
|
||||||
|
// it may not be exactly what we want for cases beatmaps are reused, as it will
|
||||||
|
// trigger a fresh load of contained resources.
|
||||||
|
lastBeatmap?.Dispose();
|
||||||
|
|
||||||
|
Audio.Track.AddItem(b.Track);
|
||||||
|
}
|
||||||
|
|
||||||
|
lastBeatmap = b;
|
||||||
|
};
|
||||||
|
|
||||||
API.Register(this);
|
API.Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private WorkingBeatmap lastBeatmap;
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(APIAccess api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -8,6 +9,10 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Online.Chat;
|
using osu.Game.Online.Chat;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Graphics.Effects;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Chat
|
namespace osu.Game.Overlays.Chat
|
||||||
{
|
{
|
||||||
@ -53,21 +58,16 @@ namespace osu.Game.Overlays.Chat
|
|||||||
OsuColour.FromHex("992861"),
|
OsuColour.FromHex("992861"),
|
||||||
};
|
};
|
||||||
|
|
||||||
private Color4 getUsernameColour(Message message)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(message.Sender?.Colour))
|
|
||||||
return OsuColour.FromHex(message.Sender.Colour);
|
|
||||||
|
|
||||||
//todo: use User instead of Message when user_id is correctly populated.
|
|
||||||
return username_colours[message.UserId % username_colours.Length];
|
|
||||||
}
|
|
||||||
|
|
||||||
public const float LEFT_PADDING = message_padding + padding * 2;
|
public const float LEFT_PADDING = message_padding + padding * 2;
|
||||||
|
|
||||||
private const float padding = 15;
|
private const float padding = 15;
|
||||||
private const float message_padding = 200;
|
private const float message_padding = 200;
|
||||||
private const float text_size = 20;
|
private const float text_size = 20;
|
||||||
|
|
||||||
|
private Action<User> loadProfile;
|
||||||
|
|
||||||
|
private Color4 customUsernameColour;
|
||||||
|
|
||||||
public ChatLine(Message message)
|
public ChatLine(Message message)
|
||||||
{
|
{
|
||||||
Message = message;
|
Message = message;
|
||||||
@ -76,6 +76,59 @@ namespace osu.Game.Overlays.Chat
|
|||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Padding = new MarginPadding { Left = padding, Right = padding };
|
Padding = new MarginPadding { Left = padding, Right = padding };
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, UserProfileOverlay profile)
|
||||||
|
{
|
||||||
|
customUsernameColour = colours.ChatBlue;
|
||||||
|
loadProfile = u => profile?.ShowUser(u);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
bool hasBackground = !string.IsNullOrEmpty(Message.Sender.Colour);
|
||||||
|
Drawable username = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = @"Exo2.0-BoldItalic",
|
||||||
|
Text = $@"{Message.Sender.Username}" + (hasBackground ? "" : ":"),
|
||||||
|
Colour = hasBackground ? customUsernameColour : username_colours[Message.UserId % username_colours.Length],
|
||||||
|
TextSize = text_size,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (hasBackground)
|
||||||
|
{
|
||||||
|
// Background effect
|
||||||
|
username = username.WithEffect(new EdgeEffect
|
||||||
|
{
|
||||||
|
CornerRadius = 4,
|
||||||
|
Parameters = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Radius = 1,
|
||||||
|
Colour = OsuColour.FromHex(Message.Sender.Colour),
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
}
|
||||||
|
}, d =>
|
||||||
|
{
|
||||||
|
d.Padding = new MarginPadding { Left = 3, Right = 3, Bottom = 1, Top = -3 };
|
||||||
|
d.Y = 3;
|
||||||
|
})
|
||||||
|
// Drop shadow effect
|
||||||
|
.WithEffect(new EdgeEffect
|
||||||
|
{
|
||||||
|
CornerRadius = 4,
|
||||||
|
Parameters = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Roundness = 1,
|
||||||
|
Offset = new Vector2(0, 3),
|
||||||
|
Radius = 3,
|
||||||
|
Colour = Color4.Black.Opacity(0.3f),
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -94,15 +147,14 @@ namespace osu.Game.Overlays.Chat
|
|||||||
TextSize = text_size * 0.75f,
|
TextSize = text_size * 0.75f,
|
||||||
Alpha = 0.4f,
|
Alpha = 0.4f,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new ClickableContainer
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-BoldItalic",
|
AutoSizeAxes = Axes.Both,
|
||||||
Text = $@"{Message.Sender.Username}:",
|
|
||||||
Colour = getUsernameColour(Message),
|
|
||||||
TextSize = text_size,
|
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
}
|
Child = username,
|
||||||
|
Action = () => loadProfile(Message.Sender),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
|
@ -29,6 +29,9 @@ namespace osu.Game.Overlays.Chat
|
|||||||
scroll = new OsuScrollContainer
|
scroll = new OsuScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
// Some chat lines have effects that slightly protrude to the bottom,
|
||||||
|
// which we do not want to mask away, hence the padding.
|
||||||
|
Padding = new MarginPadding { Bottom = 5 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
flow = new FillFlowContainer<ChatLine>
|
flow = new FillFlowContainer<ChatLine>
|
||||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Bottom = textbox_height + padding
|
Bottom = textbox_height
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
|
||||||
{
|
|
||||||
public class DragBar : Container
|
|
||||||
{
|
|
||||||
protected readonly Container Fill;
|
|
||||||
|
|
||||||
public Action<float> SeekRequested;
|
|
||||||
|
|
||||||
public bool IsSeeking { get; private set; }
|
|
||||||
|
|
||||||
private bool enabled = true;
|
|
||||||
public bool IsEnabled
|
|
||||||
{
|
|
||||||
get { return enabled; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
enabled = value;
|
|
||||||
if (!enabled)
|
|
||||||
Fill.Width = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public DragBar()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
Fill = new Container
|
|
||||||
{
|
|
||||||
Name = "FillContainer",
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Width = 0,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdatePosition(float position)
|
|
||||||
{
|
|
||||||
if (IsSeeking || !IsEnabled) return;
|
|
||||||
|
|
||||||
updatePosition(position, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void seek(InputState state)
|
|
||||||
{
|
|
||||||
float seekLocation = state.Mouse.Position.X / DrawWidth;
|
|
||||||
|
|
||||||
if (!IsEnabled) return;
|
|
||||||
|
|
||||||
SeekRequested?.Invoke(seekLocation);
|
|
||||||
updatePosition(seekLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePosition(float position, bool easing = true)
|
|
||||||
{
|
|
||||||
position = MathHelper.Clamp(position, 0, 1);
|
|
||||||
Fill.TransformTo(position, easing ? 200 : 0, EasingTypes.OutQuint, new TransformSeek());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
|
||||||
{
|
|
||||||
seek(state);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDrag(InputState state)
|
|
||||||
{
|
|
||||||
seek(state);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => IsSeeking = true;
|
|
||||||
|
|
||||||
protected override bool OnDragEnd(InputState state)
|
|
||||||
{
|
|
||||||
IsSeeking = false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class TransformSeek : TransformFloat<Drawable>
|
|
||||||
{
|
|
||||||
public override void Apply(Drawable d) => d.Width = CurrentValue;
|
|
||||||
public override void ReadIntoStartValue(Drawable d) => StartValue = d.Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -3,9 +3,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,7 +13,6 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
|
||||||
@ -30,7 +27,6 @@ namespace osu.Game.Overlays.Music
|
|||||||
private FilterControl filter;
|
private FilterControl filter;
|
||||||
private PlaylistList list;
|
private PlaylistList list;
|
||||||
|
|
||||||
private TrackManager trackManager;
|
|
||||||
private BeatmapDatabase beatmaps;
|
private BeatmapDatabase beatmaps;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
||||||
@ -43,7 +39,6 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
this.inputManager = inputManager;
|
this.inputManager = inputManager;
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
trackManager = game.Audio.Track;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -83,11 +78,12 @@ namespace osu.Game.Overlays.Music
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>().ToList();
|
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending).ToList();
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
beatmapBacking.BindTo(game.Beatmap);
|
||||||
|
|
||||||
filter.Search.OnCommit = (sender, newText) => {
|
filter.Search.OnCommit = (sender, newText) =>
|
||||||
|
{
|
||||||
var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||||
if (beatmap != null) playSpecified(beatmap);
|
if (beatmap != null) playSpecified(beatmap);
|
||||||
};
|
};
|
||||||
@ -153,13 +149,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
private void playSpecified(BeatmapInfo info)
|
private void playSpecified(BeatmapInfo info)
|
||||||
{
|
{
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
|
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(info, beatmapBacking);
|
||||||
|
beatmapBacking.Value.Track.Start();
|
||||||
Task.Run(() =>
|
|
||||||
{
|
|
||||||
var track = beatmapBacking.Value.Track;
|
|
||||||
trackManager.SetExclusive(track);
|
|
||||||
track.Start();
|
|
||||||
}).ContinueWith(task => Schedule(task.ThrowIfFaulted), TaskContinuationOptions.OnlyOnFaulted);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -39,7 +40,7 @@ namespace osu.Game.Overlays
|
|||||||
private const float bottom_black_area_height = 55;
|
private const float bottom_black_area_height = 55;
|
||||||
|
|
||||||
private Drawable currentBackground;
|
private Drawable currentBackground;
|
||||||
private DragBar progressBar;
|
private ProgressBar progressBar;
|
||||||
|
|
||||||
private IconButton playButton;
|
private IconButton playButton;
|
||||||
private IconButton playlistButton;
|
private IconButton playlistButton;
|
||||||
@ -187,13 +188,13 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
progressBar = new DragBar
|
progressBar = new ProgressBar
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Height = progress_height,
|
Height = progress_height,
|
||||||
Colour = colours.Yellow,
|
FillColour = colours.Yellow,
|
||||||
SeekRequested = seek
|
OnSeek = progress => current?.Track.Seek(progress)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -228,7 +229,9 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
var track = current.Track;
|
var track = current.Track;
|
||||||
|
|
||||||
progressBar.UpdatePosition(track.Length == 0 ? 0 : (float)(track.CurrentTime / track.Length));
|
progressBar.EndTime = track.Length;
|
||||||
|
progressBar.CurrentTime = track.CurrentTime;
|
||||||
|
|
||||||
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||||
|
|
||||||
if (track.HasCompleted && !track.Looping) next();
|
if (track.HasCompleted && !track.Looping) next();
|
||||||
@ -274,13 +277,11 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private void beatmapChanged(WorkingBeatmap beatmap)
|
private void beatmapChanged(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
progressBar.IsEnabled = beatmap != null;
|
|
||||||
|
|
||||||
TransformDirection direction = TransformDirection.None;
|
TransformDirection direction = TransformDirection.None;
|
||||||
|
|
||||||
if (current != null)
|
if (current != null)
|
||||||
{
|
{
|
||||||
bool audioEquals = beatmapBacking.Value?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
|
bool audioEquals = beatmap?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
|
||||||
|
|
||||||
if (audioEquals)
|
if (audioEquals)
|
||||||
direction = TransformDirection.None;
|
direction = TransformDirection.None;
|
||||||
@ -293,15 +294,18 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
//figure out the best direction based on order in playlist.
|
//figure out the best direction based on order in playlist.
|
||||||
var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo.ID).Count();
|
var last = playlist.BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo.ID).Count();
|
||||||
var next = beatmapBacking.Value == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmapBacking.Value.BeatmapSetInfo.ID).Count();
|
var next = beatmap == null ? -1 : playlist.BeatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo.ID).Count();
|
||||||
|
|
||||||
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current = beatmapBacking.Value;
|
current = beatmap;
|
||||||
|
|
||||||
|
progressBar.CurrentTime = 0;
|
||||||
|
|
||||||
|
updateDisplay(current, direction);
|
||||||
|
|
||||||
updateDisplay(beatmapBacking, direction);
|
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -360,12 +364,6 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seek(float position)
|
|
||||||
{
|
|
||||||
var track = current?.Track;
|
|
||||||
track?.Seek(track.Length * position);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
@ -426,5 +424,49 @@ namespace osu.Game.Overlays
|
|||||||
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
|
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ProgressBar : SliderBar<double>
|
||||||
|
{
|
||||||
|
public Action<double> OnSeek;
|
||||||
|
|
||||||
|
private readonly Box fill;
|
||||||
|
|
||||||
|
public Color4 FillColour
|
||||||
|
{
|
||||||
|
set { fill.Colour = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public double EndTime
|
||||||
|
{
|
||||||
|
set { CurrentNumber.MaxValue = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CurrentTime
|
||||||
|
{
|
||||||
|
set { CurrentNumber.Value = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProgressBar()
|
||||||
|
{
|
||||||
|
CurrentNumber.MinValue = 0;
|
||||||
|
CurrentNumber.MaxValue = 1;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
fill = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateValue(float value)
|
||||||
|
{
|
||||||
|
fill.Width = value * UsableWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,20 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile
|
namespace osu.Game.Overlays.Profile
|
||||||
{
|
{
|
||||||
public class ProfileHeader : Container
|
public class ProfileHeader : Container
|
||||||
{
|
{
|
||||||
private readonly OsuTextFlowContainer infoTextLeft, infoTextRight;
|
private readonly OsuTextFlowContainer infoTextLeft;
|
||||||
|
private readonly LinkFlowContainer infoTextRight;
|
||||||
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
|
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
|
||||||
|
|
||||||
private readonly Container coverContainer, chartContainer, supporterTag;
|
private readonly Container coverContainer, chartContainer, supporterTag;
|
||||||
@ -29,6 +33,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
private readonly SpriteText levelText;
|
private readonly SpriteText levelText;
|
||||||
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
|
private readonly GradeBadge gradeSSPlus, gradeSS, gradeSPlus, gradeS, gradeA;
|
||||||
private readonly Box colourBar;
|
private readonly Box colourBar;
|
||||||
|
private readonly DrawableFlag countryFlag;
|
||||||
|
|
||||||
private const float cover_height = 350;
|
private const float cover_height = 350;
|
||||||
private const float info_height = 150;
|
private const float info_height = 150;
|
||||||
@ -114,16 +119,17 @@ namespace osu.Game.Overlays.Profile
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new LinkFlowContainer.LinkText
|
||||||
{
|
{
|
||||||
Text = user.Username,
|
Text = user.Username,
|
||||||
|
Url = $@"https://osu.ppy.sh/users/{user.Id}",
|
||||||
TextSize = 30,
|
TextSize = 30,
|
||||||
Font = @"Exo2.0-RegularItalic",
|
Font = @"Exo2.0-RegularItalic",
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Y = -48
|
Y = -48
|
||||||
},
|
},
|
||||||
new DrawableFlag(user.Country?.FlagName ?? "__")
|
countryFlag = new DrawableFlag(user.Country?.FlagName ?? "__")
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
@ -158,7 +164,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
ParagraphSpacing = 0.8f,
|
ParagraphSpacing = 0.8f,
|
||||||
LineSpacing = 0.2f
|
LineSpacing = 0.2f
|
||||||
},
|
},
|
||||||
infoTextRight = new OsuTextFlowContainer(t =>
|
infoTextRight = new LinkFlowContainer(t =>
|
||||||
{
|
{
|
||||||
t.TextSize = 14;
|
t.TextSize = 14;
|
||||||
t.Font = @"Exo2.0-RegularItalic";
|
t.Font = @"Exo2.0-RegularItalic";
|
||||||
@ -350,6 +356,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
{
|
{
|
||||||
infoTextLeft.AddText("from ");
|
infoTextLeft.AddText("from ");
|
||||||
infoTextLeft.AddText(user.Country.FullName, boldItalic);
|
infoTextLeft.AddText(user.Country.FullName, boldItalic);
|
||||||
|
countryFlag.FlagName = user.Country.FlagName;
|
||||||
}
|
}
|
||||||
infoTextLeft.NewParagraph();
|
infoTextLeft.NewParagraph();
|
||||||
|
|
||||||
@ -373,14 +380,22 @@ namespace osu.Game.Overlays.Profile
|
|||||||
infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic);
|
infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string websiteWithoutProtcol = user.Website;
|
||||||
|
if (!string.IsNullOrEmpty(websiteWithoutProtcol))
|
||||||
|
{
|
||||||
|
int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal);
|
||||||
|
if (protocolIndex >= 0)
|
||||||
|
websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2);
|
||||||
|
}
|
||||||
|
|
||||||
tryAddInfoRightLine(FontAwesome.fa_map_marker, user.Location);
|
tryAddInfoRightLine(FontAwesome.fa_map_marker, user.Location);
|
||||||
tryAddInfoRightLine(FontAwesome.fa_heart_o, user.Intrerests);
|
tryAddInfoRightLine(FontAwesome.fa_heart_o, user.Intrerests);
|
||||||
tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation);
|
tryAddInfoRightLine(FontAwesome.fa_suitcase, user.Occupation);
|
||||||
infoTextRight.NewParagraph();
|
infoTextRight.NewParagraph();
|
||||||
if (!string.IsNullOrEmpty(user.Twitter))
|
if (!string.IsNullOrEmpty(user.Twitter))
|
||||||
tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter);
|
tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
|
||||||
tryAddInfoRightLine(FontAwesome.fa_globe, user.Website);
|
tryAddInfoRightLine(FontAwesome.fa_globe, websiteWithoutProtcol, user.Website);
|
||||||
tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype);
|
tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat");
|
||||||
|
|
||||||
if (user.Statistics != null)
|
if (user.Statistics != null)
|
||||||
{
|
{
|
||||||
@ -390,7 +405,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
scoreText.Add(createScoreText("Ranked Score"));
|
scoreText.Add(createScoreText("Ranked Score"));
|
||||||
scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0")));
|
scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0")));
|
||||||
scoreText.Add(createScoreText("Accuracy"));
|
scoreText.Add(createScoreText("Accuracy"));
|
||||||
scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy}%"));
|
scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy.ToString("0.##", CultureInfo.CurrentCulture)}%"));
|
||||||
scoreText.Add(createScoreText("Play Count"));
|
scoreText.Add(createScoreText("Play Count"));
|
||||||
scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0")));
|
scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0")));
|
||||||
scoreText.Add(createScoreText("Total Score"));
|
scoreText.Add(createScoreText("Total Score"));
|
||||||
@ -433,12 +448,12 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Text = text
|
Text = text
|
||||||
};
|
};
|
||||||
|
|
||||||
private void tryAddInfoRightLine(FontAwesome icon, string str)
|
private void tryAddInfoRightLine(FontAwesome icon, string str, string url = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(str)) return;
|
if (string.IsNullOrEmpty(str)) return;
|
||||||
|
|
||||||
infoTextRight.AddIcon(icon);
|
infoTextRight.AddIcon(icon);
|
||||||
infoTextRight.AddText(" " + str);
|
infoTextRight.AddLink(" " + str, url);
|
||||||
infoTextRight.NewLine();
|
infoTextRight.NewLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -479,5 +494,51 @@ namespace osu.Game.Overlays.Profile
|
|||||||
badge.Texture = textures.Get($"Grades/{grade}");
|
badge.Texture = textures.Get($"Grades/{grade}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class LinkFlowContainer : OsuTextFlowContainer
|
||||||
|
{
|
||||||
|
public override bool HandleInput => true;
|
||||||
|
|
||||||
|
public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null) : base(defaultCreationParameters)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override SpriteText CreateSpriteText() => new LinkText();
|
||||||
|
|
||||||
|
public void AddLink(string text, string url) => AddText(text, link => ((LinkText)link).Url = url);
|
||||||
|
|
||||||
|
public class LinkText : OsuSpriteText
|
||||||
|
{
|
||||||
|
public override bool HandleInput => Url != null;
|
||||||
|
|
||||||
|
public string Url;
|
||||||
|
|
||||||
|
private Color4 hoverColour;
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
FadeColour(hoverColour, 500, EasingTypes.OutQuint);
|
||||||
|
return base.OnHover(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
FadeColour(Color4.White, 500, EasingTypes.OutQuint);
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(InputState state)
|
||||||
|
{
|
||||||
|
Process.Start(Url);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
hoverColour = colours.Yellow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
@ -26,11 +27,12 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
{
|
{
|
||||||
if (beatmap == value && beatmap != null)
|
if (beatmap == value && beatmap != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
beatmap = value;
|
beatmap = value;
|
||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
var newBackground = beatmap == null ? new Background(@"Backgrounds/bg1") : new BeatmapBackground(beatmap);
|
var newBackground = new BeatmapBackground(beatmap);
|
||||||
|
|
||||||
LoadComponentAsync(newBackground, delegate
|
LoadComponentAsync(newBackground, delegate
|
||||||
{
|
{
|
||||||
@ -51,7 +53,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap)
|
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
@ -80,9 +82,9 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Sprite.Texture = beatmap?.Background;
|
Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
Beatmap?.Track?.Stop();
|
Beatmap.Value.Track?.Stop();
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,13 +26,13 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
Background.FadeColour(Color4.DarkGray, 500);
|
Background.FadeColour(Color4.DarkGray, 500);
|
||||||
Beatmap?.Track?.Stop();
|
Beatmap.Value.Track?.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
{
|
{
|
||||||
Background.FadeColour(Color4.White, 500);
|
Background.FadeColour(Color4.White, 500);
|
||||||
Beatmap?.Track?.Start();
|
Beatmap.Value.Track?.Start();
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,8 +72,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||||
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||||
|
|
||||||
var trackManager = audio.Track;
|
|
||||||
|
|
||||||
BeatmapSetInfo setInfo = null;
|
BeatmapSetInfo setInfo = null;
|
||||||
|
|
||||||
if (!menuMusic)
|
if (!menuMusic)
|
||||||
@ -103,10 +101,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
beatmaps.GetChildren(setInfo);
|
beatmaps.GetChildren(setInfo);
|
||||||
Beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||||
|
|
||||||
track = Beatmap.Track;
|
track = Beatmap.Value.Track;
|
||||||
trackManager.SetExclusive(track);
|
|
||||||
|
|
||||||
welcome = audio.Sample.Get(@"welcome");
|
welcome = audio.Sample.Get(@"welcome");
|
||||||
seeya = audio.Sample.Get(@"seeya");
|
seeya = audio.Sample.Get(@"seeya");
|
||||||
@ -121,7 +118,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
Scheduler.AddDelayed(delegate
|
Scheduler.AddDelayed(delegate
|
||||||
{
|
{
|
||||||
track.Start();
|
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
|
||||||
|
if (menuMusic)
|
||||||
|
track.Start();
|
||||||
|
|
||||||
LoadComponentAsync(mainMenu = new MainMenu());
|
LoadComponentAsync(mainMenu = new MainMenu());
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Graphics.ES30;
|
using OpenTK.Graphics.ES30;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Batches;
|
using osu.Framework.Graphics.Batches;
|
||||||
@ -16,6 +15,7 @@ using osu.Framework.Graphics.Textures;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Menu
|
namespace osu.Game.Screens.Menu
|
||||||
{
|
{
|
||||||
@ -76,23 +76,24 @@ namespace osu.Game.Screens.Menu
|
|||||||
BlendingMode = BlendingMode.Additive;
|
BlendingMode = BlendingMode.Additive;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ShaderManager shaders, OsuGame game)
|
private void load(ShaderManager shaders, OsuGameBase game)
|
||||||
{
|
{
|
||||||
if (game?.Beatmap != null)
|
beatmap.BindTo(game.Beatmap);
|
||||||
beatmap.BindTo(game.Beatmap);
|
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||||
shader = shaders?.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAmplitudes()
|
private void updateAmplitudes()
|
||||||
{
|
{
|
||||||
float[] temporalAmplitudes = beatmap.Value?.Track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
|
var track = beatmap.Value.Track;
|
||||||
|
|
||||||
var effect = beatmap.Value?.Beatmap.ControlPointInfo.EffectPointAt(beatmap.Value.Track?.CurrentTime ?? Time.Current);
|
float[] temporalAmplitudes = track?.CurrentAmplitudes.FrequencyAmplitudes ?? new float[256];
|
||||||
|
|
||||||
|
var effect = beatmap.Value.Beatmap.ControlPointInfo.EffectPointAt(track?.CurrentTime ?? Time.Current);
|
||||||
|
|
||||||
for (int i = 0; i < bars_per_visualiser; i++)
|
for (int i = 0; i < bars_per_visualiser; i++)
|
||||||
{
|
{
|
||||||
if (beatmap?.Value?.Track?.IsRunning ?? false)
|
if (track?.IsRunning ?? false)
|
||||||
{
|
{
|
||||||
float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f);
|
float targetAmplitude = temporalAmplitudes[(i + indexOffset) % bars_per_visualiser] * (effect?.KiaiMode == true ? 1 : 0.5f);
|
||||||
if (targetAmplitude > frequencyAmplitudes[i])
|
if (targetAmplitude > frequencyAmplitudes[i])
|
||||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
private readonly BackgroundScreenDefault background;
|
private readonly BackgroundScreenDefault background;
|
||||||
private Screen songSelect;
|
private Screen songSelect;
|
||||||
|
|
||||||
|
private readonly MenuSideFlashes sideFlashes;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => background;
|
protected override BackgroundScreen CreateBackground() => background;
|
||||||
|
|
||||||
public MainMenu()
|
public MainMenu()
|
||||||
@ -49,10 +51,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
OnSolo = delegate { Push(consumeSongSelect()); },
|
OnSolo = delegate { Push(consumeSongSelect()); },
|
||||||
OnMulti = delegate { Push(new Lobby()); },
|
OnMulti = delegate { Push(new Lobby()); },
|
||||||
OnExit = delegate { Exit(); },
|
OnExit = delegate { Exit(); },
|
||||||
},
|
}
|
||||||
new MenuSideFlashes(),
|
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
sideFlashes = new MenuSideFlashes(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,12 +69,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
base.OnBeatmapChanged(beatmap);
|
|
||||||
background.Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void preloadSongSelect()
|
private void preloadSongSelect()
|
||||||
{
|
{
|
||||||
if (songSelect == null)
|
if (songSelect == null)
|
||||||
@ -90,16 +86,30 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
buttons.FadeInFromZero(500);
|
buttons.FadeInFromZero(500);
|
||||||
if (last is Intro && Beatmap != null)
|
|
||||||
|
var track = Beatmap.Value.Track;
|
||||||
|
var metadata = Beatmap.Value.Metadata;
|
||||||
|
|
||||||
|
if (last is Intro && track != null)
|
||||||
{
|
{
|
||||||
if (!Beatmap.Track.IsRunning)
|
if (!track.IsRunning)
|
||||||
{
|
{
|
||||||
Beatmap.Track.Seek(Beatmap.Metadata.PreviewTime);
|
track.Seek(metadata.PreviewTime);
|
||||||
if (Beatmap.Metadata.PreviewTime == -1)
|
if (metadata.PreviewTime == -1)
|
||||||
Beatmap.Track.Seek(Beatmap.Track.Length * 0.4f);
|
track.Seek(track.Length * 0.4f);
|
||||||
Beatmap.Track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += beatmap_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void beatmap_ValueChanged(WorkingBeatmap newValue)
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen)
|
||||||
|
return;
|
||||||
|
|
||||||
|
background.Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnSuspending(Screen next)
|
protected override void OnSuspending(Screen next)
|
||||||
@ -112,6 +122,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
Content.FadeOut(length, EasingTypes.InSine);
|
Content.FadeOut(length, EasingTypes.InSine);
|
||||||
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
Content.MoveTo(new Vector2(-800, 0), length, EasingTypes.InSine);
|
||||||
|
|
||||||
|
sideFlashes.FadeOut(length / 4, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
@ -129,6 +141,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
Content.FadeIn(length, EasingTypes.OutQuint);
|
Content.FadeIn(length, EasingTypes.OutQuint);
|
||||||
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
Content.MoveTo(new Vector2(0, 0), length, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
sideFlashes.FadeIn(length / 4, EasingTypes.InQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
|
@ -275,7 +275,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
const float scale_adjust_cutoff = 0.4f;
|
const float scale_adjust_cutoff = 0.4f;
|
||||||
const float velocity_adjust_cutoff = 0.98f;
|
const float velocity_adjust_cutoff = 0.98f;
|
||||||
|
|
||||||
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value?.Track?.CurrentAmplitudes.Maximum ?? 0 : 0;
|
var maxAmplitude = lastBeatIndex >= 0 ? Beatmap.Value.Track?.CurrentAmplitudes.Maximum ?? 0 : 0;
|
||||||
logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint);
|
logoAmplitudeContainer.ScaleTo(1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 75, EasingTypes.OutQuint);
|
||||||
|
|
||||||
if (maxAmplitude > velocity_adjust_cutoff)
|
if (maxAmplitude > velocity_adjust_cutoff)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -35,34 +36,31 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal virtual bool AllowBeatmapRulesetChange => true;
|
internal virtual bool AllowBeatmapRulesetChange => true;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
|
public WorkingBeatmap InitialBeatmap
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (IsLoaded) throw new InvalidOperationException($"Cannot set {nameof(InitialBeatmap)} post-load.");
|
||||||
|
Beatmap.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
private SampleChannel sampleExit;
|
private SampleChannel sampleExit;
|
||||||
|
|
||||||
public WorkingBeatmap Beatmap
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return beatmap.Value;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
beatmap.Value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
|
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
|
||||||
{
|
{
|
||||||
if (game != null)
|
if (game != null)
|
||||||
{
|
{
|
||||||
//if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap.
|
//if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap.
|
||||||
var localMap = beatmap.Value;
|
var localMap = Beatmap.Value;
|
||||||
beatmap.BindTo(game.Beatmap);
|
Beatmap.BindTo(game.Beatmap);
|
||||||
if (localMap != null)
|
if (localMap != null)
|
||||||
beatmap.Value = localMap;
|
Beatmap.Value = localMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
@ -71,20 +69,6 @@ namespace osu.Game.Screens
|
|||||||
sampleExit = audio.Sample.Get(@"UI/melodic-1");
|
sampleExit = audio.Sample.Get(@"UI/melodic-1");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
beatmap.ValueChanged += OnBeatmapChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The global Beatmap was changed.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
if (!IsCurrentScreen) return;
|
if (!IsCurrentScreen) return;
|
||||||
@ -94,7 +78,7 @@ namespace osu.Game.Screens
|
|||||||
// we only want to apply these restrictions when we are inside a screen stack.
|
// we only want to apply these restrictions when we are inside a screen stack.
|
||||||
// the use case for not applying is in visual/unit tests.
|
// the use case for not applying is in visual/unit tests.
|
||||||
ruleset.Disabled = !AllowBeatmapRulesetChange;
|
ruleset.Disabled = !AllowBeatmapRulesetChange;
|
||||||
beatmap.Disabled = !AllowBeatmapRulesetChange;
|
Beatmap.Disabled = !AllowBeatmapRulesetChange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,8 +94,6 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
BackgroundScreen bg = CreateBackground();
|
BackgroundScreen bg = CreateBackground();
|
||||||
|
|
||||||
OnBeatmapChanged(Beatmap);
|
|
||||||
|
|
||||||
if (lastOsu?.Background != null)
|
if (lastOsu?.Background != null)
|
||||||
{
|
{
|
||||||
if (bg == null || lastOsu.Background.Equals(bg))
|
if (bg == null || lastOsu.Background.Equals(bg))
|
||||||
@ -156,11 +138,7 @@ namespace osu.Game.Screens
|
|||||||
if (base.OnExiting(next))
|
if (base.OnExiting(next))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// while this is not necessary as we are constructing our own bindable, there are cases where
|
Beatmap.UnbindAll();
|
||||||
// the GC doesn't run as fast as expected and this is triggered post-exit.
|
|
||||||
// added to resolve https://github.com/ppy/osu/issues/829
|
|
||||||
beatmap.ValueChanged -= OnBeatmapChanged;
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor;
|
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor;
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
internal override bool AllowBeatmapRulesetChange => false;
|
internal override bool AllowBeatmapRulesetChange => false;
|
||||||
@ -69,6 +67,8 @@ namespace osu.Game.Screens.Play
|
|||||||
private HUDOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
|
|
||||||
|
private bool loadedSuccessfully => HitRenderer?.Objects.Any() == true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu)
|
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuConfigManager config, OsuGame osu)
|
||||||
{
|
{
|
||||||
@ -81,24 +81,25 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Beatmap == null)
|
if (!Beatmap.Value.FullyLoaded)
|
||||||
Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
|
// we need to ensure extras like storyboards are loaded.
|
||||||
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true);
|
||||||
|
|
||||||
if (Beatmap?.Beatmap == null)
|
if (Beatmap.Value.Beatmap == null)
|
||||||
throw new InvalidOperationException("Beatmap was not loaded");
|
throw new InvalidOperationException("Beatmap was not loaded");
|
||||||
|
|
||||||
ruleset = osu?.Ruleset.Value ?? Beatmap.BeatmapInfo.Ruleset;
|
ruleset = osu?.Ruleset.Value ?? Beatmap.Value.BeatmapInfo.Ruleset;
|
||||||
rulesetInstance = ruleset.CreateInstance();
|
rulesetInstance = ruleset.CreateInstance();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, ruleset.ID == Beatmap.BeatmapInfo.Ruleset.ID);
|
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, ruleset.ID == Beatmap.Value.BeatmapInfo.Ruleset.ID);
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException)
|
catch (BeatmapInvalidForRulesetException)
|
||||||
{
|
{
|
||||||
// we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset
|
// we may fail to create a HitRenderer if the beatmap cannot be loaded with the user's preferred ruleset
|
||||||
// let's try again forcing the beatmap's ruleset.
|
// let's try again forcing the beatmap's ruleset.
|
||||||
ruleset = Beatmap.BeatmapInfo.Ruleset;
|
ruleset = Beatmap.Value.BeatmapInfo.Ruleset;
|
||||||
rulesetInstance = ruleset.CreateInstance();
|
rulesetInstance = ruleset.CreateInstance();
|
||||||
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, true);
|
HitRenderer = rulesetInstance.CreateHitRendererWith(Beatmap, true);
|
||||||
}
|
}
|
||||||
@ -115,22 +116,11 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Track track = Beatmap.Track;
|
adjustableSourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||||
|
|
||||||
if (track != null)
|
|
||||||
{
|
|
||||||
audio.Track.SetExclusive(track);
|
|
||||||
adjustableSourceClock = track;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
adjustableSourceClock = new StopwatchClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
|
||||||
|
|
||||||
var firstObjectTime = HitRenderer.Objects.First().StartTime;
|
var firstObjectTime = HitRenderer.Objects.First().StartTime;
|
||||||
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, Beatmap.BeatmapInfo.AudioLeadIn)));
|
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(Beatmap.Value.Beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, Beatmap.Value.BeatmapInfo.AudioLeadIn)));
|
||||||
decoupledClock.ProcessFrame();
|
decoupledClock.ProcessFrame();
|
||||||
|
|
||||||
offsetClock = new FramedOffsetClock(decoupledClock);
|
offsetClock = new FramedOffsetClock(decoupledClock);
|
||||||
@ -143,7 +133,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
adjustableSourceClock.Reset();
|
adjustableSourceClock.Reset();
|
||||||
|
|
||||||
foreach (var mod in Beatmap.Mods.Value.OfType<IApplicableToClock>())
|
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToClock>())
|
||||||
mod.ApplyToClock(adjustableSourceClock);
|
mod.ApplyToClock(adjustableSourceClock);
|
||||||
|
|
||||||
decoupledClock.ChangeSource(adjustableSourceClock);
|
decoupledClock.ChangeSource(adjustableSourceClock);
|
||||||
@ -211,7 +201,7 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded;
|
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded;
|
||||||
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
||||||
|
|
||||||
hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods);
|
hudOverlay.ModDisplay.Current.BindTo(Beatmap.Value.Mods);
|
||||||
|
|
||||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||||
HitRenderer.OnAllJudged += onCompletion;
|
HitRenderer.OnAllJudged += onCompletion;
|
||||||
@ -244,7 +234,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
var score = new Score
|
var score = new Score
|
||||||
{
|
{
|
||||||
Beatmap = Beatmap.BeatmapInfo,
|
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||||
Ruleset = ruleset
|
Ruleset = ruleset
|
||||||
};
|
};
|
||||||
scoreProcessor.PopulateScore(score);
|
scoreProcessor.PopulateScore(score);
|
||||||
@ -267,6 +257,9 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
|
if (!loadedSuccessfully)
|
||||||
|
return;
|
||||||
|
|
||||||
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint);
|
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, EasingTypes.OutQuint);
|
||||||
Background?.FadeTo(1 - (float)dimLevel, 1500, EasingTypes.OutQuint);
|
Background?.FadeTo(1 - (float)dimLevel, 1500, EasingTypes.OutQuint);
|
||||||
|
|
||||||
@ -306,7 +299,11 @@ namespace osu.Game.Screens.Play
|
|||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
pauseContainer.Pause();
|
if (loadedSuccessfully)
|
||||||
|
{
|
||||||
|
pauseContainer.Pause();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
this.player = player;
|
this.player = player;
|
||||||
|
|
||||||
player.RestartRequested = () => {
|
player.RestartRequested = () =>
|
||||||
|
{
|
||||||
showOverlays = false;
|
showOverlays = false;
|
||||||
ValidForResume = true;
|
ValidForResume = true;
|
||||||
};
|
};
|
||||||
@ -74,7 +75,6 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
RestartCount = player.RestartCount + 1,
|
RestartCount = player.RestartCount + 1,
|
||||||
RestartRequested = player.RestartRequested,
|
RestartRequested = player.RestartRequested,
|
||||||
Beatmap = player.Beatmap,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Delay(400);
|
Delay(400);
|
||||||
|
@ -12,7 +12,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class SongProgress : OverlayContainer
|
public class SongProgress : OverlayContainer
|
||||||
@ -50,6 +49,9 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
info.StartTime = firstHitTime;
|
info.StartTime = firstHitTime;
|
||||||
info.EndTime = lastHitTime;
|
info.EndTime = lastHitTime;
|
||||||
|
|
||||||
|
bar.StartTime = firstHitTime;
|
||||||
|
bar.EndTime = lastHitTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +91,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
SeekRequested = delegate (float position)
|
OnSeek = position => OnSeek?.Invoke(position),
|
||||||
{
|
|
||||||
OnSeek?.Invoke(firstHitTime + position * (lastHitTime - firstHitTime));
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -144,11 +143,12 @@ namespace osu.Game.Screens.Play
|
|||||||
if (objects == null)
|
if (objects == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double progress = ((audioClock?.CurrentTime ?? Time.Current) - firstHitTime) / (lastHitTime - firstHitTime);
|
double position = audioClock?.CurrentTime ?? Time.Current;
|
||||||
|
double progress = (position - firstHitTime) / (lastHitTime - firstHitTime);
|
||||||
|
|
||||||
if (progress < 1)
|
if (progress < 1)
|
||||||
{
|
{
|
||||||
bar.UpdatePosition((float)progress);
|
bar.CurrentTime = position;
|
||||||
graph.Progress = (int)(graph.ColumnCount * progress);
|
graph.Progress = (int)(graph.ColumnCount * progress);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,74 +1,117 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Overlays;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class SongProgressBar : DragBar
|
public class SongProgressBar : SliderBar<double>
|
||||||
{
|
{
|
||||||
|
public Action<double> OnSeek;
|
||||||
|
|
||||||
|
private readonly Box fill;
|
||||||
|
private readonly Container handleBase;
|
||||||
|
|
||||||
public Color4 FillColour
|
public Color4 FillColour
|
||||||
{
|
{
|
||||||
get { return Fill.Colour; }
|
set { fill.Colour = value; }
|
||||||
set { Fill.Colour = value; }
|
}
|
||||||
|
|
||||||
|
public double StartTime
|
||||||
|
{
|
||||||
|
set { CurrentNumber.MinValue = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public double EndTime
|
||||||
|
{
|
||||||
|
set { CurrentNumber.MaxValue = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public double CurrentTime
|
||||||
|
{
|
||||||
|
set { CurrentNumber.Value = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize)
|
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize)
|
||||||
{
|
{
|
||||||
|
CurrentNumber.MinValue = 0;
|
||||||
|
CurrentNumber.MaxValue = 1;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = barHeight + handleBarHeight + handleSize.Y;
|
Height = barHeight + handleBarHeight + handleSize.Y;
|
||||||
|
|
||||||
Fill.RelativeSizeAxes = Axes.X;
|
Children = new Drawable[]
|
||||||
Fill.Height = barHeight;
|
|
||||||
|
|
||||||
Add(new Box
|
|
||||||
{
|
{
|
||||||
Name = "Background",
|
new Box
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
Height = barHeight,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
Alpha = 0.5f,
|
|
||||||
Depth = 1
|
|
||||||
});
|
|
||||||
|
|
||||||
Fill.Add(new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomRight,
|
|
||||||
Anchor = Anchor.BottomRight,
|
|
||||||
Width = 2,
|
|
||||||
Height = barHeight + handleBarHeight,
|
|
||||||
Colour = Color4.White,
|
|
||||||
Position = new Vector2(2, 0),
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Box
|
Name = "Background",
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = barHeight,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
Depth = 1,
|
||||||
|
},
|
||||||
|
fill = new Box
|
||||||
|
{
|
||||||
|
Name = "Fill",
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Height = barHeight,
|
||||||
|
},
|
||||||
|
handleBase = new Container
|
||||||
|
{
|
||||||
|
Name = "HandleBar container",
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Width = 2,
|
||||||
|
Height = barHeight + handleBarHeight,
|
||||||
|
Colour = Color4.White,
|
||||||
|
Position = new Vector2(2, 0),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Box
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Size = handleSize,
|
|
||||||
CornerRadius = 5,
|
|
||||||
Masking = true,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Box
|
Name = "HandleBar box",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Name = "Handle container",
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Size = handleSize,
|
||||||
|
CornerRadius = 5,
|
||||||
|
Masking = true,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Box
|
||||||
Colour = Color4.White
|
{
|
||||||
|
Name = "Handle box",
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateValue(float value)
|
||||||
|
{
|
||||||
|
var xFill = value * UsableWidth;
|
||||||
|
fill.Width = xFill;
|
||||||
|
handleBase.MoveToX(xFill);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0.2f,
|
Alpha = 0.2f,
|
||||||
Texture = Beatmap?.Background,
|
Texture = Beatmap.Value.Background,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill
|
FillMode = FillMode.Fill
|
||||||
|
@ -137,6 +137,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
selectedGroup = null;
|
selectedGroup = null;
|
||||||
selectedPanel = null;
|
selectedPanel = null;
|
||||||
|
SelectionChanged?.Invoke(null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +285,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private void load(BeatmapDatabase database, OsuConfigManager config)
|
private void load(BeatmapDatabase database, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
this.database = database;
|
this.database = database;
|
||||||
|
|
||||||
randomType = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType);
|
randomType = config.GetBindable<SelectionRandomType>(OsuSetting.SelectionRandomType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,12 @@ namespace osu.Game.Screens.Select
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool HideOnEscape => false;
|
protected override bool HideOnEscape => false;
|
||||||
|
|
||||||
protected override bool BlockPassThroughMouse => false;
|
protected override bool BlockPassThroughMouse => false;
|
||||||
@ -63,18 +69,6 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
public void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
if (beatmap?.BeatmapInfo == null)
|
|
||||||
{
|
|
||||||
State = Visibility.Hidden;
|
|
||||||
beatmapInfoContainer?.FadeOut(250);
|
|
||||||
beatmapInfoContainer?.Expire();
|
|
||||||
beatmapInfoContainer = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
State = Visibility.Visible;
|
|
||||||
AlwaysPresent = true;
|
|
||||||
|
|
||||||
var lastContainer = beatmapInfoContainer;
|
var lastContainer = beatmapInfoContainer;
|
||||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -31,7 +32,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public Action OnBack;
|
public Action OnBack;
|
||||||
public Action OnStart;
|
public Action OnStart;
|
||||||
|
|
||||||
private readonly FillFlowContainer buttons;
|
private readonly FillFlowContainer<FooterButton> buttons;
|
||||||
|
|
||||||
public OsuLogo StartButton;
|
public OsuLogo StartButton;
|
||||||
|
|
||||||
@ -43,29 +44,21 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <para>Higher depth to be put on the left, and lower to be put on the right.</para>
|
/// <para>Higher depth to be put on the left, and lower to be put on the right.</para>
|
||||||
/// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para>
|
/// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para>
|
||||||
/// </param>
|
/// </param>
|
||||||
public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0)
|
public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) => buttons.Add(new FooterButton
|
||||||
{
|
{
|
||||||
var button = new FooterButton
|
Text = text,
|
||||||
{
|
Height = play_song_select_button_height,
|
||||||
Text = text,
|
Width = play_song_select_button_width,
|
||||||
Height = play_song_select_button_height,
|
Depth = depth,
|
||||||
Width = play_song_select_button_width,
|
SelectedColour = colour,
|
||||||
Depth = depth,
|
DeselectedColour = colour.Opacity(0.5f),
|
||||||
SelectedColour = colour,
|
Hotkey = hotkey,
|
||||||
DeselectedColour = colour.Opacity(0.5f),
|
Hovered = updateModeLight,
|
||||||
Hotkey = hotkey,
|
HoverLost = updateModeLight,
|
||||||
};
|
Action = action,
|
||||||
|
});
|
||||||
|
|
||||||
button.Hovered = () => updateModeLight(button);
|
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||||
button.HoverLost = () => updateModeLight();
|
|
||||||
button.Action = action;
|
|
||||||
buttons.Add(button);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateModeLight(FooterButton button = null)
|
|
||||||
{
|
|
||||||
modeLight.FadeColour(button?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Footer()
|
public Footer()
|
||||||
{
|
{
|
||||||
@ -111,7 +104,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Spacing = new Vector2(padding, 0),
|
Spacing = new Vector2(padding, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
buttons = new FillFlowContainer
|
buttons = new FillFlowContainer<FooterButton>
|
||||||
{
|
{
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(0.2f, 0),
|
Spacing = new Vector2(0.2f, 0),
|
||||||
|
@ -59,21 +59,20 @@ namespace osu.Game.Screens.Select
|
|||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
Push(new Editor());
|
Push(new Editor());
|
||||||
}, Key.Number3);
|
}, Key.Number3);
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += beatmap_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
private void beatmap_ValueChanged(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
beatmap?.Mods.BindTo(modSelect.SelectedMods);
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
if (Beatmap?.Track != null)
|
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
||||||
Beatmap.Track.Looping = false;
|
|
||||||
|
|
||||||
beatmapDetails.Beatmap = beatmap;
|
beatmapDetails.Beatmap = beatmap;
|
||||||
|
|
||||||
if (beatmap?.Track != null)
|
if (beatmap.Track != null)
|
||||||
beatmap.Track.Looping = true;
|
beatmap.Track.Looping = true;
|
||||||
|
|
||||||
base.OnBeatmapChanged(beatmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
@ -83,7 +82,7 @@ namespace osu.Game.Screens.Select
|
|||||||
modSelect.SelectedMods.Value = originalMods;
|
modSelect.SelectedMods.Value = originalMods;
|
||||||
originalMods = null;
|
originalMods = null;
|
||||||
|
|
||||||
Beatmap.Track.Looping = true;
|
Beatmap.Value.Track.Looping = true;
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
@ -106,8 +105,8 @@ namespace osu.Game.Screens.Select
|
|||||||
if (base.OnExiting(next))
|
if (base.OnExiting(next))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (Beatmap?.Track != null)
|
if (Beatmap.Value.Track != null)
|
||||||
Beatmap.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -125,12 +124,9 @@ namespace osu.Game.Screens.Select
|
|||||||
modSelect.SelectedMods.Value = originalMods.Concat(new[] { auto });
|
modSelect.SelectedMods.Value = originalMods.Concat(new[] { auto });
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
|
||||||
LoadComponentAsync(player = new PlayerLoader(new Player
|
LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
|
||||||
{
|
|
||||||
Beatmap = Beatmap, //eagerly set this so it's present before push.
|
|
||||||
}), l => Push(player));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mod findAutoMod(IEnumerable<Mod> mods)
|
private Mod findAutoMod(IEnumerable<Mod> mods)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
@ -28,10 +29,9 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||||
private BeatmapDatabase database;
|
private BeatmapDatabase database;
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
||||||
|
|
||||||
private readonly BeatmapCarousel carousel;
|
private readonly BeatmapCarousel carousel;
|
||||||
private TrackManager trackManager;
|
|
||||||
private DialogOverlay dialogOverlay;
|
private DialogOverlay dialogOverlay;
|
||||||
|
|
||||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||||
@ -107,8 +107,9 @@ namespace osu.Game.Screens.Select
|
|||||||
Size = new Vector2(carousel_width, 1),
|
Size = new Vector2(carousel_width, 1),
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
SelectionChanged = selectionChanged,
|
SelectionChanged = carouselSelectionChanged,
|
||||||
StartRequested = raiseSelect
|
BeatmapsChanged = carouselBeatmapsLoaded,
|
||||||
|
StartRequested = carouselRaisedStart
|
||||||
});
|
});
|
||||||
Add(FilterControl = new FilterControl
|
Add(FilterControl = new FilterControl
|
||||||
{
|
{
|
||||||
@ -127,7 +128,6 @@ namespace osu.Game.Screens.Select
|
|||||||
Top = left_area_padding,
|
Top = left_area_padding,
|
||||||
Right = left_area_padding,
|
Right = left_area_padding,
|
||||||
},
|
},
|
||||||
X = -50,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ShowFooter)
|
if (ShowFooter)
|
||||||
@ -146,7 +146,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Add(Footer = new Footer
|
Add(Footer = new Footer
|
||||||
{
|
{
|
||||||
OnBack = Exit,
|
OnBack = Exit,
|
||||||
OnStart = raiseSelect,
|
OnStart = carouselRaisedStart,
|
||||||
});
|
});
|
||||||
|
|
||||||
FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
|
FooterPanels.Add(BeatmapOptions = new BeatmapOptionsOverlay());
|
||||||
@ -173,7 +173,6 @@ namespace osu.Game.Screens.Select
|
|||||||
database.BeatmapSetAdded += onBeatmapSetAdded;
|
database.BeatmapSetAdded += onBeatmapSetAdded;
|
||||||
database.BeatmapSetRemoved += onBeatmapSetRemoved;
|
database.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||||
|
|
||||||
trackManager = audio.Track;
|
|
||||||
dialogOverlay = dialog;
|
dialogOverlay = dialog;
|
||||||
|
|
||||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||||
@ -181,34 +180,79 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
initialAddSetsTask = new CancellationTokenSource();
|
initialAddSetsTask = new CancellationTokenSource();
|
||||||
|
|
||||||
carousel.BeatmapsChanged = beatmapsLoaded;
|
|
||||||
carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending);
|
carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending);
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += beatmap_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapsLoaded()
|
private void carouselBeatmapsLoaded()
|
||||||
{
|
{
|
||||||
if (Beatmap != null)
|
if (Beatmap.Value != null && Beatmap.Value.BeatmapSetInfo?.DeletePending != false)
|
||||||
carousel.SelectBeatmap(Beatmap.BeatmapInfo, false);
|
carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false);
|
||||||
else
|
else
|
||||||
carousel.SelectNext();
|
carousel.SelectNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void raiseSelect()
|
private void carouselRaisedStart()
|
||||||
{
|
{
|
||||||
var pendingSelection = selectionChangedDebounce;
|
var pendingSelection = selectionChangedDebounce;
|
||||||
selectionChangedDebounce = null;
|
selectionChangedDebounce = null;
|
||||||
|
|
||||||
if (pendingSelection?.Completed == false)
|
if (pendingSelection?.Completed == false)
|
||||||
{
|
{
|
||||||
pendingSelection?.RunTask();
|
pendingSelection.RunTask();
|
||||||
pendingSelection?.Cancel(); // cancel the already scheduled task.
|
pendingSelection.Cancel(); // cancel the already scheduled task.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Beatmap == null) return;
|
|
||||||
|
|
||||||
OnSelected();
|
OnSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ScheduledDelegate selectionChangedDebounce;
|
||||||
|
|
||||||
|
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||||
|
private BeatmapInfo beatmapNoDebounce;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
|
/// </summary>
|
||||||
|
private void carouselSelectionChanged(BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
Action performLoad = delegate
|
||||||
|
{
|
||||||
|
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value.BeatmapInfo.BeatmapSetInfoID;
|
||||||
|
|
||||||
|
Beatmap.Value = database.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
|
|
||||||
|
ensurePlayingSelected(preview);
|
||||||
|
changeBackground(Beatmap.Value);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (beatmap == null)
|
||||||
|
{
|
||||||
|
if (!Beatmap.IsDefault)
|
||||||
|
performLoad();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectionChangedDebounce?.Cancel();
|
||||||
|
|
||||||
|
if (beatmap.Equals(beatmapNoDebounce))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (beatmap.BeatmapSetInfoID == beatmapNoDebounce?.BeatmapSetInfoID)
|
||||||
|
sampleChangeDifficulty.Play();
|
||||||
|
else
|
||||||
|
sampleChangeBeatmap.Play();
|
||||||
|
|
||||||
|
beatmapNoDebounce = beatmap;
|
||||||
|
|
||||||
|
if (beatmap == Beatmap.Value.BeatmapInfo)
|
||||||
|
performLoad();
|
||||||
|
else
|
||||||
|
selectionChangedDebounce = Scheduler.AddDelayed(performLoad, 100);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void triggerRandom(UserInputManager input)
|
private void triggerRandom(UserInputManager input)
|
||||||
{
|
{
|
||||||
if (input.CurrentState.Keyboard.ShiftPressed)
|
if (input.CurrentState.Keyboard.ShiftPressed)
|
||||||
@ -231,23 +275,27 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override void OnEntering(Screen last)
|
protected override void OnEntering(Screen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
ensurePlayingSelected();
|
|
||||||
|
|
||||||
changeBackground(Beatmap);
|
|
||||||
|
|
||||||
selectionChangeNoBounce = Beatmap?.BeatmapInfo;
|
|
||||||
|
|
||||||
Content.FadeInFromZero(250);
|
Content.FadeInFromZero(250);
|
||||||
|
|
||||||
beatmapInfoWedge.State = Visibility.Visible;
|
|
||||||
|
|
||||||
FilterControl.Activate();
|
FilterControl.Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void beatmap_ValueChanged(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
if (!IsCurrentScreen) return;
|
||||||
|
|
||||||
|
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
changeBackground(Beatmap);
|
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||||
ensurePlayingSelected();
|
{
|
||||||
|
changeBackground(Beatmap);
|
||||||
|
ensurePlayingSelected();
|
||||||
|
}
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
|
||||||
Content.FadeIn(250);
|
Content.FadeIn(250);
|
||||||
@ -300,61 +348,17 @@ namespace osu.Game.Screens.Select
|
|||||||
backgroundModeBeatmap.FadeTo(1, 250);
|
backgroundModeBeatmap.FadeTo(1, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
beatmapInfoWedge.State = Visibility.Visible;
|
||||||
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
beatmapInfoWedge.UpdateBeatmap(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The global Beatmap was changed.
|
|
||||||
/// </summary>
|
|
||||||
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
|
||||||
{
|
|
||||||
base.OnBeatmapChanged(beatmap);
|
|
||||||
|
|
||||||
//todo: change background in selectionChanged instead; support per-difficulty backgrounds.
|
|
||||||
changeBackground(beatmap);
|
|
||||||
carousel.SelectBeatmap(beatmap?.BeatmapInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private ScheduledDelegate selectionChangedDebounce;
|
|
||||||
|
|
||||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
|
||||||
private BeatmapInfo selectionChangeNoBounce;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// selection has been changed as the result of interaction with the carousel.
|
|
||||||
/// </summary>
|
|
||||||
private void selectionChanged(BeatmapInfo beatmap)
|
|
||||||
{
|
|
||||||
selectionChangedDebounce?.Cancel();
|
|
||||||
|
|
||||||
if (beatmap.Equals(Beatmap?.BeatmapInfo))
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool preview = beatmap.BeatmapSetInfoID != Beatmap?.BeatmapInfo.BeatmapSetInfoID;
|
|
||||||
|
|
||||||
if (beatmap.BeatmapSetInfoID == selectionChangeNoBounce?.BeatmapSetInfoID)
|
|
||||||
sampleChangeDifficulty.Play();
|
|
||||||
else
|
|
||||||
sampleChangeBeatmap.Play();
|
|
||||||
|
|
||||||
selectionChangeNoBounce = beatmap;
|
|
||||||
|
|
||||||
selectionChangedDebounce = Scheduler.AddDelayed(delegate
|
|
||||||
{
|
|
||||||
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
|
|
||||||
ensurePlayingSelected(preview);
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensurePlayingSelected(bool preview = false)
|
private void ensurePlayingSelected(bool preview = false)
|
||||||
{
|
{
|
||||||
Track track = Beatmap?.Track;
|
Track track = Beatmap.Value.Track;
|
||||||
|
|
||||||
if (track != null)
|
if (!track.IsRunning)
|
||||||
{
|
{
|
||||||
trackManager.SetExclusive(track);
|
if (preview) track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
||||||
if (preview)
|
|
||||||
track.Seek(Beatmap.Metadata.PreviewTime);
|
|
||||||
track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -363,7 +367,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
carousel.RemoveBeatmap(beatmapSet);
|
carousel.RemoveBeatmap(beatmapSet);
|
||||||
if (carousel.SelectedBeatmap == null)
|
if (carousel.SelectedBeatmap == null)
|
||||||
Beatmap = null;
|
Beatmap.SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void promptDelete()
|
private void promptDelete()
|
||||||
@ -380,7 +384,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
case Key.KeypadEnter:
|
case Key.KeypadEnter:
|
||||||
case Key.Enter:
|
case Key.Enter:
|
||||||
raiseSelect();
|
carouselRaisedStart();
|
||||||
return true;
|
return true;
|
||||||
case Key.Delete:
|
case Key.Delete:
|
||||||
if (state.Keyboard.ShiftPressed)
|
if (state.Keyboard.ShiftPressed)
|
||||||
|
@ -76,6 +76,7 @@
|
|||||||
<Compile Include="Audio\SampleInfoList.cs" />
|
<Compile Include="Audio\SampleInfoList.cs" />
|
||||||
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
|
||||||
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
<Compile Include="Beatmaps\DifficultyCalculator.cs" />
|
||||||
|
<Compile Include="Beatmaps\DummyWorkingBeatmap.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
||||||
@ -230,7 +231,6 @@
|
|||||||
<Compile Include="Online\API\Requests\GetScoresRequest.cs" />
|
<Compile Include="Online\API\Requests\GetScoresRequest.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetBeatmapDetailsRequest.cs" />
|
<Compile Include="Online\API\Requests\GetBeatmapDetailsRequest.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
<Compile Include="Online\API\Requests\GetUserRequest.cs" />
|
||||||
<Compile Include="Overlays\DragBar.cs" />
|
|
||||||
<Compile Include="Overlays\LoginOverlay.cs" />
|
<Compile Include="Overlays\LoginOverlay.cs" />
|
||||||
<Compile Include="Overlays\MusicController.cs" />
|
<Compile Include="Overlays\MusicController.cs" />
|
||||||
<Compile Include="Beatmaps\Beatmap.cs" />
|
<Compile Include="Beatmaps\Beatmap.cs" />
|
||||||
|
Reference in New Issue
Block a user