2017-02-23 02:16:23 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-02-23 02:26:50 +00:00
|
|
|
|
using System.Linq;
|
2017-02-23 03:17:59 +00:00
|
|
|
|
using osu.Framework;
|
2017-02-18 11:28:22 +00:00
|
|
|
|
using OpenTK.Graphics;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2017-02-18 11:28:22 +00:00
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Framework.Graphics.Transformations;
|
|
|
|
|
|
2017-02-23 02:16:23 +00:00
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
|
|
|
|
public abstract class WaveOverlayContainer : OverlayContainer
|
|
|
|
|
{
|
2017-02-23 03:42:31 +00:00
|
|
|
|
protected const float CONTENT_DURATION = 800;
|
2017-02-23 03:17:59 +00:00
|
|
|
|
|
2017-02-23 03:42:31 +00:00
|
|
|
|
private const EasingTypes easing_show = EasingTypes.OutSine;
|
|
|
|
|
private const EasingTypes easing_hide = EasingTypes.InSine;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
|
2017-02-23 02:26:50 +00:00
|
|
|
|
private Wave firstWave, secondWave, thirdWave, fourthWave;
|
|
|
|
|
|
|
|
|
|
private Container<Wave> wavesContainer;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
|
|
|
|
|
private readonly Container contentContainer;
|
2017-02-23 03:42:31 +00:00
|
|
|
|
|
2017-02-23 02:16:23 +00:00
|
|
|
|
protected override Container<Drawable> Content => contentContainer;
|
|
|
|
|
|
|
|
|
|
public Color4 FirstWaveColour
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
return firstWave.Colour;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
if (firstWave.Colour == value) return;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
firstWave.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Color4 SecondWaveColour
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
return secondWave.Colour;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
if (secondWave.Colour == value) return;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
secondWave.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Color4 ThirdWaveColour
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
return thirdWave.Colour;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
if (thirdWave.Colour == value) return;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
thirdWave.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Color4 FourthWaveColour
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
return fourthWave.Colour;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
if (fourthWave.Colour == value) return;
|
2017-02-23 02:16:23 +00:00
|
|
|
|
fourthWave.Colour = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public WaveOverlayContainer()
|
|
|
|
|
{
|
|
|
|
|
Masking = true;
|
|
|
|
|
|
2017-02-23 02:26:50 +00:00
|
|
|
|
AddInternal(wavesContainer = new Container<Wave>
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Origin = Anchor.TopCentre,
|
|
|
|
|
Anchor = Anchor.TopCentre,
|
2017-02-23 03:17:59 +00:00
|
|
|
|
Children = new[]
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
2017-02-23 02:22:01 +00:00
|
|
|
|
firstWave = new Wave
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
Rotation = 13,
|
2017-02-23 03:42:31 +00:00
|
|
|
|
FinalPosition = -930,
|
2017-02-23 02:16:23 +00:00
|
|
|
|
},
|
2017-02-23 02:22:01 +00:00
|
|
|
|
secondWave = new Wave
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
2017-02-23 03:17:59 +00:00
|
|
|
|
Rotation = -7,
|
2017-02-23 03:42:31 +00:00
|
|
|
|
FinalPosition = -560,
|
2017-02-23 02:16:23 +00:00
|
|
|
|
},
|
2017-02-23 02:22:01 +00:00
|
|
|
|
thirdWave = new Wave
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
Rotation = 4,
|
2017-02-23 03:42:31 +00:00
|
|
|
|
FinalPosition = -390,
|
2017-02-23 02:16:23 +00:00
|
|
|
|
},
|
2017-02-23 02:22:01 +00:00
|
|
|
|
fourthWave = new Wave
|
2017-02-23 02:16:23 +00:00
|
|
|
|
{
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
Anchor = Anchor.TopRight,
|
2017-02-23 03:17:59 +00:00
|
|
|
|
Rotation = -2,
|
2017-02-23 03:42:31 +00:00
|
|
|
|
FinalPosition = -220,
|
2017-02-23 02:16:23 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
AddInternal(contentContainer = new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Anchor = Anchor.BottomCentre,
|
|
|
|
|
Origin = Anchor.BottomCentre,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = Color4.White.Opacity(50),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|
2017-02-23 02:22:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-02-23 03:42:31 +00:00
|
|
|
|
protected override void PopIn()
|
|
|
|
|
{
|
|
|
|
|
foreach (var w in wavesContainer.Children)
|
|
|
|
|
w.State = Visibility.Visible;
|
|
|
|
|
|
|
|
|
|
contentContainer.FadeIn(CONTENT_DURATION, EasingTypes.OutQuint);
|
|
|
|
|
contentContainer.MoveToY(0, CONTENT_DURATION, EasingTypes.OutQuint);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void PopOut()
|
|
|
|
|
{
|
|
|
|
|
contentContainer.FadeOut(CONTENT_DURATION, easing_hide);
|
|
|
|
|
contentContainer.MoveToY(DrawHeight * 2f, CONTENT_DURATION, easing_hide);
|
|
|
|
|
|
|
|
|
|
foreach (var w in wavesContainer.Children)
|
|
|
|
|
w.State = Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
|
2017-02-23 03:17:59 +00:00
|
|
|
|
class Wave : Container, IStateful<Visibility>
|
2017-02-23 02:22:01 +00:00
|
|
|
|
{
|
2017-02-23 03:17:59 +00:00
|
|
|
|
public float FinalPosition;
|
|
|
|
|
|
2017-02-23 02:22:01 +00:00
|
|
|
|
public Wave()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
Size = new Vector2(1.5f);
|
|
|
|
|
Masking = true;
|
|
|
|
|
EdgeEffect = new EdgeEffect
|
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Colour = Color4.Black.Opacity(50),
|
|
|
|
|
Radius = 20f,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2017-02-23 03:17:59 +00:00
|
|
|
|
|
|
|
|
|
private Visibility state;
|
|
|
|
|
public Visibility State
|
|
|
|
|
{
|
|
|
|
|
get { return state; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == state) return;
|
|
|
|
|
state = value;
|
|
|
|
|
|
|
|
|
|
switch (value)
|
|
|
|
|
{
|
|
|
|
|
case Visibility.Hidden:
|
2017-02-23 03:42:31 +00:00
|
|
|
|
MoveToY(DrawHeight / Height, CONTENT_DURATION, easing_hide);
|
2017-02-23 03:17:59 +00:00
|
|
|
|
break;
|
|
|
|
|
case Visibility.Visible:
|
2017-02-23 03:42:31 +00:00
|
|
|
|
MoveToY(FinalPosition, CONTENT_DURATION, easing_show);
|
2017-02-23 03:17:59 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-02-23 02:16:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|