コード例 #1
0
        internal void OpenComputerImportWindow()
        {
            if (SessionPath.IsSessionPathValid() == false)
            {
                ViewModel.UserMessage = "Cannot import: You must set your path to Session before importing maps.";
                return;
            }

            ComputerImportViewModel importViewModel = new ComputerImportViewModel();

            ComputerImportWindow importWindow = new ComputerImportWindow(importViewModel)
            {
                WindowStyle           = WindowStyle.ToolWindow,
                WindowStartupLocation = WindowStartupLocation.CenterScreen
            };

            importWindow.ShowDialog();

            ViewModel.ReloadAvailableMapsInBackground(); // reload list of available maps as it may have changed
        }
コード例 #2
0
        private void BtnApplySettings_Click(object sender, RoutedEventArgs e)
        {
            if (ViewModel.InputControlsEnabled == false)
            {
                return;
            }


            bool didSet = ViewModel.UpdateGameSettings(promptToDownloadIfMissing: true);


            if (didSet)
            {
                ViewModel.UserMessage = "Game settings updated!";

                if (SessionPath.IsSessionRunning())
                {
                    ViewModel.UserMessage += " Restart the game for changes to take effect.";
                }
            }
        }
コード例 #3
0
        private void ContextMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            // disable certain menu items if no map selected
            bool isMapSelected      = (lstMaps.SelectedItem != null);
            bool isSessionPathValid = SessionPath.IsSessionPathValid();

            menuReimporSelectedMap.IsEnabled    = isMapSelected;
            menuOpenSelectedMapFolder.IsEnabled = isMapSelected;
            menuRenameSelectedMap.IsEnabled     = isMapSelected;
            menuHideSelectedMap.IsEnabled       = isMapSelected;

            menuOpenSessionFolder.IsEnabled = isSessionPathValid;
            menuOpenMapsFolder.IsEnabled    = isSessionPathValid;

            if (isMapSelected)
            {
                MapListItem selected          = (lstMaps.SelectedItem as MapListItem);
                bool        hasImportLocation = MetaDataManager.IsImportLocationStored(selected);
                menuReimporSelectedMap.IsEnabled = hasImportLocation;
                menuReimporSelectedMap.ToolTip   = hasImportLocation ? null : "You can only re-import if you imported the map from 'Import Map > From Computer ...' and imported a folder.\n(does not work with .zip files)";
                menuHideSelectedMap.Header       = selected.IsHiddenByUser ? "Show Selected Map ..." : "Hide Selected Map ...";


                if (ViewModel.SecondMapToLoad == null || ViewModel.SecondMapToLoad?.FullPath != selected.FullPath)
                {
                    menuSecondMapToLoad.Header  = "Set As Second Map To Load (When Leaving Apartment) ...";
                    menuSecondMapToLoad.ToolTip = "Set the map to be loaded after you leave the apartment (before starting the game)";
                }
                else
                {
                    menuSecondMapToLoad.ToolTip = "This will clear the selected map to not load after you leave the apartment";
                    menuSecondMapToLoad.Header  = "Clear As Second Map To Load ...";
                }


                bool canBeDeleted = MetaDataManager.HasPathToMapFilesStored(selected);
                menuDeleteSelectedMap.IsEnabled = canBeDeleted;
                menuDeleteSelectedMap.ToolTip   = canBeDeleted ? null : "You can only delete a map that has been imported via version 2.2.3 or greater.";
            }
        }
コード例 #4
0
        private void BtnStartGame_Click(object sender, RoutedEventArgs e)
        {
            if (SessionPath.IsSessionRunning())
            {
                MessageBoxResult result = System.Windows.MessageBox.Show("Session is already running! Click 'Yes' if you want to restart the game.", "Notice!", MessageBoxButton.YesNo, MessageBoxImage.Information, MessageBoxResult.No);

                if (result == MessageBoxResult.No)
                {
                    return;
                }
                else
                {
                    // kill the process
                    Process[] procs = System.Diagnostics.Process.GetProcessesByName("SessionGame-Win64-Shipping");
                    if (procs.Length > 0)
                    {
                        procs[0].Kill();
                    }
                }
            }

            LoadMapInBackgroundAndContinueWith((antecedent) =>
            {
                ViewModel.InputControlsEnabled = true;

                // validate and set game settings
                bool didSet = ViewModel.UpdateGameSettings();

                if (didSet == false)
                {
                    // do not start game with invalid settings
                    ViewModel.UserMessage = $"NOTE: Cannot apply custom game settings - {ViewModel.UserMessage}";
                }

                ViewModel.InputControlsEnabled = false;
                Process.Start(SessionPath.ToSessionExe);
                ViewModel.InputControlsEnabled = true;
            });
        }
