mirror of
https://github.com/osukey/osukey.git
synced 2025-05-15 02:27:33 +09:00
Merge remote-tracking branch 'upstream/master' into background-blur
This commit is contained in:
commit
338eaad0e5
@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
if (beatmap.ComboColors.Count == 0)
|
if (beatmap.ComboColors.Count == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int comboIndex = 0;
|
int index = 0;
|
||||||
int colourIndex = 0;
|
int colourIndex = 0;
|
||||||
|
|
||||||
CatchHitObject lastObj = null;
|
CatchHitObject lastObj = null;
|
||||||
@ -31,12 +31,10 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
if (obj.NewCombo)
|
if (obj.NewCombo)
|
||||||
{
|
{
|
||||||
if (lastObj != null) lastObj.LastInCombo = true;
|
if (lastObj != null) lastObj.LastInCombo = true;
|
||||||
|
|
||||||
comboIndex = 0;
|
|
||||||
colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count;
|
colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.ComboIndex = comboIndex++;
|
obj.IndexInBeatmap = index++;
|
||||||
obj.ComboColour = beatmap.ComboColors[colourIndex];
|
obj.ComboColour = beatmap.ComboColors[colourIndex];
|
||||||
|
|
||||||
lastObj = obj;
|
lastObj = obj;
|
||||||
|
@ -15,8 +15,11 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
|
|
||||||
public float X { get; set; }
|
public float X { get; set; }
|
||||||
|
|
||||||
public Color4 ComboColour { get; set; } = Color4.Gray;
|
public Color4 ComboColour { get; set; }
|
||||||
public int ComboIndex { get; set; }
|
|
||||||
|
public int IndexInBeatmap { get; set; }
|
||||||
|
|
||||||
|
public virtual FruitVisualRepresentation VisualRepresentation => (FruitVisualRepresentation)(IndexInBeatmap % 4);
|
||||||
|
|
||||||
public virtual bool NewCombo { get; set; }
|
public virtual bool NewCombo { get; set; }
|
||||||
|
|
||||||
@ -44,4 +47,13 @@ namespace osu.Game.Rulesets.Catch.Objects
|
|||||||
Scale = 1.0f - 0.7f * (difficulty.CircleSize - 5) / 5;
|
Scale = 1.0f - 0.7f * (difficulty.CircleSize - 5) / 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum FruitVisualRepresentation
|
||||||
|
{
|
||||||
|
Pear,
|
||||||
|
Grape,
|
||||||
|
Raspberry,
|
||||||
|
Pineapple,
|
||||||
|
Banana // banananananannaanana
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,9 +14,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS) / 4;
|
||||||
Size = new Vector2(Pulp.PULP_SIZE);
|
|
||||||
|
|
||||||
AccentColour = h.ComboColour;
|
AccentColour = h.ComboColour;
|
||||||
Masking = false;
|
Masking = false;
|
||||||
}
|
}
|
||||||
@ -27,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
Child = new Pulp
|
Child = new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour,
|
||||||
Scale = new Vector2(0.8f),
|
Size = Size
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -13,12 +16,14 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
public class DrawableFruit : DrawableCatchHitObject<Fruit>
|
public class DrawableFruit : DrawableCatchHitObject<Fruit>
|
||||||
{
|
{
|
||||||
|
private Circle border;
|
||||||
|
|
||||||
public DrawableFruit(Fruit h)
|
public DrawableFruit(Fruit h)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Size = new Vector2(Pulp.PULP_SIZE * 2.2f, Pulp.PULP_SIZE * 2.8f);
|
Size = new Vector2((float)CatchHitObject.OBJECT_RADIUS);
|
||||||
AccentColour = HitObject.ComboColour;
|
AccentColour = HitObject.ComboColour;
|
||||||
Masking = false;
|
Masking = false;
|
||||||
|
|
||||||
@ -28,48 +33,34 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
createPulp(HitObject.VisualRepresentation),
|
||||||
|
border = new Circle
|
||||||
|
{
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Hollow = !HitObject.HyperDash,
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Radius = 4,
|
||||||
|
Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f)
|
||||||
|
},
|
||||||
|
Size = new Vector2(Height * 1.5f),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
BorderThickness = 4f,
|
||||||
Children = new Framework.Graphics.Drawable[]
|
Children = new Framework.Graphics.Drawable[]
|
||||||
{
|
{
|
||||||
//todo: share this more
|
new Box
|
||||||
new BufferedContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
AlwaysPresent = true,
|
||||||
CacheDrawnFrameBuffer = true,
|
Colour = AccentColour,
|
||||||
Children = new Framework.Graphics.Drawable[]
|
Alpha = 0,
|
||||||
{
|
RelativeSizeAxes = Axes.Both
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
Scale = new Vector2(0.6f),
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.CentreLeft,
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
Y = -0.08f
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.CentreRight,
|
|
||||||
Origin = Anchor.CentreRight,
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
Y = -0.08f
|
|
||||||
},
|
|
||||||
new Pulp
|
|
||||||
{
|
|
||||||
RelativePositionAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
AccentColour = AccentColour,
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (HitObject.HyperDash)
|
if (HitObject.HyperDash)
|
||||||
@ -82,9 +73,184 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
AccentColour = Color4.Red,
|
AccentColour = Color4.Red,
|
||||||
Blending = BlendingMode.Additive,
|
Blending = BlendingMode.Additive,
|
||||||
Alpha = 0.5f,
|
Alpha = 0.5f,
|
||||||
Scale = new Vector2(2)
|
Scale = new Vector2(1.333f)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Framework.Graphics.Drawable createPulp(FruitVisualRepresentation representation)
|
||||||
|
{
|
||||||
|
const float large_pulp_3 = 13f;
|
||||||
|
const float distance_from_centre_3 = 0.23f;
|
||||||
|
|
||||||
|
const float large_pulp_4 = large_pulp_3 * 0.925f;
|
||||||
|
const float distance_from_centre_4 = distance_from_centre_3 / 0.925f;
|
||||||
|
|
||||||
|
const float small_pulp = large_pulp_3 / 2;
|
||||||
|
|
||||||
|
Vector2 positionAt(float angle, float distance) => new Vector2(
|
||||||
|
distance * (float)Math.Sin(angle * Math.PI / 180),
|
||||||
|
distance * (float)Math.Cos(angle * Math.PI / 180));
|
||||||
|
|
||||||
|
switch (representation)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return new Container();
|
||||||
|
case FruitVisualRepresentation.Raspberry:
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Framework.Graphics.Drawable[]
|
||||||
|
{
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(small_pulp),
|
||||||
|
Y = 0.05f,
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(0, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(90, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(180, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Position = positionAt(270, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case FruitVisualRepresentation.Pineapple:
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Framework.Graphics.Drawable[]
|
||||||
|
{
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.BottomCentre,
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(small_pulp),
|
||||||
|
Y = 0.1f,
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(45, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(135, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
Position = positionAt(225, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Size = new Vector2(large_pulp_4),
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Position = positionAt(315, distance_from_centre_4),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case FruitVisualRepresentation.Pear:
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Framework.Graphics.Drawable[]
|
||||||
|
{
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(small_pulp),
|
||||||
|
Y = -0.1f,
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
Position = positionAt(60, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
Position = positionAt(180, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Position = positionAt(300, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
case FruitVisualRepresentation.Grape:
|
||||||
|
return new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Framework.Graphics.Drawable[]
|
||||||
|
{
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(small_pulp),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
Position = positionAt(0, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
Position = positionAt(120, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
new Pulp
|
||||||
|
{
|
||||||
|
Size = new Vector2(large_pulp_3),
|
||||||
|
AccentColour = AccentColour,
|
||||||
|
Position = positionAt(240, distance_from_centre_3),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
border.Alpha = (float)MathHelper.Clamp((HitObject.StartTime - Time.Current) / 500, 0, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,18 +6,17 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using OpenTK;
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
|
namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
|
||||||
{
|
{
|
||||||
public class Pulp : Circle, IHasAccentColour
|
public class Pulp : Circle, IHasAccentColour
|
||||||
{
|
{
|
||||||
public const float PULP_SIZE = (float)CatchHitObject.OBJECT_RADIUS / 2.2f;
|
|
||||||
|
|
||||||
public Pulp()
|
public Pulp()
|
||||||
{
|
{
|
||||||
Size = new Vector2(PULP_SIZE);
|
RelativePositionAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
Blending = BlendingMode.Additive;
|
Blending = BlendingMode.Additive;
|
||||||
Colour = Color4.White.Opacity(0.9f);
|
Colour = Color4.White.Opacity(0.9f);
|
||||||
@ -34,8 +33,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 5,
|
Radius = 8,
|
||||||
Colour = accentColour.Lighten(100),
|
Colour = accentColour.Darken(0.2f).Opacity(0.75f)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
104
osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs
Normal file
104
osu.Game.Rulesets.Catch/Tests/TestCaseFruitObjects.cs
Normal file
@ -0,0 +1,104 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
|
{
|
||||||
|
[Ignore("getting CI working")]
|
||||||
|
public class TestCaseFruitObjects : OsuTestCase
|
||||||
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
|
{
|
||||||
|
typeof(CatchHitObject),
|
||||||
|
typeof(Fruit),
|
||||||
|
typeof(Droplet),
|
||||||
|
typeof(DrawableCatchHitObject),
|
||||||
|
typeof(DrawableFruit),
|
||||||
|
typeof(DrawableDroplet),
|
||||||
|
typeof(Pulp),
|
||||||
|
};
|
||||||
|
|
||||||
|
public TestCaseFruitObjects()
|
||||||
|
{
|
||||||
|
Add(new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
createDrawable(0),
|
||||||
|
createDrawable(1),
|
||||||
|
createDrawable(2),
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
createDrawable(3),
|
||||||
|
createDrawable(4),
|
||||||
|
createDrawable(5),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private DrawableFruit createDrawable(int index)
|
||||||
|
{
|
||||||
|
var fruit = new Fruit
|
||||||
|
{
|
||||||
|
StartTime = 1000000000000,
|
||||||
|
IndexInBeatmap = index,
|
||||||
|
Scale = 1.5f,
|
||||||
|
};
|
||||||
|
|
||||||
|
fruit.ComboColour = colourForRrepesentation(fruit.VisualRepresentation);
|
||||||
|
|
||||||
|
return new DrawableFruit(fruit)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
|
Position = Vector2.Zero,
|
||||||
|
Alpha = 1,
|
||||||
|
LifetimeStart = double.NegativeInfinity,
|
||||||
|
LifetimeEnd = double.PositiveInfinity,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 colourForRrepesentation(FruitVisualRepresentation representation)
|
||||||
|
{
|
||||||
|
switch (representation)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case FruitVisualRepresentation.Pear:
|
||||||
|
return new Color4(17, 136, 170, 255);
|
||||||
|
case FruitVisualRepresentation.Grape:
|
||||||
|
return new Color4(204, 102, 0, 255);
|
||||||
|
case FruitVisualRepresentation.Raspberry:
|
||||||
|
return new Color4(121, 9, 13, 255);
|
||||||
|
case FruitVisualRepresentation.Pineapple:
|
||||||
|
return new Color4(102, 136, 0, 255);
|
||||||
|
case FruitVisualRepresentation.Banana:
|
||||||
|
switch (RNG.Next(0, 3))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return new Color4(255, 240, 0, 255);
|
||||||
|
case 1:
|
||||||
|
return new Color4(255, 192, 0, 255);
|
||||||
|
case 2:
|
||||||
|
return new Color4(214, 221, 28, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
@ -23,7 +22,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
private readonly CatcherArea catcherArea;
|
private readonly CatcherArea catcherArea;
|
||||||
|
|
||||||
public CatchPlayfield(BeatmapDifficulty difficulty)
|
public CatchPlayfield(BeatmapDifficulty difficulty)
|
||||||
: base(Axes.Y)
|
: base(Axes.Y, BASE_WIDTH)
|
||||||
{
|
{
|
||||||
Container explodingFruitContainer;
|
Container explodingFruitContainer;
|
||||||
|
|
||||||
@ -32,7 +31,10 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Anchor = Anchor.TopCentre;
|
Anchor = Anchor.TopCentre;
|
||||||
Origin = Anchor.TopCentre;
|
Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
ScaledContent.Anchor = Anchor.BottomLeft;
|
||||||
|
ScaledContent.Origin = Anchor.BottomLeft;
|
||||||
|
|
||||||
|
ScaledContent.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
content = new Container<Drawable>
|
content = new Container<Drawable>
|
||||||
{
|
{
|
||||||
@ -48,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
}
|
}
|
||||||
};
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj);
|
public bool CheckIfWeCanCatch(CatchHitObject obj) => catcherArea.AttemptCatch(obj);
|
||||||
@ -63,18 +65,6 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
fruit.CheckPosition = CheckIfWeCanCatch;
|
fruit.CheckPosition = CheckIfWeCanCatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
public override void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) => catcherArea.OnJudgement((DrawableCatchHitObject)judgedObject, judgement);
|
||||||
{
|
|
||||||
if (judgement.IsHit)
|
|
||||||
{
|
|
||||||
Vector2 screenPosition = judgedObject.ScreenSpaceDrawQuad.Centre;
|
|
||||||
|
|
||||||
// todo: don't do this
|
|
||||||
(judgedObject.Parent as Container<DrawableHitObject>)?.Remove(judgedObject);
|
|
||||||
(judgedObject.Parent as Container)?.Remove(judgedObject);
|
|
||||||
|
|
||||||
catcherArea.Add(judgedObject, screenPosition);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,8 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
|
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
||||||
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
@ -39,19 +41,36 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Add(DrawableHitObject fruit, Vector2 absolutePosition)
|
public void OnJudgement(DrawableCatchHitObject fruit, Judgement judgement)
|
||||||
{
|
{
|
||||||
|
if (judgement.IsHit)
|
||||||
|
{
|
||||||
|
var screenSpacePosition = fruit.ScreenSpaceDrawQuad.Centre;
|
||||||
|
|
||||||
|
// todo: make this less ugly, somehow.
|
||||||
|
(fruit.Parent as Container<DrawableHitObject>)?.Remove(fruit);
|
||||||
|
(fruit.Parent as Container)?.Remove(fruit);
|
||||||
|
|
||||||
fruit.RelativePositionAxes = Axes.None;
|
fruit.RelativePositionAxes = Axes.None;
|
||||||
fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(absolutePosition).X - MovableCatcher.DrawSize.X / 2, 0);
|
fruit.Position = new Vector2(MovableCatcher.ToLocalSpace(screenSpacePosition).X - MovableCatcher.DrawSize.X / 2, 0);
|
||||||
|
|
||||||
fruit.Anchor = Anchor.TopCentre;
|
fruit.Anchor = Anchor.TopCentre;
|
||||||
fruit.Origin = Anchor.BottomCentre;
|
fruit.Origin = Anchor.Centre;
|
||||||
fruit.Scale *= 0.7f;
|
fruit.Scale *= 0.7f;
|
||||||
fruit.LifetimeEnd = double.MaxValue;
|
fruit.LifetimeEnd = double.MaxValue;
|
||||||
|
|
||||||
MovableCatcher.Add(fruit);
|
MovableCatcher.Add(fruit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fruit.HitObject.LastInCombo)
|
||||||
|
{
|
||||||
|
if (judgement.IsHit)
|
||||||
|
MovableCatcher.Explode();
|
||||||
|
else
|
||||||
|
MovableCatcher.Drop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
public bool AttemptCatch(CatchHitObject obj) => MovableCatcher.AttemptCatch(obj);
|
||||||
|
|
||||||
public class Catcher : Container, IKeyBindingHandler<CatchAction>
|
public class Catcher : Container, IKeyBindingHandler<CatchAction>
|
||||||
@ -84,12 +103,12 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
createCatcherSprite(),
|
|
||||||
caughtFruit = new Container<DrawableHitObject>
|
caughtFruit = new Container<DrawableHitObject>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
}
|
},
|
||||||
|
createCatcherSprite(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,20 +186,23 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// <param name="fruit">The fruit that was caught.</param>
|
/// <param name="fruit">The fruit that was caught.</param>
|
||||||
public void Add(DrawableHitObject fruit)
|
public void Add(DrawableHitObject fruit)
|
||||||
{
|
{
|
||||||
float distance = fruit.DrawSize.X / 2 * fruit.Scale.X;
|
float ourRadius = fruit.DrawSize.X / 2 * fruit.Scale.X;
|
||||||
|
float theirRadius = 0;
|
||||||
|
|
||||||
while (caughtFruit.Any(f => f.LifetimeEnd == double.MaxValue && Vector2Extensions.DistanceSquared(f.Position, fruit.Position) < distance * distance))
|
const float allowance = 6;
|
||||||
|
|
||||||
|
while (caughtFruit.Any(f =>
|
||||||
|
f.LifetimeEnd == double.MaxValue &&
|
||||||
|
Vector2Extensions.Distance(f.Position, fruit.Position) < (ourRadius + (theirRadius = f.DrawSize.X / 2 * f.Scale.X)) / (allowance / 2)))
|
||||||
{
|
{
|
||||||
fruit.X += RNG.Next(-5, 5);
|
float diff = (ourRadius + theirRadius) / allowance;
|
||||||
fruit.Y -= RNG.Next(0, 5);
|
fruit.X += (RNG.NextSingle() - 0.5f) * 2 * diff;
|
||||||
|
fruit.Y -= RNG.NextSingle() * diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fruit.X = MathHelper.Clamp(fruit.X, -CATCHER_SIZE / 2, CATCHER_SIZE / 2);
|
||||||
|
|
||||||
caughtFruit.Add(fruit);
|
caughtFruit.Add(fruit);
|
||||||
|
|
||||||
var catchObject = (CatchHitObject)fruit.HitObject;
|
|
||||||
|
|
||||||
if (catchObject.LastInCombo)
|
|
||||||
explode();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -190,15 +212,15 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
/// <returns>Whether the catch is possible.</returns>
|
/// <returns>Whether the catch is possible.</returns>
|
||||||
public bool AttemptCatch(CatchHitObject fruit)
|
public bool AttemptCatch(CatchHitObject fruit)
|
||||||
{
|
{
|
||||||
const double relative_catcher_width = CATCHER_SIZE / 2;
|
double halfCatcherWidth = CATCHER_SIZE * Math.Abs(Scale.X) * 0.5f;
|
||||||
|
|
||||||
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
// this stuff wil disappear once we move fruit to non-relative coordinate space in the future.
|
||||||
var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
|
var catchObjectPosition = fruit.X * CatchPlayfield.BASE_WIDTH;
|
||||||
var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
|
var catcherPosition = Position.X * CatchPlayfield.BASE_WIDTH;
|
||||||
|
|
||||||
var validCatch =
|
var validCatch =
|
||||||
catchObjectPosition >= catcherPosition - relative_catcher_width / 2 &&
|
catchObjectPosition >= catcherPosition - halfCatcherWidth &&
|
||||||
catchObjectPosition <= catcherPosition + relative_catcher_width / 2;
|
catchObjectPosition <= catcherPosition + halfCatcherWidth;
|
||||||
|
|
||||||
if (validCatch && fruit.HyperDash)
|
if (validCatch && fruit.HyperDash)
|
||||||
{
|
{
|
||||||
@ -309,7 +331,35 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
X = (float)MathHelper.Clamp(X + direction * Clock.ElapsedFrameTime * BASE_SPEED * dashModifier, 0, 1);
|
X = (float)MathHelper.Clamp(X + direction * Clock.ElapsedFrameTime * BASE_SPEED * dashModifier, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void explode()
|
/// <summary>
|
||||||
|
/// Drop any fruit off the plate.
|
||||||
|
/// </summary>
|
||||||
|
public void Drop()
|
||||||
|
{
|
||||||
|
var fruit = caughtFruit.ToArray();
|
||||||
|
|
||||||
|
foreach (var f in fruit)
|
||||||
|
{
|
||||||
|
if (ExplodingFruitTarget != null)
|
||||||
|
{
|
||||||
|
f.Anchor = Anchor.TopLeft;
|
||||||
|
f.Position = caughtFruit.ToSpaceOfOtherDrawable(f.DrawPosition, ExplodingFruitTarget);
|
||||||
|
|
||||||
|
caughtFruit.Remove(f);
|
||||||
|
|
||||||
|
ExplodingFruitTarget.Add(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
f.MoveToY(f.Y + 75, 750, Easing.InSine);
|
||||||
|
f.FadeOut(750);
|
||||||
|
f.Expire();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Explode any fruit off the plate.
|
||||||
|
/// </summary>
|
||||||
|
public void Explode()
|
||||||
{
|
{
|
||||||
var fruit = caughtFruit.ToArray();
|
var fruit = caughtFruit.ToArray();
|
||||||
|
|
||||||
|
@ -75,6 +75,7 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Tests\TestCaseCatcherArea.cs" />
|
<Compile Include="Tests\TestCaseCatcherArea.cs" />
|
||||||
<Compile Include="Tests\TestCaseCatchStacker.cs" />
|
<Compile Include="Tests\TestCaseCatchStacker.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseFruitObjects.cs" />
|
||||||
<Compile Include="Tests\TestCasePerformancePoints.cs" />
|
<Compile Include="Tests\TestCasePerformancePoints.cs" />
|
||||||
<Compile Include="Tests\TestCaseCatchPlayer.cs" />
|
<Compile Include="Tests\TestCaseCatchPlayer.cs" />
|
||||||
<Compile Include="Tests\TestCaseHyperdash.cs" />
|
<Compile Include="Tests\TestCaseHyperdash.cs" />
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
|||||||
colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count;
|
colourIndex = (colourIndex + 1) % beatmap.ComboColors.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.ComboIndex = comboIndex++;
|
obj.IndexInCurrentCombo = comboIndex++;
|
||||||
obj.ComboColour = beatmap.ComboColors[colourIndex];
|
obj.ComboColour = beatmap.ComboColors[colourIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
},
|
},
|
||||||
number = new NumberPiece
|
number = new NumberPiece
|
||||||
{
|
{
|
||||||
Text = (HitObject.ComboIndex + 1).ToString(),
|
Text = (HitObject.IndexInCurrentCombo + 1).ToString(),
|
||||||
},
|
},
|
||||||
ring = new RingPiece(),
|
ring = new RingPiece(),
|
||||||
flash = new FlashPiece(),
|
flash = new FlashPiece(),
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
StartTime = s.StartTime,
|
StartTime = s.StartTime,
|
||||||
Position = s.StackedPosition,
|
Position = s.StackedPosition,
|
||||||
ComboIndex = s.ComboIndex,
|
IndexInCurrentCombo = s.IndexInCurrentCombo,
|
||||||
Scale = s.Scale,
|
Scale = s.Scale,
|
||||||
ComboColour = s.ComboColour,
|
ComboColour = s.ComboColour,
|
||||||
Samples = s.Samples,
|
Samples = s.Samples,
|
||||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
public Color4 ComboColour { get; set; } = Color4.Gray;
|
public Color4 ComboColour { get; set; } = Color4.Gray;
|
||||||
public virtual bool NewCombo { get; set; }
|
public virtual bool NewCombo { get; set; }
|
||||||
public int ComboIndex { get; set; }
|
public int IndexInCurrentCombo { get; set; }
|
||||||
|
|
||||||
public double HitWindowFor(HitResult result)
|
public double HitWindowFor(HitResult result)
|
||||||
{
|
{
|
||||||
|
@ -110,6 +110,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
//dividing by the customwidth will effectively scale our content to the required container size.
|
//dividing by the customwidth will effectively scale our content to the required container size.
|
||||||
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
|
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
RelativeChildSize = new Vector2(DrawScale.X, RelativeChildSize.Y);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -598,7 +598,7 @@
|
|||||||
</TypePattern>
|
</TypePattern>
|
||||||
</Patterns></s:String>
|
</Patterns></s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) 2007-$CURRENT_YEAR$ ppy Pty Ltd <contact@ppy.sh>.
|
<s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) 2007-$CURRENT_YEAR$ ppy Pty Ltd <contact@ppy.sh>.
|
||||||
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
</s:String>
|
</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=Constants/@EntryIndexedValue"><Policy Inspect="True" Prefix="" Suffix="" Style="AA_BB" /></s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue"><Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=EnumMember/@EntryIndexedValue"><Policy Inspect="False" Prefix="" Suffix="" Style="AaBb" /></s:String>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user