Browse Source

Removed Steam Overlay and added loading screen

Krzysztof Krysiński 2 years ago
parent
commit
418c7f9513

+ 1 - 1
src/PixiEditor.Platform.Steam/OverlayHandler.cs

@@ -17,7 +17,7 @@ public class SteamOverlayHandler
 
     private void InitStartingRefresh()
     {
-        System.Timers.Timer timer = new(10000);
+        System.Timers.Timer timer = new(11000);
         timer.Elapsed += (sender, args) =>
         {
             if (_isOverlayActive) return;

+ 2 - 1
src/PixiEditor.Platform.Steam/SteamAdditionalContentProvider.cs

@@ -14,7 +14,8 @@ public sealed class SteamAdditionalContentProvider : IAdditionalContentProvider
         if(!PlatformHasContent(product)) return false;
 
         AppId_t appId = productIds[product];
-        return SteamApps.BIsDlcInstalled(appId);
+        bool installed = SteamApps.BIsDlcInstalled(appId);
+        return installed;
     }
 
     public bool PlatformHasContent(AdditionalContentProduct product)

+ 1 - 0
src/PixiEditor.Platform.Steam/SteamPlatform.cs

@@ -1,4 +1,5 @@
 using Steamworks;
+using Timer = System.Timers.Timer;
 
 namespace PixiEditor.Platform.Steam;
 

+ 7 - 0
src/PixiEditor/App.xaml.cs

@@ -55,6 +55,9 @@ internal partial class App : Application
         }
         #endif
 
+        LoadingWindow loadingWindow = new();
+        loadingWindow.Show();
+
         AddNativeAssets();
 
         InitPlatform();
@@ -63,6 +66,10 @@ internal partial class App : Application
         extensionLoader.LoadExtensions();
 
         MainWindow = new MainWindow(extensionLoader);
+        MainWindow.ContentRendered += (sender, args) =>
+        {
+            loadingWindow.Close();
+        };
 
         MainWindow.Show();
     }

+ 18 - 0
src/PixiEditor/Views/LoadingWindow.xaml

@@ -0,0 +1,18 @@
+<Window x:Class="PixiEditor.Views.LoadingWindow"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:local="clr-namespace:PixiEditor.Views"
+        xmlns:gif="http://wpfanimatedgif.codeplex.com"
+        mc:Ignorable="d" ShowInTaskbar="False" WindowStyle="None"
+        ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
+        Title="LoadingWindow" Height="200" Width="200">
+    <Grid Background="{StaticResource MainColor}">
+        <Image
+            gif:ImageBehavior.AnimatedSource="/Images/Processing.gif"
+            HorizontalAlignment="Center" VerticalAlignment="Center"
+            Height="50"
+            gif:ImageBehavior.AnimationSpeedRatio="1.5"/>
+    </Grid>
+</Window>

+ 12 - 0
src/PixiEditor/Views/LoadingWindow.xaml.cs

@@ -0,0 +1,12 @@
+using System.Windows;
+
+namespace PixiEditor.Views;
+
+public partial class LoadingWindow : Window
+{
+    public LoadingWindow()
+    {
+        InitializeComponent();
+    }
+}
+

+ 0 - 2
src/PixiEditor/Views/MainWindow.xaml

@@ -101,8 +101,6 @@
         </b:EventTrigger>
     </b:Interaction.Triggers>
     <Grid>
-        <usercontrols:SteamOverlay x:Name="steamRefresher" Width="{Binding ElementName=mainWindow, Path=Width}"
-                                   Height="{Binding ElementName=mainWindow, Path=Height}"/>
         <Grid
             Name="mainGrid"
             Margin="5"

+ 1 - 26
src/PixiEditor/Views/MainWindow.xaml.cs

@@ -57,8 +57,8 @@ internal partial class MainWindow : Window
 
         preferences = services.GetRequiredService<IPreferences>();
         platform = services.GetRequiredService<IPlatform>();
-        DataContext = services.GetRequiredService<ViewModelMain>();
 
+        DataContext = services.GetRequiredService<ViewModelMain>();
         DataContext.Setup(services);
 
         InitializeComponent();
@@ -79,31 +79,6 @@ internal partial class MainWindow : Window
         });
 
         DataContext.DocumentManagerSubViewModel.ActiveDocumentChanged += DocumentChanged;
-
-        StartSteamRefresher();
-    }
-
-    private void StartSteamRefresher()
-    {
-#if STEAM
-        steamRefresher.Activate();
-
-        var handler = new PixiEditor.Platform.Steam.SteamOverlayHandler();
-        handler.ActivateRefreshingElement += (bool activate) =>
-        {
-            Application.Current.Dispatcher.Invoke(() =>
-            {
-                if (activate)
-                {
-                    steamRefresher.Activate();
-                }
-                else
-                {
-                    steamRefresher.Deactivate();
-                }
-            });
-        };
-#endif
     }
 
     private void SetupTranslator()

+ 5 - 6
src/PixiEditor/Views/UserControls/SteamOverlay.xaml

@@ -6,13 +6,12 @@
              xmlns:local="clr-namespace:PixiEditor.Views.UserControls"
              Name="uc"
              mc:Ignorable="d">
-    <Border HorizontalAlignment="Right" VerticalAlignment="Bottom"
-            Background="Transparent"
-            BorderThickness="0"
-            Width="{Binding Width, ElementName=uc}"
+    <Grid
+          Width="{Binding Width, ElementName=uc}"
             Height="{Binding Height, ElementName=uc}"
+          Background="Transparent"
             Focusable="False"
             Panel.ZIndex="-1000"
-            Name="refresher">
-    </Border>
+            x:Name="refresher">
+    </Grid>
 </UserControl>

+ 1 - 0
src/PixiEditor/Views/UserControls/SteamOverlay.xaml.cs

@@ -15,6 +15,7 @@ public partial class SteamOverlay : UserControl
     }
 
     private void CreateFadeTimer()
+    
     {
         StopFadeTimer();
         _fadeTimer = new DispatcherTimer(DispatcherPriority.Render) { Interval = TimeSpan.FromSeconds(1f) };