Add a basic loading screen! (#6003)

* Added basic loading screen

* Make it look better!

* I forgor xD

* Fix test fails

* Add comment

* Removed unused import

* Only write to file if the number of sections changed

* Servers can now have their own settings

* Minor optionzation and rare colors

* Remove some of the cvars

* debug only loading messages

* Added a few more steps

* Only one section at a time

* nullable section name

* Lock out functions if finished

* Get rid of saving the ccvar

* Cleanup

* Forgot!

* A few tweaks

* Disable vsync

* remove colors

* remove outdated vsync functions

* Silly me xD

* What I get for trying to be clever... ;(

* Better seconds display

* Simplify drawing logic + it looks better

* Type does not need to be partial

* Make interface to expose to content

* Use correct define to gate showing debug info

Should be TOOLS instead of DEBUG

* Use appropriate exception type in BeginLoadingSection

* Fix exception when closing window during loading screen

Would try to stop the main loop before it exists.

* Rename CVars, put debug info behind CVar instead of conditional compilation.

* Add to RELEASE-NOTES.md

* Add UI scaling support

* Make ILoadingScreenManager fully internal

Didn't realize content can't touch it as it'd break the total amount of sections

* Don't re-enable vsync manually, GameController does it at the end of init

* Add command to show top load time usage.

* Improve verbosity of debug time tracking

More steps and some steps named better

---------

Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com>
This commit is contained in:
beck-thompson
2025-10-29 16:38:59 -07:00
committed by GitHub
parent f3a3f564e1
commit e49515956a
10 changed files with 442 additions and 64 deletions

View File

@@ -1940,5 +1940,27 @@ namespace Robust.Shared
/// </summary>
public static readonly CVarDef<bool> FontWindowsDownloadable =
CVarDef.Create("font.windows_downloadable", false, CVar.CLIENTONLY | CVar.ARCHIVE);
/*
* LOADING
*/
/// <summary>
/// Whether to show explicit loading bar during client initialization.
/// </summary>
public static readonly CVarDef<bool> LoadingShowBar =
CVarDef.Create("loading.show_bar", true, CVar.CLIENTONLY);
#if TOOLS
private const bool DefaultShowDebug = true;
#else
private const bool DefaultShowDebug = false;
#endif
/// <summary>
/// Whether to show "debug" info in the loading screen.
/// </summary>
public static readonly CVarDef<bool> LoadingShowDebug =
CVarDef.Create("loading.show_debug", DefaultShowDebug, CVar.CLIENTONLY);
}
}

View File

@@ -11,12 +11,13 @@ internal sealed record ResourceManifestData(
string? DefaultWindowTitle,
string? WindowIconSet,
string? SplashLogo,
bool? ShowLoadingBar,
bool AutoConnect,
string[]? ClientAssemblies
)
{
public static readonly ResourceManifestData Default =
new ResourceManifestData(Array.Empty<string>(), null, null, null, null, true, null);
new ResourceManifestData(Array.Empty<string>(), null, null, null, null, null, true, null);
public static ResourceManifestData LoadResourceManifest(IResourceManager res)
{
@@ -58,6 +59,10 @@ internal sealed record ResourceManifestData(
if (mapping.TryGetNode("splashLogo", out var splashNode))
splashLogo = splashNode.AsString();
bool? showBar = null;
if (mapping.TryGetNode("show_loading_bar", out var showBarNode))
showBar = showBarNode.AsBool();
bool autoConnect = true;
if (mapping.TryGetNode("autoConnect", out var autoConnectNode))
autoConnect = autoConnectNode.AsBool();
@@ -70,6 +75,7 @@ internal sealed record ResourceManifestData(
defaultWindowTitle,
windowIconSet,
splashLogo,
showBar,
autoConnect,
clientAssemblies
);