1
0
mirror of https://github.com/ppy/osu synced 2024-12-24 15:53:37 +00:00

Merge branch 'master' into test-case

This commit is contained in:
Huo Yaoyuan 2016-12-18 12:30:50 +08:00
commit 1323c6a861
154 changed files with 2124 additions and 766 deletions
osu-frameworkosu-resources
osu.Desktop.VisualTests
osu.Desktop
osu.Game.Mode.Osu
osu.Game.Modes.Catch
osu.Game.Modes.Mania
osu.Game.Modes.Osu
osu.Game.Modes.Taiko
osu.Game.Tests
osu.Game

@ -1 +1 @@
Subproject commit 7b2f4dfce7894ca7dea7626dcc34bcc32df651b9
Subproject commit eab5cc9fde277a9558712c69d92aed0671f2b0ad

@ -1 +1 @@
Subproject commit 6edd5eacdd25cc8c4f4dbca3414678c0b7dc5deb
Subproject commit e24414a277e407ae2438e4b6d9fa9c7992dd6485

View File

@ -1,3 +1,8 @@
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>

View File

@ -1,4 +1,7 @@
using osu.Framework;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Desktop.Platform;
using SQLite.Net;
using SQLite.Net.Interop;

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Desktop;

View File

@ -42,7 +42,8 @@ namespace osu.Desktop.VisualTests.Tests
objects.Add(new HitCircle()
{
StartTime = time,
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384))
Position = new Vector2(RNG.Next(0, 512), RNG.Next(0, 384)),
Scale = RNG.NextSingle(0.5f, 1.0f),
});
time += RNG.Next(50, 500);
@ -85,11 +86,5 @@ namespace osu.Desktop.VisualTests.Tests
}
});
}
protected override void Update()
{
base.Update();
Clock.ProcessFrame();
}
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Desktop.VisualTests.Tests
public TestCaseHitObjects()
{
var swClock = new StopwatchClock(true) { Rate = 1 };
var swClock = new StopwatchClock(true) { Rate = 0.2f };
Clock = new FramedClock(swClock);
}
@ -52,17 +52,13 @@ namespace osu.Desktop.VisualTests.Tests
Origin = Anchor.Centre,
Depth = i,
State = ArmedState.Hit,
Judgement = new OsuJudgementInfo { Result = HitResult.Hit }
};
approachContainer.Add(d.ApproachCircle.CreateProxy());
Add(d);
}
}
protected override void Update()
{
base.Update();
Clock.ProcessFrame();
}
}
}

View File

@ -32,11 +32,5 @@ namespace osu.Desktop.VisualTests.Tests
Add(mc);
AddToggle(@"Show", mc.ToggleVisibility);
}
protected override void Update()
{
base.Update();
Clock.ProcessFrame();
}
}
}

View File

@ -82,11 +82,5 @@ namespace osu.Desktop.VisualTests.Tests
Beatmap = beatmap
});
}
protected override void Update()
{
base.Update();
Clock.ProcessFrame();
}
}
}

View File

@ -1,5 +1,5 @@
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.GameModes.Testing;

View File

@ -150,7 +150,7 @@
<Project>{d9a367c9-4c1a-489f-9b05-a0cea2b53b58}</Project>
<Name>osu.Game.Resources</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{c92a607b-1fdd-4954-9f92-03ff547d9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net45" />

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;

View File

@ -130,7 +130,7 @@
<Project>{d9a367c9-4c1a-489f-9b05-a0cea2b53b58}</Project>
<Name>osu.Game.Resources</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{c92a607b-1fdd-4954-9f92-03ff547d9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>

View File

@ -1,318 +0,0 @@
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Modes.Objects.Drawables;
using OpenTK;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using OpenTK.Graphics;
using osu.Framework.Input;
using OpenTK.Graphics.ES30;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Game.Configuration;
using osu.Framework.Configuration;
using System;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
class DrawableSlider : DrawableOsuHitObject
{
private Slider slider;
private DrawableHitCircle startCircle;
private Container ball;
private Body body;
public DrawableSlider(Slider s) : base(s)
{
slider = s;
Origin = Anchor.TopLeft;
Position = Vector2.Zero;
RelativeSizeAxes = Axes.Both;
Children = new Drawable[]
{
body = new Body(s)
{
Position = s.Position,
},
ball = new Ball(),
startCircle = new DrawableHitCircle(new HitCircle
{
StartTime = s.StartTime,
Position = s.Position,
Colour = s.Colour,
})
{
Depth = -1 //override time-based depth.
},
};
}
private Bindable<bool> snakingIn;
private Bindable<bool> snakingOut;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
}
protected override void LoadComplete()
{
base.LoadComplete();
//force application of the state that was set before we loaded.
UpdateState(State);
body.PathWidth = 32;
}
private void computeProgress(out int repeat, out double progress)
{
progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
repeat = (int)(progress * slider.RepeatCount);
progress = (progress * slider.RepeatCount) % 1;
if (repeat % 2 == 1)
progress = 1 - progress;
}
private void updateBall(double progress)
{
ball.Alpha = Time.Current >= slider.StartTime && Time.Current <= slider.EndTime ? 1 : 0;
ball.Position = slider.Curve.PositionAt(progress);
}
private void updateBody(int repeat, double progress)
{
double drawStartProgress = 0;
double drawEndProgress = MathHelper.Clamp((Time.Current - slider.StartTime + TIME_PREEMPT) / TIME_FADEIN, 0, 1);
if (repeat >= slider.RepeatCount - 1)
{
if (Math.Min(repeat, slider.RepeatCount - 1) % 2 == 1)
{
drawStartProgress = 0;
drawEndProgress = progress;
}
else
{
drawStartProgress = progress;
drawEndProgress = 1;
}
}
body.SetRange(
snakingOut ? drawStartProgress : 0,
snakingIn ? drawEndProgress : 1);
}
protected override void Update()
{
base.Update();
double progress;
int repeat;
computeProgress(out repeat, out progress);
updateBall(progress);
updateBody(repeat, progress);
}
protected override void CheckJudgement(bool userTriggered)
{
var j = Judgement as OsuJudgementInfo;
var sc = startCircle.Judgement as OsuJudgementInfo;
if (!userTriggered && Time.Current >= HitObject.EndTime)
{
j.Score = sc.Score;
j.Result = sc.Result;
}
}
protected override void UpdateState(ArmedState state)
{
base.UpdateState(state);
Delay(HitObject.Duration);
FadeOut(300);
}
private class Ball : Container
{
private Box follow;
public Ball()
{
Masking = true;
AutoSizeAxes = Axes.Both;
BlendingMode = BlendingMode.Additive;
Origin = Anchor.Centre;
Children = new Drawable[]
{
follow = new Box
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Colour = Color4.Orange,
Width = 64,
Height = 64,
},
new Container
{
Masking = true,
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Colour = Color4.Cyan,
CornerRadius = 32,
Children = new[]
{
new Box
{
Width = 64,
Height = 64,
},
}
}
};
}
private InputState lastState;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
lastState = state;
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
lastState = state;
return base.OnMouseUp(state, args);
}
protected override bool OnMouseMove(InputState state)
{
lastState = state;
return base.OnMouseMove(state);
}
bool tracking;
protected bool Tracking
{
get { return tracking; }
set
{
if (value == tracking) return;
tracking = value;
follow.ScaleTo(tracking ? 2.4f : 1, 140, EasingTypes.Out);
follow.FadeTo(tracking ? 0.8f : 0, 140, EasingTypes.Out);
}
}
protected override void Update()
{
base.Update();
CornerRadius = DrawWidth / 2;
Tracking = lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
}
}
private class Body : Container
{
private Path path;
private BufferedContainer container;
public float PathWidth
{
get { return path.PathWidth; }
set { path.PathWidth = value; }
}
private double? drawnProgressStart;
private double? drawnProgressEnd;
private Slider slider;
public Body(Slider s)
{
slider = s;
Children = new Drawable[]
{
container = new BufferedContainer
{
CacheDrawnFrameBuffer = true,
Children = new Drawable[]
{
path = new Path
{
Colour = s.Colour,
BlendingMode = BlendingMode.None,
},
}
}
};
container.Attach(RenderbufferInternalFormat.DepthComponent16);
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
// Surprisingly, this looks somewhat okay and works well as a test for self-overlaps.
// TODO: Don't do this.
path.Texture = textures.Get(@"Menu/logo");
}
public void SetRange(double p0, double p1)
{
if (p0 > p1)
MathHelper.Swap(ref p0, ref p1);
if (updateSnaking(p0, p1))
{
// Autosizing does not give us the desired behaviour here.
// We want the container to have the same size as the slider,
// and to be positioned such that the slider head is at (0,0).
container.Size = path.Size;
container.Position = -path.PositionInBoundingBox(slider.Curve.PositionAt(0) - currentCurve[0]);
container.ForceRedraw();
}
}
private List<Vector2> currentCurve = new List<Vector2>();
private bool updateSnaking(double p0, double p1)
{
if (drawnProgressStart == p0 && drawnProgressEnd == p1) return false;
drawnProgressStart = p0;
drawnProgressEnd = p1;
slider.Curve.GetPathToProgress(currentCurve, p0, p1);
path.ClearVertices();
foreach (Vector2 p in currentCurve)
path.AddVertex(p - currentCurve[0]);
return true;
}
}
}
}

