private void load() { Dependencies.Cache(Config); Resources = new ResourceStore <byte[]>(); Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources")); Resources.AddStore(new DllResourceStore(MainResourceFile)); Textures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))); Textures.AddStore(new RawTextureLoaderStore(new OnlineStore())); Dependencies.Cache(Textures); Audio = Dependencies.Cache(new AudioManager( new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples")) { EventScheduler = Scheduler }); //attach our bindables to the audio subsystem. Audio.AudioDevice.Weld(Config.GetBindable <string>(FrameworkConfig.AudioDevice)); Audio.Volume.Weld(Config.GetBindable <double>(FrameworkConfig.VolumeUniversal)); Audio.VolumeSample.Weld(Config.GetBindable <double>(FrameworkConfig.VolumeEffect)); Audio.VolumeTrack.Weld(Config.GetBindable <double>(FrameworkConfig.VolumeMusic)); Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders")); Dependencies.Cache(Shaders); Fonts = new FontStore(new GlyphStore(Resources, @"Fonts/OpenSans")) { ScaleAdjust = 100 }; Dependencies.Cache(Fonts); }
private void load(FrameworkConfigManager frameworkConfig) { frameworkLocale = frameworkConfig.GetBindable <string>(FrameworkSetting.Locale); Children = new Drawable[] { languageSelection = new SettingsEnumDropdown <Language> { LabelText = "Language", }, new SettingsCheckbox { LabelText = "Prefer metadata in original language", Current = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowUnicode) }, }; if (!Enum.TryParse <Language>(frameworkLocale.Value, out var locale)) { locale = Language.en; } languageSelection.Current.Value = locale; languageSelection.Current.BindValueChanged(val => frameworkLocale.Value = val.NewValue.ToString()); }
public LocalisationEngine(FrameworkConfigManager config) { preferUnicode = config.GetBindable <bool>(FrameworkConfig.ShowUnicode); preferUnicode.ValueChanged += updateUnicodeStrings; locale = config.GetBindable <string>(FrameworkConfig.Locale); locale.ValueChanged += checkLocale; }
private void load(FrameworkConfigManager config) { letterboxing = config.GetBindable <bool>(FrameworkSetting.Letterboxing); Children = new Drawable[] { new SettingsEnumDropdown <WindowMode> { LabelText = "Screen mode", Bindable = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, new SettingsCheckbox { LabelText = "Letterboxing", Bindable = letterboxing, }, letterboxSettings = new FillFlowContainer { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new Drawable[] { new SettingsSlider <double> { LabelText = "Horizontal position", Bindable = config.GetBindable <double>(FrameworkSetting.LetterboxPositionX), NormalKeyboardStep = 0.1f, SmallKeyboardStep = 0.01f }, new SettingsSlider <double> { LabelText = "Vertical position", Bindable = config.GetBindable <double>(FrameworkSetting.LetterboxPositionY), NormalKeyboardStep = 0.1f, SmallKeyboardStep = 0.01f }, } }, }; letterboxing.ValueChanged += isVisible => { letterboxSettings.ClearTransforms(); letterboxSettings.AutoSizeAxes = isVisible ? Axes.Y : Axes.None; if (!isVisible) { letterboxSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } }; letterboxing.TriggerChange(); }
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "绝对输入(在Linux上有问题)", Bindable = rawInputToggle }, sensitivity = new SensitivitySetting { LabelText = "光标灵敏度", Bindable = config.GetBindable <double>(FrameworkSetting.CursorSensitivity) }, new SettingsCheckbox { LabelText = "绝对坐标只映射在osu!窗口中", Bindable = config.GetBindable <bool>(FrameworkSetting.MapAbsoluteInputToWindow) }, new SettingsEnumDropdown <ConfineMouseMode> { LabelText = "光标边界", Bindable = config.GetBindable <ConfineMouseMode>(FrameworkSetting.ConfineMouseMode), }, new SettingsCheckbox { LabelText = "在游戏中禁用鼠标滚轮", Bindable = osuConfig.GetBindable <bool>(OsuSetting.MouseDisableWheel) }, new SettingsCheckbox { LabelText = "在游戏中禁用鼠标按键", Bindable = osuConfig.GetBindable <bool>(OsuSetting.MouseDisableButtons) }, }; rawInputToggle.ValueChanged += enabled => { // this is temporary until we support per-handler settings. const string raw_mouse_handler = @"OsuTKRawMouseHandler"; const string standard_mouse_handler = @"OsuTKMouseHandler"; ignoredInputHandler.Value = enabled.NewValue ? standard_mouse_handler : raw_mouse_handler; }; ignoredInputHandler = config.GetBindable <string>(FrameworkSetting.IgnoredInputHandlers); ignoredInputHandler.ValueChanged += handler => { bool raw = !handler.NewValue.Contains("Raw"); rawInputToggle.Value = raw; sensitivity.Bindable.Disabled = !raw; }; ignoredInputHandler.TriggerChange(); }
private void load(FrameworkConfigManager config) { AddRange(new Drawable[] { new SettingsEnumDropdown<FrameSync> { Label = "Frame limiter", Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync), }, new SettingsEnumDropdown<ExecutionMode> { Label = "Threading mode", Current = config.GetBindable<ExecutionMode>(FrameworkSetting.ExecutionMode), }, }); }
private void setupConfig() { Dependencies.Cache(debugConfig = new FrameworkDebugConfigManager()); Dependencies.Cache(config = new FrameworkConfigManager(Storage)); Dependencies.Cache(Localisation = new LocalisationEngine(config)); activeGCMode = debugConfig.GetBindable <GCLatencyMode>(DebugSetting.ActiveGCMode); activeGCMode.ValueChanged += newMode => { GCSettings.LatencyMode = IsActive ? newMode : GCLatencyMode.Interactive; }; frameSyncMode = config.GetBindable <FrameSync>(FrameworkSetting.FrameSync); frameSyncMode.ValueChanged += newMode => { float refreshRate = DisplayDevice.Default.RefreshRate; float drawLimiter = refreshRate; float updateLimiter = drawLimiter * 2; setVSyncMode(); switch (newMode) { case FrameSync.VSync: drawLimiter = int.MaxValue; updateLimiter *= 2; break; case FrameSync.Limit2x: drawLimiter *= 2; updateLimiter *= 2; break; case FrameSync.Limit4x: drawLimiter *= 4; updateLimiter *= 4; break; case FrameSync.Limit8x: drawLimiter *= 8; updateLimiter *= 8; break; case FrameSync.Unlimited: drawLimiter = updateLimiter = int.MaxValue; break; } if (DrawThread != null) { DrawThread.ActiveHz = drawLimiter; } if (UpdateThread != null) { UpdateThread.ActiveHz = updateLimiter; } }; }
private void load(OsuGame game, FrameworkConfigManager frameworkConfigManager, OsuConfigManager osuConfigManager) { frameworkConfineMode = frameworkConfigManager.GetBindable <ConfineMouseMode>(FrameworkSetting.ConfineMouseMode); osuConfineMode = osuConfigManager.GetBindable <OsuConfineMouseMode>(OsuSetting.ConfineMouseMode); localUserPlaying = game.LocalUserPlaying.GetBoundCopy(); osuConfineMode.ValueChanged += _ => updateConfineMode(); localUserPlaying.BindValueChanged(_ => updateConfineMode(), true); }
private void load(FrameworkConfigManager frameworkConfig) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "以原语言显示歌曲信息", Bindable = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowUnicode) }, }; }
private void load(VignetteConfigManager gameConfig, FrameworkConfigManager frameworkConfig, FrameworkDebugConfigManager debugConfig, VignetteGameBase game, Storage storage) { AddRange(new Drawable[] { new Container { AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Bottom = 30 }, Child = versionText = new ThemableSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = game.Version, Font = SegoeUI.Bold.With(size: 24), }, }, new SettingsCheckbox { Label = "Show FPS", Current = gameConfig.GetBindable <bool>(VignetteSetting.ShowFpsOverlay), }, new SettingsCheckbox { Label = "Show log overlay", Current = frameworkConfig.GetBindable <bool>(FrameworkSetting.ShowLogOverlay), }, new SettingsCheckbox { Label = "Bypass front-to-back render pass", Current = debugConfig.GetBindable <bool>(DebugSetting.BypassFrontToBackPass), }, new SettingsButton { Label = "Open logs folder", Action = () => storage.OpenPathInNativeExplorer("./logs"), }, }); if (!game.IsDeployedBuild && game.IsDebugBuild) { versionText.Colour = ThemeSlot.Error; } else if (!game.IsDeployedBuild) { versionText.Colour = ThemeSlot.Success; } else { versionText.Colour = ThemeSlot.Gray190; } }