Skip to content

Commit 60f3dd8

Browse files
committed
test 2
1 parent dd46088 commit 60f3dd8

File tree

1 file changed

+98
-1
lines changed

1 file changed

+98
-1
lines changed

osu.Game/Overlays/AfToggleSection.cs

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
using System;
66
using System.Collections.Generic;
77
using System.Linq;
8+
using JetBrains.Annotations;
89
using ManagedBass.Fx;
910
using osu.Framework.Allocation;
1011
using osu.Framework.Audio;
1112
using osu.Framework.Bindables;
1213
using osu.Framework.Graphics;
1314
using osu.Framework.Graphics.Sprites;
15+
using osu.Framework.Graphics.Textures;
1416
using osu.Framework.Localisation;
1517
using osu.Framework.Platform;
1618
using osu.Framework.Testing;
@@ -65,21 +67,42 @@ public partial class ToggleSettings : SettingsSubsection
6567
private AutoWahParameters autoWahParameters;
6668
private ChorusParameters chorusParameters;
6769
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;
6877

6978
private AudioManager audio;
7079

7180
[BackgroundDependencyLoader]
72-
private void load()
81+
private void load(TextureStore textures)
7382
{
7483
autoWahParameters = new AutoWahParameters { fDryMix = 0.5f, fWetMix = 0.5f };
7584
chorusParameters = new ChorusParameters { fDryMix = 0.5f, fWetMix = 0.5f };
7685
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+
};
7799

78100
audio = game.Audio;
79101

80102
target = game.ChildrenOfType<GlobalActionContainer>().First();
81103
target.Anchor = Anchor.Centre;
82104
target.Origin = Anchor.Centre;
105+
Schedule(() => target.Add(dvdLogo));
83106

84107
reset();
85108
}
@@ -251,6 +274,80 @@ private void reset()
251274
audio.TrackMixer.AddEffect(phaserParameters);
252275
else
253276
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+
}
254351
}
255352
};
256353

0 commit comments

Comments
 (0)