1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 03:27:24 +08:00

Merge branch 'refs/heads/master' into general-fixes

This commit is contained in:
Dean Herbert 2016-12-08 13:29:59 +09:00
commit 0538681f3b
21 changed files with 498 additions and 107 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

@ -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,8 +1,11 @@
//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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Audio
@ -10,18 +13,23 @@ namespace osu.Game.Overlays.Options.Audio
public class OffsetAdjustmentOptions : OptionsSubsection
{
protected override string Header => "Offset Adjustment";
public OffsetAdjustmentOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "Universal Offset: TODO slider" },
new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = "Offset wizard"
}
};
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SliderOption<int>
{
LabelText = "Universal Offset",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.Offset)
},
new OsuButton
{
RelativeSizeAxes = Axes.X,
Text = "Offset wizard"
}
};
}
}
}
}

View File

@ -3,6 +3,7 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -14,21 +15,15 @@ namespace osu.Game.Overlays.Options.Audio
{
protected override string Header => "Volume";
private CheckBoxOption ignoreHitsounds;
public VolumeOptions()
{
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
private void load(OsuConfigManager config, AudioManager audio)
{
Children = new Drawable[]
{
new SpriteText { Text = "Master: TODO slider" },
new SpriteText { Text = "Music: TODO slider" },
new SpriteText { Text = "Effect: TODO slider" },
ignoreHitsounds = new CheckBoxOption
new SliderOption<double> { LabelText = "Master", Bindable = audio.Volume },
new SliderOption<double> { LabelText = "Effect", Bindable = audio.VolumeSample },
new SliderOption<double> { LabelText = "Music", Bindable = audio.VolumeTrack },
new CheckBoxOption
{
LabelText = "Ignore beatmap hitsounds",
Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples)

View File

@ -0,0 +1,166 @@
using System;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options
{
public class DropdownOption<T> : FlowContainer
{
private DropDownMenu<T> dropdown;
private SpriteText text;
public string LabelText
{
get { return text.Text; }
set
{
text.Text = value;
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
}
}
public Bindable<T> Bindable
{
get { return bindable; }
set
{
if (bindable != null)
bindable.ValueChanged -= Bindable_ValueChanged;
bindable = value;
bindable.ValueChanged += Bindable_ValueChanged;
Bindable_ValueChanged(null, null);
}
}
private Bindable<T> bindable;
void Bindable_ValueChanged(object sender, EventArgs e)
{
dropdown.SelectedValue = bindable.Value;
}
void Dropdown_ValueChanged(object sender, EventArgs e)
{
bindable.Value = dropdown.SelectedValue;
}
protected override void Dispose(bool isDisposing)
{
bindable.ValueChanged -= Bindable_ValueChanged;
dropdown.ValueChanged -= Dropdown_ValueChanged;
base.Dispose(isDisposing);
}
public DropdownOption()
{
if (!typeof(T).IsEnum)
throw new InvalidOperationException("OptionsDropdown only supports enums as the generic type argument");
Direction = FlowDirection.VerticalOnly;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
var items = typeof(T).GetFields().Where(f => !f.IsSpecialName).Zip(
(T[])Enum.GetValues(typeof(T)), (a, b) => new Tuple<string, T>(
a.GetCustomAttribute<DescriptionAttribute>()?.Description ?? a.Name, b));
Children = new Drawable[]
{
text = new SpriteText { Alpha = 0 },
dropdown = new StyledDropDownMenu<T>
{
Margin = new MarginPadding { Top = 5 },
RelativeSizeAxes = Axes.X,
Items = items.Select(item => new StyledDropDownMenuItem<T>(item.Item1, item.Item2))
}
};
dropdown.ValueChanged += Dropdown_ValueChanged;
}
private class StyledDropDownMenu<U> : DropDownMenu<U>
{
protected override float DropDownListSpacing => 4;
protected override DropDownComboBox CreateComboBox()
{
return new StyledDropDownComboBox();
}
public StyledDropDownMenu()
{
ComboBox.CornerRadius = 4;
DropDown.CornerRadius = 4;
}
protected override void AnimateOpen()
{
foreach (StyledDropDownMenuItem<U> child in DropDownList.Children)
{
child.FadeIn(200);
child.ResizeTo(new Vector2(1, 24), 200);
}
DropDown.Show();
}
protected override void AnimateClose()
{
foreach (StyledDropDownMenuItem<U> child in DropDownList.Children)
{
child.ResizeTo(new Vector2(1, 0), 200);
child.FadeOut(200);
}
}
}
private class StyledDropDownComboBox : DropDownComboBox
{
protected override Color4 BackgroundColour => new Color4(255, 255, 255, 100);
protected override Color4 BackgroundColourHover => Color4.HotPink;
public StyledDropDownComboBox()
{
Foreground.Padding = new MarginPadding(4);
}
}
private class StyledDropDownMenuItem<U> : DropDownMenuItem<U>
{
public StyledDropDownMenuItem(string text, U value) : base(text, value)
{
AutoSizeAxes = Axes.None;
Height = 0;
Foreground.Padding = new MarginPadding(2);
}
protected override void OnSelectChange()
{
if (!IsLoaded)
return;
FormatBackground();
FormatCaret();
FormatLabel();
}
protected override void FormatCaret()
{
(Caret as SpriteText).Text = IsSelected ? @"+" : @"-";
}
protected override void FormatLabel()
{
if (IsSelected)
(Label as SpriteText).Text = @"*" + Value + @"*";
else
(Label as SpriteText).Text = Value.ToString();
}
}
}
}

View File

@ -1,49 +1,66 @@
//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.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Gameplay
{
public class GeneralGameplayOptions : OptionsSubsection
{
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SpriteText { Text = "Background dim: TODO slider" },
new SpriteText { Text = "Progress display: TODO dropdown" },
new SpriteText { Text = "Score meter type: TODO dropdown" },
new SpriteText { Text = "Score meter size: TODO slider" },
new CheckBoxOption
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
},
new CheckBoxOption
{
LabelText = "Show approach circle on first \"Hidden\" object",
Bindable = config.GetBindable<bool>(OsuConfig.HiddenShowFirstApproach)
},
new CheckBoxOption
{
LabelText = "Scale osu!mania scroll speed with BPM",
Bindable = config.GetBindable<bool>(OsuConfig.ManiaSpeedBPMScale)
},
new CheckBoxOption
{
LabelText = "Remember osu!mania scroll speed per beatmap",
Bindable = config.GetBindable<bool>(OsuConfig.UsePerBeatmapManiaSpeed)
},
};
}
}
}
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
namespace osu.Game.Overlays.Options.Gameplay
{
public class GeneralGameplayOptions : OptionsSubsection
{
protected override string Header => "General";
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SliderOption<int>
{
LabelText = "Background dim",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.DimLevel)
},
new DropdownOption<ProgressBarType>
{
LabelText = "Progress display",
Bindable = config.GetBindable<ProgressBarType>(OsuConfig.ProgressBarType)
},
new DropdownOption<ScoreMeterType>
{
LabelText = "Score meter type",
Bindable = config.GetBindable<ScoreMeterType>(OsuConfig.ScoreMeter)
},
new SliderOption<double>
{
LabelText = "Score meter size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.ScoreMeterScale)
},
new CheckBoxOption
{
LabelText = "Always show key overlay",
Bindable = config.GetBindable<bool>(OsuConfig.KeyOverlay)
},
new CheckBoxOption
{
LabelText = "Show approach circle on first \"Hidden\" object",
Bindable = config.GetBindable<bool>(OsuConfig.HiddenShowFirstApproach)
},
new CheckBoxOption
{
LabelText = "Scale osu!mania scroll speed with BPM",
Bindable = config.GetBindable<bool>(OsuConfig.ManiaSpeedBPMScale)
},
new CheckBoxOption
{
LabelText = "Remember osu!mania scroll speed per beatmap",
Bindable = config.GetBindable<bool>(OsuConfig.UsePerBeatmapManiaSpeed)
},
};
}
}
}

