1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

iplemented stable-like algorithm

This commit is contained in:
EVAST9919 2017-05-14 07:28:12 +03:00
parent ca6df533bd
commit 12dab6f75c

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 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 OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -44,7 +45,11 @@ namespace osu.Game.Graphics.Cursor
private Bindable<double> cursorScale; private Bindable<double> cursorScale;
private Bindable<bool> autoCursorScale; private Bindable<bool> autoCursorScale;
private const int scaling_factor = 5; private float beatmapCircleSize;
private const float default_beatmap_cs = 5f;
private float autoScaleMultiplier => autoCursorScale ? (float)(1 - (0.7 * (beatmapCircleSize - 4) / 5)) : 1f;
public OsuCursor() public OsuCursor()
{ {
@ -117,19 +122,19 @@ namespace osu.Game.Graphics.Cursor
}, },
}; };
cursorScale = config.GetBindable<double>(OsuConfig.GameplayCursorSize); beatmapCircleSize = game?.Beatmap?.Value.Beatmap.BeatmapInfo.Difficulty.CircleSize ?? default_beatmap_cs;
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale);
cursorScale.TriggerChange();
cursorScale = config.GetBindable<double>(OsuConfig.GameplayCursorSize);
autoCursorScale = config.GetBindable<bool>(OsuConfig.AutoCursorSize); autoCursorScale = config.GetBindable<bool>(OsuConfig.AutoCursorSize);
autoCursorScale.ValueChanged += newScale =>
{ cursorScale.ValueChanged += newValue => calculateScale();
if (newScale) autoCursorScale.ValueChanged += newValue => calculateScale();
cursorContainer.Scale *= scaling_factor / (game?.Beatmap?.Value.Beatmap.BeatmapInfo.Difficulty.CircleSize ?? scaling_factor); cursorScale.TriggerChange();
else }
cursorScale.TriggerChange();
}; private void calculateScale()
autoCursorScale.TriggerChange(); {
cursorContainer.Scale = new Vector2(autoScaleMultiplier * (float)cursorScale);
} }
} }
} }