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/UndoRedo.xml | |
parent | 8612c12be61c0bc50d9039402fe19cabadfe0b16 (diff) |
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/UndoRedo.xml')
-rw-r--r-- | doc/classes/UndoRedo.xml | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/doc/classes/UndoRedo.xml b/doc/classes/UndoRedo.xml index 6c151ef958..e43bceb941 100644 --- a/doc/classes/UndoRedo.xml +++ b/doc/classes/UndoRedo.xml @@ -27,11 +27,11 @@ undo_redo.commit_action() [/gdscript] [csharp] - public UndoRedo UndoRedo; + private UndoRedo _undoRedo; public override void _Ready() { - UndoRedo = GetUndoRedo(); // Method of EditorPlugin. + _undoRedo = GetUndoRedo(); // Method of EditorPlugin. } public void DoSomething() @@ -47,12 +47,12 @@ private void OnMyButtonPressed() { var node = GetNode<Node2D>("MyNode2D"); - UndoRedo.CreateAction("Move the node"); - UndoRedo.AddDoMethod(this, MethodName.DoSomething); - UndoRedo.AddUndoMethod(this, MethodName.UndoSomething); - UndoRedo.AddDoProperty(node, Node2D.PropertyName.Position, new Vector2(100, 100)); - UndoRedo.AddUndoProperty(node, Node2D.PropertyName.Position, node.Position); - UndoRedo.CommitAction(); + _undoRedo.CreateAction("Move the node"); + _undoRedo.AddDoMethod(new Callable(this, MethodName.DoSomething)); + _undoRedo.AddUndoMethod(new Callable(this, MethodName.UndoSomething)); + _undoRedo.AddDoProperty(node, "position", new Vector2(100, 100)); + _undoRedo.AddUndoProperty(node, "position", node.Position); + _undoRedo.CommitAction(); } [/csharp] [/codeblocks] |