diff options
author | Raul Santos <raulsntos@gmail.com> | 2023-01-31 18:21:09 +0100 |
---|---|---|
committer | Raul Santos <raulsntos@gmail.com> | 2023-01-31 19:04:07 +0100 |
commit | 7eb832518081f15477150c561d6767fe35d17221 (patch) | |
tree | e13d1d0502d6290571daf441d41e1449e0c5f232 /doc/classes/EditorImportPlugin.xml | |
parent | 8612c12be61c0bc50d9039402fe19cabadfe0b16 (diff) | |
download | redot-engine-7eb832518081f15477150c561d6767fe35d17221.tar.gz |
Fix C# examples in documentation
- Fix documentation after C# renames.
- Add missing `partial` in C# class declarations.
- Change `delta` parameter type to `double` in C#.
- Ensure parameters match base declaration.
- Use `$` string interpolation in C#.
- Fix invalid or outdated C# code.
- Changed some examples to follow our style guide more closely.
Diffstat (limited to 'doc/classes/EditorImportPlugin.xml')
-rw-r--r-- | doc/classes/EditorImportPlugin.xml | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/doc/classes/EditorImportPlugin.xml b/doc/classes/EditorImportPlugin.xml index ec9efcc9c4..b30ce5a528 100644 --- a/doc/classes/EditorImportPlugin.xml +++ b/doc/classes/EditorImportPlugin.xml @@ -48,61 +48,67 @@ [/gdscript] [csharp] using Godot; - using System; - public class MySpecialPlugin : EditorImportPlugin + public partial class MySpecialPlugin : EditorImportPlugin { - public override String GetImporterName() + public override string _GetImporterName() { return "my.special.plugin"; } - public override String GetVisibleName() + public override string _GetVisibleName() { return "Special Mesh"; } - public override Godot.Collections.Array GetRecognizedExtensions() + public override string[] _GetRecognizedExtensions() { - return new Godot.Collections.Array{"special", "spec"}; + return new string[] { "special", "spec" }; } - public override String GetSaveExtension() + public override string _GetSaveExtension() { return "mesh"; } - public override String GetResourceType() + public override string _GetResourceType() { return "Mesh"; } - public override int GetPresetCount() + public override int _GetPresetCount() { return 1; } - public override String GetPresetName(int i) + public override string _GetPresetName(int presetIndex) { return "Default"; } - public override Godot.Collections.Array GetImportOptions(int i) + public override Godot.Collections.Array<Godot.Collections.Dictionary> _GetImportOptions(string path, int presetIndex) { - return new Godot.Collections.Array{new Godot.Collections.Dictionary{{"name", "myOption"}, {"defaultValue", false}}}; + return new Godot.Collections.Array<Godot.Collections.Dictionary> + { + new Godot.Collections.Dictionary + { + { "name", "myOption" }, + { "defaultValue", false }, + } + }; } - public override int Import(String sourceFile, String savePath, Godot.Collections.Dictionary options, Godot.Collections.Array platformVariants, Godot.Collections.Array genFiles) + public override int _Import(string sourceFile, string savePath, Godot.Collections.Dictionary options, Godot.Collections.Array<string> platformVariants, Godot.Collections.Array<string> genFiles) { - var file = new File(); - if (file.Open(sourceFile, File.ModeFlags.Read) != Error.Ok) + using var file = FileAccess.Open(sourceFile, FileAccess.ModeFlags.Read); + if (file.GetError() != Error.Ok) { return (int)Error.Failed; } var mesh = new ArrayMesh(); // Fill the Mesh with data read in "file", left as an exercise to the reader. - String filename = savePath + "." + GetSaveExtension(); + string filename = $"{savePath}.{_GetSaveExtension()}"; return (int)ResourceSaver.Save(mesh, filename); } } |