mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Merge pull request #749 from EVAST9919/cursor_size
Automatic gameplay cursor size
This commit is contained in:
commit
dced452667
@ -1 +1 @@
|
|||||||
Subproject commit fa44e5a47e20956b12e598e85159a1a25b500b3c
|
Subproject commit 7146c07159d2cf3d07a8d371fa50ef8b200ba038
|
@ -50,6 +50,7 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.MenuCursorSize, 1.0, 0.5f, 2);
|
Set(OsuSetting.MenuCursorSize, 1.0, 0.5f, 2);
|
||||||
Set(OsuSetting.GameplayCursorSize, 1.0, 0.5f, 2);
|
Set(OsuSetting.GameplayCursorSize, 1.0, 0.5f, 2);
|
||||||
|
Set(OsuSetting.AutoCursorSize, false);
|
||||||
|
|
||||||
Set(OsuSetting.MouseDisableButtons, false);
|
Set(OsuSetting.MouseDisableButtons, false);
|
||||||
Set(OsuSetting.MouseDisableWheel, false);
|
Set(OsuSetting.MouseDisableWheel, false);
|
||||||
@ -86,6 +87,7 @@ namespace osu.Game.Configuration
|
|||||||
Token,
|
Token,
|
||||||
MenuCursorSize,
|
MenuCursorSize,
|
||||||
GameplayCursorSize,
|
GameplayCursorSize,
|
||||||
|
AutoCursorSize,
|
||||||
DimLevel,
|
DimLevel,
|
||||||
KeyOverlay,
|
KeyOverlay,
|
||||||
ShowInterface,
|
ShowInterface,
|
||||||
|
@ -7,12 +7,17 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
public class BeatmapDifficulty
|
public class BeatmapDifficulty
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The default value used for all difficulty settings except <see cref="SliderMultiplier"/> and <see cref="SliderTickRate"/>.
|
||||||
|
/// </summary>
|
||||||
|
public const float DEFAULT_DIFFICULTY = 5;
|
||||||
|
|
||||||
[PrimaryKey, AutoIncrement]
|
[PrimaryKey, AutoIncrement]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public float DrainRate { get; set; } = 5;
|
public float DrainRate { get; set; } = DEFAULT_DIFFICULTY;
|
||||||
public float CircleSize { get; set; } = 5;
|
public float CircleSize { get; set; } = DEFAULT_DIFFICULTY;
|
||||||
public float OverallDifficulty { get; set; } = 5;
|
public float OverallDifficulty { get; set; } = DEFAULT_DIFFICULTY;
|
||||||
public float ApproachRate { get; set; } = 5;
|
public float ApproachRate { get; set; } = DEFAULT_DIFFICULTY;
|
||||||
public float SliderMultiplier { get; set; } = 1;
|
public float SliderMultiplier { get; set; } = 1;
|
||||||
public float SliderTickRate { get; set; } = 1;
|
public float SliderTickRate { get; set; } = 1;
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
namespace osu.Game.Graphics.Cursor
|
||||||
{
|
{
|
||||||
@ -41,7 +43,10 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
public class OsuCursor : Container
|
public class OsuCursor : Container
|
||||||
{
|
{
|
||||||
private Container cursorContainer;
|
private Container cursorContainer;
|
||||||
|
|
||||||
private Bindable<double> cursorScale;
|
private Bindable<double> cursorScale;
|
||||||
|
private Bindable<bool> autoCursorScale;
|
||||||
|
private Bindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
public OsuCursor()
|
public OsuCursor()
|
||||||
{
|
{
|
||||||
@ -50,7 +55,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config, OsuGameBase game)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -114,9 +119,29 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
beatmap = game.Beatmap.GetBoundCopy();
|
||||||
|
beatmap.ValueChanged += v => calculateScale();
|
||||||
|
|
||||||
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
|
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
|
||||||
cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)cursorScale);
|
cursorScale.ValueChanged += v => calculateScale();
|
||||||
cursorScale.TriggerChange();
|
|
||||||
|
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
|
||||||
|
autoCursorScale.ValueChanged += v => calculateScale();
|
||||||
|
|
||||||
|
calculateScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void calculateScale()
|
||||||
|
{
|
||||||
|
float scale = (float)cursorScale.Value;
|
||||||
|
|
||||||
|
if (autoCursorScale && beatmap.Value != null)
|
||||||
|
{
|
||||||
|
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
|
||||||
|
scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.Difficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY);
|
||||||
|
}
|
||||||
|
|
||||||
|
cursorContainer.Scale = new Vector2(scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,11 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
LabelText = "Gameplay cursor size",
|
LabelText = "Gameplay cursor size",
|
||||||
Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize)
|
Bindable = config.GetBindable<double>(OsuSetting.GameplayCursorSize)
|
||||||
},
|
},
|
||||||
|
new SettingsCheckbox
|
||||||
|
{
|
||||||
|
LabelText = "Adjust gameplay cursor size based on current beatmap",
|
||||||
|
Bindable = config.GetBindable<bool>(OsuSetting.AutoCursorSize)
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user