mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Merged upstream/master.
This commit is contained in:
@ -14,9 +14,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class CirclePiece : Container
|
||||
{
|
||||
|
||||
private Sprite disc;
|
||||
private Triangles triangles;
|
||||
|
||||
|
||||
public Func<bool> Hit;
|
||||
|
||||
@ -36,10 +35,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
},
|
||||
triangles = new Triangles
|
||||
new TrianglesPiece
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
Alpha = 0.5f,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -21,10 +21,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Triangles
|
||||
new TrianglesPiece
|
||||
{
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.1f,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -6,33 +6,54 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class NumberPiece : Container
|
||||
{
|
||||
private Sprite number;
|
||||
private SpriteText number;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return number.Text; }
|
||||
set { number.Text = value; }
|
||||
}
|
||||
|
||||
public NumberPiece()
|
||||
{
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
number = new Sprite
|
||||
new CircularContainer
|
||||
{
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Radius = 60,
|
||||
Colour = Color4.White.Opacity(0.5f),
|
||||
},
|
||||
Children = new[]
|
||||
{
|
||||
new Box()
|
||||
}
|
||||
},
|
||||
number = new OsuSpriteText
|
||||
{
|
||||
Text = @"1",
|
||||
Font = @"Venera",
|
||||
UseFullGlyphHeight = false,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 40,
|
||||
Alpha = 1
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
number.Texture = textures.Get(@"Play/osu/number");
|
||||
}
|
||||
}
|
||||
}
|
@ -11,7 +11,7 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class SliderBall : Container, ISliderProgress
|
||||
public class SliderBall : CircularContainer, ISliderProgress
|
||||
{
|
||||
private readonly Slider slider;
|
||||
private Box follow;
|
||||
@ -39,7 +39,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
Height = width,
|
||||
Alpha = 0,
|
||||
},
|
||||
new Container
|
||||
new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
@ -48,7 +48,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
BorderThickness = 10,
|
||||
BorderColour = Color4.White,
|
||||
Alpha = 1,
|
||||
CornerRadius = width / 2,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
@ -104,8 +103,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
base.Update();
|
||||
|
||||
CornerRadius = DrawWidth / 2;
|
||||
Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
|
||||
if (Time.Current < slider.EndTime)
|
||||
Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
|
||||
}
|
||||
|
||||
public void UpdateProgress(double progress, int repeat)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -10,6 +11,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -27,6 +29,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
set { Disc.Colour = value; }
|
||||
}
|
||||
|
||||
Color4 completeColour;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
completeColour = colours.YellowLight.Opacity(0.8f);
|
||||
}
|
||||
|
||||
class SpinnerBorder : Container
|
||||
{
|
||||
public SpinnerBorder()
|
||||
@ -120,6 +130,22 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
}
|
||||
|
||||
bool complete;
|
||||
public bool Complete
|
||||
{
|
||||
get { return complete; }
|
||||
set
|
||||
{
|
||||
if (value == complete) return;
|
||||
|
||||
complete = value;
|
||||
|
||||
Disc.FadeColour(completeColour, 200);
|
||||
|
||||
updateCompleteTick();
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
Tracking = true;
|
||||
@ -145,6 +171,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
private float currentRotation;
|
||||
public float RotationAbsolute;
|
||||
|
||||
private int completeTick;
|
||||
|
||||
private bool updateCompleteTick() => completeTick != (completeTick = (int)(RotationAbsolute / 720));
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
@ -162,6 +192,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
}
|
||||
lastAngle = thisAngle;
|
||||
|
||||
if (Complete && updateCompleteTick())
|
||||
{
|
||||
Disc.Flush(flushType: typeof(TransformAlpha));
|
||||
Disc.FadeTo(0.75f, 30, EasingTypes.OutExpo);
|
||||
Disc.Delay(30);
|
||||
Disc.FadeTo(0.5f, 250, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
RotateTo(currentRotation, 100, EasingTypes.OutExpo);
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.MathUtils;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class Triangles : Container<Triangle>
|
||||
{
|
||||
public override bool HandleInput => false;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
const float size = 100;
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
Add(new Triangle
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()),
|
||||
Scale = new Vector2(RNG.NextSingle() * 0.4f + 0.2f),
|
||||
// Scaling height by 0.866 results in equiangular triangles (== 60° and equal side length)
|
||||
Size = new Vector2(size, 0.866f * size),
|
||||
Alpha = RNG.NextSingle() * 0.3f,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
foreach (Drawable d in Children)
|
||||
d.Position -= new Vector2(0, (float)(d.Scale.X * (Time.Elapsed / 2880)));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
// 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.Game.Graphics.Backgrounds;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class TrianglesPiece : Triangles
|
||||
{
|
||||
protected override bool ExpireOffScreenTriangles => false;
|
||||
protected override bool CreateNewTriangles => false;
|
||||
protected override float SpawnRatio => 0.5f;
|
||||
|
||||
public TrianglesPiece()
|
||||
{
|
||||
TriangleScale = 1.2f;
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
if (IsPresent)
|
||||
base.Update();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user