From 4e912e270bdd439cc1799675f7acdba97b1640f7 Mon Sep 17 00:00:00 2001 From: Paul Joannon Date: Sun, 19 May 2024 17:42:42 +0200 Subject: [PATCH] :shower: Clean some coding style issues --- .editorconfig | 17 ++++++- GodotInk.sln.DotSettings | 5 +++ addons/GodotInk/Src/InkChoice.Interop.cs | 10 ++--- addons/GodotInk/Src/InkDock.cs | 19 ++++---- addons/GodotInk/Src/InkList.cs | 5 +++ addons/GodotInk/Src/InkStory.cs | 52 +++++++++++++--------- addons/GodotInk/Src/InkStoryImporter.cs | 7 ++- addons/GodotInk/Src/InvalidInkException.cs | 2 +- addons/GodotInk/Src/MarshalUtils.cs | 8 ++-- 9 files changed, 80 insertions(+), 45 deletions(-) create mode 100644 GodotInk.sln.DotSettings diff --git a/.editorconfig b/.editorconfig index 8c5f444..0c2bc81 100644 --- a/.editorconfig +++ b/.editorconfig @@ -108,14 +108,18 @@ dotnet_naming_rule.non_field_members.severity = warning dotnet_naming_rule.non_field_members.symbols = non_field_members dotnet_naming_rule.non_field_members.style = pascal_case -dotnet_naming_rule.private_fields.severity = silent +dotnet_naming_rule.private_fields.severity = warning dotnet_naming_rule.private_fields.symbols = private_fields -dotnet_naming_rule.private_fields.style = prefix_underscore +dotnet_naming_rule.private_fields.style = camel_case dotnet_naming_rule.constants.severity = warning dotnet_naming_rule.constants.symbols = constant_fields dotnet_naming_rule.constants.style = constant_style +dotnet_naming_rule.static_readonly.severity = warning +dotnet_naming_rule.static_readonly.symbols = static_readonly_fields +dotnet_naming_rule.static_readonly.style = constant_style + dotnet_naming_rule.type_parameters.severity = warning dotnet_naming_rule.type_parameters.symbols = type_parameters dotnet_naming_rule.type_parameters.style = prefix_T @@ -142,6 +146,10 @@ dotnet_naming_symbols.constant_fields.applicable_kinds = field dotnet_naming_symbols.constant_fields.applicable_accessibilities = * dotnet_naming_symbols.constant_fields.required_modifiers = const +dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field +dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = * +dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly + dotnet_naming_symbols.type_parameters.applicable_kinds = type_parameter dotnet_naming_symbols.type_parameters.applicable_accessibilities = * dotnet_naming_symbols.type_parameters.required_modifiers = @@ -153,6 +161,11 @@ dotnet_naming_style.pascal_case.required_suffix = dotnet_naming_style.pascal_case.word_separator = dotnet_naming_style.pascal_case.capitalization = pascal_case +dotnet_naming_style.camel_case.required_prefix = +dotnet_naming_style.camel_case.required_suffix = +dotnet_naming_style.camel_case.word_separator = +dotnet_naming_style.camel_case.capitalization = camel_case + dotnet_naming_style.prefix_I.required_prefix = I dotnet_naming_style.prefix_I.required_suffix = dotnet_naming_style.prefix_I.word_separator = diff --git a/GodotInk.sln.DotSettings b/GodotInk.sln.DotSettings new file mode 100644 index 0000000..590e50b --- /dev/null +++ b/GodotInk.sln.DotSettings @@ -0,0 +1,5 @@ + + DO_NOT_SHOW + UseVarWhenEvident + UseVarWhenEvident + UseVarWhenEvident \ No newline at end of file diff --git a/addons/GodotInk/Src/InkChoice.Interop.cs b/addons/GodotInk/Src/InkChoice.Interop.cs index 5c61372..22c90b9 100644 --- a/addons/GodotInk/Src/InkChoice.Interop.cs +++ b/addons/GodotInk/Src/InkChoice.Interop.cs @@ -8,31 +8,31 @@ public partial class InkChoice { #pragma warning disable IDE0022 /// - /// This method is here for GDScript compatibility. Use instead. + /// This method is here for GDScript compatibility. Use instead. /// [EditorBrowsable(EditorBrowsableState.Never)] public string GetText() => Text; /// - /// This method is here for GDScript compatibility. Use instead. + /// This method is here for GDScript compatibility. Use instead. /// [EditorBrowsable(EditorBrowsableState.Never)] public string GetPathStringOnChoice() => PathStringOnChoice; /// - /// This method is here for GDScript compatibility. Use instead. + /// This method is here for GDScript compatibility. Use instead. /// [EditorBrowsable(EditorBrowsableState.Never)] public string GetSourcePath() => SourcePath; /// - /// This method is here for GDScript compatibility. Use instead. + /// This method is here for GDScript compatibility. Use instead. /// [EditorBrowsable(EditorBrowsableState.Never)] public int GetIndex() => Index; /// - /// This method is here for GDScript compatibility. Use instead. + /// This method is here for GDScript compatibility. Use instead. /// [EditorBrowsable(EditorBrowsableState.Never)] public Godot.Collections.Array GetTags() => new(Tags); diff --git a/addons/GodotInk/Src/InkDock.cs b/addons/GodotInk/Src/InkDock.cs index fdca185..b1f3537 100644 --- a/addons/GodotInk/Src/InkDock.cs +++ b/addons/GodotInk/Src/InkDock.cs @@ -66,10 +66,11 @@ public override void _Ready() scroll = GetNode("Container/Left/Scroll"); // Set icons. - loadButton.Icon = GetThemeIcon("Load", "EditorIcons"); - startButton.Icon = GetThemeIcon("Play", "EditorIcons"); - stopButton.Icon = GetThemeIcon("Stop", "EditorIcons"); - clearButton.Icon = GetThemeIcon("Clear", "EditorIcons"); + var editorTheme = EditorInterface.Singleton.GetEditorTheme(); + loadButton.Icon = editorTheme.GetIcon("Load", "EditorIcons"); + startButton.Icon = editorTheme.GetIcon("Play", "EditorIcons"); + stopButton.Icon = editorTheme.GetIcon("Stop", "EditorIcons"); + clearButton.Icon = editorTheme.GetIcon("Clear", "EditorIcons"); // Update UI. UpdateTop(); @@ -157,7 +158,7 @@ private void ContinueStory() if (currentText.Length > 0) { - Label newLine = new() + var newLine = new Label() { AutowrapMode = TextServer.AutowrapMode.WordSmart, Text = currentText, @@ -182,7 +183,7 @@ private void ContinueStory() Button button = new() { Text = choice.Text }; button.SetMeta(CHOICE_INDEX_META, choice.Index); - button.Connect(Button.SignalName.Pressed, Callable.From(ClickChoice)); + button.Connect(BaseButton.SignalName.Pressed, Callable.From(ClickChoice)); storyChoices.AddChild(button); } @@ -192,7 +193,7 @@ private void ContinueStory() private void ClickChoice() { - if (storyChoices.GetChildren().OfType