コード例 #5
0
        private void BtnApplySettings_Click(object sender, RoutedEventArgs e)
        {
            if (ViewModel.InputControlsEnabled == false)
            {
                return;
            }

            if (UeModUnlocker.IsGamePatched() == false)
            {
                MessageBoxResult result = System.Windows.MessageBox.Show("Session has not been patched yet. Click 'Patch With Illusory Mod Unlocker' to patch the game.", "Notice!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            if (GameSettingsManager.DoesObjectPlacementFileExist() == false)
            {
                MessageBoxResult promptResult = System.Windows.MessageBox.Show("The required file is missing and must be extracted before object count can be modified.\n\nClick 'Yes' to extract the file (UnrealPak and crypto.json will be downloaded if it is not installed locally).",
                                                                               "Warning - Cannot Modify Object Count!",
                                                                               MessageBoxButton.YesNo,
                                                                               MessageBoxImage.Information,
                                                                               MessageBoxResult.Yes);

                if (promptResult == MessageBoxResult.Yes)
                {
                    ViewModel.StartUnrealPakProcess(RegistryHelper.GetPathToUnrealEngine());
                    return;
                }
            }


            bool didSet = ViewModel.UpdateGameSettings();

            if (didSet)
            {
                if (SessionPath.IsSessionRunning())
                {
                    ViewModel.UserMessage += " Restart the game for changes to take effect.";
                }
            }
        }
コード例 #6
0
        private void BtnApplySettings_Click(object sender, RoutedEventArgs e)
        {
            if (ViewModel.InputControlsEnabled == false)
            {
                return;
            }

            if (UeModUnlocker.IsGamePatched() == false)
            {
                MessageBoxResult result = System.Windows.MessageBox.Show("Session has not been patched yet. Click 'Patch With Illusory Mod Unlocker' to patch the game.", "Notice!", MessageBoxButton.OK, MessageBoxImage.Warning);
                return;
            }

            bool didSet = ViewModel.UpdateGameSettings();

            if (didSet)
            {
                if (SessionPath.IsSessionRunning())
                {
                    ViewModel.UserMessage += " Restart the game for changes to take effect.";
                }
            }
        }
コード例 #7
0
        private void ContextMenu_ContextMenuOpening(object sender, System.Windows.Controls.ContextMenuEventArgs e)
        {
            // disable certain menu items if no map selected
            bool isMapSelected      = (lstMaps.SelectedItem != null);
            bool isSessionPathValid = SessionPath.IsSessionPathValid();

            menuReimporSelectedMap.IsEnabled    = isMapSelected;
            menuOpenSelectedMapFolder.IsEnabled = isMapSelected;
            menuRenameSelectedMap.IsEnabled     = isMapSelected;
            menuHideSelectedMap.IsEnabled       = isMapSelected;

            menuOpenSessionFolder.IsEnabled = isSessionPathValid;
            menuOpenMapsFolder.IsEnabled    = isSessionPathValid;

            if (isMapSelected)
            {
                MapListItem selected          = (lstMaps.SelectedItem as MapListItem);
                bool        hasImportLocation = MetaDataManager.IsImportLocationStored(selected.MapName);
                menuReimporSelectedMap.IsEnabled = hasImportLocation;
                menuReimporSelectedMap.ToolTip   = hasImportLocation ? null : "You can only re-import if you imported the map from 'Import Map > From Computer ...' and imported a folder.\n(does not work with .zip files)";
                menuHideSelectedMap.Header       = selected.IsHiddenByUser ? "Show Selected Map ..." : "Hide Selected Map ...";
            }
        }