View File

@ -1,51 +0,0 @@
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Game.Modes.Objects.Drawables;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
public class HitExplosion : FlowContainer
{
private SpriteText line1;
private SpriteText line2;
public HitExplosion(OsuJudgementInfo judgement)
{
AutoSizeAxes = Axes.Both;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
Direction = FlowDirection.VerticalOnly;
Spacing = new Vector2(0, 2);
Children = new Drawable[]
{
line1 = new SpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = judgement.Score.GetDescription(),
Font = @"Venera",
TextSize = 20,
},
line2 = new SpriteText
{
Text = judgement.Combo.GetDescription(),
Font = @"Venera",
TextSize = 14,
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
line1.TransformSpacingTo(14, 1800, EasingTypes.OutQuint);
line2.TransformSpacingTo(14, 1800, EasingTypes.OutQuint);
}
}
}

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Modes.Osu
{
class OsuScore : Score
{
}
}

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net452" />
</packages>

View File

@ -1,3 +1,8 @@
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>

View File

@ -1,4 +1,7 @@
using System.Reflection;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View File

@ -57,6 +57,9 @@
<Compile Include="CatchRuleset.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />
</ItemGroup>
@ -65,7 +68,7 @@
<Project>{C76BF5B3-985E-4D39-95FE-97C9C879B83A}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{C92A607B-1FDD-4954-9F92-03FF547D9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net45" />
</packages>

View File

@ -1,3 +1,8 @@
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>

View File

@ -1,4 +1,7 @@
using System.Reflection;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -61,7 +61,7 @@
<Project>{C76BF5B3-985E-4D39-95FE-97C9C879B83A}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{C92A607B-1FDD-4954-9F92-03FF547D9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>
@ -75,6 +75,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<None Include="app.config" />
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net45" />
</packages>

View File

@ -1,4 +1,7 @@
using System.Collections.Generic;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects
@ -10,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects
private Vector2[] subdivisionBuffer1;
private Vector2[] subdivisionBuffer2;
private const float TOLERANCE = 0.5f;
private const float TOLERANCE = 0.25f;
private const float TOLERANCE_SQ = TOLERANCE * TOLERANCE;
public BezierApproximator(List<Vector2> controlPoints)
@ -33,7 +36,7 @@ namespace osu.Game.Modes.Osu.Objects
private static bool IsFlatEnough(Vector2[] controlPoints)
{
for (int i = 1; i < controlPoints.Length - 1; i++)
if ((controlPoints[i - 1] - 2 * controlPoints[i] + controlPoints[i + 1]).LengthSquared > TOLERANCE_SQ)
if ((controlPoints[i - 1] - 2 * controlPoints[i] + controlPoints[i + 1]).LengthSquared > TOLERANCE_SQ * 4)
return false;
return true;
@ -93,7 +96,6 @@ namespace osu.Game.Modes.Osu.Objects
/// Creates a piecewise-linear approximation of a bezier curve, by adaptively repeatedly subdividing
/// the control points until their approximation error vanishes below a given threshold.
/// </summary>
/// <param name="controlPoints">The control points describing the curve.</param>
/// <returns>A list of vectors representing the piecewise-linear approximation.</returns>
public List<Vector2> CreateBezier()
{

View File

@ -0,0 +1,102 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.MathUtils;
using System;
using System.Collections.Generic;
namespace osu.Game.Modes.Osu.Objects
{
public class CircularArcApproximator
{
private Vector2 A;
private Vector2 B;
private Vector2 C;
private int amountPoints;
private const float TOLERANCE = 0.1f;
public CircularArcApproximator(Vector2 A, Vector2 B, Vector2 C)
{
this.A = A;
this.B = B;
this.C = C;
}
/// <summary>
/// Creates a piecewise-linear approximation of a circular arc curve.
/// </summary>
/// <returns>A list of vectors representing the piecewise-linear approximation.</returns>
public List<Vector2> CreateArc()
{
float aSq = (B - C).LengthSquared;
float bSq = (A - C).LengthSquared;
float cSq = (A - B).LengthSquared;
// If we have a degenerate triangle where a side-length is almost zero, then give up and fall
// back to a more numerically stable method.
if (Precision.AlmostEquals(aSq, 0) || Precision.AlmostEquals(bSq, 0) || Precision.AlmostEquals(cSq, 0))
return new List<Vector2>();
float s = aSq * (bSq + cSq - aSq);
float t = bSq * (aSq + cSq - bSq);
float u = cSq * (aSq + bSq - cSq);
float sum = s + t + u;
// If we have a degenerate triangle with an almost-zero size, then give up and fall
// back to a more numerically stable method.
if (Precision.AlmostEquals(sum, 0))
return new List<Vector2>();
Vector2 centre = (s * A + t * B + u * C) / sum;
Vector2 dA = A - centre;
Vector2 dC = C - centre;
float r = dA.Length;
double thetaStart = Math.Atan2(dA.Y, dA.X);
double thetaEnd = Math.Atan2(dC.Y, dC.X);
while (thetaEnd < thetaStart)
thetaEnd += 2 * Math.PI;
double dir = 1;
double thetaRange = thetaEnd - thetaStart;
// Decide in which direction to draw the circle, depending on which side of
// AC B lies.
Vector2 orthoAC = C - A;
orthoAC = new Vector2(orthoAC.Y, -orthoAC.X);
if (Vector2.Dot(orthoAC, B - A) < 0)
{
dir = -dir;
thetaRange = 2 * Math.PI - thetaRange;
}
// We select the amount of points for the approximation by requiring the discrete curvature
// to be smaller than the provided tolerance. The exact angle required to meet the tolerance
// is: 2 * Math.Acos(1 - TOLERANCE / r)
if (2 * r <= TOLERANCE)
// This special case is required for extremely short sliders where the radius is smaller than
// the tolerance. This is a pathological rather than a realistic case.
amountPoints = 2;
else
amountPoints = Math.Max(2, (int)Math.Ceiling(thetaRange / (2 * Math.Acos(1 - TOLERANCE / r))));
List<Vector2> output = new List<Vector2>(amountPoints);
for (int i = 0; i < amountPoints; ++i)
{
double fract = (double)i / (amountPoints - 1);
double theta = thetaStart + dir * fract * thetaRange;
Vector2 o = new Vector2((float)Math.Cos(theta), (float)Math.Sin(theta)) * r;
output.Add(centre + o);
}
return output;
}
}
}

View File

@ -13,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
public class DrawableHitCircle : DrawableOsuHitObject
{
private OsuHitObject osuObject;
private HitCircle osuObject;
public ApproachCircle ApproachCircle;
private CirclePiece circle;
@ -22,14 +22,14 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private ExplodePiece explode;
private NumberPiece number;
private GlowPiece glow;
private HitExplosion explosion;
public DrawableHitCircle(OsuHitObject h) : base(h)
public DrawableHitCircle(HitCircle h) : base(h)
{
osuObject = h;
Origin = Anchor.Centre;
Position = osuObject.Position;
Scale = new Vector2(osuObject.Scale);
Children = new Drawable[]
{
@ -64,14 +64,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Size = circle.DrawSize;
}
protected override void LoadComplete()
{
base.LoadComplete();
//force application of the state that was set before we loaded.
UpdateState(State);
}
double hit50 = 150;
double hit100 = 80;
double hit300 = 30;
@ -113,7 +105,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
ApproachCircle.Alpha = 0;
ApproachCircle.Scale = new Vector2(2);
explode.Alpha = 0;
Scale = new Vector2(0.5f); //this will probably need to be moved to DrawableHitObject at some point.
}
protected override void UpdatePreemptState()
@ -138,25 +129,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
case ArmedState.Idle:
Delay(osuObject.Duration + TIME_PREEMPT);
FadeOut(TIME_FADEOUT);
explosion?.Expire();
explosion = null;
break;
case ArmedState.Miss:
ring.FadeOut();
circle.FadeOut();
number.FadeOut();
glow.FadeOut();
explosion?.Expire();
explosion = null;
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
FadeOut(800);
FadeOut(TIME_FADEOUT / 5);
break;
case ArmedState.Hit:
const double flash_in = 30;
const double flash_in = 40;
flash.FadeTo(0.8f, flash_in);
flash.Delay(flash_in);
@ -164,8 +142,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
explode.FadeIn(flash_in);
Schedule(() => Add(explosion = new HitExplosion((OsuJudgementInfo)Judgement)));
Delay(flash_in, true);
//after the flash, we can hide some elements that were behind it

View File

@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Drawables;
@ -11,9 +9,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
public class DrawableOsuHitObject : DrawableHitObject
{
protected const float TIME_PREEMPT = 600;
protected const float TIME_FADEIN = 400;
protected const float TIME_FADEOUT = 500;
public const float TIME_PREEMPT = 600;
public const float TIME_FADEIN = 400;
public const float TIME_FADEOUT = 500;
public DrawableOsuHitObject(OsuHitObject hitObject)
: base(hitObject)
@ -26,7 +24,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
if (!IsLoaded) return;
Flush(true);
Flush();
UpdateInitialState();

View File

@ -0,0 +1,141 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects.Drawables.Pieces;
using OpenTK;
using osu.Framework.Input;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
class DrawableSlider : DrawableOsuHitObject
{
private Slider slider;
private DrawableHitCircle initialCircle;
private List<ISliderProgress> components = new List<ISliderProgress>();
SliderBody body;
SliderBall ball;
SliderBouncer bouncer1, bouncer2;
public DrawableSlider(Slider s) : base(s)
{
slider = s;
Children = new Drawable[]
{
body = new SliderBody(s)
{
Position = s.Position,
PathWidth = s.Scale * 72,
},
bouncer1 = new SliderBouncer(s, false)
{
Position = s.Curve.PositionAt(1),
Scale = new Vector2(s.Scale),
},
bouncer2 = new SliderBouncer(s, true)
{
Position = s.Position,
Scale = new Vector2(s.Scale),
},
ball = new SliderBall(s)
{
Scale = new Vector2(s.Scale),
},
initialCircle = new DrawableHitCircle(new HitCircle
{
StartTime = s.StartTime,
Position = s.Position,
Scale = s.Scale,
Colour = s.Colour,
Sample = s.Sample,
}),
};
components.Add(body);
components.Add(ball);
components.Add(bouncer1);
components.Add(bouncer2);
}
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
public override bool Contains(Vector2 screenSpacePos) => true;
int currentRepeat;
protected override void Update()
{
base.Update();
double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
int repeat = (int)(progress * slider.RepeatCount);
progress = (progress * slider.RepeatCount) % 1;
if (repeat > currentRepeat)
{
if (ball.Tracking)
PlaySample();
currentRepeat = repeat;
}
if (repeat % 2 == 1)
progress = 1 - progress;
bouncer2.Position = slider.Curve.PositionAt(body.SnakedEnd ?? 0);
//todo: we probably want to reconsider this before adding scoring, but it looks and feels nice.
if (initialCircle.Judgement?.Result != HitResult.Hit)
initialCircle.Position = slider.Curve.PositionAt(progress);
components.ForEach(c => c.UpdateProgress(progress, repeat));
}
protected override void CheckJudgement(bool userTriggered)
{
var j = Judgement as OsuJudgementInfo;
var sc = initialCircle.Judgement as OsuJudgementInfo;
if (!userTriggered && Time.Current >= HitObject.EndTime)
{
j.Score = sc.Score;
j.Result = sc.Result;
}
}
protected override void UpdateInitialState()
{
base.UpdateInitialState();
body.Alpha = 1;
//we need to be visible to handle input events. note that we still don't get enough events (we don't get a position if the mouse hasn't moved since the slider appeared).
ball.Alpha = 0.01f;
}
protected override void UpdateState(ArmedState state)
{
base.UpdateState(state);
ball.FadeIn();
Delay(HitObject.Duration, true);
body.FadeOut(160);
ball.FadeOut(160);
FadeOut(800);
}
}
internal interface ISliderProgress
{
void UpdateProgress(double progress, int repeat);
}
}

View File

@ -0,0 +1,84 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Game.Modes.Objects.Drawables;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables
{
public class HitExplosion : FlowContainer
{
private readonly OsuJudgementInfo judgement;
private SpriteText line1;
private SpriteText line2;
public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
{
this.judgement = judgement;
AutoSizeAxes = Axes.Both;
Origin = Anchor.Centre;
Direction = FlowDirection.VerticalOnly;
Spacing = new Vector2(0, 2);
Position = (h?.EndPosition ?? Vector2.Zero) + judgement.PositionOffset;
Children = new Drawable[]
{
line1 = new SpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = judgement.Score.GetDescription(),
Font = @"Venera",
TextSize = 16,
},
line2 = new SpriteText
{
Text = judgement.Combo.GetDescription(),
Font = @"Venera",
TextSize = 11,
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
if (judgement.Result == HitResult.Miss)
{
FadeInFromZero(60);
ScaleTo(1.6f);
ScaleTo(1, 100, EasingTypes.In);
MoveToOffset(new Vector2(0, 100), 800, EasingTypes.InQuint);
RotateTo(40, 800, EasingTypes.InQuint);
Delay(600);
FadeOut(200);
}
else
{
line1.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint);
line2.TransformSpacingTo(new Vector2(14, 0), 1800, EasingTypes.OutQuint);
FadeOut(500);
}
switch (judgement.Result)
{
case HitResult.Miss:
Colour = Color4.Red;
break;
}
Expire();
}
}
}

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -1,4 +1,7 @@
using osu.Framework.Graphics;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using OpenTK;

View File

@ -1,4 +1,7 @@
using osu.Framework.Graphics;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using OpenTK;

View File

@ -1,4 +1,7 @@
using osu.Framework.Allocation;
//Copyright (c) 2007-2016 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;

View File

@ -1,4 +1,7 @@
using osu.Framework.Allocation;
//Copyright (c) 2007-2016 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;

View File

@ -1,4 +1,7 @@
using osu.Framework.Allocation;
//Copyright (c) 2007-2016 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;

View File

@ -0,0 +1,116 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Framework.Input;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class SliderBall : Container, ISliderProgress
{
private readonly Slider slider;
private Box follow;
const float width = 140;
public SliderBall(Slider slider)
{
this.slider = slider;
Masking = true;
AutoSizeAxes = Axes.Both;
BlendingMode = BlendingMode.Additive;
Origin = Anchor.Centre;
BorderThickness = 10;
BorderColour = Color4.Orange;
Children = new Drawable[]
{
follow = new Box
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Colour = Color4.Orange,
Width = width,
Height = width,
Alpha = 0,
},
new Container
{
Masking = true,
AutoSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
BorderThickness = 14,
BorderColour = Color4.White,
Alpha = 1,
CornerRadius = width / 2,
Children = new[]
{
new Box
{
Colour = slider.Colour,
Alpha = 0.4f,
Width = width,
Height = width,
},
}
}
};
}
private InputState lastState;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
lastState = state;
return base.OnMouseDown(state, args);
}
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
{
lastState = state;
return base.OnMouseUp(state, args);
}
protected override bool OnMouseMove(InputState state)
{
lastState = state;
return base.OnMouseMove(state);
}
bool tracking;
public bool Tracking
{
get { return tracking; }
set
{
if (value == tracking) return;
tracking = value;
follow.ScaleTo(tracking ? 2.8f : 1, 300, EasingTypes.OutQuint);
follow.FadeTo(tracking ? 0.2f : 0, 300, EasingTypes.OutQuint);
}
}
private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime;
protected override void Update()
{
base.Update();
CornerRadius = DrawWidth / 2;
Tracking = canCurrentlyTrack && lastState != null && Contains(lastState.Mouse.NativeState.Position) && lastState.Mouse.HasMainButtonPressed;
}
public void UpdateProgress(double progress, int repeat)
{
Position = slider.Curve.PositionAt(progress);
}
}
}

View File

@ -0,0 +1,163 @@
//Copyright (c) 2007-2016 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 osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.OpenGL.Textures;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Configuration;
using OpenTK;
using OpenTK.Graphics.ES30;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class SliderBody : Container, ISliderProgress
{
private Path path;
private BufferedContainer container;
public float PathWidth
{
get { return path.PathWidth; }
set
{
path.PathWidth = value;
}
}
public double? SnakedStart { get; private set; }
public double? SnakedEnd { get; private set; }
private Slider slider;
public SliderBody(Slider s)
{
slider = s;
Children = new Drawable[]
{
container = new BufferedContainer
{
CacheDrawnFrameBuffer = true,
Children = new Drawable[]
{
path = new Path
{
BlendingMode = BlendingMode.None,
},
}
},
};
container.Attach(RenderbufferInternalFormat.DepthComponent16);
}
public void SetRange(double p0, double p1)
{
if (p0 > p1)
MathHelper.Swap(ref p0, ref p1);
if (updateSnaking(p0, p1))
{
// Autosizing does not give us the desired behaviour here.
// We want the container to have the same size as the slider,
// and to be positioned such that the slider head is at (0,0).
container.Size = path.Size;
container.Position = -path.PositionInBoundingBox(slider.Curve.PositionAt(0) - currentCurve[0]);
container.ForceRedraw();
}
}
private Bindable<bool> snakingIn;
private Bindable<bool> snakingOut;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
int textureWidth = (int)PathWidth * 2;
//initialise background
var upload = new TextureUpload(textureWidth * 4);
var bytes = upload.Data;
const float aa_portion = 0.02f;
const float border_portion = 0.18f;
const float gradient_portion = 1 - border_portion;
const float opacity_at_centre = 0.3f;
const float opacity_at_edge = 0.8f;
for (int i = 0; i < textureWidth; i++)
{
float progress = (float)i / (textureWidth - 1);
if (progress <= border_portion)
{
bytes[i * 4] = 255;
bytes[i * 4 + 1] = 255;
bytes[i * 4 + 2] = 255;
bytes[i * 4 + 3] = (byte)(Math.Min(progress / aa_portion, 1) * 255);
}
else
{
progress -= border_portion;
bytes[i * 4] = (byte)(slider.Colour.R * 255);
bytes[i * 4 + 1] = (byte)(slider.Colour.G * 255);
bytes[i * 4 + 2] = (byte)(slider.Colour.B * 255);
bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (slider.Colour.A * 255));
}
}
var texture = new Texture(textureWidth, 1);
texture.SetData(upload);
path.Texture = texture;
}
private List<Vector2> currentCurve = new List<Vector2>();
private bool updateSnaking(double p0, double p1)
{
if (SnakedStart == p0 && SnakedEnd == p1) return false;
SnakedStart = p0;
SnakedEnd = p1;
slider.Curve.GetPathToProgress(currentCurve, p0, p1);
path.ClearVertices();
foreach (Vector2 p in currentCurve)
path.AddVertex(p - currentCurve[0]);
return true;
}
public void UpdateProgress(double progress, int repeat)
{
double start = 0;
double end = snakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - DrawableOsuHitObject.TIME_PREEMPT)) / DrawableOsuHitObject.TIME_FADEIN, 0, 1) : 1;
if (repeat >= slider.RepeatCount - 1)
{
if (Math.Min(repeat, slider.RepeatCount - 1) % 2 == 1)
{
start = 0;
end = snakingOut ? progress : 1;
}
else
{
start = snakingOut ? progress : 0;
}
}
SetRange(start, end);
}
}
}

