Add C# code examples to the docs

Only existing GDScript code examples are converted and added to the
docs.
This is the first batch include classes beginning with A and B.

Included classes:
 * AcceptDialog
 * AESContext
 * Animation
 * AnimationNodeStateMachine
 * AnimationNodeStateMachinePlayback
 * AnimationNodeStateMachineTransition
 * Array
 * ArrayMesh
 * AStar
 * AStar2D
 * Bool
 * Button
This commit is contained in:
HaSa1002
2020-07-31 16:07:26 +02:00
parent fea72f2a71
commit c5aded55df
12 changed files with 388 additions and 66 deletions

View File

@@ -6,7 +6,8 @@
<description>
Button is the standard themed button. It can contain text and an icon, and will display them according to the current [Theme].
[b]Example of creating a button and assigning an action when pressed by code:[/b]
[codeblock]
[codeblocks]
[gdscript]
func _ready():
var button = Button.new()
button.text = "Click me"
@@ -15,7 +16,22 @@
func _button_pressed():
print("Hello world!")
[/codeblock]
[/gdscript]
[csharp]
public override void _Ready()
{
var button = new Button();
button.Text = "Click me";
button.Connect("pressed", this, nameof(ButtonPressed));
AddChild(button);
}
private void ButtonPressed()
{
GD.Print("Hello world!");
}
[/csharp]
[/codeblocks]
Buttons (like all Control nodes) can also be created in the editor, but some situations may require creating them from code.
See also [BaseButton] which contains common properties and methods associated with this node.
</description>