View File

@ -1,23 +1,37 @@
//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.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Options.Gameplay
{
public class SongSelectGameplayOptions : OptionsSubsection
{
protected override string Header => "Song Select";
public SongSelectGameplayOptions()
{
Children = new Drawable[]
{
new SpriteText { Text = "Display beatmaps from: TODO slider" },
new SpriteText { Text = "up to: TODO slider" },
};
}
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
{
new SliderOption<double>
{
LabelText = "Display beatmaps from",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMinimum)
},
new SliderOption<double>
{
LabelText = "up to",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.DisplayStarsMaximum)
},
};
}
}
}

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 DropdownOption<ReleaseStream>
{
LabelText = "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 DropdownOption<ScreenshotFormat>
{
LabelText = "Screenshot",
Bindable = config.GetBindable<ScreenshotFormat>(OsuConfig.ScreenshotFormat)
}
};
}
}

View File

@ -3,6 +3,7 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -30,10 +31,16 @@ namespace osu.Game.Overlays.Options.Graphics
LabelText = "Letterboxing",
Bindable = config.GetBindable<bool>(OsuConfig.Letterboxing),
},
new SpriteText { Text = "Horizontal position" },
new SpriteText { Text = "TODO: slider" },
new SpriteText { Text = "Vertical position" },
new SpriteText { Text = "TODO: slider" },
new SliderOption<int>
{
LabelText = "Horizontal position",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionX)
},
new SliderOption<int>
{
LabelText = "Vertical position",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.LetterboxPositionY)
},
};
}
}

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 DropdownOption<FrameSync>
{
LabelText = "Frame limiter",
Bindable = config.GetBindable<FrameSync>(OsuConfig.FrameSync)
},
new CheckBoxOption
{
LabelText = "Show FPS counter",

View File

@ -3,6 +3,7 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -14,40 +15,43 @@ 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)
{
Children = new Drawable[]
{
new SpriteText { Text = "Sensitivity: TODO slider" },
rawInput = new CheckBoxOption
new SliderOption<double>
{
LabelText = "Sensitivity",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.MouseSpeed),
},
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 DropdownOption<ConfineMouseMode>
{
LabelText = "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

@ -4,6 +4,7 @@
using OpenTK;
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
@ -62,6 +63,11 @@ namespace osu.Game.Overlays.Options
Bindable = config.GetBindable<bool>(OsuConfig.UseSkinCursor)
},
new SpriteText { Text = "Cursor size: TODO slider" },
new SliderOption<double>
{
LabelText = "Cursor size",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.CursorSize)
},
new CheckBoxOption
{
LabelText = "Automatic cursor size",

View File

@ -0,0 +1,53 @@
using System;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Overlays.Options
{
public class SliderOption<T> : FlowContainer where T : struct,
IComparable, IFormattable, IConvertible, IComparable<T>, IEquatable<T>
{
private SliderBar<T> slider;
private SpriteText text;
public string LabelText
{
get { return text.Text; }
set
{
text.Text = value;
text.Alpha = string.IsNullOrEmpty(value) ? 0 : 1;
}
}
public BindableNumber<T> Bindable
{
get { return slider.Bindable; }
set { slider.Bindable = value; }
}
public SliderOption()
{
Direction = FlowDirection.VerticalOnly;
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
text = new SpriteText { Alpha = 0 },
slider = new SliderBar<T>
{
Margin = new MarginPadding { Top = 5 },
Height = 10,
RelativeSizeAxes = Axes.X,
Color = Color4.White,
SelectionColor = new Color4(255, 102, 170, 255),
}
};
}
}
}

View File

@ -222,6 +222,15 @@
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
<Compile Include="Overlays\Options\SidebarButton.cs" />
<Compile Include="Overlays\Options\TextBoxOption.cs" />
<Compile Include="Overlays\Options\SliderOption.cs" />
<Compile Include="Configuration\ProgressBarType.cs" />
<Compile Include="Overlays\Options\DropdownOption.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">
@ -250,4 +259,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>