1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 00:02:54 +08:00

Update usages of Animation and Video in line with framework changes

This commit is contained in:
Dean Herbert 2020-04-03 15:59:56 +09:00
parent aa74b3193e
commit 51db361c32
7 changed files with 17 additions and 17 deletions

View File

@ -384,7 +384,7 @@ namespace osu.Game.Rulesets.Catch.UI
} }
currentCatcher.Show(); currentCatcher.Show();
(currentCatcher.Drawable as IAnimation)?.GotoFrame(0); (currentCatcher.Drawable as IFramedAnimation)?.GotoFrame(0);
} }
private void beginTrail() private void beginTrail()

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
// This animation is discarded and re-queried with the appropriate frame length afterwards. // This animation is discarded and re-queried with the appropriate frame length afterwards.
var tmp = skin.GetAnimation(imageName, true, false); var tmp = skin.GetAnimation(imageName, true, false);
double frameLength = 0; double frameLength = 0;
if (tmp is IAnimation tmpAnimation && tmpAnimation.FrameCount > 0) if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount); frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);
explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true, frameLength: frameLength).With(d => explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true, frameLength: frameLength).With(d =>

View File

@ -16,7 +16,7 @@ namespace osu.Game.Tournament.Components
{ {
private readonly string filename; private readonly string filename;
private readonly bool drawFallbackGradient; private readonly bool drawFallbackGradient;
private VideoSprite video; private Video video;
private ManualClock manualClock; private ManualClock manualClock;
@ -33,7 +33,7 @@ namespace osu.Game.Tournament.Components
if (stream != null) if (stream != null)
{ {
InternalChild = video = new VideoSprite(stream, false) InternalChild = video = new Video(stream, false)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,

View File

@ -270,10 +270,9 @@ namespace osu.Game.Screens.Menu
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
InternalChild = new VideoSprite(videoStream, false) InternalChild = new Video(videoStream, false)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Clock = new FramedOffsetClock(Clock) { Offset = -logo_1 }
}; };
} }
} }

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Animations;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Timing;
namespace osu.Game.Skinning namespace osu.Game.Skinning
{ {
@ -28,7 +27,7 @@ namespace osu.Game.Skinning
var animation = new SkinnableTextureAnimation(startAtCurrentTime) var animation = new SkinnableTextureAnimation(startAtCurrentTime)
{ {
DefaultFrameLength = frameLength ?? getFrameLength(source, applyConfigFrameRate, textures), DefaultFrameLength = frameLength ?? getFrameLength(source, applyConfigFrameRate, textures),
Repeat = looping, Loop = looping,
}; };
foreach (var t in textures) foreach (var t in textures)
@ -71,7 +70,10 @@ namespace osu.Game.Skinning
base.LoadComplete(); base.LoadComplete();
if (timeReference != null) if (timeReference != null)
Clock = new FramedOffsetClock(timeReference.Clock) { Offset = -timeReference.AnimationStartTime }; {
Clock = timeReference.Clock;
PlaybackPosition = timeReference.AnimationStartTime - timeReference.Clock.CurrentTime;
}
} }
} }

View File

@ -108,7 +108,7 @@ namespace osu.Game.Storyboards.Drawables
Animation = animation; Animation = animation;
Origin = animation.Origin; Origin = animation.Origin;
Position = animation.InitialPosition; Position = animation.InitialPosition;
Repeat = animation.LoopType == AnimationLoopType.LoopForever; Loop = animation.LoopType == AnimationLoopType.LoopForever;
LifetimeStart = animation.StartTime; LifetimeStart = animation.StartTime;
LifetimeEnd = animation.EndTime; LifetimeEnd = animation.EndTime;

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video; using osu.Framework.Graphics.Video;
using osu.Framework.Timing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
namespace osu.Game.Storyboards.Drawables namespace osu.Game.Storyboards.Drawables
@ -16,7 +15,7 @@ namespace osu.Game.Storyboards.Drawables
public class DrawableStoryboardVideo : CompositeDrawable public class DrawableStoryboardVideo : CompositeDrawable
{ {
public readonly StoryboardVideo Video; public readonly StoryboardVideo Video;
private VideoSprite videoSprite; private Video video;
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
@ -40,14 +39,14 @@ namespace osu.Game.Storyboards.Drawables
if (stream == null) if (stream == null)
return; return;
InternalChild = videoSprite = new VideoSprite(stream, false) InternalChild = video = new Video(stream, false)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Alpha = 0, Alpha = 0,
Clock = new FramedOffsetClock(Clock) { Offset = -Video.StartTime } PlaybackPosition = Video.StartTime
}; };
} }
@ -55,10 +54,10 @@ namespace osu.Game.Storyboards.Drawables
{ {
base.LoadComplete(); base.LoadComplete();
if (videoSprite == null) return; if (video == null) return;
using (videoSprite.BeginAbsoluteSequence(0)) using (video.BeginAbsoluteSequence(0))
videoSprite.FadeIn(500); video.FadeIn(500);
} }
} }
} }