basic splash.png
All checks were successful
Build / Compute Version (push) Successful in 6s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 4m16s
Build / Build Nuget package (NuGet) (push) Successful in 4m16s
Build / Build Nuget package (SharedCringe) (push) Successful in 4m15s
Build / Build Nuget package (CringePlugins) (push) Successful in 4m41s
Build / Build Launcher (push) Successful in 5m12s

This commit is contained in:
zznty
2025-06-08 21:46:47 +07:00
parent fb75897810
commit 79f8d4b6a5
5 changed files with 21 additions and 3 deletions

View File

@@ -53,6 +53,10 @@
<ItemGroup> <ItemGroup>
<Content Include="NativeMethods.txt" /> <Content Include="NativeMethods.txt" />
<None Remove="splash.png" />
<Content Include="splash.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -96,10 +96,10 @@ public class Launcher : ICorePlugin
MyFileSystem.ExePath = Path.GetDirectoryName(args.ElementAtOrDefault(0) ?? Assembly.GetExecutingAssembly().Location)!; MyFileSystem.ExePath = Path.GetDirectoryName(args.ElementAtOrDefault(0) ?? Assembly.GetExecutingAssembly().Location)!;
MyFileSystem.RootPath = new DirectoryInfo(MyFileSystem.ExePath).Parent!.FullName; MyFileSystem.RootPath = new DirectoryInfo(MyFileSystem.ExePath).Parent!.FullName;
var splash = new Splash();
var serviceProvider = SetupServices(); var serviceProvider = SetupServices();
var splash = new Splash();
splash.DefineStage(_lifetime = serviceProvider.GetRequiredService<IPluginsLifetime>()); splash.DefineStage(_lifetime = serviceProvider.GetRequiredService<IPluginsLifetime>());
InitTexts(); InitTexts();

BIN
CringeLauncher/splash.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

View File

@@ -37,6 +37,10 @@ internal class PluginsLifetime(ConfigHandler configHandler, HttpClient client) :
progress.Report("Discovering local plugins"); progress.Report("Discovering local plugins");
#if DEBUG
await Task.Delay(10000);
#endif
DiscoverLocalPlugins(_dir.CreateSubdirectory("plugins")); DiscoverLocalPlugins(_dir.CreateSubdirectory("plugins"));
progress.Report("Loading config"); progress.Report("Loading config");

View File

@@ -1,6 +1,8 @@
using System.Numerics; using System.Numerics;
using CringePlugins.Abstractions; using CringePlugins.Abstractions;
using CringePlugins.Services;
using ImGuiNET; using ImGuiNET;
using Microsoft.Extensions.DependencyInjection;
using NLog; using NLog;
using static ImGuiNET.ImGui; using static ImGuiNET.ImGui;
@@ -15,6 +17,10 @@ public class Splash : ISplashProgress, IRenderComponent
private ProgressInfo? _lastInfo; private ProgressInfo? _lastInfo;
private bool _done; private bool _done;
private readonly string _splashPath = Path.Join(AppContext.BaseDirectory, "splash.png");
private readonly IImGuiImageService _imageService =
GameServicesExtension.GameServices.GetRequiredService<IImGuiImageService>();
public void Report(ProgressInfo value) public void Report(ProgressInfo value)
{ {
@@ -60,9 +66,13 @@ public class Splash : ISplashProgress, IRenderComponent
if (_done) return; if (_done) return;
SetNextWindowPos(GetMainViewport().GetCenter(), ImGuiCond.Always, new(.5f, .5f)); SetNextWindowPos(GetMainViewport().GetCenter(), ImGuiCond.Always, new(.5f, .5f));
SetNextWindowSize(new(400, GetFrameHeightWithSpacing()), ImGuiCond.Always); const int imageSize = 512;
SetNextWindowSize(new(512, GetFrameHeightWithSpacing() * 2 + imageSize), ImGuiCond.Always);
Begin("Splash", ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoInputs); Begin("Splash", ImGuiWindowFlags.NoDecoration | ImGuiWindowFlags.NoInputs);
var image = _imageService.GetFromPath(_splashPath);
Image(image, new(imageSize));
var sizeArg = new Vector2(GetWindowWidth() - GetStyle().WindowPadding.X * 2, 0); var sizeArg = new Vector2(GetWindowWidth() - GetStyle().WindowPadding.X * 2, 0);
if (_lastInfo is null) if (_lastInfo is null)
{ {