From 72488c4250a39e3f0381808c990f50a4341cb49e Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 22 Aug 2023 21:14:33 -0500 Subject: [PATCH 1/2] Update cs script temple to use non-indented namespace. --- Content/Editor/Scripting/ScriptTemplate.cs | 50 +++++++++---------- .../Editor/Content/Proxy/CSharpScriptProxy.cs | 2 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Content/Editor/Scripting/ScriptTemplate.cs b/Content/Editor/Scripting/ScriptTemplate.cs index 2a150306d..8d43ad590 100644 --- a/Content/Editor/Scripting/ScriptTemplate.cs +++ b/Content/Editor/Scripting/ScriptTemplate.cs @@ -3,34 +3,34 @@ using System.Collections.Generic; using FlaxEngine; namespace %namespace% + +/// +/// %class% Script. +/// +public class %class% : Script { - /// - /// %class% Script. - /// - public class %class% : Script + /// + public override void OnStart() { - /// - public override void OnStart() - { - // Here you can add code that needs to be called when script is created, just before the first game update - } - - /// - public override void OnEnable() - { - // Here you can add code that needs to be called when script is enabled (eg. register for events) - } + // Here you can add code that needs to be called when script is created, just before the first game update + } + + /// + public override void OnEnable() + { + // Here you can add code that needs to be called when script is enabled (eg. register for events) + } - /// - public override void OnDisable() - { - // Here you can add code that needs to be called when script is disabled (eg. unregister from events) - } + /// + public override void OnDisable() + { + // Here you can add code that needs to be called when script is disabled (eg. unregister from events) + } - /// - public override void OnUpdate() - { - // Here you can add code that needs to be called every frame - } + /// + public override void OnUpdate() + { + // Here you can add code that needs to be called every frame } } + diff --git a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs index 24c44aa20..09440d43a 100644 --- a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs +++ b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs @@ -51,7 +51,7 @@ namespace FlaxEditor.Content var copyrightComment = string.IsNullOrEmpty(gameSettings.CopyrightNotice) ? string.Empty : string.Format("// {0}{1}{1}", gameSettings.CopyrightNotice, Environment.NewLine); scriptTemplate = scriptTemplate.Replace("%copyright%", copyrightComment); scriptTemplate = scriptTemplate.Replace("%class%", scriptName); - scriptTemplate = scriptTemplate.Replace("%namespace%", scriptNamespace); + scriptTemplate = scriptTemplate.Replace("%namespace%", $"{scriptNamespace};"); // Save File.WriteAllText(outputPath, scriptTemplate, Encoding.UTF8); From 3295d58684894d39945ee6e803b1f3fe237ab6de Mon Sep 17 00:00:00 2001 From: Chandler Cox Date: Tue, 22 Aug 2023 21:34:36 -0500 Subject: [PATCH 2/2] Simplify --- Content/Editor/Scripting/ScriptTemplate.cs | 2 +- Source/Editor/Content/Proxy/CSharpScriptProxy.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Content/Editor/Scripting/ScriptTemplate.cs b/Content/Editor/Scripting/ScriptTemplate.cs index 8d43ad590..663acf05f 100644 --- a/Content/Editor/Scripting/ScriptTemplate.cs +++ b/Content/Editor/Scripting/ScriptTemplate.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using FlaxEngine; -namespace %namespace% +namespace %namespace%; /// /// %class% Script. diff --git a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs index 09440d43a..24c44aa20 100644 --- a/Source/Editor/Content/Proxy/CSharpScriptProxy.cs +++ b/Source/Editor/Content/Proxy/CSharpScriptProxy.cs @@ -51,7 +51,7 @@ namespace FlaxEditor.Content var copyrightComment = string.IsNullOrEmpty(gameSettings.CopyrightNotice) ? string.Empty : string.Format("// {0}{1}{1}", gameSettings.CopyrightNotice, Environment.NewLine); scriptTemplate = scriptTemplate.Replace("%copyright%", copyrightComment); scriptTemplate = scriptTemplate.Replace("%class%", scriptName); - scriptTemplate = scriptTemplate.Replace("%namespace%", $"{scriptNamespace};"); + scriptTemplate = scriptTemplate.Replace("%namespace%", scriptNamespace); // Save File.WriteAllText(outputPath, scriptTemplate, Encoding.UTF8);