private void beatmapUpdated(ValueChangedEvent <WorkingBeatmap> map) { Drawable newBackground; if (map.NewValue.Background == null) { newBackground = new Box { Alpha = 0, RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Colour4.FromHex("4A4A4C") }; } else { newBackground = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Texture = map.NewValue.Background }; } bufferedContainer.Add(newBackground); background.FadeOut(1000, Easing.Out); newBackground.FadeIn(1000, Easing.In); background.Expire(); }
private void updateColour() { if (Type == BackgroundType.Color) { Colour = Colour4.FromHex(colour.Value); } }
public NovelSection() { SectionName = "NOVEL"; Children = new Drawable[] { new SpriteText { Text = "Text Display Speed", Font = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light) }, new SpriteText { Text = "Auto Play Speed", Font = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light) }, new SpriteText { Text = "Skip Unread Text", Font = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light) }, new SpriteText { Text = "Mark Read Text", Font = KanojoWorksFont.GetFont(size: 30, weight: FontWeight.Light) }, new KanojoWorksButton { Text = "Change character volumes...", Size = new Vector2(250, 40), BackgroundColour = Colour4.FromHex("#00000066"), } }; }
public Theme(IDictionary <string, string> mapping) { foreach ((string key, string value) in mapping) { colours.Add(Enum.Parse <ThemeColour>(key.Pascalize()), Colour4.FromHex(value)); } }
public void TestTextFlowLocalisation() { Container textFlowParent = null; TextFlowContainer textFlowContainer = null; AddStep("create text flow", () => Child = textFlowParent = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Origin = Anchor.Centre, Anchor = Anchor.Centre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.FromHex("#333") }, textFlowContainer = new TextFlowContainer(text => text.Font = FrameworkFont.Condensed) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Origin = Anchor.Centre, Anchor = Anchor.Centre, }, } }); AddStep("add text", () => { const string player = "spaceman_atlas"; var rankAchieved = 12_345_678.ToLocalisableString("N0"); var beatmap = new RomanisableString( "ELFENSJóN - ASH OF ROUGE (HeTo's Normal)", "ELFENSJoN - ASH OF ROUGE (HeTo's Normal)"); const string mode = "osu!"; textFlowContainer.AddText(new TranslatableString(rank, rank_default, player, rankAchieved, beatmap, mode)); textFlowContainer.NewParagraph(); textFlowContainer.AddText(new TranslatableString(rank_lost, rank_lost_default, player, beatmap, mode), text => { text.Font = FontUsage.Default; text.Colour = Colour4.Red; }); }); AddStep("change locale to en", () => configManager.SetValue(FrameworkSetting.Locale, "en")); AddStep("change locale to fr", () => configManager.SetValue(FrameworkSetting.Locale, "fr")); AddStep("change locale to tr", () => configManager.SetValue(FrameworkSetting.Locale, "tr")); AddToggleStep("toggle romanisation", romanised => configManager.SetValue(FrameworkSetting.ShowUnicode, romanised)); AddSliderStep("change text flow width", 0, 1f, 1f, width => { if (textFlowParent != null) { textFlowParent.Width = width; } }); }
public TestScreen() { InternalChild = new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.FromHex("ea005e") }; }
private void load() { Children = new Drawable[] { buffered = new BufferedContainer { RelativeSizeAxes = Axes.Both, Child = new ScreenStack(new BasicMainMenu()), }, settingsContainer = new SettingsContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Height = 360, Y = 360, Children = new Drawable[] { new BufferedContainer { RelativeSizeAxes = Axes.Both, BlurSigma = new Vector2(5), Children = new Drawable[] { buffered.CreateView().With(d => { d.RelativeSizeAxes = Axes.Both; d.SynchronisedDrawQuad = true; }), new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.FromHex("8E8E8E"), Alpha = 0.5f }, } }, new FillFlowContainer { Padding = new MarginPadding { Bottom = 0, Top = 15, Left = 15, Right = 15 }, Direction = FillDirection.Horizontal, Spacing = new Vector2(20), Children = new Drawable[] { new VideoSection(), new AudioSection(), new NovelSection(), new DebugSection() } } } } }; settingsContainer.Show(); }
public DrawableKanojoWorksDropdownMenuItem(MenuItem item) : base(item) { BackgroundColour = Colour4.FromHex("D9D9D9"); BackgroundColourHover = Colour4.FromHex("E5E5E5").Opacity(0.8f); BackgroundColourSelected = Colour4.FromHex("E5E5E5"); Foreground.Padding = new MarginPadding { Horizontal = 8, Vertical = 5 }; }
public void TestShearedButton(bool bigButton) { ShearedButton button = null; bool actionFired = false; AddStep("create button", () => { actionFired = false; if (bigButton) { Child = button = new ShearedButton(400) { LighterColour = Colour4.FromHex("#FFFFFF"), DarkerColour = Colour4.FromHex("#FFCC22"), TextColour = Colour4.Black, TextSize = 36, Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Let's GO!", Height = 80, Action = () => actionFired = true, }; } else { Child = button = new ShearedButton(200) { LighterColour = Colour4.FromHex("#FF86DD"), DarkerColour = Colour4.FromHex("#DE31AE"), TextColour = Colour4.White, Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Press me", Height = 80, Action = () => actionFired = true, }; } }); AddStep("set disabled", () => button.Enabled.Value = false); AddStep("press button", () => button.TriggerClick()); AddAssert("action not fired", () => !actionFired); AddStep("set enabled", () => button.Enabled.Value = true); AddStep("press button", () => button.TriggerClick()); AddAssert("action fired", () => actionFired); }
protected override void OnTextCommitted(bool changed) => CurrentColor.Value = Colour4.FromHex(Text.PadRight(6, '0'));
private void load(ApplicationConfigManager config, BackgroundImageStore images, BackgroundVideoStore videos) { type = config.GetBindable <BackgroundType>(ApplicationSetting.Background); ox = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetX); oy = config.GetBindable <float>(ApplicationSetting.BackgroundOffsetY); sx = config.GetBindable <float>(ApplicationSetting.BackgroundScaleXY); colorConfig = config.GetBindable <string>(ApplicationSetting.BackgroundColor); imageConfig = config.GetBindable <string>(ApplicationSetting.BackgroundImageFile); videoConfig = config.GetBindable <string>(ApplicationSetting.BackgroundVideoFile); Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Preview" }, new Container { RelativeSizeAxes = Axes.X, CornerRadius = 5.0f, Masking = true, Margin = new MarginPadding { Bottom = 10 }, Height = 250, Width = 0.95f, Children = new Drawable[] { new Box { Colour = Colour4.Black, RelativeSizeAxes = Axes.Both, }, new Background(false) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Colour4.Black.Opacity(0.2f), Radius = 10.0f, Hollow = true, }, }, new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Display" }, new LabelledEnumDropdown <BackgroundType> { Label = "Type", Current = type, }, imagesDropdown = new LabelledFileDropdown <Texture> { Label = "Image", ItemSource = images.Loaded, }, videosDropdown = new LabelledFileDropdown <Stream> { Label = "Video", ItemSource = videos.Loaded, }, colourPicker = new ColourPicker { Current = new Bindable <Colour4>(), }, new ThemedTextButton { Text = "Open Folder", Width = 200, Action = () => images.OpenInNativeExplorer(), }, offsetConfigContainer = new FillFlowContainer { Spacing = new Vector2(0, 10), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { new ThemedSpriteText { Font = SegoeUI.Bold.With(size: 18), Text = "Offset" }, new FillFlowContainer { Alpha = type.Value != BackgroundType.Color ? 1 : 0, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Spacing = new Vector2(10, 0), Children = new Drawable[] { new LabelledNumberBox { Label = "X", Width = 50, Current = inputOffsetX, }, new LabelledNumberBox { Label = "Y", Width = 50, Current = inputOffsetY, }, new LabelledNumberBox { Label = "Scale", Width = 50, Current = inputScaleXY, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.Drag24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = enableBackgroundAdjustments, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, new ThemedIconButton { Icon = FluentSystemIcons.Filled.ArrowUndo24, Size = new Vector2(25), Style = ButtonStyle.Override, Action = resetBackgroundOffsets, IconSize = new Vector2(15), LabelColour = ThemeColour.NeutralPrimary, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, }, } }, } }, }; type.BindValueChanged(handleTypeChange, true); imagesDropdown.Current.ValueChanged += e => imageConfig.Value = e.NewValue?.Name ?? string.Empty; imagesDropdown.Current.Value = images.GetReference(imageConfig.Value); videosDropdown.Current.ValueChanged += e => videoConfig.Value = e.NewValue?.Name ?? string.Empty; videosDropdown.Current.Value = videos.GetReference(videoConfig.Value); colourPicker.Current.ValueChanged += e => colorConfig.Value = e.NewValue.ToHex(); colourPicker.Current.Value = Colour4.FromHex(colorConfig.Value); inputOffsetX.ValueChanged += e => { if (float.TryParse(e.NewValue, out float x)) { ox.Value = x; } }; inputOffsetY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float y)) { oy.Value = y; } }; inputScaleXY.ValueChanged += e => { if (float.TryParse(e.NewValue, out float s)) { sx.Value = s; } }; ox.ValueChanged += e => inputOffsetX.Value = e.NewValue.ToString(); oy.ValueChanged += e => inputOffsetY.Value = e.NewValue.ToString(); sx.ValueChanged += e => inputScaleXY.Value = e.NewValue.ToString(); }
private void load() { Children = new Drawable[] { new Container { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.Both, Height = 0.1f, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.FromHex("252526") }, new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = 0.25f, Children = new Drawable[] { new FillFlowContainer <IconButton> { AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Direction = FillDirection.Horizontal, Spacing = new osuTK.Vector2(5), Children = new[] { new IconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = FontAwesome.Solid.StepBackward, Action = () => musicController.PreviousTrack() }, playButton = new IconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = FontAwesome.Solid.Play, Action = () => musicController.TogglePlay() }, new IconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = FontAwesome.Solid.StepForward, Action = () => musicController.NextTrack() } } } } }, richMetadata = new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Width = 0.5f, Masking = true, Children = new Drawable[] { nowPlayingInfo = new DrawableNowPlayingInfo { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre } } }, } }, playlist = new PlaylistSection { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Height = 0.9f } }; playlist.BeatmapSets.BindTo(musicController.BeatmapSets); }
/// <summary> /// Adds a colour to the colour mappings. If a slot is already defined, it will be overwritten. /// </summary> /// </summary> /// <param name="slot">The slot to add the colour to.</param> /// <param name="hex">The colour represented as a valid hex string.</param> /// <returns></returns> public Theme AddColour(ThemeSlot slot, string hex) => AddColour(slot, Colour4.FromHex(hex));
public KanojoWorksMenu(Direction direction, bool topLevelMenu = false) : base(direction, topLevelMenu) { BackgroundColour = Colour4.FromHex("C4C4C4"); ItemsContainer.Padding = new MarginPadding(0); }