7
7
using osu . Framework . Bindables ;
8
8
using osu . Framework . Extensions . Color4Extensions ;
9
9
using osu . Framework . Graphics ;
10
- using osu . Framework . Graphics . Colour ;
11
10
using osu . Framework . Graphics . Containers ;
12
- using osu . Framework . Graphics . Effects ;
13
11
using osu . Framework . Graphics . Shapes ;
14
12
using osu . Framework . Input . Events ;
15
13
using osu . Framework . Utils ;
16
14
using osu . Game . Graphics ;
17
15
using osu . Game . Graphics . UserInterface ;
18
16
using osuTK ;
19
- using osuTK . Graphics ;
20
17
21
18
namespace osu . Game . Screens . Select . Carousel
22
19
{
23
20
public partial class CarouselHeader : Container
24
21
{
25
22
public Container AlphaContainer ;
26
23
public Container EffectContainer ;
27
- public Container BorderContainer ;
28
24
29
25
public readonly Bindable < CarouselItemState > State = new Bindable < CarouselItemState > ( CarouselItemState . NotSelected ) ;
30
26
public static readonly Vector2 SHEAR = new Vector2 ( 0.15f , 0 ) ;
31
27
32
28
protected override Container < Drawable > Content { get ; } = new Container { RelativeSizeAxes = Axes . Both } ;
33
29
34
- public bool HasCustomBorder ;
35
-
36
30
private const float corner_radius = 10 ;
37
- private const float border_thickness = 2 ;
38
31
39
32
public CarouselHeader ( )
40
33
{
@@ -45,83 +38,21 @@ public CarouselHeader()
45
38
InternalChild = AlphaContainer = new Container
46
39
{
47
40
RelativeSizeAxes = Axes . Both ,
48
- Children = new Drawable [ ]
41
+ Child = EffectContainer = new Container
49
42
{
50
- EffectContainer = new Container
51
- {
52
- RelativeSizeAxes = Axes . Both ,
53
- Masking = true ,
54
- CornerRadius = corner_radius ,
55
- Children = new Drawable [ ]
56
- {
57
- Content ,
58
- new HoverLayer ( ) ,
59
- new HeaderSounds ( ) ,
60
- }
61
- } ,
62
- BorderContainer = new Container
43
+ RelativeSizeAxes = Axes . Both ,
44
+ Masking = true ,
45
+ CornerRadius = corner_radius ,
46
+ Children = new Drawable [ ]
63
47
{
64
- RelativeSizeAxes = Axes . Both ,
65
- Masking = true ,
66
- CornerRadius = corner_radius ,
67
- BorderColour = ColourInfo . GradientHorizontal ( Colour4 . White , Colour4 . White . Opacity ( 0 ) ) ,
68
- Child = new Box
69
- {
70
- RelativeSizeAxes = Axes . Both ,
71
- Colour = Colour4 . Transparent ,
72
- }
73
- } ,
48
+ Content ,
49
+ new HoverLayer ( ) ,
50
+ new HeaderSounds ( ) ,
51
+ }
74
52
} ,
75
53
} ;
76
54
}
77
55
78
- protected override void LoadComplete ( )
79
- {
80
- base . LoadComplete ( ) ;
81
-
82
- State . BindValueChanged ( updateState , true ) ;
83
- }
84
-
85
- private void updateState ( ValueChangedEvent < CarouselItemState > state )
86
- {
87
- switch ( state . NewValue )
88
- {
89
- case CarouselItemState . Collapsed :
90
- case CarouselItemState . NotSelected :
91
- BorderContainer . BorderThickness = 0 ;
92
- EffectContainer . EdgeEffect = new EdgeEffectParameters
93
- {
94
- Type = EdgeEffectType . Shadow ,
95
- Offset = new Vector2 ( 1 ) ,
96
- Radius = 10 ,
97
- Colour = Color4 . Black . Opacity ( 100 ) ,
98
- } ;
99
-
100
- BorderContainer . EdgeEffect = new EdgeEffectParameters ( ) ;
101
- break ;
102
-
103
- case CarouselItemState . Selected :
104
- if ( HasCustomBorder ) return ;
105
-
106
- BorderContainer . BorderThickness = border_thickness ;
107
- EffectContainer . EdgeEffect = new EdgeEffectParameters
108
- {
109
- Type = EdgeEffectType . Shadow ,
110
- Colour = Color4Extensions . FromHex ( @"4EBFFF" ) . Opacity ( 0.5f ) ,
111
- Radius = 50 ,
112
- } ;
113
-
114
- BorderContainer . EdgeEffect = new EdgeEffectParameters
115
- {
116
- Type = EdgeEffectType . Shadow ,
117
- Colour = Color4Extensions . FromHex ( @"4EBFFF" ) . Opacity ( 0.5f ) ,
118
- Radius = 15 ,
119
- Hollow = true ,
120
- } ;
121
- break ;
122
- }
123
- }
124
-
125
56
public partial class HoverLayer : CompositeDrawable
126
57
{
127
58
private Box box = null ! ;
0 commit comments