public override void OnGameStarting(OnGameStartingEventArgs args) { var game = args.Game; if (game.IsInstalled == false) { return; } if (BuiltinExtensions.GetExtensionFromId(game.PluginId) != BuiltinExtension.SteamLibrary) { return; } string modeFeatureName = GetModeFeatureName(); if (game.Features != null) { var matchingFeature = game.Features.Where(f => f.Name == modeFeatureName); if (settings.Settings.LaunchMode == 0 && matchingFeature.Count() > 0) { logger.Info(String.Format("Stopped execution in game \"{0}\". Global mode and game has \"{1}\" feature", game.Name, modeFeatureName)); return; } else if (settings.Settings.LaunchMode == 1 && matchingFeature.Count() == 0) { logger.Info(String.Format("Stopped execution in game \"{0}\". Selective mode and game doesn't have \"{1}\" feature", game.Name, modeFeatureName)); return; } } LaunchSteam(); }
public override void OnGameStarting(OnGameStartingEventArgs args) { if (SupportedEvents.Contains(ApplicationEvent.OnGameStarting)) { InvokeFunction(ApplicationEvent.OnGameStarting.ToString(), new List <object> { args }); } }
public override void OnGameStarting(OnGameStartingEventArgs args) { // Add code to be executed when game is preparing to be started. }
public override void OnGameStarting(OnGameStartingEventArgs args) { logger.Info($"TestPluginDev OnGameStarting {args.Game.Name}"); logger.Warn(args.SourceAction?.Name); }
public override void OnGameStarting(OnGameStartingEventArgs args) { if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop && !settings.Settings.ExecuteInDesktopMode) { logger.Info("Execution disabled for Desktop mode in settings"); return; } else if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen && !settings.Settings.ExecuteInFullscreenMode) { logger.Info("Execution disabled for Fullscreen mode in settings"); return; } // In case somebody starts another game or if splash screen was not closed before for some reason if (currentSplashWindow != null) { // Dispatcher is needed since the window is created on a different thread currentSplashWindow.Dispatcher.Invoke(() => currentSplashWindow.Close()); currentSplashWindow = null; RestoreBackgroundMusic(); } var game = args.Game; if (game.Features != null && game.Features.Any(x => x.Name.Equals("[Splash Screen] Disable", StringComparison.OrdinalIgnoreCase))) { logger.Info($"{game.Name} has splashscreen disable feature"); return; } currentSplashWindow = null; var splashImagePath = string.Empty; var logoPath = string.Empty; var videoPath = string.Empty; var showSplashImage = true; if (game.Features != null) { if (game.Features.Any(x => x.Name == "[Splash Screen] Skip splash image")) { logger.Info($"Game has splash image skip feature"); showSplashImage = false; } } if (showSplashImage == true) { if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop) { showSplashImage = settings.Settings.ViewImageSplashscreenDesktopMode; } else { showSplashImage = settings.Settings.ViewImageSplashscreenFullscreenMode; } } if (showSplashImage == true) { var usingGlobalImage = false; if (settings.Settings.UseGlobalSplashImage && !string.IsNullOrEmpty(settings.Settings.GlobalSplashFile)) { var globalSplashImagePath = Path.Combine(GetPluginUserDataPath(), settings.Settings.GlobalSplashFile); if (File.Exists(globalSplashImagePath)) { splashImagePath = globalSplashImagePath; usingGlobalImage = true; if (settings.Settings.UseLogoInGlobalSplashImage) { logoPath = GetSplashLogoPath(game); } } } if (!usingGlobalImage) { if (settings.Settings.UseBlackSplashscreen) { splashImagePath = Path.Combine(pluginInstallPath, "Images", "SplashScreenBlack.png"); } else { splashImagePath = GetSplashImagePath(game); } if (settings.Settings.ShowLogoInSplashscreen) { logoPath = GetSplashLogoPath(game); } } bool closeSplashScreenAutomatic = false; if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop) { closeSplashScreenAutomatic = settings.Settings.CloseSplashScreenDesktopMode; } else { closeSplashScreenAutomatic = settings.Settings.CloseSplashScreenFullscreenMode; } } if ((PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop && settings.Settings.ViewVideoDesktopMode) || (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen && settings.Settings.ViewVideoFullscreenMode)) { videoPath = GetSplashVideoPath(game); if (videoPath != string.Empty) { CreateSplashVideoWindow(showSplashImage, videoPath, splashImagePath, logoPath); } else if (showSplashImage == true) { CreateSplashImageWindow(splashImagePath, logoPath); } } else if (showSplashImage == true) { CreateSplashImageWindow(splashImagePath, logoPath); } }
public override void OnGameStarting(OnGameStartingEventArgs args) { // Add code to be executed when game is preparing to be started. DoSpeak(Settings.Settings.SpeakGameLaunchingText.Replace("[game]", args.Game.Name), Settings.Settings.SpeakGameLaunching, true); }
// Add code to be executed when game is preparing to be started. public override void OnGameStarting(OnGameStartingEventArgs args) { }
/// <summary> /// Called before game is started. /// </summary> public virtual void OnGameStarting(OnGameStartingEventArgs args) { }
public override void OnGameStarting(OnGameStartingEventArgs args) { // Stops video from playing when game is starting PauseAllVideoControls(); }
internal void InvokeOnStarting(object sender, OnGameStartingEventArgs e) { Starting?.Invoke(this, e); }
public override void OnGameStarting(OnGameStartingEventArgs args) { var game = args.Game; splashImagePath = string.Empty; logoPath = string.Empty; videoPath = string.Empty; if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop && !settings.Settings.ExecuteInDesktopMode) { logger.Info("Execution disabled for Desktop mode in settings"); } else if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen && !settings.Settings.ExecuteInFullscreenMode) { logger.Info("Execution disabled for Fullscreen mode in settings"); } logger.Info($"Game: {game.Name}"); var skipSplashImage = false; if (game.Features != null) { if (game.Features.Any(x => x.Name == "[Splash Screen] Skip splash image")) { skipSplashImage = true; } } if (skipSplashImage == false) { if (settings.Settings.UseBlackSplashscreen == true) { splashImagePath = Path.Combine(pluginInstallPath, "Images", "SplashScreenBlack.png"); } else { splashImagePath = GetSplashImagePath(game); } bool closeSplashScreenAutomatic = false; if (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop) { closeSplashScreenAutomatic = settings.Settings.CloseSplashScreenDesktopMode; } else { closeSplashScreenAutomatic = settings.Settings.CloseSplashScreenFullscreenMode; } if (settings.Settings.ShowLogoInSplashscreen) { logoPath = GetSplashLogoPath(game); } } if ((PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Desktop && settings.Settings.ViewVideoDesktopMode) || (PlayniteApi.ApplicationInfo.Mode == ApplicationMode.Fullscreen && settings.Settings.ViewVideoFullscreenMode)) { videoPath = GetSplashVideoPath(game); if (videoPath != string.Empty) { CreateSplashVideoWindow(skipSplashImage); } else if (skipSplashImage == false) { CreateSplashImageWindow(); // To make sure splash window shows at least for a few seconds Task.Delay(10000); } } else if (skipSplashImage == false) { CreateSplashImageWindow(); // To make sure splash window shows at least for a few seconds Task.Delay(10000); } }