diff --git a/FRBDK/Glue/CompilerLibrary/ViewModels/CompilerViewModel.cs b/FRBDK/Glue/CompilerLibrary/ViewModels/CompilerViewModel.cs index 16a5a3022..9b756109d 100644 --- a/FRBDK/Glue/CompilerLibrary/ViewModels/CompilerViewModel.cs +++ b/FRBDK/Glue/CompilerLibrary/ViewModels/CompilerViewModel.cs @@ -76,6 +76,20 @@ public bool IsCompiling set => Set(value); } + public bool IsConnectedToGame + { + get => Get(); + set => Set(value); + } + + [DependsOn(nameof(IsRunning))] + [DependsOn(nameof(IsConnectedToGame))] + public Visibility ConnectedButtonVisibility => (IsRunning && IsConnectedToGame).ToVisibility(); + + [DependsOn(nameof(IsRunning))] + [DependsOn(nameof(IsConnectedToGame))] + public Visibility CancelButtonVisibility => (IsRunning && !IsConnectedToGame).ToVisibility(); + [DependsOn(nameof(IsCompiling))] public Visibility BuildingActivitySpinnerVisibility => IsCompiling.ToVisibility(); @@ -337,12 +351,6 @@ public bool IsEditChecked [DependsOn(nameof(PlayOrEdit))] public Visibility FocusButtonVisibility => (PlayOrEdit == PlayOrEdit.Edit).ToVisibility(); - public double LastWaitTimeInSeconds - { - get => Get(); - set => Set(value); - } - [DependsOn(nameof(PlayOrEdit))] [DependsOn(nameof(IsRunning))] public Visibility ConnectedFrameVisibility @@ -350,42 +358,6 @@ public Visibility ConnectedFrameVisibility get => (PlayOrEdit == PlayOrEdit.Edit && IsRunning).ToVisibility(); } - [DependsOn(nameof(LastWaitTimeInSeconds))] - public string ConnectedString - { - get - { - if(LastWaitTimeInSeconds < 1) - { - return $"Connected {LastWaitTimeInSeconds:0.0}"; - } - else - { - return $"Waiting for game {LastWaitTimeInSeconds:0.0}"; - } - } - } - - [DependsOn(nameof(LastWaitTimeInSeconds))] - public Brush ConnectedFrameBackgroundColor - { - get - { - if(LastWaitTimeInSeconds < 1) - { - return Brushes.Green; - } - else if(LastWaitTimeInSeconds < 3) - { - return Brushes.Yellow; - } - else - { - return Brushes.Red; - } - } - } - public bool HasDraggedTreeNodeOverView { get => Get(); diff --git a/FRBDK/Glue/GameCommunicationPlugin/GameCommunicationPlugin.csproj b/FRBDK/Glue/GameCommunicationPlugin/GameCommunicationPlugin.csproj index add65da55..4ac6c141a 100644 --- a/FRBDK/Glue/GameCommunicationPlugin/GameCommunicationPlugin.csproj +++ b/FRBDK/Glue/GameCommunicationPlugin/GameCommunicationPlugin.csproj @@ -67,6 +67,8 @@ + + @@ -151,6 +153,8 @@ + + diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/CommandSending/CommandSender.cs b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/CommandSending/CommandSender.cs index 6e68896b2..deb936b0f 100644 --- a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/CommandSending/CommandSender.cs +++ b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/CommandSending/CommandSender.cs @@ -25,7 +25,21 @@ public class CommandSender public GlueViewSettingsViewModel GlueViewSettingsViewModel { get; set; } public CompilerViewModel CompilerViewModel { get; set; } - public bool IsConnected { get; internal set; } + + bool isConnected; + public bool IsConnected + { + get => isConnected; + internal set + { + isConnected = value; + + if (CompilerViewModel != null) + { + CompilerViewModel.IsConnectedToGame = value; + } + } + } public static CommandSender Self { get; private set; } diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Connected.png b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Connected.png new file mode 100644 index 000000000..623fbfd78 Binary files /dev/null and b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Connected.png differ diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Disconnected.png b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Disconnected.png new file mode 100644 index 000000000..0f5c515ed Binary files /dev/null and b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Icons/Disconnected.png differ diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/MainCompilerPlugin.cs b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/MainCompilerPlugin.cs index 113a143f3..213853f03 100644 --- a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/MainCompilerPlugin.cs +++ b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/MainCompilerPlugin.cs @@ -753,7 +753,7 @@ private async Task ReactToPlayOrEditSet() if (response?.Succeeded != true) { - var message = "Failed to change game/edit mode. "; + var message = $"Failed to set game/edit mode to {CompilerViewModel.PlayOrEdit}."; if (response == null) { message += "Game sent no response back."; @@ -763,10 +763,11 @@ private async Task ReactToPlayOrEditSet() message += response.Message; } ReactToPluginEvent("Compiler_Output_Standard", message); + GlueCommands.Self.PrintOutput(message); } else if (CommandSender.Self.IsConnected == false) { - + var message = $"Failed to set game/edit mode to {CompilerViewModel.PlayOrEdit} because the game is not connected."; } else if (inEditMode) { @@ -827,8 +828,8 @@ private async Task ReactToPlayOrEditSet() { if(displaySettings != null && displaySettings.AspectRatioHeight > 0 && - displaySettings.FixedAspectRatio == true - ) + // need to reearch at some time - do we want to worry about variable aspect ratio? + displaySettings.AspectRatioBehavior == AspectRatioBehavior.FixedAspectRatio) { setCameraAspectRatioDto.AspectRatio = GlueState.Self.CurrentGlueProject.DisplaySettings.AspectRatioWidth / GlueState.Self.CurrentGlueProject.DisplaySettings.AspectRatioHeight; diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Managers/FileChangeManager.cs b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Managers/FileChangeManager.cs index c170dd8ea..c2f7441e0 100644 --- a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Managers/FileChangeManager.cs +++ b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Managers/FileChangeManager.cs @@ -33,6 +33,13 @@ class FileChangeManager private RefreshManager _refreshManager; CompilerViewModel viewModel; + string[] ignoredFilesForCopying = new[] + { + "gum_events.json", + "GumLastChangeFilePath.txt" + }; + + public FileChangeManager(Action output, CompilerViewModel viewModel, RefreshManager refreshManager) { this._output = output; @@ -68,7 +75,15 @@ private bool IsFileIgnored(FilePath fileName) { var settingsFolder = GlueState.Self.ProjectSpecificSettingsPath; - return settingsFolder.IsRootOf(fileName); + if(settingsFolder.IsRootOf(fileName)) + { + return true; + } + + + var strippedFileName = fileName.NoPath; + + return ignoredFilesForCopying.Contains(strippedFileName); } private void OutputSuccessOrFailure(bool succeeded) diff --git a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Views/GameHostView.xaml b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Views/GameHostView.xaml index 5bf68f58b..e10654eff 100644 --- a/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Views/GameHostView.xaml +++ b/FRBDK/Glue/GameCommunicationPlugin/GlueControl/Views/GameHostView.xaml @@ -61,11 +61,27 @@ + + + + Connected to game + + + + + Disconnected from game + + + - + Enable Game Embed and Edit in Settings - diff --git a/FRBDK/Glue/Glue/Plugins/ExportedImplementations/CommandInterfaces/ProjectCommands.cs b/FRBDK/Glue/Glue/Plugins/ExportedImplementations/CommandInterfaces/ProjectCommands.cs index 68216de5f..9e319ed60 100644 --- a/FRBDK/Glue/Glue/Plugins/ExportedImplementations/CommandInterfaces/ProjectCommands.cs +++ b/FRBDK/Glue/Glue/Plugins/ExportedImplementations/CommandInterfaces/ProjectCommands.cs @@ -565,9 +565,9 @@ public void CopyToBuildFolder(FilePath absoluteSource) }, $"{nameof(CopyToBuildFolder)} {absoluteSource}"); } - private static void CopyToBuildFolder(FilePath absoluteSource, string debugPath) + private static void CopyToBuildFolder(FilePath absoluteSource, string outputPathRelativeToCsProj) { - string buildFolder = FileManager.GetDirectory(GlueState.Self.CurrentCodeProjectFileName.FullPath) + debugPath + "Content/"; + string buildFolder = FileManager.GetDirectory(GlueState.Self.CurrentCodeProjectFileName.FullPath) + outputPathRelativeToCsProj + "Content/"; string destination = buildFolder + FileManager.MakeRelative(absoluteSource.FullPath, GlueState.Self.ContentDirectory); string destinationFolder = FileManager.GetDirectory(destination);