mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
update c# class examples
This commit is contained in:
@@ -66,7 +66,7 @@ you should remove the instance you have added by calling
|
||||
using Godot;
|
||||
|
||||
[Tool]
|
||||
public class Plugin : EditorPlugin
|
||||
public partial class Plugin : EditorPlugin
|
||||
{
|
||||
private MyInspectorPlugin _plugin;
|
||||
|
||||
@@ -141,7 +141,7 @@ specifically add :ref:`class_EditorProperty`-based controls.
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
|
||||
public class MyInspectorPlugin : EditorInspectorPlugin
|
||||
public partial class MyInspectorPlugin : EditorInspectorPlugin
|
||||
{
|
||||
public override bool CanHandle(Object @object)
|
||||
{
|
||||
@@ -249,7 +249,7 @@ followed by ``set_bottom_editor()`` to position it below the name.
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
|
||||
public class RandomIntEditor : EditorProperty
|
||||
public partial class RandomIntEditor : EditorProperty
|
||||
{
|
||||
// The main control for editing the property.
|
||||
private Button _propertyControl = new Button();
|
||||
|
||||
@@ -59,7 +59,6 @@ Add five extra methods such that the script looks like this:
|
||||
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class MainScreenPlugin : EditorPlugin
|
||||
@@ -129,7 +128,6 @@ Add a script to the button like this:
|
||||
.. code-tab:: csharp
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class PrintHello : Button
|
||||
@@ -199,7 +197,6 @@ Here is the full plugin script:
|
||||
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public partial class MainScreenPlugin : EditorPlugin
|
||||
|
||||
@@ -127,10 +127,9 @@ like this:
|
||||
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class CustomNode : EditorPlugin
|
||||
public partial class CustomNode : EditorPlugin
|
||||
{
|
||||
public override void _EnterTree()
|
||||
{
|
||||
@@ -191,10 +190,9 @@ clicked. For that, we'll need a script that extends from
|
||||
.. code-tab:: csharp
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class MyButton : Button
|
||||
public partial class MyButton : Button
|
||||
{
|
||||
public override void _EnterTree()
|
||||
{
|
||||
@@ -240,10 +238,9 @@ dialog. For that, change the ``custom_node.gd`` script to the following:
|
||||
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class CustomNode : EditorPlugin
|
||||
public partial class CustomNode : EditorPlugin
|
||||
{
|
||||
public override void _EnterTree()
|
||||
{
|
||||
@@ -366,10 +363,9 @@ The script could look like this:
|
||||
|
||||
#if TOOLS
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class CustomDock : EditorPlugin
|
||||
public partial class CustomDock : EditorPlugin
|
||||
{
|
||||
Control dock;
|
||||
|
||||
|
||||
@@ -129,10 +129,9 @@ and open a script, and change it to this:
|
||||
.. code-tab:: csharp
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class MySprite : Sprite2D
|
||||
public partial class MySprite : Sprite2D
|
||||
{
|
||||
public override void _Process(float delta)
|
||||
{
|
||||
@@ -205,10 +204,9 @@ Add and export a variable speed to the script. The function set_speed after
|
||||
.. code-tab:: csharp
|
||||
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
[Tool]
|
||||
public class MySprite : Sprite2D
|
||||
public partial class MySprite : Sprite2D
|
||||
{
|
||||
private float speed = 1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user