mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 17:52:56 +08:00
Header3
This commit is contained in:
parent
b4bb97fba8
commit
3c1e445fdf
@ -3,11 +3,9 @@
|
||||
|
||||
using NUnit.Framework;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Changelog.Header;
|
||||
|
||||
namespace osu.Game.Tests.Visual
|
||||
@ -58,19 +56,7 @@ namespace osu.Game.Tests.Visual
|
||||
AddStep(@"white badge", () => textBadgePair.SetBadgeColour(Color4.White, 100));
|
||||
AddStep(@"hide text", () => textBadgePair.HideText(250));
|
||||
AddStep(@"show text", () => textBadgePair.ShowText(250));
|
||||
AddStep(@"change text", () => textBadgePair.ChangeText(250));
|
||||
}
|
||||
|
||||
//[BackgroundDependencyLoader]
|
||||
//private void load(OsuColour colours)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
//private enum BreadcrumbTab
|
||||
//{
|
||||
// Click,
|
||||
// The,
|
||||
// Circles,
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,14 @@
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Changelog.Header;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
@ -25,11 +19,12 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
private readonly Container coverContainer;
|
||||
|
||||
private Color4 purple = new Color4(191, 4, 255, 255);
|
||||
protected Color4 purple = new Color4(191, 4, 255, 255);
|
||||
private readonly Sprite coverImage;
|
||||
private readonly Sprite headerBadge; //50x50, margin-right: 20
|
||||
private readonly FillFlowContainer headerTextContainer;
|
||||
private readonly OsuSpriteText title, titleStream;
|
||||
private readonly SpriteIcon chevron;
|
||||
private readonly TextBadgePairListing listing;
|
||||
private readonly TextBadgePairRelease releaseStream;
|
||||
private readonly FillFlowContainer breadcrumbContainer;
|
||||
@ -61,110 +56,117 @@ namespace osu.Game.Overlays.Changelog
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
//new Container
|
||||
//{
|
||||
// RelativeSizeAxes = Axes.X,
|
||||
// Height = cover_height,
|
||||
// Children = new Drawable[]
|
||||
// {
|
||||
new Container // this is the line badge-Changelog-Stream
|
||||
new Container // this is the line badge-Changelog-Stream
|
||||
{
|
||||
Height = title_height,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = -version_height,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer // a purple circle
|
||||
{
|
||||
Height = title_height,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Y = -version_height,
|
||||
X = icon_margin,
|
||||
Masking = true,
|
||||
BorderColour = purple,
|
||||
BorderThickness = 3,
|
||||
MaskingSmoothness = 1,
|
||||
Size = new OpenTK.Vector2(50),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer // a purple circle
|
||||
headerBadge = new Sprite
|
||||
{
|
||||
X = icon_margin,
|
||||
Masking = true,
|
||||
BorderColour = purple,
|
||||
BorderThickness = 3,
|
||||
MaskingSmoothness = 1,
|
||||
Size = new OpenTK.Vector2(50),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
headerBadge = new Sprite
|
||||
{
|
||||
Size = new OpenTK.Vector2(0.8f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Box // this ensures the purple circle doesn't disappear..?
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new OpenTK.Vector2(1),
|
||||
AlwaysPresent = true,
|
||||
Colour = Color4.Transparent,
|
||||
}
|
||||
}
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new OpenTK.Vector2(0.8f),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
headerTextContainer = new FillFlowContainer
|
||||
|
||||
// this box has 2 functions:
|
||||
// - ensures the circle doesn't disappear on the X and Y edges
|
||||
// - lessens the white "contamination" on the circle (due to smoothing)
|
||||
new Box
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = icon_size + icon_margin * 2,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Text = "Changelog ",
|
||||
Font = @"Exo2.0-Light",
|
||||
TextSize = 38, // web: 30
|
||||
},
|
||||
titleStream = new OsuSpriteText
|
||||
{
|
||||
Text = "Listing",
|
||||
TextSize = 38, // web: 30
|
||||
Font = @"Exo2.0-Light",
|
||||
Colour = purple,
|
||||
},
|
||||
}
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new OpenTK.Vector2(1),
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true,
|
||||
Colour = purple,
|
||||
}
|
||||
}
|
||||
},
|
||||
breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1
|
||||
headerTextContainer = new FillFlowContainer
|
||||
{
|
||||
X = 2 * icon_margin + icon_size - 8, // for some reason off by 3px
|
||||
Height = version_height,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = icon_size + icon_margin * 2,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
listing = new TextBadgePairListing(purple),
|
||||
new SpriteIcon
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(7),
|
||||
Colour = OsuColour.FromHex(@"bf04ff"),
|
||||
Icon = FontAwesome.fa_chevron_right,
|
||||
Margin = new MarginPadding()
|
||||
{
|
||||
Top = 8,
|
||||
Left = 5,
|
||||
Right = 5,
|
||||
Bottom = 15,
|
||||
},
|
||||
Text = "Changelog ",
|
||||
Font = @"Exo2.0-Light",
|
||||
TextSize = 38, // web: 30
|
||||
},
|
||||
titleStream = new OsuSpriteText
|
||||
{
|
||||
Text = "Listing",
|
||||
TextSize = 38, // web: 30
|
||||
Font = @"Exo2.0-Light",
|
||||
Colour = purple,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
breadcrumbContainer = new FillFlowContainer // Listing > Lazer 2018.713.1
|
||||
{
|
||||
X = 2 * icon_margin + icon_size - 8,
|
||||
Height = version_height,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
listing = new TextBadgePairListing(purple),
|
||||
new Container() // without a container, moving the chevron wont work
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Margin = new MarginPadding()
|
||||
{
|
||||
Top = 10,
|
||||
Left = 7,
|
||||
Right = 9,
|
||||
Bottom = 15,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
chevron = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(7),
|
||||
Colour = purple,
|
||||
Icon = FontAwesome.fa_chevron_right,
|
||||
Alpha = 0,
|
||||
X = -200,
|
||||
},
|
||||
releaseStream = new TextBadgePairRelease(purple, "Lazer")
|
||||
},
|
||||
},
|
||||
new Box // purple line
|
||||
{
|
||||
Colour = purple,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 3,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
// }
|
||||
//}
|
||||
releaseStream = new TextBadgePairRelease(purple, "Lazer")
|
||||
},
|
||||
},
|
||||
new Box // purple line
|
||||
{
|
||||
Colour = purple,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 3,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -172,10 +174,15 @@ namespace osu.Game.Overlays.Changelog
|
||||
// is this a bad way to do this?
|
||||
OnLoadComplete = d =>
|
||||
{
|
||||
releaseStream.OnActivation = listing.Deactivate;
|
||||
releaseStream.OnActivation = () =>
|
||||
{
|
||||
listing.Deactivate();
|
||||
chevron.MoveToX(0, 100).FadeIn(100);
|
||||
};
|
||||
listing.OnActivation = () =>
|
||||
{
|
||||
releaseStream.Deactivate();
|
||||
chevron.MoveToX(-20, 100).FadeOut(100);
|
||||
ChangeHeaderText("Listing");
|
||||
};
|
||||
};
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
@ -12,24 +10,26 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
private const float transition_duration = 100;
|
||||
private const float uncollapsed_height = 10;
|
||||
public float UncollapsedHeight => uncollapsed_height;
|
||||
|
||||
public float TransitionDuration => transition_duration;
|
||||
private bool isCollapsed;
|
||||
public float UncollapsedHeight => uncollapsed_height;
|
||||
protected bool isCollapsed;
|
||||
public bool IsCollapsed
|
||||
{
|
||||
get { return isCollapsed; }
|
||||
set
|
||||
{
|
||||
isCollapsed = value;
|
||||
this.ResizeHeightTo(value ? 1 : 10, transition_duration);
|
||||
this.ResizeHeightTo(value ? 1 : uncollapsed_height, transition_duration);
|
||||
}
|
||||
}
|
||||
|
||||
public LineBadge(bool startCollapsed = false)
|
||||
public LineBadge()
|
||||
{
|
||||
IsCollapsed = startCollapsed;
|
||||
Anchor = Anchor.BottomCentre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
// this margin prevents jumps when changing text's font weight
|
||||
Margin = new MarginPadding()
|
||||
{
|
||||
Left = 10,
|
||||
|
@ -1,16 +1,10 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Changelog;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog.Header
|
||||
@ -43,7 +37,11 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
|
||||
public void ShowText(double duration = 0, string displayText = null, Easing easing = Easing.InOutCubic)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(displayText)) text.Text = displayText;
|
||||
if (!string.IsNullOrEmpty(displayText))
|
||||
{
|
||||
text.Text = displayText;
|
||||
}
|
||||
|
||||
text.MoveToY(0, duration, easing)
|
||||
.FadeIn(duration, easing)
|
||||
.Finally(d => {
|
||||
@ -74,7 +72,7 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
// didn't apply to transforms that come after the .finally), I'm using a scheduler here
|
||||
Scheduler.AddDelayed(() =>
|
||||
{
|
||||
lineBadge.ResizeWidthTo(0); // resizes when not visible
|
||||
//lineBadge.ResizeWidthTo(0); // resizes when not visible
|
||||
if (!string.IsNullOrEmpty(displayText)) text.Text = displayText;
|
||||
}, duration);
|
||||
}
|
||||
@ -91,7 +89,6 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
Text = displayText,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Origin = Anchor.TopLeft,
|
||||
AlwaysPresent = true,
|
||||
Margin = new MarginPadding()
|
||||
{
|
||||
Top = 5,
|
||||
|
@ -5,7 +5,6 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Input;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
|
@ -1,9 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Changelog.Header
|
||||
{
|
||||
@ -27,15 +25,17 @@ namespace osu.Game.Overlays.Changelog.Header
|
||||
|
||||
public void Activate(string displayText = null)
|
||||
{
|
||||
ClearTransforms();
|
||||
if (!lineBadge.IsCollapsed) ChangeText(transition_duration, displayText);
|
||||
//ClearTransforms();
|
||||
// not using if (!lineBadge.IsCollapsed) because the text sometimes gets reset
|
||||
// when quickly switching release streams
|
||||
if (text.IsPresent) ChangeText(transition_duration, displayText);
|
||||
else ShowText(transition_duration, displayText);
|
||||
OnActivation?.Invoke();
|
||||
}
|
||||
|
||||
public override void Deactivate()
|
||||
{
|
||||
FinishTransforms(true);
|
||||
//FinishTransforms(true);
|
||||
HideText(transition_duration);
|
||||
OnDeactivation?.Invoke();
|
||||
}
|
||||
|
@ -9,11 +9,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Changelog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -23,19 +19,22 @@ namespace osu.Game.Overlays
|
||||
|
||||
public ChangelogHeader header;
|
||||
|
||||
protected Color4 purple = new Color4(191, 4, 255, 255);
|
||||
|
||||
public ChangelogOverlay()
|
||||
{
|
||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
||||
// these possibly need adjusting?
|
||||
Waves.FirstWaveColour = OsuColour.FromHex(@"bf04ff");
|
||||
Waves.SecondWaveColour = OsuColour.FromHex(@"8F03BF");
|
||||
Waves.ThirdWaveColour = OsuColour.FromHex(@"600280");
|
||||
Waves.FourthWaveColour = OsuColour.FromHex(@"300140");
|
||||
|
||||
Anchor = Anchor.TopCentre;
|
||||
Origin = Anchor.TopCentre;
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Width = 0.85f;
|
||||
|
||||
Masking = true;
|
||||
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
|
Loading…
Reference in New Issue
Block a user