mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 18:47:27 +08:00
Merge branch 'master' into replay-recording
This commit is contained in:
commit
800e395bc8
@ -3,24 +3,17 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
public class ManiaModRandom : Mod, IApplicableToBeatmap
|
public class ManiaModRandom : ModRandom, IApplicableToBeatmap
|
||||||
{
|
{
|
||||||
public override string Name => "Random";
|
|
||||||
public override string Acronym => "RD";
|
|
||||||
public override ModType Type => ModType.Conversion;
|
|
||||||
public override IconUsage? Icon => OsuIcon.Dice;
|
|
||||||
public override string Description => @"Shuffle around the keys!";
|
public override string Description => @"Shuffle around the keys!";
|
||||||
public override double ScoreMultiplier => 1;
|
|
||||||
|
|
||||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
27
osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs
Normal file
27
osu.Game.Rulesets.Taiko/Mods/TaikoModRandom.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Taiko.Mods
|
||||||
|
{
|
||||||
|
public class TaikoModRandom : ModRandom, IApplicableToBeatmap
|
||||||
|
{
|
||||||
|
public override string Description => @"Shuffle around the colours!";
|
||||||
|
|
||||||
|
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
var taikoBeatmap = (TaikoBeatmap)beatmap;
|
||||||
|
|
||||||
|
foreach (var obj in taikoBeatmap.HitObjects)
|
||||||
|
{
|
||||||
|
if (obj is Hit hit)
|
||||||
|
hit.Type = RNG.Next(2) == 0 ? HitType.Centre : HitType.Rim;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -114,6 +114,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
case ModType.Conversion:
|
case ModType.Conversion:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
|
new TaikoModRandom(),
|
||||||
new TaikoModDifficultyAdjust(),
|
new TaikoModDifficultyAdjust(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,34 +26,34 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
var storyboard = decoder.Decode(stream);
|
var storyboard = decoder.Decode(stream);
|
||||||
|
|
||||||
Assert.IsTrue(storyboard.HasDrawable);
|
Assert.IsTrue(storyboard.HasDrawable);
|
||||||
Assert.AreEqual(4, storyboard.Layers.Count());
|
Assert.AreEqual(5, storyboard.Layers.Count());
|
||||||
|
|
||||||
StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
|
StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
|
||||||
Assert.IsNotNull(background);
|
Assert.IsNotNull(background);
|
||||||
Assert.AreEqual(16, background.Elements.Count);
|
Assert.AreEqual(16, background.Elements.Count);
|
||||||
Assert.IsTrue(background.EnabledWhenFailing);
|
Assert.IsTrue(background.VisibleWhenFailing);
|
||||||
Assert.IsTrue(background.EnabledWhenPassing);
|
Assert.IsTrue(background.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Background", background.Name);
|
Assert.AreEqual("Background", background.Name);
|
||||||
|
|
||||||
StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
|
StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
|
||||||
Assert.IsNotNull(fail);
|
Assert.IsNotNull(fail);
|
||||||
Assert.AreEqual(0, fail.Elements.Count);
|
Assert.AreEqual(0, fail.Elements.Count);
|
||||||
Assert.IsTrue(fail.EnabledWhenFailing);
|
Assert.IsTrue(fail.VisibleWhenFailing);
|
||||||
Assert.IsFalse(fail.EnabledWhenPassing);
|
Assert.IsFalse(fail.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Fail", fail.Name);
|
Assert.AreEqual("Fail", fail.Name);
|
||||||
|
|
||||||
StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
|
StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
|
||||||
Assert.IsNotNull(pass);
|
Assert.IsNotNull(pass);
|
||||||
Assert.AreEqual(0, pass.Elements.Count);
|
Assert.AreEqual(0, pass.Elements.Count);
|
||||||
Assert.IsFalse(pass.EnabledWhenFailing);
|
Assert.IsFalse(pass.VisibleWhenFailing);
|
||||||
Assert.IsTrue(pass.EnabledWhenPassing);
|
Assert.IsTrue(pass.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Pass", pass.Name);
|
Assert.AreEqual("Pass", pass.Name);
|
||||||
|
|
||||||
StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
|
StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
|
||||||
Assert.IsNotNull(foreground);
|
Assert.IsNotNull(foreground);
|
||||||
Assert.AreEqual(151, foreground.Elements.Count);
|
Assert.AreEqual(151, foreground.Elements.Count);
|
||||||
Assert.IsTrue(foreground.EnabledWhenFailing);
|
Assert.IsTrue(foreground.VisibleWhenFailing);
|
||||||
Assert.IsTrue(foreground.EnabledWhenPassing);
|
Assert.IsTrue(foreground.VisibleWhenPassing);
|
||||||
Assert.AreEqual("Foreground", foreground.Name);
|
Assert.AreEqual("Foreground", foreground.Name);
|
||||||
|
|
||||||
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
||||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
|
|
||||||
introStack.Push(CreateScreen());
|
introStack.Push(CreateScreen());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddUntilStep("wait for menu", () => introStack.CurrentScreen is MainMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IScreen CreateScreen();
|
protected abstract IScreen CreateScreen();
|
||||||
|
@ -6,7 +6,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
@ -51,8 +50,6 @@ namespace osu.Game.Tests
|
|||||||
|
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
|
|
||||||
protected override VideoSprite GetVideo() => null;
|
|
||||||
|
|
||||||
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
|
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
|
||||||
|
|
||||||
protected override Track GetTrack() => trackStore.Get(firstAudioFile);
|
protected override Track GetTrack() => trackStore.Get(firstAudioFile);
|
||||||
|
@ -14,7 +14,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Framework.Lists;
|
using osu.Framework.Lists;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
@ -403,7 +402,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => beatmap;
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
protected override VideoSprite GetVideo() => null;
|
|
||||||
protected override Track GetTrack() => null;
|
protected override Track GetTrack() => null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ using System.Linq;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
@ -67,24 +66,6 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override VideoSprite GetVideo()
|
|
||||||
{
|
|
||||||
if (Metadata?.VideoFile == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var stream = textureStore.GetStream(getPathForFile(Metadata.VideoFile));
|
|
||||||
|
|
||||||
return stream == null ? null : new VideoSprite(stream);
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Logger.Error(e, "Video failed to load");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Track GetTrack()
|
protected override Track GetTrack()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -52,7 +52,6 @@ namespace osu.Game.Beatmaps
|
|||||||
public int PreviewTime { get; set; }
|
public int PreviewTime { get; set; }
|
||||||
public string AudioFile { get; set; }
|
public string AudioFile { get; set; }
|
||||||
public string BackgroundFile { get; set; }
|
public string BackgroundFile { get; set; }
|
||||||
public string VideoFile { get; set; }
|
|
||||||
|
|
||||||
public override string ToString() => $"{Artist} - {Title} ({Author})";
|
public override string ToString() => $"{Artist} - {Title} ({Author})";
|
||||||
|
|
||||||
@ -82,8 +81,7 @@ namespace osu.Game.Beatmaps
|
|||||||
&& Tags == other.Tags
|
&& Tags == other.Tags
|
||||||
&& PreviewTime == other.PreviewTime
|
&& PreviewTime == other.PreviewTime
|
||||||
&& AudioFile == other.AudioFile
|
&& AudioFile == other.AudioFile
|
||||||
&& BackgroundFile == other.BackgroundFile
|
&& BackgroundFile == other.BackgroundFile;
|
||||||
&& VideoFile == other.VideoFile;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
using osu.Game.Rulesets.Difficulty;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -45,8 +44,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override VideoSprite GetVideo() => null;
|
|
||||||
|
|
||||||
protected override Track GetTrack() => GetVirtualTrack();
|
protected override Track GetTrack() => GetVirtualTrack();
|
||||||
|
|
||||||
private class DummyRulesetInfo : RulesetInfo
|
private class DummyRulesetInfo : RulesetInfo
|
||||||
|
@ -6,11 +6,11 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Game.Beatmaps.Timing;
|
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.IO;
|
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.IO;
|
||||||
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
@ -303,10 +303,6 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = CleanFilename(split[2]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LegacyEventType.Video:
|
|
||||||
beatmap.BeatmapInfo.Metadata.VideoFile = CleanFilename(split[2]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LegacyEventType.Break:
|
case LegacyEventType.Break:
|
||||||
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
||||||
|
|
||||||
|
@ -133,9 +133,6 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (!string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
|
if (!string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.BackgroundFile))
|
||||||
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Background},0,\"{beatmap.BeatmapInfo.Metadata.BackgroundFile}\",0,0"));
|
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Background},0,\"{beatmap.BeatmapInfo.Metadata.BackgroundFile}\",0,0"));
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(beatmap.BeatmapInfo.Metadata.VideoFile))
|
|
||||||
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Video},0,\"{beatmap.BeatmapInfo.Metadata.VideoFile}\",0,0"));
|
|
||||||
|
|
||||||
foreach (var b in beatmap.Breaks)
|
foreach (var b in beatmap.Breaks)
|
||||||
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Break},{b.StartTime},{b.EndTime}"));
|
writer.WriteLine(FormattableString.Invariant($"{(int)LegacyEventType.Break},{b.StartTime},{b.EndTime}"));
|
||||||
}
|
}
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osuTK;
|
||||||
using osu.Framework.Utils;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps.Formats
|
namespace osu.Game.Beatmaps.Formats
|
||||||
{
|
{
|
||||||
@ -87,6 +87,15 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
case LegacyEventType.Video:
|
||||||
|
{
|
||||||
|
var offset = Parsing.ParseInt(split[1]);
|
||||||
|
var path = CleanFilename(split[2]);
|
||||||
|
|
||||||
|
storyboard.GetLayer("Video").Add(new StoryboardVideo(path, offset));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case LegacyEventType.Sprite:
|
case LegacyEventType.Sprite:
|
||||||
{
|
{
|
||||||
var layer = parseLayer(split[1]);
|
var layer = parseLayer(split[1]);
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -27,11 +26,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Texture Background { get; }
|
Texture Background { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves the video background file for this <see cref="WorkingBeatmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
VideoSprite Video { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the audio track for this <see cref="WorkingBeatmap"/>.
|
/// Retrieves the audio track for this <see cref="WorkingBeatmap"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -8,6 +8,7 @@ namespace osu.Game.Beatmaps.Legacy
|
|||||||
Background = 0,
|
Background = 0,
|
||||||
Fail = 1,
|
Fail = 1,
|
||||||
Pass = 2,
|
Pass = 2,
|
||||||
Foreground = 3
|
Foreground = 3,
|
||||||
|
Video = 4
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Storyboards;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Framework.Graphics.Video;
|
using osu.Game.Storyboards;
|
||||||
using osu.Framework.Logging;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
@ -234,10 +233,6 @@ namespace osu.Game.Beatmaps
|
|||||||
protected abstract Texture GetBackground();
|
protected abstract Texture GetBackground();
|
||||||
private readonly RecyclableLazy<Texture> background;
|
private readonly RecyclableLazy<Texture> background;
|
||||||
|
|
||||||
public VideoSprite Video => GetVideo();
|
|
||||||
|
|
||||||
protected abstract VideoSprite GetVideo();
|
|
||||||
|
|
||||||
public bool TrackLoaded => track.IsResultAvailable;
|
public bool TrackLoaded => track.IsResultAvailable;
|
||||||
public Track Track => track.Value;
|
public Track Track => track.Value;
|
||||||
protected abstract Track GetTrack();
|
protected abstract Track GetTrack();
|
||||||
|
@ -70,7 +70,6 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.ShowFpsDisplay, false);
|
Set(OsuSetting.ShowFpsDisplay, false);
|
||||||
|
|
||||||
Set(OsuSetting.ShowStoryboard, true);
|
Set(OsuSetting.ShowStoryboard, true);
|
||||||
Set(OsuSetting.ShowVideoBackground, true);
|
|
||||||
Set(OsuSetting.BeatmapSkins, true);
|
Set(OsuSetting.BeatmapSkins, true);
|
||||||
Set(OsuSetting.BeatmapHitsounds, true);
|
Set(OsuSetting.BeatmapHitsounds, true);
|
||||||
|
|
||||||
@ -176,7 +175,6 @@ namespace osu.Game.Configuration
|
|||||||
BlurLevel,
|
BlurLevel,
|
||||||
LightenDuringBreaks,
|
LightenDuringBreaks,
|
||||||
ShowStoryboard,
|
ShowStoryboard,
|
||||||
ShowVideoBackground,
|
|
||||||
KeyOverlay,
|
KeyOverlay,
|
||||||
ScoreMeter,
|
ScoreMeter,
|
||||||
FloatingComments,
|
FloatingComments,
|
||||||
|
@ -55,8 +55,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected Bindable<bool> ShowStoryboard { get; private set; }
|
protected Bindable<bool> ShowStoryboard { get; private set; }
|
||||||
|
|
||||||
protected Bindable<bool> ShowVideo { get; private set; }
|
|
||||||
|
|
||||||
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
|
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
|
||||||
|
|
||||||
protected float DimLevel => Math.Max(EnableUserDim.Value && !IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : 0, 0);
|
protected float DimLevel => Math.Max(EnableUserDim.Value && !IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : 0, 0);
|
||||||
@ -79,14 +77,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
UserDimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
UserDimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
LightenDuringBreaks = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks);
|
LightenDuringBreaks = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks);
|
||||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
ShowVideo = config.GetBindable<bool>(OsuSetting.ShowVideoBackground);
|
|
||||||
|
|
||||||
EnableUserDim.ValueChanged += _ => UpdateVisuals();
|
EnableUserDim.ValueChanged += _ => UpdateVisuals();
|
||||||
UserDimLevel.ValueChanged += _ => UpdateVisuals();
|
UserDimLevel.ValueChanged += _ => UpdateVisuals();
|
||||||
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
|
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
|
||||||
IsBreakTime.ValueChanged += _ => UpdateVisuals();
|
IsBreakTime.ValueChanged += _ => UpdateVisuals();
|
||||||
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
|
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
|
||||||
ShowVideo.ValueChanged += _ => UpdateVisuals();
|
|
||||||
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
|
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
|
||||||
IgnoreUserSettings.ValueChanged += _ => UpdateVisuals();
|
IgnoreUserSettings.ValueChanged += _ => UpdateVisuals();
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Sprites
|
namespace osu.Game.Graphics.Sprites
|
||||||
{
|
{
|
||||||
@ -15,23 +13,4 @@ namespace osu.Game.Graphics.Sprites
|
|||||||
Font = OsuFont.Default;
|
Font = OsuFont.Default;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class OsuSpriteTextTransformExtensions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
|
||||||
public static TransformSequence<T> TransformTextTo<T>(this T spriteText, string newText, double duration = 0, Easing easing = Easing.None)
|
|
||||||
where T : OsuSpriteText
|
|
||||||
=> spriteText.TransformTo(nameof(OsuSpriteText.Text), newText, duration, easing);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
|
||||||
public static TransformSequence<T> TransformTextTo<T>(this TransformSequence<T> t, string newText, double duration = 0, Easing easing = Easing.None)
|
|
||||||
where T : OsuSpriteText
|
|
||||||
=> t.Append(o => o.TransformTextTo(newText, duration, easing));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,10 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
LabelText = "Storyboards",
|
LabelText = "Storyboard / Video",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard)
|
Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard)
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
|
||||||
LabelText = "Video",
|
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.ShowVideoBackground)
|
|
||||||
},
|
|
||||||
new SettingsCheckbox
|
|
||||||
{
|
{
|
||||||
LabelText = "Hit Lighting",
|
LabelText = "Hit Lighting",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.HitLighting)
|
Bindable = config.GetBindable<bool>(OsuSetting.HitLighting)
|
||||||
|
@ -39,7 +39,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
player.Background.EnableUserDim.Value = false;
|
player.Background.EnableUserDim.Value = false;
|
||||||
|
|
||||||
player.DimmableVideo.IgnoreUserSettings.Value = true;
|
|
||||||
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
||||||
|
|
||||||
player.BreakOverlay.Hide();
|
player.BreakOverlay.Hide();
|
||||||
|
17
osu.Game/Rulesets/Mods/ModRandom.cs
Normal file
17
osu.Game/Rulesets/Mods/ModRandom.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
public abstract class ModRandom : Mod
|
||||||
|
{
|
||||||
|
public override string Name => "Random";
|
||||||
|
public override string Acronym => "RD";
|
||||||
|
public override ModType Type => ModType.Conversion;
|
||||||
|
public override IconUsage? Icon => OsuIcon.Dice;
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
}
|
||||||
|
}
|
@ -166,7 +166,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
BlurAmount.ValueChanged += _ => UpdateVisuals();
|
BlurAmount.ValueChanged += _ => UpdateVisuals();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShowDimContent => !ShowStoryboard.Value || !StoryboardReplacesBackground.Value || !ShowVideo.Value; // The background needs to be hidden in the case of it being replaced by the storyboard
|
protected override bool ShowDimContent => !ShowStoryboard.Value || !StoryboardReplacesBackground.Value; // The background needs to be hidden in the case of it being replaced by the storyboard
|
||||||
|
|
||||||
protected override void UpdateVisuals()
|
protected override void UpdateVisuals()
|
||||||
{
|
{
|
||||||
|
@ -140,7 +140,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved(canBeNull: true)]
|
||||||
private OsuGame game { get; set; }
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
private void confirmAndExit()
|
private void confirmAndExit()
|
||||||
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
if (exitConfirmed) return;
|
if (exitConfirmed) return;
|
||||||
|
|
||||||
exitConfirmed = true;
|
exitConfirmed = true;
|
||||||
game.PerformFromScreen(menu => menu.Exit());
|
game?.PerformFromScreen(menu => menu.Exit());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preloadSongSelect()
|
private void preloadSongSelect()
|
||||||
|
@ -44,7 +44,6 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
drawableStoryboard = storyboard.CreateDrawable();
|
drawableStoryboard = storyboard.CreateDrawable();
|
||||||
drawableStoryboard.Masking = true;
|
|
||||||
|
|
||||||
if (async)
|
if (async)
|
||||||
LoadComponentAsync(drawableStoryboard, Add);
|
LoadComponentAsync(drawableStoryboard, Add);
|
||||||
|
@ -1,88 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
|
||||||
{
|
|
||||||
public class DimmableVideo : UserDimContainer
|
|
||||||
{
|
|
||||||
private readonly VideoSprite video;
|
|
||||||
private DrawableVideo drawableVideo;
|
|
||||||
|
|
||||||
public DimmableVideo(VideoSprite video)
|
|
||||||
{
|
|
||||||
this.video = video;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
initializeVideo(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
ShowVideo.BindValueChanged(_ => initializeVideo(true), true);
|
|
||||||
base.LoadComplete();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool ShowDimContent => IgnoreUserSettings.Value || (ShowVideo.Value && DimLevel < 1);
|
|
||||||
|
|
||||||
private void initializeVideo(bool async)
|
|
||||||
{
|
|
||||||
if (video == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (drawableVideo != null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!ShowVideo.Value && !IgnoreUserSettings.Value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
drawableVideo = new DrawableVideo(video);
|
|
||||||
|
|
||||||
if (async)
|
|
||||||
LoadComponentAsync(drawableVideo, Add);
|
|
||||||
else
|
|
||||||
Add(drawableVideo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class DrawableVideo : Container
|
|
||||||
{
|
|
||||||
public DrawableVideo(VideoSprite video)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Masking = true;
|
|
||||||
|
|
||||||
video.RelativeSizeAxes = Axes.Both;
|
|
||||||
video.FillMode = FillMode.Fit;
|
|
||||||
video.Anchor = Anchor.Centre;
|
|
||||||
video.Origin = Anchor.Centre;
|
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
},
|
|
||||||
video,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(GameplayClock clock)
|
|
||||||
{
|
|
||||||
if (clock != null)
|
|
||||||
Clock = clock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -89,7 +89,6 @@ namespace osu.Game.Screens.Play
|
|||||||
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
||||||
|
|
||||||
public DimmableStoryboard DimmableStoryboard { get; private set; }
|
public DimmableStoryboard DimmableStoryboard { get; private set; }
|
||||||
public DimmableVideo DimmableVideo { get; private set; }
|
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
@ -210,7 +209,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void addUnderlayComponents(Container target)
|
private void addUnderlayComponents(Container target)
|
||||||
{
|
{
|
||||||
target.Add(DimmableVideo = new DimmableVideo(Beatmap.Value.Video) { RelativeSizeAxes = Axes.Both });
|
|
||||||
target.Add(DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both });
|
target.Add(DimmableStoryboard = new DimmableStoryboard(Beatmap.Value.Storyboard) { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -578,7 +576,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// bind component bindables.
|
// bind component bindables.
|
||||||
Background.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
Background.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
||||||
DimmableStoryboard.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
DimmableStoryboard.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
||||||
DimmableVideo.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
|
|
||||||
|
|
||||||
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
DimmableStoryboard.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
|
@ -15,7 +15,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
private readonly PlayerSliderBar<double> dimSliderBar;
|
private readonly PlayerSliderBar<double> dimSliderBar;
|
||||||
private readonly PlayerSliderBar<double> blurSliderBar;
|
private readonly PlayerSliderBar<double> blurSliderBar;
|
||||||
private readonly PlayerCheckbox showStoryboardToggle;
|
private readonly PlayerCheckbox showStoryboardToggle;
|
||||||
private readonly PlayerCheckbox showVideoToggle;
|
|
||||||
private readonly PlayerCheckbox beatmapSkinsToggle;
|
private readonly PlayerCheckbox beatmapSkinsToggle;
|
||||||
private readonly PlayerCheckbox beatmapHitsoundsToggle;
|
private readonly PlayerCheckbox beatmapHitsoundsToggle;
|
||||||
|
|
||||||
@ -43,8 +42,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
{
|
{
|
||||||
Text = "Toggles:"
|
Text = "Toggles:"
|
||||||
},
|
},
|
||||||
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboards" },
|
showStoryboardToggle = new PlayerCheckbox { LabelText = "Storyboard / Video" },
|
||||||
showVideoToggle = new PlayerCheckbox { LabelText = "Video" },
|
|
||||||
beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" },
|
beatmapSkinsToggle = new PlayerCheckbox { LabelText = "Beatmap skins" },
|
||||||
beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }
|
beatmapHitsoundsToggle = new PlayerCheckbox { LabelText = "Beatmap hitsounds" }
|
||||||
};
|
};
|
||||||
@ -56,7 +54,6 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
|||||||
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
blurSliderBar.Bindable = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboardToggle.Current = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
showVideoToggle.Current = config.GetBindable<bool>(OsuSetting.ShowVideoBackground);
|
|
||||||
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
beatmapSkinsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapSkins);
|
||||||
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
beatmapHitsoundsToggle.Current = config.GetBindable<bool>(OsuSetting.BeatmapHitsounds);
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ using Container = osu.Framework.Graphics.Containers.Container;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -187,5 +188,9 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
private void updateCriteria() => FilterChanged?.Invoke(CreateCriteria());
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,5 +107,7 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
protected override bool OnMouseDown(MouseDownEvent e) => true;
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e) => true;
|
protected override bool OnClick(ClickEvent e) => true;
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e) => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,6 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Value.Track.Looping = false;
|
|
||||||
|
|
||||||
SampleConfirm?.Play();
|
SampleConfirm?.Play();
|
||||||
|
|
||||||
this.Push(player = new PlayerLoader(() => new Player()));
|
this.Push(player = new PlayerLoader(() => new Player()));
|
||||||
|
@ -572,6 +572,9 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
BeatmapOptions.Hide();
|
BeatmapOptions.Hide();
|
||||||
|
|
||||||
|
if (Beatmap.Value.Track != null)
|
||||||
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
|
||||||
this.ScaleTo(1.1f, 250, Easing.InSine);
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
|
|
||||||
this.FadeOut(250);
|
this.FadeOut(250);
|
||||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
private void updateLayerVisibility()
|
private void updateLayerVisibility()
|
||||||
{
|
{
|
||||||
foreach (var layer in Children)
|
foreach (var layer in Children)
|
||||||
layer.Enabled = passing ? layer.Layer.EnabledWhenPassing : layer.Layer.EnabledWhenFailing;
|
layer.Enabled = passing ? layer.Layer.VisibleWhenPassing : layer.Layer.VisibleWhenFailing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,8 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Enabled = layer.EnabledWhenPassing;
|
Enabled = layer.VisibleWhenPassing;
|
||||||
|
Masking = layer.Masking;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
62
osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs
Normal file
62
osu.Game/Storyboards/Drawables/DrawableStoryboardVideo.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Framework.Graphics.Video;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
|
namespace osu.Game.Storyboards.Drawables
|
||||||
|
{
|
||||||
|
public class DrawableStoryboardVideo : CompositeDrawable
|
||||||
|
{
|
||||||
|
public readonly StoryboardVideo Video;
|
||||||
|
private VideoSprite videoSprite;
|
||||||
|
|
||||||
|
public override bool RemoveWhenNotAlive => false;
|
||||||
|
|
||||||
|
public DrawableStoryboardVideo(StoryboardVideo video)
|
||||||
|
{
|
||||||
|
Video = video;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
|
||||||
|
{
|
||||||
|
var path = beatmap.Value.BeatmapSetInfo?.Files?.Find(f => f.Filename.Equals(Video.Path, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
|
||||||
|
|
||||||
|
if (path == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var stream = textureStore.GetStream(path);
|
||||||
|
|
||||||
|
if (stream == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
InternalChild = videoSprite = new VideoSprite(stream, false)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
FillMode = FillMode.Fill,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Alpha = 0,
|
||||||
|
Clock = new FramedOffsetClock(Clock) { Offset = -Video.StartTime }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
using (videoSprite.BeginAbsoluteSequence(0))
|
||||||
|
videoSprite.FadeIn(500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Storyboards.Drawables;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
@ -21,9 +21,10 @@ namespace osu.Game.Storyboards
|
|||||||
|
|
||||||
public Storyboard()
|
public Storyboard()
|
||||||
{
|
{
|
||||||
|
layers.Add("Video", new StoryboardLayer("Video", 4, false));
|
||||||
layers.Add("Background", new StoryboardLayer("Background", 3));
|
layers.Add("Background", new StoryboardLayer("Background", 3));
|
||||||
layers.Add("Fail", new StoryboardLayer("Fail", 2) { EnabledWhenPassing = false, });
|
layers.Add("Fail", new StoryboardLayer("Fail", 2) { VisibleWhenPassing = false, });
|
||||||
layers.Add("Pass", new StoryboardLayer("Pass", 1) { EnabledWhenFailing = false, });
|
layers.Add("Pass", new StoryboardLayer("Pass", 1) { VisibleWhenFailing = false, });
|
||||||
layers.Add("Foreground", new StoryboardLayer("Foreground", 0));
|
layers.Add("Foreground", new StoryboardLayer("Foreground", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,6 +47,9 @@ namespace osu.Game.Storyboards
|
|||||||
if (backgroundPath == null)
|
if (backgroundPath == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (GetLayer("Video").Elements.Any())
|
||||||
|
return true;
|
||||||
|
|
||||||
return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath);
|
return GetLayer("Background").Elements.Any(e => e.Path.ToLowerInvariant() == backgroundPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,23 @@ namespace osu.Game.Storyboards
|
|||||||
{
|
{
|
||||||
public class StoryboardLayer
|
public class StoryboardLayer
|
||||||
{
|
{
|
||||||
public string Name;
|
public readonly string Name;
|
||||||
public int Depth;
|
|
||||||
public bool EnabledWhenPassing = true;
|
public readonly int Depth;
|
||||||
public bool EnabledWhenFailing = true;
|
|
||||||
|
public readonly bool Masking;
|
||||||
|
|
||||||
|
public bool VisibleWhenPassing = true;
|
||||||
|
|
||||||
|
public bool VisibleWhenFailing = true;
|
||||||
|
|
||||||
public List<IStoryboardElement> Elements = new List<IStoryboardElement>();
|
public List<IStoryboardElement> Elements = new List<IStoryboardElement>();
|
||||||
|
|
||||||
public StoryboardLayer(string name, int depth)
|
public StoryboardLayer(string name, int depth, bool masking = true)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
Depth = depth;
|
Depth = depth;
|
||||||
|
Masking = masking;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(IStoryboardElement element)
|
public void Add(IStoryboardElement element)
|
||||||
|
25
osu.Game/Storyboards/StoryboardVideo.cs
Normal file
25
osu.Game/Storyboards/StoryboardVideo.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Storyboards.Drawables;
|
||||||
|
|
||||||
|
namespace osu.Game.Storyboards
|
||||||
|
{
|
||||||
|
public class StoryboardVideo : IStoryboardElement
|
||||||
|
{
|
||||||
|
public string Path { get; }
|
||||||
|
|
||||||
|
public bool IsDrawable => true;
|
||||||
|
|
||||||
|
public double StartTime { get; }
|
||||||
|
|
||||||
|
public StoryboardVideo(string path, int offset)
|
||||||
|
{
|
||||||
|
Path = path;
|
||||||
|
StartTime = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Drawable CreateDrawable() => new DrawableStoryboardVideo(this);
|
||||||
|
}
|
||||||
|
}
|
@ -10,7 +10,6 @@ using Newtonsoft.Json;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
@ -207,8 +206,6 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
protected override Texture GetBackground() => throw new NotImplementedException();
|
protected override Texture GetBackground() => throw new NotImplementedException();
|
||||||
|
|
||||||
protected override VideoSprite GetVideo() => throw new NotImplementedException();
|
|
||||||
|
|
||||||
protected override Track GetTrack() => throw new NotImplementedException();
|
protected override Track GetTrack() => throw new NotImplementedException();
|
||||||
|
|
||||||
protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
protected override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Video;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
@ -32,8 +31,6 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
|
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
|
|
||||||
protected override VideoSprite GetVideo() => null;
|
|
||||||
|
|
||||||
protected override Track GetTrack() => null;
|
protected override Track GetTrack() => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user