1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 04:27:34 +08:00
osu-lazer/osu.Game/Configuration/OsuConfigManager.cs

337 lines
14 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-08-26 11:28:23 +08:00
2016-12-02 06:28:20 +08:00
using System;
2016-08-26 11:28:23 +08:00
using osu.Framework.Configuration;
using osu.Framework.Platform;
using osu.Game.Screens.Select;
2016-08-26 11:28:23 +08:00
namespace osu.Game.Configuration
{
public class OsuConfigManager : ConfigManager<OsuConfig>
2016-08-26 11:28:23 +08:00
{
protected override void InitialiseDefaults()
{
2016-12-02 06:28:20 +08:00
#pragma warning disable CS0612 // Type or member is obsolete
2016-08-31 18:49:34 +08:00
Set(OsuConfig.Username, string.Empty);
Set(OsuConfig.Token, string.Empty);
2017-04-15 04:52:46 +08:00
Set(OsuConfig.Ruleset, 0, 0, int.MaxValue);
Set(OsuConfig.AudioDevice, string.Empty);
Set(OsuConfig.SavePassword, false);
Set(OsuConfig.SaveUsername, true);
2017-03-22 00:16:23 +08:00
Set(OsuConfig.MenuCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.GameplayCursorSize, 1.0, 0.5f, 2);
Set(OsuConfig.DimLevel, 0.3, 0, 1);
2016-11-03 07:47:54 +08:00
Set(OsuConfig.MouseDisableButtons, false);
2017-02-28 07:08:34 +08:00
Set(OsuConfig.MouseDisableWheel, false);
Set(OsuConfig.SnakingInSliders, true);
2017-04-07 08:28:13 +08:00
Set(OsuConfig.SnakingOutSliders, true);
2017-02-19 04:34:21 +08:00
Set(OsuConfig.MenuParallax, true);
2017-03-01 18:22:01 +08:00
Set(OsuConfig.MenuVoice, true);
Set(OsuConfig.MenuMusic, true);
Set(OsuConfig.BeatmapDetailTab, BeatmapDetailTab.Details);
2017-03-31 21:43:31 +08:00
Set(OsuConfig.ShowInterface, true);
2017-04-05 00:06:53 +08:00
Set(OsuConfig.KeyOverlay, false);
//todo: implement all settings below this line (remove the Disabled set when doing so).
Set(OsuConfig.AudioOffset, 0, -500.0, 500.0);
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues
Set(OsuConfig.AllowPublicInvites, true).Disabled = true;
Set(OsuConfig.AutoChatHide, true).Disabled = true;
Set(OsuConfig.AutomaticDownload, true).Disabled = true;
Set(OsuConfig.AutomaticDownloadNoVideo, false).Disabled = true;
Set(OsuConfig.BlockNonFriendPM, false).Disabled = true;
2017-04-10 15:39:10 +08:00
Set(OsuConfig.Bloom, false).Disabled = true;
Set(OsuConfig.BloomSoftening, false).Disabled = true;
Set(OsuConfig.BossKeyFirstActivation, true).Disabled = true;
Set(OsuConfig.ChatAudibleHighlight, true).Disabled = true;
Set(OsuConfig.ChatChannels, string.Empty).Disabled = true;
Set(OsuConfig.ChatFilter, false).Disabled = true;
Set(OsuConfig.ChatHighlightName, true).Disabled = true;
Set(OsuConfig.ChatMessageNotification, true).Disabled = true;
Set(OsuConfig.ChatLastChannel, string.Empty).Disabled = true;
Set(OsuConfig.ChatRemoveForeign, false).Disabled = true;
//Set(OsuConfig.ChatSortMode, UserSortMode.Rank).Disabled = true;
Set(OsuConfig.ComboBurst, true).Disabled = true;
Set(OsuConfig.ComboFire, false).Disabled = true;
Set(OsuConfig.ComboFireHeight, 3).Disabled = true;
Set(OsuConfig.ConfirmExit, false).Disabled = true;
Set(OsuConfig.AutoSendNowPlaying, true).Disabled = true;
Set(OsuConfig.AutomaticCursorSizing, false).Disabled = true;
Set(OsuConfig.Display, 1).Disabled = true;
Set(OsuConfig.DisplayCityLocation, false).Disabled = true;
Set(OsuConfig.DistanceSpacingEnabled, true).Disabled = true;
Set(OsuConfig.EditorTip, 0).Disabled = true;
Set(OsuConfig.VideoEditor, true).Disabled = true;
Set(OsuConfig.EditorDefaultSkin, false).Disabled = true;
Set(OsuConfig.EditorSnakingSliders, true).Disabled = true;
Set(OsuConfig.EditorHitAnimations, false).Disabled = true;
Set(OsuConfig.EditorFollowPoints, true).Disabled = true;
Set(OsuConfig.EditorStacking, true).Disabled = true;
Set(OsuConfig.ForceSliderRendering, false).Disabled = true;
Set(OsuConfig.FpsCounter, false).Disabled = true;
Set(OsuConfig.FrameTimeDisplay, false).Disabled = true;
Set(OsuConfig.GuideTips, @"").Disabled = true;
Set(OsuConfig.CursorRipple, false).Disabled = true;
Set(OsuConfig.HighlightWords, string.Empty).Disabled = true;
Set(OsuConfig.HighResolution, false).Disabled = true;
Set(OsuConfig.HitLighting, true).Disabled = true;
Set(OsuConfig.IgnoreBarline, false).Disabled = true;
Set(OsuConfig.IgnoreBeatmapSamples, false).Disabled = true;
Set(OsuConfig.IgnoreBeatmapSkins, false).Disabled = true;
Set(OsuConfig.IgnoreList, string.Empty).Disabled = true;
Set(OsuConfig.AllowNowPlayingHighlights, false).Disabled = true;
Set(OsuConfig.LastVersion, string.Empty).Disabled = true;
Set(OsuConfig.LastVersionPermissionsFailed, string.Empty).Disabled = true;
Set(OsuConfig.LoadSubmittedThread, true).Disabled = true;
Set(OsuConfig.LobbyPlayMode, -1).Disabled = true;
Set(OsuConfig.ShowInterfaceDuringRelax, false).Disabled = true;
Set(OsuConfig.LobbyShowExistingOnly, false).Disabled = true;
Set(OsuConfig.LobbyShowFriendsOnly, false).Disabled = true;
Set(OsuConfig.LobbyShowFull, false).Disabled = true;
Set(OsuConfig.LobbyShowInProgress, true).Disabled = true;
Set(OsuConfig.LobbyShowPassworded, true).Disabled = true;
Set(OsuConfig.LogPrivateMessages, false).Disabled = true;
Set(OsuConfig.LowResolution, false).Disabled = true;
//Set(OsuConfig.ManiaSpeed, SpeedMania.SPEED_DEFAULT, SpeedMania.SPEED_MIN, SpeedMania.SPEED_MAX).Disabled = true;
Set(OsuConfig.UsePerBeatmapManiaSpeed, true).Disabled = true;
Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true;
Set(OsuConfig.MenuTip, 0).Disabled = true;
Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true;
Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true;
//Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true;
Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true;
Set(OsuConfig.EditorBeatDivisor, 1, 1, 16).Disabled = true;
Set(OsuConfig.EditorGridSize, 32, 4, 32).Disabled = true;
Set(OsuConfig.EditorGridSizeDesign, 32, 4, 32).Disabled = true;
Set(OsuConfig.CustomFrameLimit, 240, 240, 999).Disabled = true;
Set(OsuConfig.MsnIntegration, false).Disabled = true;
Set(OsuConfig.MyPcSucks, false).Disabled = true;
Set(OsuConfig.NotifyFriends, true).Disabled = true;
Set(OsuConfig.NotifySubmittedThread, true).Disabled = true;
Set(OsuConfig.PopupDuringGameplay, true).Disabled = true;
Set(OsuConfig.ProgressBarType, ProgressBarType.Pie).Disabled = true;
Set(OsuConfig.RankType, RankingType.Top).Disabled = true;
Set(OsuConfig.RefreshRate, 60).Disabled = true;
Set(OsuConfig.OverrideRefreshRate, Get<int>(OsuConfig.RefreshRate) != 60).Disabled = true;
//Set(OsuConfig.ScaleMode, ScaleMode.WidescreenConservative).Disabled = true;
Set(OsuConfig.ScoreboardVisible, true).Disabled = true;
Set(OsuConfig.ScoreMeter, ScoreMeterType.Error).Disabled = true;
//Set(OsuConfig.ScoreMeter, OsuGame.Tournament ? ScoreMeterType.Colour : ScoreMeterType.Error).Disabled = true;
Set(OsuConfig.ScreenshotId, 0).Disabled = true;
Set(OsuConfig.MenuSnow, false).Disabled = true;
Set(OsuConfig.MenuTriangles, true).Disabled = true;
Set(OsuConfig.SongSelectThumbnails, true).Disabled = true;
Set(OsuConfig.ScreenshotFormat, ScreenshotFormat.Jpg).Disabled = true;
Set(OsuConfig.ShowReplayComments, true).Disabled = true;
Set(OsuConfig.ShowSpectators, true).Disabled = true;
Set(OsuConfig.ShowStoryboard, true).Disabled = true;
//Set(OsuConfig.Skin, SkinManager.DEFAULT_SKIN).Disabled = true;
Set(OsuConfig.SkinSamples, true).Disabled = true;
Set(OsuConfig.SkipTablet, false).Disabled = true;
Set(OsuConfig.Tablet, false).Disabled = true;
Set(OsuConfig.UpdatePending, false).Disabled = true;
Set(OsuConfig.UseSkinCursor, false).Disabled = true;
Set(OsuConfig.UseTaikoSkin, false).Disabled = true;
Set(OsuConfig.Video, true).Disabled = true;
Set(OsuConfig.Wiimote, false).Disabled = true;
Set(OsuConfig.YahooIntegration, false).Disabled = true;
Set(OsuConfig.ForceFrameFlush, false).Disabled = true;
Set(OsuConfig.DetectPerformanceIssues, true).Disabled = true;
Set(OsuConfig.RawInput, false).Disabled = true;
Set(OsuConfig.AbsoluteToOsuWindow, Get<bool>(OsuConfig.RawInput)).Disabled = true;
Set(OsuConfig.ShowMenuTips, true).Disabled = true;
Set(OsuConfig.HiddenShowFirstApproach, true).Disabled = true;
Set(OsuConfig.ComboColourSliderBall, true).Disabled = true;
Set(OsuConfig.AlternativeChatFont, false).Disabled = true;
Set(OsuConfig.DisplayStarsMaximum, 10.0, 0.0, 10.0).Disabled = true;
Set(OsuConfig.DisplayStarsMinimum, 0.0, 0.0, 10.0).Disabled = true;
Set(OsuConfig.ReleaseStream, ReleaseStream.Lazer).Disabled = true;
Set(OsuConfig.UpdateFailCount, 0).Disabled = true;
//Set(OsuConfig.TreeSortMode, TreeGroupMode.Show_All).Disabled = true;
//Set(OsuConfig.TreeSortMode2, TreeSortMode.Title).Disabled = true;
Set(OsuConfig.PermanentSongInfo, false).Disabled = true;
Set(OsuConfig.Ticker, false).Disabled = true;
Set(OsuConfig.CompatibilityContext, false).Disabled = true;
Set(OsuConfig.CanForceOptimusCompatibility, true).Disabled = true;
2016-12-02 06:28:20 +08:00
Set(OsuConfig.ConfineMouse, Get<bool>(OsuConfig.ConfineMouseToFullscreen) ?
ConfineMouseMode.Fullscreen : ConfineMouseMode.Never).Disabled = true;
2017-01-28 18:10:05 +08:00
GetOriginalBindable<bool>(OsuConfig.SavePassword).ValueChanged += delegate
2017-01-28 21:56:05 +08:00
{
2017-01-28 22:01:11 +08:00
if (Get<bool>(OsuConfig.SavePassword)) Set(OsuConfig.SaveUsername, true);
2017-01-28 21:56:05 +08:00
};
GetOriginalBindable<bool>(OsuConfig.SaveUsername).ValueChanged += delegate
2017-01-28 21:56:05 +08:00
{
2017-01-28 22:01:11 +08:00
if (!Get<bool>(OsuConfig.SaveUsername)) Set(OsuConfig.SavePassword, false);
2017-01-28 21:56:05 +08:00
};
#pragma warning restore CS0612 // Type or member is obsolete
2017-01-28 18:10:05 +08:00
}
2017-02-23 14:38:17 +08:00
public OsuConfigManager(Storage storage) : base(storage)
{
}
2016-08-26 11:28:23 +08:00
}
public enum OsuConfig
2016-08-26 11:28:23 +08:00
{
2016-11-03 07:37:52 +08:00
// New osu:
2017-04-15 04:22:41 +08:00
Ruleset,
2016-11-03 07:37:52 +08:00
Token,
// Imported from old osu:
BeatmapDirectory,
AllowPublicInvites,
AutoChatHide,
AutomaticDownload,
AutomaticDownloadNoVideo,
BlockNonFriendPM,
Bloom,
BloomSoftening,
BossKeyFirstActivation,
ChatAudibleHighlight,
ChatChannels,
ChatFilter,
ChatHighlightName,
ChatMessageNotification,
ChatLastChannel,
ChatRemoveForeign,
ChatSortMode,
ComboBurst,
ComboFire,
ComboFireHeight,
ConfirmExit,
AutoSendNowPlaying,
2017-03-22 00:16:23 +08:00
MenuCursorSize,
GameplayCursorSize,
2016-11-03 07:37:52 +08:00
AutomaticCursorSizing,
DimLevel,
Display,
DisplayCityLocation,
DistanceSpacingEnabled,
EditorTip,
VideoEditor,
EditorDefaultSkin,
EditorSnakingSliders,
EditorHitAnimations,
EditorFollowPoints,
EditorStacking,
ForceSliderRendering,
FpsCounter,
FrameTimeDisplay,
GuideTips,
CursorRipple,
HighlightWords,
HighResolution,
HitLighting,
IgnoreBarline,
IgnoreBeatmapSamples,
2016-11-03 07:25:00 +08:00
IgnoreBeatmapSkins,
2016-11-03 07:37:52 +08:00
IgnoreList,
KeyOverlay,
Language,
LastPlayMode,
AllowNowPlayingHighlights,
LastVersion,
LastVersionPermissionsFailed,
LoadSubmittedThread,
LobbyPlayMode,
ShowInterface,
ShowInterfaceDuringRelax,
LobbyShowExistingOnly,
LobbyShowFriendsOnly,
LobbyShowFull,
LobbyShowInProgress,
LobbyShowPassworded,
LogPrivateMessages,
LowResolution,
ManiaSpeed,
UsePerBeatmapManiaSpeed,
ManiaSpeedBPMScale,
MenuTip,
MouseDisableButtons,
MouseDisableWheel,
MouseSpeed,
AudioOffset,
2016-11-03 07:37:52 +08:00
ScoreMeterScale,
DistanceSpacing,
EditorBeatDivisor,
EditorGridSize,
EditorGridSizeDesign,
CustomFrameLimit,
MsnIntegration,
MyPcSucks,
NotifyFriends,
NotifySubmittedThread,
PopupDuringGameplay,
ProgressBarType,
RankType,
RefreshRate,
OverrideRefreshRate,
ScaleMode,
ScoreboardVisible,
ScoreMeter,
ScreenshotId,
MenuSnow,
MenuTriangles,
SongSelectThumbnails,
ScreenshotFormat,
ShowReplayComments,
ShowSpectators,
ShowStoryboard,
Skin,
SkinSamples,
SkipTablet,
SnakingInSliders,
SnakingOutSliders,
2016-11-03 07:37:52 +08:00
Tablet,
UpdatePending,
UserFilter,
2016-11-03 07:25:00 +08:00
UseSkinCursor,
2016-11-03 07:37:52 +08:00
UseTaikoSkin,
Video,
Wiimote,
YahooIntegration,
ForceFrameFlush,
DetectPerformanceIssues,
MenuMusic,
MenuVoice,
MenuParallax,
BeatmapDetailTab,
2016-11-03 07:37:52 +08:00
RawInput,
AbsoluteToOsuWindow,
ConfineMouse,
2016-12-02 06:28:20 +08:00
[Obsolete]
ConfineMouseToFullscreen,
2016-11-03 07:37:52 +08:00
ShowMenuTips,
HiddenShowFirstApproach,
ComboColourSliderBall,
AlternativeChatFont,
Username,
DisplayStarsMaximum,
DisplayStarsMinimum,
AudioDevice,
ReleaseStream,
UpdateFailCount,
SavePassword,
SaveUsername,
TreeSortMode,
TreeSortMode2,
PermanentSongInfo,
Ticker,
CompatibilityContext,
CanForceOptimusCompatibility,
2016-08-26 11:28:23 +08:00
}
}