|
5 | 5 | using System; |
6 | 6 | using System.Collections.Generic; |
7 | 7 | using System.Linq; |
| 8 | +using JetBrains.Annotations; |
8 | 9 | using ManagedBass.Fx; |
9 | 10 | using osu.Framework.Allocation; |
10 | 11 | using osu.Framework.Audio; |
11 | 12 | using osu.Framework.Bindables; |
12 | 13 | using osu.Framework.Graphics; |
13 | 14 | using osu.Framework.Graphics.Sprites; |
| 15 | +using osu.Framework.Graphics.Textures; |
14 | 16 | using osu.Framework.Localisation; |
15 | 17 | using osu.Framework.Platform; |
16 | 18 | using osu.Framework.Testing; |
@@ -65,21 +67,42 @@ public partial class ToggleSettings : SettingsSubsection |
65 | 67 | private AutoWahParameters autoWahParameters; |
66 | 68 | private ChorusParameters chorusParameters; |
67 | 69 | private PhaserParameters phaserParameters; |
| 70 | + private Bindable<double> balanceAdjustment; |
| 71 | + |
| 72 | + private Sprite dvdLogo; |
| 73 | + private Vector2 dvdLogoVelocity = new Vector2(0.005f); |
| 74 | + |
| 75 | + [CanBeNull] |
| 76 | + private ScheduledDelegate dvdLogoMovement; |
68 | 77 |
|
69 | 78 | private AudioManager audio; |
70 | 79 |
|
71 | 80 | [BackgroundDependencyLoader] |
72 | | - private void load() |
| 81 | + private void load(TextureStore textures) |
73 | 82 | { |
74 | 83 | autoWahParameters = new AutoWahParameters { fDryMix = 0.5f, fWetMix = 0.5f }; |
75 | 84 | chorusParameters = new ChorusParameters { fDryMix = 0.5f, fWetMix = 0.5f }; |
76 | 85 | phaserParameters = new PhaserParameters { fDryMix = 0.5f, fWetMix = 0.5f }; |
| 86 | + balanceAdjustment = new Bindable<double>(1); |
| 87 | + |
| 88 | + dvdLogo = new Sprite |
| 89 | + { |
| 90 | + Anchor = Anchor.Centre, |
| 91 | + Origin = Anchor.Centre, |
| 92 | + Depth = float.MinValue, |
| 93 | + Size = new Vector2(30), |
| 94 | + Texture = textures.Get(@"Menu/logo"), |
| 95 | + RelativePositionAxes = Axes.Both, |
| 96 | + Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()), |
| 97 | + Alpha = 0, |
| 98 | + }; |
77 | 99 |
|
78 | 100 | audio = game.Audio; |
79 | 101 |
|
80 | 102 | target = game.ChildrenOfType<GlobalActionContainer>().First(); |
81 | 103 | target.Anchor = Anchor.Centre; |
82 | 104 | target.Origin = Anchor.Centre; |
| 105 | + Schedule(() => target.Add(dvdLogo)); |
83 | 106 |
|
84 | 107 | reset(); |
85 | 108 | } |
@@ -251,6 +274,80 @@ private void reset() |
251 | 274 | audio.TrackMixer.AddEffect(phaserParameters); |
252 | 275 | else |
253 | 276 | audio.TrackMixer.RemoveEffect(phaserParameters); |
| 277 | + }, |
| 278 | + |
| 279 | + // game blinks at you |
| 280 | + val => |
| 281 | + { |
| 282 | + if (val.NewValue) |
| 283 | + { |
| 284 | + target.ScaleTo(new Vector2(1, 0), 50, Easing.OutQuint) |
| 285 | + .Then().ScaleTo(Vector2.One, 50, Easing.OutQuint); |
| 286 | + } |
| 287 | + }, |
| 288 | + |
| 289 | + // messing with balance |
| 290 | + val => |
| 291 | + { |
| 292 | + if (val.NewValue) |
| 293 | + { |
| 294 | + audio.AddAdjustment(AdjustableProperty.Balance, balanceAdjustment); |
| 295 | + this.TransformBindableTo(balanceAdjustment, 0.3f, 5_000) |
| 296 | + .Then().TransformBindableTo(balanceAdjustment, 0.7f, 10_000) |
| 297 | + .Then().TransformBindableTo(balanceAdjustment, 0.5f, 5_000) |
| 298 | + .Loop(); |
| 299 | + } |
| 300 | + else |
| 301 | + { |
| 302 | + audio.RemoveAdjustment(AdjustableProperty.Balance, balanceAdjustment); |
| 303 | + } |
| 304 | + }, |
| 305 | + |
| 306 | + // do a barrel roll! (press Z or R twice) |
| 307 | + val => |
| 308 | + { |
| 309 | + if (val.NewValue) |
| 310 | + { |
| 311 | + target.RotateTo(360, 1000) |
| 312 | + .Then().RotateTo(0); |
| 313 | + } |
| 314 | + }, |
| 315 | + |
| 316 | + // what if you just alpha everything. thats bound to look uninteresting... unless? |
| 317 | + val => |
| 318 | + { |
| 319 | + target.Alpha = val.NewValue ? RNG.NextSingle(0.6f, 0.8f) : 1; |
| 320 | + }, |
| 321 | + |
| 322 | + // IS IT GONNA HIT THE CORNER |
| 323 | + val => |
| 324 | + { |
| 325 | + if (val.NewValue) |
| 326 | + { |
| 327 | + dvdLogo.Alpha = 1; |
| 328 | + dvdLogoMovement = Scheduler.AddDelayed(() => |
| 329 | + { |
| 330 | + var logoPosition = dvdLogo.ScreenSpaceDrawQuad; |
| 331 | + var bounds = target.ScreenSpaceDrawQuad; |
| 332 | + |
| 333 | + if (logoPosition.TopLeft.X < bounds.TopLeft.X) |
| 334 | + dvdLogoVelocity = new Vector2(0.005f, dvdLogoVelocity.Y); |
| 335 | + else if (logoPosition.BottomRight.X > bounds.BottomRight.X) |
| 336 | + dvdLogoVelocity = new Vector2(-0.005f, dvdLogoVelocity.Y); |
| 337 | + |
| 338 | + if (logoPosition.TopLeft.Y < bounds.TopLeft.Y) |
| 339 | + dvdLogoVelocity = new Vector2(dvdLogoVelocity.X, 0.005f); |
| 340 | + else if (logoPosition.BottomRight.Y > bounds.BottomRight.Y) |
| 341 | + dvdLogoVelocity = new Vector2(dvdLogoVelocity.X, -0.005f); |
| 342 | + |
| 343 | + dvdLogo.Position += dvdLogoVelocity; |
| 344 | + }, 15, true); |
| 345 | + } |
| 346 | + else |
| 347 | + { |
| 348 | + dvdLogo.Alpha = 0; |
| 349 | + dvdLogoMovement?.Cancel(); |
| 350 | + } |
254 | 351 | } |
255 | 352 | }; |
256 | 353 |
|
|
0 commit comments