public CustomCursorBox(Colour4 cursorColour, bool providesUserCursor = true) { ProvidingUserCursor = providesUserCursor; Colour = cursorColour; Masking = true; Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.1f }, new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = providesUserCursor ? "User cursor" : "Local cursor" }, Cursor = new TestCursorContainer { State = { Value = providesUserCursor ? Visibility.Hidden : Visibility.Visible }, } }; }
public Theme(IDictionary <string, string> mapping) { foreach ((string key, string value) in mapping) { colours.Add(Enum.Parse <ThemeColour>(key.Pascalize()), Colour4.FromHex(value)); } }
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => base.CreateDrawableMenuItem(item).With(drawableItem => { float hue = (float)depth / max_depth; drawableItem.BackgroundColour = Colour4.FromHSV(hue, 1, 0.3f); drawableItem.BackgroundColourHover = Colour4.FromHSV(hue, 0.6f, 0.5f); });
public OptionButton(OptionItem option, Action action) { HoverFadeDuration = 150; Action = action; Text = option.Text; switch (option.Type) { case OptionType.Destructive: HoverColour = new Colour4(200, 40, 40, 255); BackgroundColour = Colour4.IndianRed; break; case OptionType.Neutral: HoverColour = new Colour4(50, 50, 50, 255); BackgroundColour = new Colour4(115, 115, 115, 255); break; case OptionType.Additive: HoverColour = Colour4.Green.Opacity(150); BackgroundColour = Colour4.DarkGreen; break; } Padding = new MarginPadding { Horizontal = 10 }; SpriteText.Font = new FontUsage(size: 40); SpriteText.Colour = Colour4.White; }
private void updateColour() { if (Type == BackgroundType.Color) { Colour = Colour4.FromHex(colour.Value); } }
private void load(OsuColour colours) { AutoSizeAxes = Axes.Both; Colour4 colour = point.GetRepresentingColour(colours); InternalChildren = new Drawable[] { new Container { AutoSizeAxes = Axes.X, Height = 16, Masking = true, CornerRadius = 8, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Children = new Drawable[] { new Box { Colour = colour, RelativeSizeAxes = Axes.Both, }, Label = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Padding = new MarginPadding(5), Font = OsuFont.Default.With(size: 12, weight: FontWeight.SemiBold), Colour = colours.B5, } } }, }; }
private void load(IScrollingInfo scrollingInfo) { InternalChildren = new[] { background = new Box { Name = "Background", RelativeSizeAxes = Axes.Both, }, backgroundOverlay = new Box { Name = "Background Gradient Overlay", RelativeSizeAxes = Axes.Both, Height = 0.5f, Blending = BlendingParameters.Additive, Alpha = 0 } }; background.Colour = column.AccentColour.Darken(5); brightColour = column.AccentColour.Opacity(0.6f); dimColour = column.AccentColour.Opacity(0); direction.BindTo(scrollingInfo.Direction); direction.BindValueChanged(onDirectionChanged, true); }
protected override void UpdateState() { Action = incompatible.Value ? () => { } : (Action)Active.Toggle; if (incompatible.Value) { Colour4 backgroundColour = ColourProvider.Background5; Colour4 textBackgroundColour = ColourProvider.Background4; Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(backgroundColour, textBackgroundColour), TRANSITION_DURATION, Easing.OutQuint); Background.FadeColour(backgroundColour, TRANSITION_DURATION, Easing.OutQuint); SwitchContainer.ResizeWidthTo(IDLE_SWITCH_WIDTH, TRANSITION_DURATION, Easing.OutQuint); SwitchContainer.FadeColour(Colour4.Gray, TRANSITION_DURATION, Easing.OutQuint); MainContentContainer.TransformTo(nameof(Padding), new MarginPadding { Left = IDLE_SWITCH_WIDTH, Right = CORNER_RADIUS }, TRANSITION_DURATION, Easing.OutQuint); TextBackground.FadeColour(textBackgroundColour, TRANSITION_DURATION, Easing.OutQuint); TextFlow.FadeColour(Colour4.White.Opacity(0.5f), TRANSITION_DURATION, Easing.OutQuint); return; } SwitchContainer.FadeColour(Colour4.White, TRANSITION_DURATION, Easing.OutQuint); base.UpdateState(); }
private void load(OsuColour colours) { Colour = defaultColour = colours.Gray4; Anchor = Anchor.TopLeft; Origin = Anchor.TopCentre; Width = size; RelativeSizeAxes = Axes.Y; RelativePositionAxes = Axes.X; InternalChildren = new Drawable[] { new Box { Width = 2, RelativeSizeAxes = Axes.Y, Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Colour = ColourInfo.GradientVertical(Colour4.White.Opacity(0.2f), Colour4.White), Blending = BlendingParameters.Additive, }, new EquilateralTriangle { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Height = size, EdgeSmoothness = new Vector2(1), Colour = Colour4.White, } }; }
private void load(AudioManager audio, OsuColour colours) { sampleOn = audio.Samples.Get(@"UI/check-on"); sampleOff = audio.Samples.Get(@"UI/check-off"); activeColour = colours.ForModType(Mod.Type); }
private void setColour(Colour4 objectColour) { const float roundness = 100; largeFaint.EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Interpolation.ValueAt(0.1f, objectColour, Colour4.White, 0, 1).Opacity(0.3f), Roundness = 160, Radius = 200, }; smallFaint.EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Interpolation.ValueAt(0.6f, objectColour, Colour4.White, 0, 1), Roundness = 20, Radius = 50, }; directionalGlow1.EdgeEffect = directionalGlow2.EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Glow, Colour = Interpolation.ValueAt(0.4f, objectColour, Colour4.White, 0, 1), Roundness = roundness, Radius = 40, }; }
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 void Show(string text, Colour4 color) { spriteText.Text = text; if (LatestTransformEndTime > Clock.CurrentTime) { backgroundBox.FadeColour(color, 300, Easing.OutCubic); spriteText.MoveToY(1) .Then() .MoveToY(0, 200, Easing.OutCubic); } else { backgroundBox.Colour = color; } if (Math.Abs(Y - -80) < 0.0001f) { ClearTransforms(); } this.MoveToY(-80, 400, Easing.OutCubic) .Delay(4000) .MoveToY(0, 400, Easing.OutCubic) .OnComplete(_ => Hide()); Show(); }
public HitExplosionEntry(double startTime, JudgementResult judgementResult, Colour4 objectColour, float position) { LifetimeStart = startTime; Position = position; JudgementResult = judgementResult; ObjectColour = objectColour; }
public Badge(Colour4 colour, string text) { AutoSizeAxes = Axes.Both; Masking = true; CornerRadius = 2.5f; Anchor = Anchor.CentreLeft; Origin = Anchor.CentreLeft; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colour, }, new SpriteText { Padding = new MarginPadding { Horizontal = 5, Vertical = 3 }, Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = SegoeUI.SemiBold.With(size: 11), Text = text.ToUpperInvariant(), }, }; }
private void load(OsuColour colour) { borderColourUnfocused = colour.Gray4.Opacity(0.5f); borderColourFocused = BorderColour; updateBorder(); }
private void load() { // chroma key area for stable gameplay Colour = new Colour4(0, 255, 0, 255); ladder.PlayersPerTeam.BindValueChanged(performLayout, true); }
/// <summary> /// Applies a <see cref="Colour4"/> to a <see cref="Drawable"/>, doubling the alpha value into the <see cref="Drawable.Alpha"/> property. /// </summary> /// <remarks> /// This is equivalent to setting colour in the constructor in osu!stable. /// </remarks> /// <param name="drawable">The <see cref="Drawable"/> to apply the colour to.</param> /// <param name="colour">The <see cref="Colour4"/> to apply.</param> /// <returns>The given <paramref name="drawable"/>.</returns> public static T ApplyWithDoubledAlpha <T>(T drawable, Colour4 colour) where T : Drawable { drawable.Alpha = colour.A; drawable.Colour = DisallowZeroAlpha(colour); return(drawable); }
protected virtual void UpdateState() { float targetWidth = Active.Value ? EXPANDED_SWITCH_WIDTH : IDLE_SWITCH_WIDTH; double transitionDuration = TRANSITION_DURATION; Colour4 textBackgroundColour = Active.Value ? activeColour : (Colour4)ColourProvider.Background2; Colour4 mainBackgroundColour = Active.Value ? activeColour.Darken(0.3f) : (Colour4)ColourProvider.Background3; Colour4 textColour = Active.Value ? (Colour4)ColourProvider.Background6 : Colour4.White; // Hover affects colour of button background if (IsHovered) { textBackgroundColour = textBackgroundColour.Lighten(0.1f); mainBackgroundColour = mainBackgroundColour.Lighten(0.1f); } // Mouse down adds a halfway tween of the movement if (mouseDown) { targetWidth = (float)Interpolation.Lerp(IDLE_SWITCH_WIDTH, EXPANDED_SWITCH_WIDTH, 0.5f); transitionDuration *= 4; } Content.TransformTo(nameof(BorderColour), ColourInfo.GradientVertical(mainBackgroundColour, textBackgroundColour), transitionDuration, Easing.OutQuint); Background.FadeColour(mainBackgroundColour, transitionDuration, Easing.OutQuint); SwitchContainer.ResizeWidthTo(targetWidth, transitionDuration, Easing.OutQuint); MainContentContainer.TransformTo(nameof(Padding), new MarginPadding { Left = targetWidth, Right = CORNER_RADIUS }, transitionDuration, Easing.OutQuint); TextBackground.FadeColour(textBackgroundColour, transitionDuration, Easing.OutQuint); TextFlow.FadeColour(textColour, transitionDuration, Easing.OutQuint); }
protected override void LoadComplete() { base.LoadComplete(); BackgroundUnfocused = new Colour4(10, 10, 10, 10); BackgroundFocused = new Colour4(10, 10, 10, 255); }
private void load(OsuColour colours) { if (HoverColour == default) { HoverColour = colours.Yellow; } }
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(); }
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; } }); }
/// <summary> /// Forces an alpha of 1 if a given <see cref="Colour4"/> is fully transparent. /// </summary> /// <remarks> /// This is equivalent to setting colour post-constructor in osu!stable. /// </remarks> /// <param name="colour">The <see cref="Colour4"/> to disallow zero alpha on.</param> /// <returns>The resultant <see cref="Colour4"/>.</returns> public static Colour4 DisallowZeroAlpha(Colour4 colour) { if (colour.A == 0) { colour = colour.Opacity(1); } return(colour); }
public void Show(string text, Colour4 colour) { Hide(); delayedHide?.Cancel(); targetText = text; targetColour = colour; Show(); }
public ChooseColorBox(Canvas canvas, Colour4 color) : base(color) { Canvas = canvas; OutBorder = 3; InBorder = 1; Sprite.Width = Sprite.Height = 26; }
public ColorBox(Colour4 color) : base(Texture.WhitePixel) { Sprite.Colour = Color = color; OutBorder = 0; InBorder = 1; Sprite.Width = Sprite.Height = 18; }
private void load(OverlayColourProvider?colourProvider, OsuColour colours) { enabledColour = colourProvider?.Highlight1 ?? colours.BlueDark; disabledColour = colourProvider?.Background3 ?? colours.Gray3; switchContainer.Colour = enabledColour; fill.Colour = disabledColour; }
public Chunk_MCCV(ADTFile file) : base(file, "MCCV", Magic) { colours = new Colour4[145]; for (int i = 0; i < 145; i++) { colours[i] = Colour4.Read(file); } }
public TestScreen() { InternalChild = new Box { RelativeSizeAxes = Axes.Both, Colour = Colour4.FromHex("ea005e") }; }
public Sprite(TextureRegion textureRegion, int x, int y, Colour4 colour) { if (textureRegion == null) { throw new ArgumentNullException(nameof(textureRegion)); } this.textureRegion = textureRegion; this.x = x; this.y = y; this.width = textureRegion.Width; this.height = textureRegion.Height; this.colour = colour; }
public void StaticColours_ReturnExpectedColours(Colour4 expected, Colour4 actual) { expected.ShouldBe(actual); }
public void EqualsOperator_ReturnsTrue_OnEqualColour(Colour4 other) { (colour == other).ShouldBeTrue(); }
public void ValueEquals_ReturnsFalse_OnUnequalColours(Colour4 other) { colour.Equals(other).ShouldBeFalse(); }
public void SetUp() { colour = new Colour4(red, green, blue); }
public void EqualsOperator_ReturnsFalse_OnUnequalColours(Colour4 other) { (colour == other).ShouldBeFalse(); }
public void NotEqualsOperator_ReturnsFalse_OnEqualColour(Colour4 other) { (colour != other).ShouldBeFalse(); }
public void HashCodes_AreEqual_ForEqualColours(Colour4 other) { colour.GetHashCode().ShouldBe(other.GetHashCode()); }
public void HashCodes_AreNotEqual_ForUnequalColours(Colour4 other) { colour.GetHashCode().ShouldNotBe(other.GetHashCode()); }
public void SetBackGroundColour(Colour4 colour) { ThrowIfDisposed(); adapter.ClearColor( colour.R / 255, colour.G / 255, colour.B / 255, colour.A / 255 ); }
public void ValueEquals_ReturnsTrue_OnEqualColour(Colour4 other) { colour.Equals(other).ShouldBeTrue(); }
public void NotEqualsOperator_ReturnsTrue_OnUnequalColours(Colour4 other) { (colour != other).ShouldBeTrue(); }