update logging and add pl splash as the main one
All checks were successful
Build / Build Launcher (push) Successful in 2m31s
All checks were successful
Build / Build Launcher (push) Successful in 2m31s
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
using System.Reflection;
|
||||
using Sandbox.Game;
|
||||
using VRage;
|
||||
|
||||
namespace PluginLoader.GUI;
|
||||
|
||||
public class SplashScreen : Form
|
||||
public sealed class SplashScreen : Form
|
||||
{
|
||||
private const float barWidth = 0.98f; // 98% of width
|
||||
private const float barHeight = 0.06f; // 6% of height
|
||||
@@ -18,21 +17,20 @@ public class SplashScreen : Form
|
||||
|
||||
public SplashScreen()
|
||||
{
|
||||
Image gif;
|
||||
if (Application.OpenForms.Count == 0 || !TryLoadImage(out gif))
|
||||
CheckForIllegalCrossThreadCalls = false;
|
||||
if (!TryLoadImage(out var gif))
|
||||
{
|
||||
invalid = true;
|
||||
return;
|
||||
}
|
||||
|
||||
var defaultSplash = Application.OpenForms[0];
|
||||
Size = defaultSplash.Size;
|
||||
ClientSize = defaultSplash.ClientSize;
|
||||
MyVRage.Platform.Windows.HideSplashScreen();
|
||||
|
||||
Name = "SplashScreenPluginLoader";
|
||||
TopMost = true;
|
||||
FormBorderStyle = FormBorderStyle.None;
|
||||
Size = new((int)(gif.Width * 1.65), (int)(gif.Height * 1.25));
|
||||
BackColor = Color.Black;
|
||||
UseWaitCursor = true;
|
||||
ShowInTaskbar = false;
|
||||
|
||||
var barSize = new SizeF(Size.Width * barWidth, Size.Height * barHeight);
|
||||
var padding = (1 - barWidth) * Size.Width * 0.5f;
|
||||
@@ -59,15 +57,13 @@ public class SplashScreen : Form
|
||||
Image = gif,
|
||||
Size = Size,
|
||||
AutoSize = false,
|
||||
SizeMode = PictureBoxSizeMode.StretchImage
|
||||
SizeMode = PictureBoxSizeMode.CenterImage
|
||||
};
|
||||
Controls.Add(gifBox);
|
||||
|
||||
gifBox.Paint += OnPictureBoxDraw;
|
||||
|
||||
CenterToScreen();
|
||||
Show();
|
||||
ForceUpdate();
|
||||
}
|
||||
|
||||
public object GameInfo { get; private set; }
|
||||
@@ -77,7 +73,7 @@ public class SplashScreen : Form
|
||||
try
|
||||
{
|
||||
var myAssembly = Assembly.GetExecutingAssembly();
|
||||
var myStream = myAssembly.GetManifestResourceStream("PluginLoader.splash.gif");
|
||||
var myStream = myAssembly.GetManifestResourceStream("PluginLoader.splash.gif")!;
|
||||
img = new Bitmap(myStream);
|
||||
return true;
|
||||
}
|
||||
@@ -95,8 +91,6 @@ public class SplashScreen : Form
|
||||
|
||||
lbl.Text = msg;
|
||||
barValue = float.NaN;
|
||||
gifBox.Invalidate();
|
||||
ForceUpdate();
|
||||
}
|
||||
|
||||
public void SetBarValue(float percent = float.NaN)
|
||||
@@ -105,13 +99,6 @@ public class SplashScreen : Form
|
||||
return;
|
||||
|
||||
barValue = percent;
|
||||
gifBox.Invalidate();
|
||||
ForceUpdate();
|
||||
}
|
||||
|
||||
private void ForceUpdate()
|
||||
{
|
||||
Application.DoEvents();
|
||||
}
|
||||
|
||||
private void OnPictureBoxDraw(object sender, PaintEventArgs e)
|
||||
@@ -132,7 +119,6 @@ public class SplashScreen : Form
|
||||
gifBox.Paint -= OnPictureBoxDraw;
|
||||
Close();
|
||||
Dispose();
|
||||
ForceUpdate();
|
||||
MyVRage.Platform.Windows.ShowSplashScreen(MyPerGameSettings.BasicGameInfo.SplashScreenImage, new(0.7f, 0.7f));
|
||||
MyVRage.Platform.Windows.Window.ShowAndFocus();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user