7
7
using osuTK . Graphics ;
8
8
using osu . Framework . Extensions . Color4Extensions ;
9
9
using osu . Framework . Graphics . Effects ;
10
- using osu . Framework . Graphics . Sprites ;
11
10
using osu . Framework . Allocation ;
12
11
using osu . Game . Rulesets . Sandbox . Screens . Visualizer . Components . MusicHelpers ;
13
12
using osu . Game . Graphics . Backgrounds ;
@@ -81,7 +80,7 @@ protected override void OnBeatmapChanged(ValueChangedEvent<WorkingBeatmap> beatm
81
80
Anchor = Anchor . Centre ,
82
81
Origin = Anchor . Centre ,
83
82
Alpha = 0 ,
84
- Colour = Color4 . LightGray
83
+ Colour = Color4 . DarkGray
85
84
} , newBackground =>
86
85
{
87
86
background ? . FadeOut ( animation_duration , Easing . OutQuint ) ;
@@ -120,8 +119,8 @@ private class BeatmapName : CompositeDrawable
120
119
private readonly Bindable < string > colour = new Bindable < string > ( "#ffffff" ) ;
121
120
122
121
private readonly WorkingBeatmap beatmap ;
123
- private SpriteText artist ;
124
- private SpriteText title ;
122
+ private TextFlowContainer artist ;
123
+ private TextFlowContainer title ;
125
124
126
125
public BeatmapName ( WorkingBeatmap beatmap = null )
127
126
{
@@ -131,8 +130,10 @@ public BeatmapName(WorkingBeatmap beatmap = null)
131
130
[ BackgroundDependencyLoader ]
132
131
private void load ( )
133
132
{
134
- AutoSizeAxes = Axes . Both ;
133
+ AutoSizeAxes = Axes . Y ;
134
+ RelativeSizeAxes = Axes . X ;
135
135
RelativePositionAxes = Axes . Y ;
136
+ Padding = new MarginPadding { Horizontal = 30 } ;
136
137
137
138
if ( beatmap == null )
138
139
return ;
@@ -141,29 +142,40 @@ private void load()
141
142
{
142
143
Anchor = Anchor . Centre ,
143
144
Origin = Anchor . Centre ,
144
- AutoSizeAxes = Axes . Both ,
145
+ AutoSizeAxes = Axes . Y ,
146
+ RelativeSizeAxes = Axes . X ,
145
147
Direction = FillDirection . Vertical ,
146
148
Spacing = new Vector2 ( 0 , 10 ) ,
147
149
Children = new Drawable [ ]
148
150
{
149
- artist = new SpriteText
151
+ artist = new TextFlowContainer ( t =>
152
+ {
153
+ t . Font = OsuFont . GetFont ( size : 28 , weight : FontWeight . Bold ) ;
154
+ } )
150
155
{
151
156
Anchor = Anchor . Centre ,
152
157
Origin = Anchor . Centre ,
153
- Font = OsuFont . GetFont ( size : 26 , weight : FontWeight . SemiBold ) ,
158
+ TextAnchor = Anchor . Centre ,
159
+ RelativeSizeAxes = Axes . X ,
160
+ AutoSizeAxes = Axes . Y ,
154
161
Text = beatmap . Metadata . Artist
155
162
} ,
156
- title = new SpriteText
163
+ title = new TextFlowContainer ( t =>
164
+ {
165
+ t . Font = OsuFont . GetFont ( size : 22 , weight : FontWeight . SemiBold ) ;
166
+ } )
157
167
{
158
168
Anchor = Anchor . Centre ,
159
169
Origin = Anchor . Centre ,
160
- Font = OsuFont . GetFont ( size : 20 , weight : FontWeight . SemiBold ) ,
161
- Text = getShortTitle ( beatmap . Metadata . Title )
170
+ TextAnchor = Anchor . Centre ,
171
+ RelativeSizeAxes = Axes . X ,
172
+ AutoSizeAxes = Axes . Y ,
173
+ Text = beatmap . Metadata . Title
162
174
}
163
175
}
164
176
} . WithEffect ( new BlurEffect
165
177
{
166
- Colour = Color4 . Black . Opacity ( 0.8f ) ,
178
+ Colour = Color4 . Black . Opacity ( 0.7f ) ,
167
179
DrawOriginal = true ,
168
180
PadExtent = true ,
169
181
Sigma = new Vector2 ( 5 )
@@ -185,39 +197,6 @@ protected override void LoadComplete()
185
197
186
198
colour . BindValueChanged ( c => artist . Colour = title . Colour = Colour4 . FromHex ( c . NewValue ) , true ) ;
187
199
}
188
-
189
- /// <summary>
190
- /// Trims additional info in brackets in beatmap title (if exists).
191
- /// </summary>
192
- /// <param name="longTitle">The title to trim.</param>
193
- /// <returns></returns>
194
- private static string getShortTitle ( string longTitle )
195
- {
196
- var newTitle = longTitle ;
197
-
198
- for ( int i = 0 ; i < title_chars . Length ; i ++ )
199
- {
200
- if ( newTitle . Contains ( title_chars [ i ] ) )
201
- {
202
- var charIndex = newTitle . IndexOf ( title_chars [ i ] ) ;
203
-
204
- if ( charIndex != 0 )
205
- newTitle = newTitle . Substring ( 0 , charIndex ) ;
206
- }
207
- }
208
-
209
- if ( newTitle . EndsWith ( " " ) )
210
- newTitle = newTitle [ 0 ..^ 1 ] ;
211
-
212
- return newTitle ;
213
- }
214
-
215
- private static readonly char [ ] title_chars = new [ ]
216
- {
217
- '(' ,
218
- '-' ,
219
- '~'
220
- } ;
221
200
}
222
201
}
223
202
}
0 commit comments