瀏覽代碼

Merge pull request #10295 from tetrapod00/gdscript-summary

Add GDScript naming convention summary table
Max Hilbrunner 8 月之前
父節點
當前提交
5b15d190e9
共有 1 個文件被更改,包括 23 次插入1 次删除
  1. 23 1
      tutorials/scripting/gdscript/gdscript_styleguide.rst

+ 23 - 1
tutorials/scripting/gdscript/gdscript_styleguide.rst

@@ -620,7 +620,29 @@ Naming conventions
 
 
 These naming conventions follow the Godot Engine style. Breaking these will make
 These naming conventions follow the Godot Engine style. Breaking these will make
 your code clash with the built-in naming conventions, leading to inconsistent
 your code clash with the built-in naming conventions, leading to inconsistent
-code.
+code. As a summary table:
+
++---------------+----------------+----------------------------------------------------+
+| Type          | Convention     | Example                                            |
++===============+================+====================================================+
+| File names    | snake_case     | ``yaml_parser.gd``                                 |
++---------------+----------------+----------------------------------------------------+
+| Class names   | PascalCase     | ``class_name YAMLParser``                          |
++---------------+----------------+----------------------------------------------------+
+| Node names    | PascalCase     | ``Camera3D``, ``Player``                           |
++---------------+----------------+----------------------------------------------------+
+| Functions     | snake_case     | ``func load_level():``                             |
++---------------+----------------+----------------------------------------------------+
+| Variables     | snake_case     | ``var particle_effect``                            |
++---------------+----------------+----------------------------------------------------+
+| Signals       | snake_case     | ``signal door_opened``                             |
++---------------+----------------+----------------------------------------------------+
+| Constants     | CONSTANT_CASE  | ``const MAX_SPEED = 200``                          |
++---------------+----------------+----------------------------------------------------+
+| Enum names    | PascalCase     | ``enum Element``                                   |
++---------------+----------------+----------------------------------------------------+
+| Enum members  | CONSTANT_CASE  | ``{EARTH, WATER, AIR, FIRE}``                      |
++---------------+----------------+----------------------------------------------------+
 
 
 File names
 File names
 ~~~~~~~~~~
 ~~~~~~~~~~