Scripting - Enabled scripting (#638)

* Scripting - Simplified view model structure
* Scripting - Removed Layer and LayerProperty scripts
This commit is contained in:
Robert Beekman authored and GitHub committed 2021-07-04 11:45:32 +02:00
1 parent ee16d69fb3
commit 631d8de2c3
26 files changed
+278 -578

No files matched your search

@@ -8,13 +8,49 @@ namespace Artemis.UI.Shared.ScriptingProviders
/// </summary>
public class ScriptEditorViewModel : Screen, IScriptEditorViewModel
{
/// <inheritdoc />
public ScriptEditorViewModel(Script script)
private Script? _script;
/// <summary>
/// Creates a new instance of <see cref="ScriptEditorViewModel" />
/// </summary>
/// <param name="scriptType">The script type this view model was created for</param>
public ScriptEditorViewModel(ScriptType scriptType)
{
ScriptType = scriptType;
}
/// <summary>
/// Called just before the script is changed to a different one
/// </summary>
/// <param name="script">The script to display or <see langword="null" /> if no script is to be displayed</param>
protected virtual void OnScriptChanging(Script? script)
{
}
/// <summary>
/// Called after the script was changed to a different one
/// </summary>
/// <param name="script">The script to display or <see langword="null" /> if no script is to be displayed</param>
protected virtual void OnScriptChanged(Script? script)
{
Script = script;
}
/// <inheritdoc />
public Script Script { get; }
public ScriptType ScriptType { get; }
/// <inheritdoc />
public Script? Script
{
get => _script;
internal set => SetAndNotify(ref _script, value);
}
/// <inheritdoc />
public void ChangeScript(Script? script)
{
OnScriptChanging(script);
Script = script;
OnScriptChanged(script);
}
}
}