View File

@ -0,0 +1,58 @@
//Copyright (c) 2007-2016 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 System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class SliderBouncer : Container, ISliderProgress
{
private readonly Slider slider;
private readonly bool isEnd;
private TextAwesome icon;
public SliderBouncer(Slider slider, bool isEnd)
{
this.slider = slider;
this.isEnd = isEnd;
AutoSizeAxes = Axes.Both;
BlendingMode = BlendingMode.Additive;
Origin = Anchor.Centre;
Children = new Drawable[]
{
icon = new TextAwesome
{
Icon = FontAwesome.fa_eercast,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
TextSize = 48,
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
icon.RotateTo(360, 1000);
icon.Loop();
}
public void UpdateProgress(double progress, int repeat)
{
if (Time.Current < slider.StartTime)
Alpha = 0;
Alpha = repeat + 1 < slider.RepeatCount && repeat % 2 == (isEnd ? 0 : 1) ? 1 : 0;
}
}
}

View File

@ -1,4 +1,7 @@
using osu.Framework.Allocation;
//Copyright (c) 2007-2016 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;
@ -10,6 +13,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{
public class Triangles : Container<Triangle>
{
public override bool HandleInput => false;
protected override void LoadComplete()
{
base.LoadComplete();

View File

@ -5,6 +5,7 @@ using System;
using osu.Game.Beatmaps.Samples;
using osu.Game.Modes.Objects;
using OpenTK;
using osu.Game.Beatmaps;
namespace osu.Game.Modes.Osu.Objects
{
@ -12,6 +13,17 @@ namespace osu.Game.Modes.Osu.Objects
{
public Vector2 Position { get; set; }
public float Scale { get; set; } = 1;
public virtual Vector2 EndPosition => Position;
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
{
base.SetDefaultsFromBeatmap(beatmap);
Scale = (1.0f - 0.7f * (beatmap.BeatmapInfo.BaseDifficulty.CircleSize - 5) / 5) / 2;
}
[Flags]
internal enum HitObjectType
{

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 System.Globalization;
using System.Linq;
@ -80,7 +83,7 @@ namespace osu.Game.Modes.Osu.Objects
s.Curve = new SliderCurve
{
Path = points,
ControlPoints = points,
Length = length,
CurveType = curveType
};
@ -98,7 +101,10 @@ namespace osu.Game.Modes.Osu.Objects
}
result.Position = new Vector2(int.Parse(split[0]), int.Parse(split[1]));
result.StartTime = double.Parse(split[2]);
result.Sample = new HitSampleInfo { Type = (SampleType)int.Parse(split[4]) };
result.Sample = new HitSampleInfo {
Type = (SampleType)int.Parse(split[4]),
Set = SampleSet.Soft,
};
result.NewCombo = combo;
// TODO: "addition" field
return result;

View File

@ -1,9 +1,8 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Database;
using osu.Game.Beatmaps;
using System;
using OpenTK;
namespace osu.Game.Modes.Osu.Objects
{
@ -11,10 +10,14 @@ namespace osu.Game.Modes.Osu.Objects
{
public override double EndTime => StartTime + RepeatCount * Curve.Length / Velocity;
public override Vector2 EndPosition => RepeatCount % 2 == 0 ? Position : Curve.PositionAt(1);
public double Velocity;
public override void SetDefaultsFromBeatmap(Beatmap beatmap)
{
base.SetDefaultsFromBeatmap(beatmap);
Velocity = 100 / beatmap.BeatLengthAt(StartTime, true) * beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier;
}

View File

@ -1,12 +1,11 @@
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using OpenTK;
using System.Linq;
using System.Diagnostics;
using osu.Framework.MathUtils;
using System;
using System.Diagnostics;
namespace osu.Game.Modes.Osu.Objects
{
@ -14,21 +13,39 @@ namespace osu.Game.Modes.Osu.Objects
{
public double Length;
public List<Vector2> Path;
public List<Vector2> ControlPoints;
public CurveTypes CurveType;
private List<Vector2> calculatedPath = new List<Vector2>();
private List<double> cumulativeLength = new List<double>();
private List<Vector2> calculateSubpath(List<Vector2> subpath)
private List<Vector2> calculateSubpath(List<Vector2> subControlPoints)
{
switch (CurveType)
{
case CurveTypes.Linear:
return subpath;
return subControlPoints;
case CurveTypes.PerfectCurve:
// If we have a different amount than 3 control points, use bezier for perfect curves.
if (ControlPoints.Count != 3)
return new BezierApproximator(subControlPoints).CreateBezier();
else
{
Debug.Assert(subControlPoints.Count == 3);
// Here we have exactly 3 control points. Attempt to fit a circular arc.
List<Vector2> subpath = new CircularArcApproximator(subControlPoints[0], subControlPoints[1], subControlPoints[2]).CreateArc();
if (subpath.Count == 0)
// For some reason a circular arc could not be fit to the 3 given points. Fall back
// to a numerically stable bezier approximation.
subpath = new BezierApproximator(subControlPoints).CreateBezier();
return subpath;
}
default:
return new BezierApproximator(subpath).CreateBezier();
return new BezierApproximator(subControlPoints).CreateBezier();
}
}
@ -39,21 +56,19 @@ namespace osu.Game.Modes.Osu.Objects
// Sliders may consist of various subpaths separated by two consecutive vertices
// with the same position. The following loop parses these subpaths and computes
// their shape independently, consecutively appending them to calculatedPath.
List<Vector2> subpath = new List<Vector2>();
for (int i = 0; i < Path.Count; ++i)
List<Vector2> subControlPoints = new List<Vector2>();
for (int i = 0; i < ControlPoints.Count; ++i)
{
subpath.Add(Path[i]);
if (i == Path.Count - 1 || Path[i] == Path[i + 1])
subControlPoints.Add(ControlPoints[i]);
if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1])
{
// If we already constructed a subpath previously, then the new subpath
// will have as starting position the end position of the previous subpath.
// Hence we can and should remove the previous endpoint to avoid a segment
// with 0 length.
if (calculatedPath.Count > 0)
calculatedPath.RemoveAt(calculatedPath.Count - 1);
List<Vector2> subpath = calculateSubpath(subControlPoints);
for (int j = 0; j < subpath.Count; ++j)
// Only add those vertices that add a new segment to the path.
if (calculatedPath.Count == 0 || calculatedPath.Last() != subpath[j])
calculatedPath.Add(subpath[j]);
calculatedPath.AddRange(calculateSubpath(subpath));
subpath.Clear();
subControlPoints.Clear();
}
}
}

View File

@ -1,3 +1,8 @@
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>

View File

@ -0,0 +1,15 @@
//Copyright (c) 2007-2016 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 System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Modes.Osu
{
class OsuScore : Score
{
}
}

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 System.Linq;
using System.Text;

View File

@ -1,4 +1,7 @@
using System.Reflection;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.UI
protected virtual float PopOutSmallScale => 1.1f;
protected virtual bool CanPopOutWhileRolling => false;
public Vector2 PopOutScale = new Vector2(2.5f);
public Vector2 PopOutScale = new Vector2(1.6f);
protected override void LoadComplete()
{

View File

@ -6,7 +6,6 @@ using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables;
using osu.Game.Modes.UI;
using OsuConverter = osu.Game.Modes.Osu.Objects.OsuHitObjectConverter;
namespace osu.Game.Modes.Osu.UI
{

View File

@ -3,19 +3,18 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Osu.Objects.Drawables;
using osu.Game.Modes.UI;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.UI
{
public class OsuPlayfield : Playfield
{
private Container approachCircles;
private Container judgementLayer;
public override Vector2 Size
{
@ -35,24 +34,40 @@ namespace osu.Game.Modes.Osu.UI
RelativeSizeAxes = Axes.Both;
Size = new Vector2(0.75f);
AddInternal(new Drawable[]
Add(new Drawable[]
{
judgementLayer = new Container
{
RelativeSizeAxes = Axes.Both,
Depth = 1,
},
approachCircles = new Container
{
RelativeSizeAxes = Axes.Both,
Depth = -1,
}
});
}
public override void Add(DrawableHitObject h)
{
h.Depth = (float)h.HitObject.StartTime;
DrawableHitCircle c = h as DrawableHitCircle;
if (c != null)
{
approachCircles.Add(c.ApproachCircle.CreateProxy());
}
h.OnJudgement += judgement;
base.Add(h);
}
private void judgement(DrawableHitObject h, JudgementInfo j)
{
HitExplosion explosion = new HitExplosion((OsuJudgementInfo)j, (OsuHitObject)h.HitObject);
judgementLayer.Add(explosion);
}
}
}

View File

@ -12,18 +12,20 @@ namespace osu.Game.Modes.Osu.UI
{
public class OsuScoreOverlay : ScoreOverlay
{
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter()
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Position = new Vector2(0, 45)
};
protected override ScoreCounter CreateScoreCounter() => new ScoreCounter()
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 60
TextSize = 60,
Margin = new MarginPadding { Right = 5 },
};
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter()
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Position = new Vector2(0, 55),
Margin = new MarginPadding { Right = 5 },
};
protected override ComboCounter CreateComboCounter() => new OsuComboCounter()

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

View File

@ -42,6 +42,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Objects\BezierApproximator.cs" />
<Compile Include="Objects\CircularArcApproximator.cs" />
<Compile Include="Objects\Drawables\DrawableOsuHitObject.cs" />
<Compile Include="Objects\Drawables\Pieces\ApproachCircle.cs" />
<Compile Include="Objects\Drawables\Pieces\CirclePiece.cs" />
@ -52,7 +53,10 @@
<Compile Include="Objects\Drawables\HitExplosion.cs" />
<Compile Include="Objects\Drawables\Pieces\NumberPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\RingPiece.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBouncer.cs" />
<Compile Include="Objects\Drawables\Pieces\Triangles.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBall.cs" />
<Compile Include="Objects\Drawables\Pieces\SliderBody.cs" />
<Compile Include="Objects\OsuHitObjectParser.cs" />
<Compile Include="Objects\SliderCurve.cs" />
<Compile Include="OsuScore.cs" />
@ -81,6 +85,9 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<None Include="app.config" />
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net452" />
</packages>

View File

@ -1,3 +1,8 @@
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<configuration>
<dllmap os="linux" dll="opengl32.dll" target="libGL.so.1"/>
<dllmap os="linux" dll="glu32.dll" target="libGLU.so.1"/>

View File

@ -1,4 +1,7 @@
using System.Reflection;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

View File

@ -55,6 +55,9 @@
<Compile Include="TaikoRuleset.cs" />
</ItemGroup>
<ItemGroup>
<None Include="..\osu.licenseheader">
<Link>osu.licenseheader</Link>
</None>
<None Include="OpenTK.dll.config" />
<None Include="packages.config" />
</ItemGroup>
@ -63,7 +66,7 @@
<Project>{C76BF5B3-985E-4D39-95FE-97C9C879B83A}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{C92A607B-1FDD-4954-9F92-03FF547D9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>

View File

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-->
<packages>
<package id="ppy.OpenTK" version="2.0.50727.1339" targetFramework="net45" />
</packages>

View File

@ -66,7 +66,7 @@
<Project>{c76bf5b3-985e-4d39-95fe-97c9c879b83a}</Project>
<Name>osu.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\osu.Game.Mode.Osu\osu.Game.Modes.Osu.csproj">
<ProjectReference Include="..\osu.Game.Modes.Osu\osu.Game.Modes.Osu.csproj">
<Project>{c92a607b-1fdd-4954-9f92-03ff547d9080}</Project>
<Name>osu.Game.Modes.Osu</Name>
</ProjectReference>

View File

@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Drawables
}
}
public BeatmapGroup(WorkingBeatmap beatmap)
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
{
this.beatmap = beatmap;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
namespace osu.Game.Beatmaps.Events
{
public enum EventType

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 System.IO;
using osu.Game.Modes.Objects;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 System.Globalization;
using System.IO;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 System.IO;
using osu.Framework.IO.Stores;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.IO;
using System.Linq;
using System.Security.Cryptography;

View File

@ -0,0 +1,10 @@
using System;
namespace osu.Game.Configuration
{
public enum ConfineMouseMode
{
Never,
Fullscreen,
Always
}
}

View File

@ -0,0 +1,12 @@
using System;
namespace osu.Game.Configuration
{
public enum FrameSync
{
VSync = 1,
Limit120 = 0,
Unlimited = 2,
CompletelyUnlimited = 4,
Custom = 5
}
}

View File

@ -1,6 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Configuration;
using osu.Framework.Platform;
using osu.Game.Modes;
@ -11,6 +12,7 @@ namespace osu.Game.Configuration
{
protected override void InitialiseDefaults()
{
#pragma warning disable CS0612 // Type or member is obsolete
Set(OsuConfig.Width, 1366, 640);
Set(OsuConfig.Height, 768, 480);
Set(OsuConfig.MouseSpeed, 1.0);
@ -96,6 +98,7 @@ namespace osu.Game.Configuration
Set(OsuConfig.MouseDisableWheel, false);
Set(OsuConfig.MouseSpeed, 1, 0.4, 6);
Set(OsuConfig.Offset, 0, -300, 300);
Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2);
//Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2);
Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6);
Set(OsuConfig.EditorBeatDivisor, 1, 1, 16);
@ -109,18 +112,19 @@ namespace osu.Game.Configuration
Set(OsuConfig.NotifyFriends, true);
Set(OsuConfig.NotifySubmittedThread, true);
Set(OsuConfig.PopupDuringGameplay, true);
//Set(OsuConfig.ProgressBarType, ProgressBarTypes.Pie);
//Set(OsuConfig.RankType, RankingType.Top);
Set(OsuConfig.ProgressBarType, ProgressBarType.Pie);
Set(OsuConfig.RankType, RankingType.Top);
Set(OsuConfig.RefreshRate, 60);
Set(OsuConfig.OverrideRefreshRate, Get<int>(OsuConfig.RefreshRate) != 60);
//Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative);
Set(OsuConfig.ScoreboardVisible, true);
Set(OsuConfig.ScoreMeter, ScoreMeterType.Error);
//Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error);
Set(OsuConfig.ScreenshotId, 0);
Set(OsuConfig.MenuSnow, false);
Set(OsuConfig.MenuTriangles, true);
Set(OsuConfig.SongSelectThumbnails, true);
//Set(OsuConfig.ScreenshotFormat, ImageFileFormat.Jpg);
Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg);
Set(OsuConfig.ShowReplayComments, true);
Set(OsuConfig.ShowSpectators, true);
Set(OsuConfig.ShowStoryboard, true);
@ -150,10 +154,10 @@ namespace osu.Game.Configuration
Set(OsuConfig.AlternativeChatFont, false);
Set(OsuConfig.Password, string.Empty);
Set(OsuConfig.Username, string.Empty);
Set(OsuConfig.DisplayStarsMaximum, 10, 0, 10);
Set(OsuConfig.DisplayStarsMinimum, 0, 0, 10);
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0);
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0);
Set(OsuConfig.AudioDevice, string.Empty);
//Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer, true);
Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer);
Set(OsuConfig.UpdateFailCount, 0);
Set(OsuConfig.SavePassword, false);
Set(OsuConfig.SaveUsername, true);
@ -162,7 +166,7 @@ namespace osu.Game.Configuration
Set(OsuConfig.Letterboxing, Get<bool>(OsuConfig.Fullscreen));
Set(OsuConfig.LetterboxPositionX, 0, -100, 100);
Set(OsuConfig.LetterboxPositionY, 0, -100, 100);
//Set(OsuConfig.FrameSync, FrameSync.Limit120);
Set(OsuConfig.FrameSync, FrameSync.Limit120);
bool unicodeDefault = false;
switch (Get<string>(OsuConfig.Language))
{
@ -177,6 +181,9 @@ namespace osu.Game.Configuration
Set(OsuConfig.Ticker, false);
Set(OsuConfig.CompatibilityContext, false);
Set(OsuConfig.CanForceOptimusCompatibility, true);
Set(OsuConfig.ConfineMouse, Get<bool>(OsuConfig.ConfineMouseToFullscreen) ?
ConfineMouseMode.Fullscreen : ConfineMouseMode.Never);
#pragma warning restore CS0612 // Type or member is obsolete
}
//todo: make a UnicodeString class/struct rather than requiring this helper method.
@ -321,6 +328,8 @@ namespace osu.Game.Configuration
RawInput,
AbsoluteToOsuWindow,
ConfineMouse,
[Obsolete]
ConfineMouseToFullscreen,
ShowMenuTips,
HiddenShowFirstApproach,
ComboColourSliderBall,

View File

@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum ProgressBarType
{
Off,
Pie,
[Description("Top Right")]
TopRight,
[Description("Bottom Right")]
BottomRight,
Bottom
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum RankingType
{
Local,
[Description("Global")]
Top,
[Description("Selected Mods")]
SelectedMod,
Friends,
Country
}
}

View File

@ -0,0 +1,11 @@
using System;
namespace osu.Game.Configuration
{
public enum ReleaseStream
{
Lazer,
//Stable40,
//Beta40,
//Stable
}
}

View File

@ -0,0 +1,10 @@
using System;
namespace osu.Game.Configuration
{
public enum ScoreMeterType
{
None,
Colour,
Error
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.ComponentModel;
namespace osu.Game.Configuration
{
public enum ScreenshotFormat
{
Bmp = 0, // TODO: Figure out the best way to hide this from the dropdown
[Description("JPG (web-friendly)")]
Jpg = 1,
[Description("PNG (lossless)")]
Png = 2
}
}

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using SQLite.Net.Attributes;
namespace osu.Game.Database

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Game.Beatmaps.Samples;
using osu.Game.Modes;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 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 SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;

View File

@ -15,6 +15,8 @@ namespace osu.Game.Graphics.Backgrounds
{
public class Triangles : Container<Triangle>
{
public override bool HandleInput => false;
public Triangles()
{
Alpha = 0.3f;

View File

@ -1,4 +1,7 @@
using osu.Framework.Graphics.Containers;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Input;
using OpenTK;

View File

@ -1,6 +1,9 @@
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
//Copyright (c) 2007-2016 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.Audio;
using osu.Framework.Audio.Sample;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
@ -16,19 +19,17 @@ namespace osu.Game.Graphics.UserInterface
{
private TextAwesome icon;
private Container leftContainer;
private Container rightContainer;
private Box leftBox;
private Box rightBox;
private const double transform_time = 300.0;
private const double transform_time = 600;
private const int pulse_length = 250;
private const float shear = 0.1f;
private static readonly Vector2 size_extended = new Vector2(140, 50);
private static readonly Vector2 size_retracted = new Vector2(100, 50);
private AudioSample sampleClick;
public BackButton()
{
@ -36,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface
Children = new Drawable[]
{
leftContainer = new Container
new Container
{
RelativeSizeAxes = Axes.Both,
Width = 0.4f,
@ -56,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface
},
}
},
rightContainer = new Container
new Container
{
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
@ -84,10 +85,7 @@ namespace osu.Game.Graphics.UserInterface
};
}
public override bool Contains(Vector2 screenSpacePos)
{
return leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos);
}
public override bool Contains(Vector2 screenSpacePos) => leftBox.Contains(screenSpacePos) || rightBox.Contains(screenSpacePos);
protected override bool OnHover(InputState state)
{
@ -141,6 +139,12 @@ namespace osu.Game.Graphics.UserInterface
});
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
sampleClick = audio.Sample.Get(@"Menu/menuback");
}
protected override bool OnClick(InputState state)
{
var flash = new Box
@ -154,6 +158,8 @@ namespace osu.Game.Graphics.UserInterface
flash.FadeOutFromOne(200);
flash.Expire();
sampleClick.Play();
return base.OnClick(state);
}
}

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics.Sprites;
namespace osu.Game.Graphics.UserInterface

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using OpenTK.Graphics;
using osu.Framework.Graphics.UserInterface;

View File

@ -20,7 +20,7 @@ namespace osu.Game.Graphics.UserInterface
{
protected override Type TransformType => typeof(TransformAccuracy);
protected override double RollingDuration => 20;
protected override double RollingDuration => 150;
protected override bool IsRollingProportional => true;
private float epsilon => 1e-10f;

View File

@ -42,7 +42,7 @@ namespace osu.Game.Graphics.UserInterface
/// <summary>
/// Easing for the counter rollover animation.
/// </summary>
protected virtual EasingTypes RollingEasing => EasingTypes.None;
protected virtual EasingTypes RollingEasing => EasingTypes.Out;
private T displayedCount;

View File

@ -35,7 +35,7 @@ namespace osu.Game.Graphics.UserInterface
protected set;
}
private double animationDelay => 150;
private double animationDelay => 80;
private double scalingDuration => 500;
private EasingTypes scalingEasing => EasingTypes.OutElasticHalf;

View File

@ -1,4 +1,7 @@
using System;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework;
using osu.Framework.Configuration;
using osu.Framework.Graphics;

View File

@ -1,4 +1,7 @@
using osu.Framework;
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -5,7 +5,11 @@ using System;
using System.ComponentModel;
using System.Diagnostics;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps.Samples;
using OpenTK;
using Container = osu.Framework.Graphics.Containers.Container;
@ -26,7 +30,6 @@ namespace osu.Game.Modes.Objects.Drawables
public DrawableHitObject(HitObject hitObject)
{
HitObject = hitObject;
Depth = (float)hitObject.StartTime;
}
private ArmedState state;
@ -40,14 +43,42 @@ namespace osu.Game.Modes.Objects.Drawables
state = value;
UpdateState(state);
Expire();
if (State == ArmedState.Hit)
PlaySample();
}
}
AudioSample sample;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
string hitType = (HitObject.Sample.Type == SampleType.None ? SampleType.Normal : HitObject.Sample.Type).ToString().ToLower();
string sampleSet = HitObject.Sample.Set.ToString().ToLower();
sample = audio.Sample.Get($@"Gameplay/{sampleSet}-hit{hitType}");
}
protected void PlaySample()
{
sample?.Play();
}
protected override void LoadComplete()
{
base.LoadComplete();
Judgement = CreateJudgementInfo();
//we may be setting a custom judgement in test cases or what not.
if (Judgement == null)
Judgement = CreateJudgementInfo();
//force application of the state that was set before we loaded.
UpdateState(State);
Expire(true);
}
/// <summary>

View File

@ -1,7 +1,6 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
namespace osu.Game.Modes

View File

@ -11,24 +11,37 @@ namespace osu.Game.Modes.UI
public abstract class Playfield : Container
{
public HitObjectContainer HitObjects;
private Container<Drawable> content;
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
public override bool Contains(Vector2 screenSpacePos) => true;
protected override Container<Drawable> Content => content;
public Playfield()
{
AddInternal(HitObjects = new HitObjectContainer
AddInternal(content = new ScaledContainer()
{
RelativeSizeAxes = Axes.Both,
});
Add(HitObjects = new HitObjectContainer
{
RelativeSizeAxes = Axes.Both,
});
}
public class HitObjectContainer : Container<DrawableHitObject>
public class ScaledContainer : Container
{
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
public override bool Contains(Vector2 screenSpacePos) => true;
}
public class HitObjectContainer : Container<DrawableHitObject>
{
public override bool Contains(Vector2 screenSpacePos) => true;
}
}
}

View File

@ -1,7 +1,6 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>

Some files were not shown because too many files have changed in this diff Show More