mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 01:57:51 +08:00
NRT-annotate MedalAnimation
and fix possible nullref
This commit is contained in:
parent
9b938f333d
commit
33a0dcaf20
@ -1,8 +1,6 @@
|
|||||||
// 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.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -20,6 +18,7 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
@ -37,9 +36,9 @@ namespace osu.Game.Overlays
|
|||||||
private readonly BackgroundStrip leftStrip, rightStrip;
|
private readonly BackgroundStrip leftStrip, rightStrip;
|
||||||
private readonly CircularContainer disc;
|
private readonly CircularContainer disc;
|
||||||
private readonly Sprite innerSpin, outerSpin;
|
private readonly Sprite innerSpin, outerSpin;
|
||||||
private DrawableMedal drawableMedal;
|
|
||||||
|
|
||||||
private Sample getSample;
|
private DrawableMedal? drawableMedal;
|
||||||
|
private Sample? getSample;
|
||||||
|
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
@ -197,7 +196,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
background.FlashColour(Color4.White.Opacity(0.25f), 400);
|
background.FlashColour(Color4.White.Opacity(0.25f), 400);
|
||||||
|
|
||||||
getSample.Play();
|
getSample?.Play();
|
||||||
|
|
||||||
innerSpin.Spin(20000, RotationDirection.Clockwise);
|
innerSpin.Spin(20000, RotationDirection.Clockwise);
|
||||||
outerSpin.Spin(40000, RotationDirection.Clockwise);
|
outerSpin.Spin(40000, RotationDirection.Clockwise);
|
||||||
@ -216,6 +215,8 @@ namespace osu.Game.Overlays
|
|||||||
leftStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint);
|
leftStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint);
|
||||||
rightStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint);
|
rightStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint);
|
||||||
|
|
||||||
|
Debug.Assert(drawableMedal != null);
|
||||||
|
|
||||||
this.Animate().Schedule(() =>
|
this.Animate().Schedule(() =>
|
||||||
{
|
{
|
||||||
if (drawableMedal.State != DisplayState.Full)
|
if (drawableMedal.State != DisplayState.Full)
|
||||||
@ -245,7 +246,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public void Dismiss()
|
public void Dismiss()
|
||||||
{
|
{
|
||||||
if (drawableMedal.State != DisplayState.Full)
|
if (drawableMedal != null && drawableMedal.State != DisplayState.Full)
|
||||||
{
|
{
|
||||||
// if we haven't yet, play out the animation fully
|
// if we haven't yet, play out the animation fully
|
||||||
drawableMedal.State = DisplayState.Full;
|
drawableMedal.State = DisplayState.Full;
|
||||||
|
Loading…
Reference in New Issue
Block a user