Skip to content

Commit

Permalink
Added xml comments
Browse files Browse the repository at this point in the history
Removed unused files from FRB Editor
Fixed some warnings in FRB editor.
Unloaded project no longer shows toolbar buttons.
  • Loading branch information
vchelaru committed Nov 17, 2023
1 parent ee3d27a commit a569371
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ protected override void ReactToVisualChanged()

#endregion

/// <summary>
/// Shows the dialog box (adds it to managers and sets IsVisible to true) and begins showing the text.
/// </summary>
/// <param name="text">The text to print out, either immediately or letter-by-letter according to LettersPerSecond.</param>
/// <param name="frbLayer">The FlatRedBall Layer to add the DialogBox to. If null, the dialog box will not be layered. This will attempt to use a Gum layer matching the FRB layer. This will automatically work if the Layer has been added through the FlatRedBall Editor.</param>
public void Show(string text, FlatRedBall.Graphics.Layer frbLayer = null)
{
base.Show(frbLayer);
Expand All @@ -155,7 +160,12 @@ public void Show(IEnumerable<string> pages, FlatRedBall.Graphics.Layer frbLayer
}
}

public Task ShowAsync(string page) => ShowAsync(new string[] { page });
/// <summary>
/// Shows the dialog box (adds it to managers and sets IsVisible to true) and begins showing the text.
/// </summary>
/// <param name="text">The text to print out, either immediately or letter-by-letter according to LettersPerSecond.</param>
/// <returns>A task which completes when the text has been displayed and the DialogBox has been dismissed.</returns>
public Task ShowAsync(string text) => ShowAsync(new string[] { text });

