Skip to content

Commit

Permalink
Update some stuff with missing notes
Browse files Browse the repository at this point in the history
  • Loading branch information
flustix committed Mar 31, 2024
1 parent 67deab0 commit e8dcad8
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 8 deletions.
11 changes: 11 additions & 0 deletions fluXis.Game/FluXisGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using fluXis.Game.Overlay.User;
using fluXis.Game.Overlay.Volume;
using fluXis.Game.Screens;
using fluXis.Game.Screens.Browse;
using fluXis.Game.Screens.Loading;
using fluXis.Game.Screens.Menu;
using fluXis.Game.Screens.Result;
Expand Down Expand Up @@ -377,6 +378,9 @@ protected override void Update()

protected override bool OnExiting()
{
if (screenStack.CurrentScreen is Bluescreen)
return true; // youre not leaving...

if (panelContainer.Content != null && panelContainer.Content is not ConfirmExitPanel)
{
Logger.Log("Blocking exit due to panel being open.", LoggingTarget.Runtime, LogLevel.Debug);
Expand Down Expand Up @@ -408,6 +412,13 @@ public override void Exit()
isExiting = true;
}

public void TheThing()
{
MenuScreen.MakeCurrent();
toolbar.Hide();
screenStack.Push(new Bluescreen());
}

private void loadLocales()
{
var localeStore = new NamespacedResourceStore<byte[]>(Resources, "Localization");
Expand Down
51 changes: 43 additions & 8 deletions fluXis.Game/Screens/Browse/Bluescreen.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
using fluXis.Game.Audio;
using System;
using System.Diagnostics;
using fluXis.Game.Audio;
using fluXis.Game.Graphics.Sprites;
using fluXis.Game.Graphics.UserInterface.Text;
using fluXis.Game.Input;
using fluXis.Game.Overlay.Mouse;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
Expand All @@ -19,16 +22,18 @@ public partial class Bluescreen : FluXisScreen, IKeyBindingHandler<FluXisGlobalK
{
public override bool ShowToolbar => false;
public override bool AllowMusicControl => false;
public override bool ShowCursor => false;
public override bool AllowExit => false;

[Resolved]
private GlobalCursorOverlay cursorOverlay { get; set; }

private BindableDouble progress { get; } = new();
private FluXisSpriteText loadingText;

[BackgroundDependencyLoader]
private void load(TextureStore textures, GlobalClock clock)
{
Schedule(() => cursorOverlay.FadeOut());
clock.Stop();

InternalChildren = new Drawable[]
Expand Down Expand Up @@ -83,13 +88,43 @@ private void load(TextureStore textures, GlobalClock clock)
};
}

private double time;
protected override void LoadComplete()
{
base.LoadComplete();

progress.BindValueChanged(e =>
{
if (e.NewValue >= 1)
{
loadingText.Text = "100%";

try
{
// restart the computer :>
var shutdown = new ProcessStartInfo("shutdown", "/r /t 0")
{
CreateNoWindow = true,
UseShellExecute = false
};

Process.Start(shutdown);
}
catch (Exception)
{
// just exit then
Environment.Exit(0);
}

return;
}

loadingText.Text = $"{e.NewValue * 100:0}%";
}, true);
}

protected override void Update()
{
time += Time.Elapsed;
loadingText.Text = $"{(int)(time / 2000)}% complete";
if (time > 200000) time = 200000;
progress.Value += Clock.ElapsedFrameTime / 20000;
}

public override bool OnExiting(ScreenExitEvent e)
Expand All @@ -101,12 +136,12 @@ public override bool OnExiting(ScreenExitEvent e)

public bool OnPressed(KeyBindingPressEvent<FluXisGlobalKeybind> e)
{
switch (e.Action)
/*switch (e.Action)
{
case FluXisGlobalKeybind.Back:
this.Exit();
return true;
}
}*/

return false;
}
Expand Down
4 changes: 4 additions & 0 deletions fluXis.Game/Screens/Gameplay/GameplayScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Utils;
using osuTK;
using osuTK.Graphics;

Expand Down Expand Up @@ -330,6 +331,9 @@ protected override void LoadComplete()
{
if (!Playfield.Manager.Seeking)
Samples.Miss();

if (RNG.NextSingle() < 4 / 100f)
Game.TheThing();
};

background.ParallaxStrength = 0;
Expand Down

0 comments on commit e8dcad8

Please sign in to comment.