1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 00:23:01 +08:00

Wire up enum-backed dropdowns

This commit is contained in:
Drew DeVault 2016-12-01 17:28:20 -05:00
parent 0378de8346
commit 4757a1c433
14 changed files with 131 additions and 22 deletions

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

@ -0,0 +1,10 @@
using System;
namespace osu.Game.Configuration
{
public class HiddenAttribute
{
public HiddenAttribute()
{
}
}
}

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);
@ -111,17 +113,18 @@ namespace osu.Game.Configuration
Set(OsuConfig.NotifySubmittedThread, true);
Set(OsuConfig.PopupDuringGameplay, true);
Set(OsuConfig.ProgressBarType, ProgressBarType.Pie);
//Set(OsuConfig.RankType, RankingType.Top);
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);
@ -154,7 +157,7 @@ namespace osu.Game.Configuration
Set(OsuConfig.DisplayStarsMaximum, 10, 0, 10);
Set(OsuConfig.DisplayStarsMinimum, 0, 0, 10);
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);
@ -163,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))
{
@ -178,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.
@ -322,6 +328,8 @@ namespace osu.Game.Configuration
RawInput,
AbsoluteToOsuWindow,
ConfineMouse,
[Obsolete]
ConfineMouseToFullscreen,
ShowMenuTips,
HiddenShowFirstApproach,
ComboColourSliderBall,

View File

@ -0,0 +1,14 @@
using System;
namespace osu.Game.Configuration
{
public enum RankingType
{
Local,
[DisplayName("Global")]
Top,
[DisplayName("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,12 @@
using System;
namespace osu.Game.Configuration
{
public enum ScreenshotFormat
{
Bmp = 0, // TODO: Figure out the best way to hide this from the dropdown
[DisplayName("JPG (web-friendly)")]
Jpg = 1,
[DisplayName("PNG (lossless)")]
Png = 2
}
}

View File

@ -30,7 +30,11 @@ namespace osu.Game.Overlays.Options.Gameplay
Label = "Progress display",
Bindable = config.GetBindable<ProgressBarType>(OsuConfig.ProgressBarType)
},
new SpriteText { Text = "Score meter type: TODO dropdown" },
new OptionsDropdown<ScoreMeterType>
{
Label = "Score meter type",
Bindable = config.GetBindable<ScoreMeterType>(OsuConfig.ScoreMeter)
},
new SliderOption<double>
{
LabelText = "Score meter size",
@ -59,4 +63,4 @@ namespace osu.Game.Overlays.Options.Gameplay
};
}
}
}
}

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Platform;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.General
@ -15,11 +16,15 @@ namespace osu.Game.Overlays.Options.General
protected override string Header => "Updates";
[BackgroundDependencyLoader]
private void load(BasicStorage storage)
private void load(BasicStorage storage, OsuConfigManager config)
{
Children = new Drawable[]
{
new SpriteText { Text = "TODO: Dropdown" },
new OptionsDropdown<ReleaseStream>
{
Label = "Release stream",
Bindable = config.GetBindable<ReleaseStream>(OsuConfig.ReleaseStream),
},
new SpriteText { Text = "Your osu! is up to date" }, // TODO: map this to reality
new OsuButton
{

View File

@ -57,7 +57,11 @@ namespace osu.Game.Overlays.Options.Graphics
LabelText = "Softening filter",
Bindable = config.GetBindable<bool>(OsuConfig.BloomSoftening)
},
new SpriteText { Text = "Screenshot format TODO: dropdown" }
new OptionsDropdown<ScreenshotFormat>
{
Label = "Screenshot",
Bindable = config.GetBindable<ScreenshotFormat>(OsuConfig.ScreenshotFormat)
}
};
}
}

View File

@ -20,7 +20,12 @@ namespace osu.Game.Overlays.Options.Graphics
// NOTE: Compatability mode omitted
Children = new Drawable[]
{
new SpriteText { Text = "Frame limiter: TODO dropdown" },
// TODO: this needs to be a custom dropdown at some point
new OptionsDropdown<FrameSync>
{
Label = "Frame limiter",
Bindable = config.GetBindable<FrameSync>(OsuConfig.FrameSync)
},
new CheckBoxOption
{
LabelText = "Show FPS counter",

View File

@ -15,12 +15,6 @@ namespace osu.Game.Overlays.Options.Input
{
protected override string Header => "Mouse";
private CheckBoxOption rawInput, mapRawInput, disableWheel, disableButtons, enableRipples;
public MouseOptions()
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
@ -32,28 +26,32 @@ namespace osu.Game.Overlays.Options.Input
LabelText = "Sensitivity",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed),
},
rawInput = new CheckBoxOption
new CheckBoxOption
{
LabelText = "Raw input",
Bindable = config.GetBindable<bool>(OsuConfig.RawInput)
},
mapRawInput = new CheckBoxOption
new CheckBoxOption
{
LabelText = "Map absolute raw input to the osu! window",
Bindable = config.GetBindable<bool>(OsuConfig.AbsoluteToOsuWindow)
},
new SpriteText { Text = "Confine mouse cursor: TODO dropdown" },
disableWheel = new CheckBoxOption
new OptionsDropdown<ConfineMouseMode>
{
Label = "Confine mouse cursor",
Bindable = config.GetBindable<ConfineMouseMode>(OsuConfig.ConfineMouse),
},
new CheckBoxOption
{
LabelText = "Disable mouse wheel in play mode",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableWheel)
},
disableButtons = new CheckBoxOption
new CheckBoxOption
{
LabelText = "Disable mouse buttons in play mode",
Bindable = config.GetBindable<bool>(OsuConfig.MouseDisableButtons)
},
enableRipples = new CheckBoxOption
new CheckBoxOption
{
LabelText = "Cursor ripples",
Bindable = config.GetBindable<bool>(OsuConfig.CursorRipple)

View File

@ -226,6 +226,12 @@
<Compile Include="Configuration\ProgressBarType.cs" />
<Compile Include="Overlays\Options\OptionsDropdown.cs" />
<Compile Include="Configuration\DisplayNameAttribute.cs" />
<Compile Include="Configuration\RankingType.cs" />
<Compile Include="Configuration\ScoreMeterType.cs" />
<Compile Include="Configuration\ReleaseStream.cs" />
<Compile Include="Configuration\ScreenshotFormat.cs" />
<Compile Include="Configuration\FrameSync.cs" />
<Compile Include="Configuration\ConfineMouseMode.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">