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; } }
private void load(VignetteConfigManager config) { colour = config.GetBindable <Colour4>(VignetteSetting.BackgroundColour); AddInternal(background = new Box { Depth = 1, RelativeSizeAxes = Axes.Both, }); colour.BindValueChanged(e => background.Colour = e.NewValue, true); }
public ThemeManager(Scheduler scheduler, UserResources resources, VignetteConfigManager config) { this.scheduler = scheduler; UseableThemes.Add(Theme.Light); UseableThemes.Add(Theme.Dark); store = resources.Themes; store.FileCreated += onFileCreated; store.FileDeleted += onFileDeleted; store.FileUpdated += onFileUpdated; store.FileRenamed += onFileRenamed; loadExistingThemes(); themeConfig = config.GetBindable <string>(VignetteSetting.Theme); themeConfig.BindValueChanged(e => { if (e.NewValue == Current.Value.Name) { return; } Current.Value = UseableThemes.FirstOrDefault(t => t.Name == e.NewValue) ?? Theme.Light; SourceChanged?.Invoke(); }, true); Current.BindValueChanged(e => { if (themeConfig.Value == e.NewValue.Name) { return; } themeConfig.Value = e.NewValue.Name; SourceChanged?.Invoke(); }, true); }
private void load(VignetteConfigManager config) { userScale = config.GetBindable <float>(VignetteSetting.ModelScale); userXOffset = config.GetBindable <float>(VignetteSetting.ModelPositionX); userYOffset = config.GetBindable <float>(VignetteSetting.ModelPositionY); allowMouseDrag = config.GetBindable <bool>(VignetteSetting.MouseDrag); allowMouseScroll = config.GetBindable <bool>(VignetteSetting.MouseWheel); asset = config.GetBindable <string>(VignetteSetting.Model); userScale.ValueChanged += _ => updateRenderer(); userXOffset.ValueChanged += _ => updateRenderer(); userYOffset.ValueChanged += _ => updateRenderer(); asset.ValueChanged += _ => updateModel(); updateModel(); }
private void load(VignetteConfigManager config) { userScale = config.GetBindable <float>(VignetteSetting.BackgroundScale); userXOffset = config.GetBindable <float>(VignetteSetting.BackgroundPositionX); userYOffset = config.GetBindable <float>(VignetteSetting.BackgroundPositionY); backgroundMode = config.GetBindable <BackgroundMode>(VignetteSetting.BackgroundMode); userTexture = config.GetBindable <string>(VignetteSetting.BackgroundImage); userColor = config.GetBindable <Colour4>(VignetteSetting.BackgroundColor); userScale.ValueChanged += _ => updateTranslation(); userXOffset.ValueChanged += _ => updateTranslation(); userYOffset.ValueChanged += _ => updateTranslation(); backgroundMode.ValueChanged += _ => updateTexture(); userColor.ValueChanged += _ => updateTexture(); userTexture.ValueChanged += v => updateMode(v.NewValue); updateTranslation(); updateTexture(); }
private void load(VignetteConfigManager gameConfig, FrameworkConfigManager frameworkConfig, GameHost host) { if (host.Window != null) { windowModes.BindTo(host.Window.SupportedWindowModes); currentDisplay.BindTo(host.Window.CurrentDisplayBindable); } AddRange(new Drawable[] { resizableSetting = new SettingsCheckbox { Label = "Allow window to be resizable", Current = gameConfig.GetBindable <bool>(VignetteSetting.WindowResizable), }, windowModeSetting = new SettingsDropdown <WindowMode> { Label = "Window mode", Current = frameworkConfig.GetBindable <WindowMode>(FrameworkSetting.WindowMode), ItemSource = windowModes, }, resolutionFullscreenSetting = new ResolutionDropdown { Label = "Resolution", Current = frameworkConfig.GetBindable <Size>(FrameworkSetting.SizeFullscreen), ItemSource = resolutions, }, resolutionWindowedSetting = new ResolutionDropdown { Label = "Resolution", Current = gameConfig.GetBindable <Size>(VignetteSetting.WindowSize), }, }); // We cannot disable the bindable obtained from framework config as it is internally modified. var frameworkWindowSize = frameworkConfig.GetBindable <Size>(FrameworkSetting.WindowedSize); resolutionWindowedSetting.Current.BindValueChanged(e => { if (!resizableSetting.Current.Value) { frameworkWindowSize.Value = e.NewValue; } }); resizableSetting.Current.BindValueChanged(e => { resolutionWindowedSetting.Current.TriggerChange(); windowModeSetting.Current.Disabled = e.NewValue; resolutionWindowedSetting.Current.Disabled = e.NewValue; resolutionFullscreenSetting.Current.Disabled = e.NewValue; }, true); windowModeSetting.Current.BindValueChanged(e => { resizableSetting.Current.Disabled = e.NewValue != WindowMode.Windowed; Schedule(() => { resolutionWindowedSetting.Alpha = e.NewValue == WindowMode.Windowed ? 1 : 0; resolutionFullscreenSetting.Alpha = e.NewValue == WindowMode.Fullscreen ? 1 : 0; }); }, true); }
private void load() { Resources.AddStore(new DllResourceStore(VignetteResources.ResourceAssembly)); AddFont(Resources, @"Fonts/SegoeUI"); AddFont(Resources, @"Fonts/SegoeUI-Italic"); AddFont(Resources, @"Fonts/SegoeUI-Bold"); AddFont(Resources, @"Fonts/SegoeUI-BoldItalic"); AddFont(Resources, @"Fonts/SegoeUI-Black"); AddFont(Resources, @"Fonts/SegoeUI-BlackItalic"); AddFont(Resources, @"Fonts/SegoeUI-Light"); AddFont(Resources, @"Fonts/SegoeUI-LightItalic"); AddFont(Resources, @"Fonts/SegoeUI-SemiBold"); AddFont(Resources, @"Fonts/SegoeUI-SemiBoldItalic"); AddFont(Resources, @"Fonts/SegoeUI-SemiLight"); AddFont(Resources, @"Fonts/SegoeUI-SemiLightItalic"); AddFont(Resources, @"Fonts/Spartan-Bold"); AddFont(Resources, @"Fonts/FluentSystemIcons-Filled"); AddFont(Resources, @"Fonts/Vignette"); dependencies.CacheAs(this); dependencies.CacheAs(LocalConfig); UserResources = new UserResources(Host, Storage); dependencies.CacheAs(UserResources); var themeManager = new ThemeManager(Scheduler, UserResources, LocalConfig); dependencies.CacheAs(themeManager); dependencies.CacheAs <IThemeSource>(themeManager); showFps = LocalConfig.GetBindable <bool>(VignetteSetting.ShowFpsOverlay); showFps.BindValueChanged(e => FrameStatistics.Value = e.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None, true); resizable = LocalConfig.GetBindable <bool>(VignetteSetting.WindowResizable); base.Content.Add(new SafeAreaContainer { RelativeSizeAxes = Axes.Both, Child = new DrawSizePreservingFillContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new FluentContextMenuContainer { RelativeSizeAxes = Axes.Both, Child = new FluentTooltipContainer { RelativeSizeAxes = Axes.Both, Child = content = new Container { RelativeSizeAxes = Axes.Both }, }, }, new GlobalActionContainer(this) { RelativeSizeAxes = Axes.Both, } }, }, }); }
private void load(VignetteConfigManager config) { Add(backgrounds = new SettingsDropdown <string> { Label = "Background", Bindable = config.GetBindable <string>(VignetteSetting.BackgroundImage), }); Add(new SettingsColorPicker { Label = @"Background Color", Bindable = config.GetBindable <Colour4>(VignetteSetting.BackgroundColor), }); Add(new SettingsSliderBar <float> { Label = @"Scale", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundScale), }); Add(new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0, 5), Direction = FillDirection.Vertical, Children = new Drawable[] { new VignetteSpriteText { Text = @"Position" }, new GridContainer { Height = 25, RelativeSizeAxes = Axes.X, ColumnDimensions = new[] { new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.Distributed), }, Content = new[] { new Drawable[] { new SettingsBadgedNumberBox <float> { Width = 0.75f, BadgeText = @"X", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundPositionX), }, new SettingsBadgedNumberBox <float> { Width = 0.75f, BadgeText = @"Y", Bindable = config.GetBindable <float>(VignetteSetting.BackgroundPositionY), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, }, }, } } }); Add(new VignetteButton { Text = @"Reset", BackgroundColor = Colour4.Red, RelativeSizeAxes = Axes.X, }); imported.CollectionChanged += (_, __) => updateList(); updateList(); }
private void load(VignetteConfigManager config) { colour = config.GetBindable <Colour4>(VignetteSetting.BackgroundColour); AddRange(new Drawable[] { new Container { Height = 100, Masking = true, CornerRadius = 2.5f, RelativeSizeAxes = Axes.X, Child = previewBox = new Box { Colour = Colour4.Red, RelativeSizeAxes = Axes.Both, } }, new SettingsHexColourBox { Label = "Hex", Current = colour, }, red = new SettingsSlider <float> { Label = "Red", Current = new BindableFloat { Value = colour.Value.R, MinValue = 0, MaxValue = 1, }, }, green = new SettingsSlider <float> { Label = "Green", Current = new BindableFloat { Value = colour.Value.G, MinValue = 0, MaxValue = 1, }, }, blue = new SettingsSlider <float> { Label = "Blue", Current = new BindableFloat { Value = colour.Value.B, MinValue = 0, MaxValue = 1, }, }, }); red.Current.ValueChanged += e => colour.Value = new Colour4(e.NewValue, colour.Value.G, colour.Value.B, 1); green.Current.ValueChanged += e => colour.Value = new Colour4(colour.Value.R, e.NewValue, colour.Value.B, 1); blue.Current.ValueChanged += e => colour.Value = new Colour4(colour.Value.R, colour.Value.G, e.NewValue, 1); colour.BindValueChanged(e => { previewBox.Colour = e.NewValue; red.Current.Value = e.NewValue.R; green.Current.Value = e.NewValue.G; blue.Current.Value = e.NewValue.B; }, true); }