public async Task ShowAsync(IEnumerable<string> pages, FlatRedBall.Graphics.Layer frbLayer = null)
{
Expand Down

This file was deleted.

65 changes: 34 additions & 31 deletions FRBDK/Glue/Glue/Errors/CsvErrorReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,49 @@ public override ErrorViewModel[] GetAllErrors()

List<ErrorViewModel> errors = new List<ErrorViewModel>();

var csvs = glueProject.GetAllReferencedFiles()
.Where(item => item.IsCsvOrTreatedAsCsv)
.ToArray();
var customClasses = glueProject.CustomClasses;
foreach (var rfs in csvs)
if(glueProject != null)
{
var classWithError = customClasses.FirstOrDefault(item =>
var csvs = glueProject.GetAllReferencedFiles()
.Where(item => item.IsCsvOrTreatedAsCsv)
.ToArray();
var customClasses = glueProject.CustomClasses;
foreach (var rfs in csvs)
{
return CsvAndCustomClassSameName.IsError(rfs, item);
});
var classWithError = customClasses.FirstOrDefault(item =>
{
return CsvAndCustomClassSameName.IsError(rfs, item);
});

if (classWithError != null)
{
var error = new CsvAndCustomClassSameName(rfs, classWithError);
if (classWithError != null)
{
var error = new CsvAndCustomClassSameName(rfs, classWithError);

errors.Add(error);
}
errors.Add(error);
}

var filePath = GlueCommands.Self.GetAbsoluteFilePath(rfs);
var filePath = GlueCommands.Self.GetAbsoluteFilePath(rfs);

// See if this has a duplicate
CsvCodeGenerator.DeserializeToRcr(
rfs.CsvDelimiter,
filePath,
out RuntimeCsvRepresentation rcr, out bool succeeded);
// See if this has a duplicate
CsvCodeGenerator.DeserializeToRcr(
rfs.CsvDelimiter,
filePath,
out RuntimeCsvRepresentation rcr, out bool succeeded);

if(succeeded)
{
var duplicateError = CsvCodeGenerator.GetDuplicateMessageIfDuplicatesFound(
rcr,
rfs.CreatesDictionary,
filePath.FullPath);

if(!string.IsNullOrEmpty(duplicateError))
if(succeeded)
{
var vm = new CsvDuplicateItemInFileViewModel();
vm.FilePath = filePath;
vm.UpdateDetails();
errors.Add(vm);
var duplicateError = CsvCodeGenerator.GetDuplicateMessageIfDuplicatesFound(
rcr,
rfs.CreatesDictionary,
filePath.FullPath);

if(!string.IsNullOrEmpty(duplicateError))
{
var vm = new CsvDuplicateItemInFileViewModel();
vm.FilePath = filePath;
vm.UpdateDetails();
errors.Add(vm);

}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion FRBDK/Glue/Glue/Errors/GlueErrorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Add(ErrorViewModel error)

// Vic says - I don't like this. I think maybe this should get moved out of a plugin?
// Need to think about it a bit...
PluginManager.CallPluginMethod("Error Window Plugin", "RefreshErrors");
PluginManager.CallPluginMethod("Error Window Plugin", "RefreshAllErrors");
}

public void ClearFixedErrors()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class CameraMainPlugin : EmbeddedPlugin
CameraSettingsControl control;
DisplaySettingsViewModel viewModel = new DisplaySettingsViewModel();
PluginTab tab;

CameraToolbar cameraToolbar;

public static CameraMainPlugin Self { get; private set; }

private bool respondToViewModelChanges = true;
Expand All @@ -32,17 +33,27 @@ public override void StartUp()
viewModel.PropertyChanged += HandleDisplaySettingsChanged;

this.ReactToLoadedGlux += HandleLoadedGlux;
this.ReactToUnloadedGlux += HandleUnloadedGlux;

cameraToolbar = new CameraToolbar();

base.AddMenuItemTo(L.Texts.CameraSettings, L.MenuIds.CameraSettingsId, HandleCameraSettings, L.MenuIds.SettingsId);
}

base.AddToToolBar(new CameraToolbar(), "Standard");
private void HandleUnloadedGlux()
{
base.RemoveFromToolbar(cameraToolbar, "Standard");
}

private void HandleLoadedGlux()
{


base.AddToToolBar(cameraToolbar, "Standard");

// When the project loads, immediately set the ATI so
// that Glue behaves properly
if(GlueState.Self.CurrentGlueProject?.DisplaySettings != null)
if (GlueState.Self.CurrentGlueProject?.DisplaySettings != null)
{
respondToViewModelChanges = false;
{
Expand Down
5 changes: 4 additions & 1 deletion FRBDK/Glue/GumPlugin/GumPlugin/MainGumPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ private void CreateToolbar()
gumToolbar = new GumToolbar();
gumToolbar.DataContext = toolbarViewModel;
gumToolbar.GumButtonClicked += HandleToolbarButtonClick;
base.AddToToolBar(gumToolbar, Localization.Texts.Tools);
}

public bool HasGum() => AppState.Self.GumProjectSave != null;
Expand Down Expand Up @@ -623,6 +622,8 @@ private bool GetIfShouldShowTab(ITreeNode selectedTreeNode)

private void HandleUnloadedGlux()
{
base.RemoveFromToolbar(gumToolbar, Localization.Texts.Tools);

AssetTypeInfoManager.Self.UnloadProjectSpecificAtis();

AppState.Self.GumProjectSave = null;
Expand Down Expand Up @@ -955,6 +956,8 @@ private void HandleGluxLoadEarly()

private async void HandleGluxLoad()
{
base.AddToToolBar(gumToolbar, Localization.Texts.Tools);

var gumRfs = GumProjectManager.Self.GetRfsForGumProject();

toolbarViewModel.HasGumProject = gumRfs != null;
Expand Down
2 changes: 1 addition & 1 deletion FRBDK/Glue/OfficialPlugins/ErrorPlugin/MainErrorPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public override void StartUp()
RefreshCommands.RefreshErrorsAction = () => RefreshLogic.RefreshAllErrors(errorListViewModel, errorListViewModel.IsOutputErrorCheckingDetailsChecked);
}

public void RefreshErrors() => RefreshLogic.RefreshAllErrors(errorListViewModel, errorListViewModel.IsOutputErrorCheckingDetailsChecked);
public void RefreshAllErrors() => RefreshLogic.RefreshAllErrors(errorListViewModel, errorListViewModel.IsOutputErrorCheckingDetailsChecked);

private void HandleRefreshClicked(object sender, EventArgs e)
{
Expand Down
Loading

0 comments on commit a569371

Please sign in to comment.