Merge Sphinx translations with Weblate translations, sync classref

Last 4.3 sync before updating to 4.4 strings.
This commit is contained in:
Rémi Verschelde
2025-02-07 14:15:08 +01:00
parent 654025e118
commit 4f45a9c5f5
8611 changed files with 616514 additions and 62415 deletions

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/gdscript/doc_classes/@GDScript.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/gdscript/doc_classes/@GDScript.xml.
.. _class_@GDScript:
@@ -126,7 +126,7 @@ GDScript 专用的实用函数及注解列表,可在任何脚本中访问。
**@export**\ (\ ) :ref:`🔗<class_@GDScript_annotation_@export>`
Mark the following property as exported (editable in the Inspector dock and saved to disk). To control the type of the exported property, use the type hint notation.
将后续的属性标记为导出属性(可以在检查器面板中编辑并保存至磁盘)。要控制导出属性的类型,请使用类型提示标记。
::
@@ -134,33 +134,33 @@ Mark the following property as exported (editable in the Inspector dock and save
enum Direction {LEFT, RIGHT, UP, DOWN}
# Built-in types.
# 内置类型。
@export var string = ""
@export var int_number = 5
@export var float_number: float = 5
# Enums.
# 枚举。
@export var type: Variant.Type
@export var format: Image.Format
@export var direction: Direction
# Resources.
# 资源。
@export var image: Image
@export var custom_resource: CustomResource
# Nodes.
# 节点。
@export var node: Node
@export var custom_node: CustomNode
# Typed arrays.
# 类型数组。
@export var int_array: Array[int]
@export var direction_array: Array[Direction]
@export var image_array: Array[Image]
@export var node_array: Array[Node]
\ **Note:** Custom resources and nodes should be registered as global classes using ``class_name``, since the Inspector currently only supports global classes. Otherwise, a less specific type will be exported instead.
\ **注意:**\ 自定义资源和自定义节点应该使用 ``class_name`` 注册为全局类,因为属性检查器目前仅支持全局类。否则,将导出不太具体的类型。
\ **Note:** Node export is only supported in :ref:`Node<class_Node>`-derived classes and has a number of other limitations.
\ **注意:**\ 节点的导出只有派生自 :ref:`Node<class_Node>` 的类才支持,并且还有一些其他限制。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/@GlobalScope.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/@GlobalScope.xml.
.. _class_@GlobalScope:
@@ -3878,7 +3878,7 @@ flags **PropertyUsageFlags**: :ref:`🔗<enum_@GlobalScope_PropertyUsageFlags>`
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_STORAGE** = ``2``
The property is serialized and saved in the scene file (default for exported properties).
将属性序列化并保存到场景文件中(用于导出属性的默认值)。
.. _class_@GlobalScope_constant_PROPERTY_USAGE_EDITOR:
@@ -3886,7 +3886,7 @@ The property is serialized and saved in the scene file (default for exported pro
:ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` **PROPERTY_USAGE_EDITOR** = ``4``
The property is shown in the :ref:`EditorInspector<class_EditorInspector>` (default for exported properties).
该属性将被显示在 :ref:`EditorInspector<class_EditorInspector>` 中(用于导出属性的默认值)。
.. _class_@GlobalScope_constant_PROPERTY_USAGE_INTERNAL:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AABB.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AABB.xml.
.. _class_AABB:
@@ -441,7 +441,7 @@ AABB
:ref:`Vector3<class_Vector3>` **get_shortest_axis**\ (\ ) |const| :ref:`🔗<class_AABB_method_get_shortest_axis>`
Returns the shortest normalized axis of this bounding box's :ref:`size<class_AABB_property_size>`, as a :ref:`Vector3<class_Vector3>` (:ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`, :ref:`Vector3.UP<class_Vector3_constant_UP>`, or :ref:`Vector3.BACK<class_Vector3_constant_BACK>`).
返回该边界框的 :ref:`size<class_AABB_property_size>` 的最短归一化轴,作为 :ref:`Vector3<class_Vector3>`\ \ :ref:`Vector3.RIGHT<class_Vector3_constant_RIGHT>`\ 、\ :ref:`Vector3.UP<class_Vector3_constant_UP>` :ref:`Vector3.BACK<class_Vector3_constant_BACK>`\ )。
.. tabs::
@@ -450,21 +450,21 @@ Returns the shortest normalized axis of this bounding box's :ref:`size<class_AAB
var box = AABB(Vector3(0, 0, 0), Vector3(2, 4, 8))
print(box.get_shortest_axis()) # Prints (1, 0, 0)
print(box.get_shortest_axis_index()) # Prints 0
print(box.get_shortest_axis_size()) # Prints 2
print(box.get_shortest_axis()) # 打印 (1, 0, 0)
print(box.get_shortest_axis_index()) # 打印 0
print(box.get_shortest_axis_size()) # 打印 2
.. code-tab:: csharp
var box = new Aabb(new Vector3(0, 0, 0), new Vector3(2, 4, 8));
GD.Print(box.GetShortestAxis()); // Prints (1, 0, 0)
GD.Print(box.GetShortestAxisIndex()); // Prints 0
GD.Print(box.GetShortestAxisSize()); // Prints 2
GD.Print(box.GetShortestAxis()); // 打印 (1, 0, 0)
GD.Print(box.GetShortestAxisIndex()); // 打印 0
GD.Print(box.GetShortestAxisSize()); // 打印 2
See also :ref:`get_shortest_axis_index<class_AABB_method_get_shortest_axis_index>` and :ref:`get_shortest_axis_size<class_AABB_method_get_shortest_axis_size>`.
另见 :ref:`get_shortest_axis_index<class_AABB_method_get_shortest_axis_index>` :ref:`get_shortest_axis_size<class_AABB_method_get_shortest_axis_size>`\ 。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AcceptDialog.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AcceptDialog.xml.
.. _class_AcceptDialog:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AESContext.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AESContext.xml.
.. _class_AESContext:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatableBody2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatableBody2D.xml.
.. _class_AnimatableBody2D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatableBody3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatableBody3D.xml.
.. _class_AnimatableBody3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedSprite2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedSprite2D.xml.
.. _class_AnimatedSprite2D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedSprite3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedSprite3D.xml.
.. _class_AnimatedSprite3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedTexture.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimatedTexture.xml.
.. _class_AnimatedTexture:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Animation.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Animation.xml.
.. _class_Animation:
@@ -1347,9 +1347,9 @@ enum **FindMode**: :ref:`🔗<enum_Animation_FindMode>`
|void| **track_set_path**\ (\ track_idx\: :ref:`int<class_int>`, path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_Animation_method_track_set_path>`
Sets the path of a track. Paths must be valid scene-tree paths to a node and must be specified starting from the :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ``":"``.
设置轨道的路径。路径必须是指向某一节点的有效场景树路径,必须从将要播放动画的 :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` 开始指定。控制属性或骨骼的轨道必须在路径后面加上它们的名字,用 ``":"`` 分隔。
For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
例如,\ ``"character/skeleton:ankle"`` ``"character/mesh:transform/local"``\ 。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationLibrary.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationLibrary.xml.
.. _class_AnimationLibrary:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationMixer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationMixer.xml.
.. _class_AnimationMixer:
@@ -25,6 +25,13 @@ AnimationMixer
在扩展后的类中实例化播放信息数据后,就会由 **AnimationMixer** 负责处理混合。
.. rst-class:: classref-introduction-group
教程
----
- `将动画从 Godot 4.0 迁移到 4.3 <https://godotengine.org/article/migrating-animations-from-godot-4-0-to-4-3/>`__
.. rst-class:: classref-reftable-group
属性
@@ -454,9 +461,9 @@ enum **AnimationCallbackModeDiscrete**: :ref:`🔗<enum_AnimationMixer_Animation
- |void| **set_root_motion_track**\ (\ value\: :ref:`NodePath<class_NodePath>`\ )
- :ref:`NodePath<class_NodePath>` **get_root_motion_track**\ (\ )
The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. The :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` uses the same format as :ref:`Animation.track_set_path<class_Animation_method_track_set_path>`, but note that a bone must be specified.
用于根部运动的动画轨道的路径。路径必须是指向某一节点的有效场景树路径,必须从将实现动画的节点的父节点开始指定。\ :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 使用与 :ref:`Animation.track_set_path<class_Animation_method_track_set_path>` 相同的格式,但注意必须指定一个骨骼。
If the track has type :ref:`Animation.TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`, :ref:`Animation.TYPE_ROTATION_3D<class_Animation_constant_TYPE_ROTATION_3D>`, or :ref:`Animation.TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>` the transformation will be canceled visually, and the animation will appear to stay in place. See also :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`, :ref:`get_root_motion_rotation<class_AnimationMixer_method_get_root_motion_rotation>`, :ref:`get_root_motion_scale<class_AnimationMixer_method_get_root_motion_scale>`, and :ref:`RootMotionView<class_RootMotionView>`.
如果轨道的类型是 :ref:`Animation.TYPE_POSITION_3D<class_Animation_constant_TYPE_POSITION_3D>`\ 、\ :ref:`Animation.TYPE_ROTATION_3D<class_Animation_constant_TYPE_ROTATION_3D>`\ 、或者 :ref:`Animation.TYPE_SCALE_3D<class_Animation_constant_TYPE_SCALE_3D>`\ ,那么将取消视觉上的变换,其动画看起来将是留在原地。另见 :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`\ 、\ :ref:`get_root_motion_rotation<class_AnimationMixer_method_get_root_motion_rotation>`\ 、\ :ref:`get_root_motion_scale<class_AnimationMixer_method_get_root_motion_scale>`\ 、\ :ref:`RootMotionView<class_RootMotionView>`\ 。
.. rst-class:: classref-item-separator
@@ -502,9 +509,9 @@ If the track has type :ref:`Animation.TYPE_POSITION_3D<class_Animation_constant_
:ref:`Error<enum_@GlobalScope_Error>` **add_animation_library**\ (\ name\: :ref:`StringName<class_StringName>`, library\: :ref:`AnimationLibrary<class_AnimationLibrary>`\ ) :ref:`🔗<class_AnimationMixer_method_add_animation_library>`
Adds ``library`` to the animation player, under the key ``name``.
将动画库 ``library`` 添加至动画播放器中,键名为 ``name``\ 。
AnimationMixer has a global library by default with an empty string as key. For adding an animation to the global library:
AnimationMixer 默认拥有一个全局库,键名为空字符串。要向这个全局库中添加动画:
.. tabs::
@@ -665,7 +672,7 @@ AnimationMixer has a global library by default with an empty string as key. For
通过将其与 :ref:`get_root_motion_position_accumulator<class_AnimationMixer_method_get_root_motion_position_accumulator>` 结合使用,你可以更正确地应用根运动位置来考虑节点的旋转。
通过将其与 :ref:`get_root_motion_rotation_accumulator<class_AnimationMixer_method_get_root_motion_rotation_accumulator>` 结合使用,你可以更正确地应用根运动位置来考虑节点的旋转。
.. tabs::
@@ -757,13 +764,13 @@ AnimationMixer has a global library by default with an empty string as key. For
:ref:`Quaternion<class_Quaternion>` **get_root_motion_rotation_accumulator**\ (\ ) |const| :ref:`🔗<class_AnimationMixer_method_get_root_motion_rotation_accumulator>`
Retrieve the blended value of the rotation tracks with the :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` as a :ref:`Quaternion<class_Quaternion>` that can be used elsewhere.
检索带有 :ref:`root_motion_track<class_AnimationMixer_property_root_motion_track>` 的旋转轨道的混合值,作为一个 :ref:`Quaternion<class_Quaternion>`\ ,可以在其他地方使用。
This is necessary to apply the root motion position correctly, taking rotation into account. See also :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`.
这里必须正确地结合根运动位置,并且要考虑到旋转。参考 :ref:`get_root_motion_position<class_AnimationMixer_method_get_root_motion_position>`\ 。
Also, this is useful in cases where you want to respect the initial key values of the animation.
并且,当你想重视动画的初始动画帧的值时,这会很有用。
For example, if an animation with only one key ``Quaternion(0, 0, 0, 1)`` is played in the previous frame and then an animation with only one key ``Quaternion(0, 0.707, 0, 0.707)`` is played in the next frame, the difference can be calculated as follows:
比如说,如果一个动画在上一帧只播放一个 ``Quaternion(0, 0, 0, 1)`` 动画帧,并且一个动画在下一帧只播放了一个动画帧的 ``Quaternion(0, 0.707, 0, 0.707)`` 时,它们相差的值可以这样求出:
.. tabs::
@@ -782,7 +789,7 @@ For example, if an animation with only one key ``Quaternion(0, 0, 0, 1)`` is pla
However, if the animation loops, an unintended discrete change may occur, so this is only useful for some simple use cases.
然而,当一个动画循环时,可能会得到一个意料之外的变化,所以这个只在一些简单情况下才有用。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNode.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNode.xml.
.. _class_AnimationNode:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAdd2.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAdd2.xml.
.. _class_AnimationNodeAdd2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAdd3.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAdd3.xml.
.. _class_AnimationNodeAdd3:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeAnimation.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeAnimation.xml.
.. _class_AnimationNodeAnimation:
@@ -124,7 +124,9 @@ enum **PlayMode**: :ref:`🔗<enum_AnimationNodeAnimation_PlayMode>`
- |void| **set_loop_mode**\ (\ value\: :ref:`LoopMode<enum_Animation_LoopMode>`\ )
- :ref:`LoopMode<enum_Animation_LoopMode>` **get_loop_mode**\ (\ )
如果\ :ref:`use_custom_timeline<class_AnimationNodeAnimation_property_use_custom_timeline>`\\ ``true``\ ,则使用该值覆盖原始\ :ref:`Animation<class_Animation>`\ 资源的循环设置。
如果 :ref:`use_custom_timeline<class_AnimationNodeAnimation_property_use_custom_timeline>```true``\ ,则用该值覆盖原始 :ref:`Animation<class_Animation>` 资源的循环设置。
\ **注意:**\ 如果 :ref:`Animation.loop_mode<class_Animation_property_loop_mode>` 未设置为循环,就不会遵守 :ref:`Animation.track_set_interpolation_loop_wrap<class_Animation_method_track_set_interpolation_loop_wrap>` 选项。如果无法得到想要的行为,请考虑制作 :ref:`Animation<class_Animation>` 资源的副本并修改其循环设置。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlend2.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlend2.xml.
.. _class_AnimationNodeBlend2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlend3.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlend3.xml.
.. _class_AnimationNodeBlend3:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendSpace1D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendSpace1D.xml.
.. _class_AnimationNodeBlendSpace1D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendSpace2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendSpace2D.xml.
.. _class_AnimationNodeBlendSpace2D:
@@ -21,7 +21,7 @@ AnimationNodeBlendSpace2D
:ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>` 使用的资源。
\ :ref:`AnimationNodeBlendSpace1D<class_AnimationNodeBlendSpace1D>` 代表放置 :ref:`AnimationRootNode<class_AnimationRootNode>` 的虚拟 2D 空间。输出的是使用 :ref:`Vector2<class_Vector2>` 权重对相邻的三个动画进行线性混合的结果。此处的“相邻”指的是构成包含当前值的三角形的三个 :ref:`AnimationRootNode<class_AnimationRootNode>`\ 。
\ **AnimationNodeBlendSpace2D** 代表放置 :ref:`AnimationRootNode<class_AnimationRootNode>` 的虚拟 2D 空间。输出的是使用 :ref:`Vector2<class_Vector2>` 权重对相邻的三个动画进行线性混合的结果。此处的“相邻”指的是构成包含当前值的三角形的三个 :ref:`AnimationRootNode<class_AnimationRootNode>`\ 。
你可以使用 :ref:`add_blend_point<class_AnimationNodeBlendSpace2D_method_add_blend_point>` 向混合空间中添加顶点,将 :ref:`auto_triangles<class_AnimationNodeBlendSpace2D_property_auto_triangles>` 设为 ``true`` 可以将其自动三角形化。否则,请使用 :ref:`add_triangle<class_AnimationNodeBlendSpace2D_method_add_triangle>`:ref:`remove_triangle<class_AnimationNodeBlendSpace2D_method_remove_triangle>` 手动对混合空间进行三角形化。
@@ -426,7 +426,7 @@ enum **BlendMode**: :ref:`🔗<enum_AnimationNodeBlendSpace2D_BlendMode>`
|void| **set_blend_point_position**\ (\ point\: :ref:`int<class_int>`, pos\: :ref:`Vector2<class_Vector2>`\ ) :ref:`🔗<class_AnimationNodeBlendSpace2D_method_set_blend_point_position>`
更新混合轴上索引 ``point`` 处的点的位置。
更新混合空间中索引 ``point`` 处的点的位置。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeBlendTree.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeBlendTree.xml.
.. _class_AnimationNodeBlendTree:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeOneShot.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeOneShot.xml.
.. _class_AnimationNodeOneShot:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeOutput.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeOutput.xml.
.. _class_AnimationNodeOutput:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachine.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachine.xml.
.. _class_AnimationNodeStateMachine:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachinePlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachinePlayback.xml.
.. _class_AnimationNodeStateMachinePlayback:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeStateMachineTransition.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeStateMachineTransition.xml.
.. _class_AnimationNodeStateMachineTransition:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeSub2.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeSub2.xml.
.. _class_AnimationNodeSub2:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeSync.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeSync.xml.
.. _class_AnimationNodeSync:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTimeScale.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTimeScale.xml.
.. _class_AnimationNodeTimeScale:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTimeSeek.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTimeSeek.xml.
.. _class_AnimationNodeTimeSeek:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTransition.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationNodeTransition.xml.
.. _class_AnimationNodeTransition:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationPlayer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationPlayer.xml.
.. _class_AnimationPlayer:
@@ -661,9 +661,9 @@ enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMetho
|void| **queue**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_method_queue>`
Queues an animation for playback once the current animation and all previously queued animations are done.
将动画加入队列,在当前动画和所有先前排队的动画完毕后播放。
\ **Note:** If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.
\ **注意:**\ 如果当前正在播放循环动画,除非以某种方式停止循环动画,否则排队的动画将永远不会播放。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationRootNode.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationRootNode.xml.
.. _class_AnimationRootNode:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationTree.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AnimationTree.xml.
.. _class_AnimationTree:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Area2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Area2D.xml.
.. _class_Area2D:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Area3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Area3D.xml.
.. _class_Area3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Array.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/Array.xml.
.. _class_Array:
@@ -40,11 +40,11 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
var array = new Godot.Collections.Array{"First", 2, 3, "Last"};
GD.Print(array[0]); // Prints "First"
GD.Print(array[2]); // Prints 3
GD.Print(array[array.Count - 1]); // Prints "Last"
GD.Print(array[^1]); // Prints "Last"
array[2] = "Second";
array[1] = "Second";
GD.Print(array[1]); // Prints "Second"
GD.Print(array[array.Count - 3]); // Prints "Second"
GD.Print(array[^3]); // Prints "Second"
@@ -247,15 +247,15 @@ An array data structure that can contain a sequence of elements of any :ref:`Var
:ref:`Array<class_Array>` **Array**\ (\ base\: :ref:`Array<class_Array>`, type\: :ref:`int<class_int>`, class_name\: :ref:`StringName<class_StringName>`, script\: :ref:`Variant<class_Variant>`\ )
Creates a typed array from the ``base`` array. A typed array can only contain elements of the given type, or that inherit from the given class, as described by this constructor's parameters:
根据 ``base`` 数组创建类型化的数组。类型化的数组只能包含给定类型的元素,或者从给定类继承的元素,构造函数的参数如下所述:
- ``type`` is the built-in :ref:`Variant<class_Variant>` type, as one the :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` constants.
- ``type`` 是内置 :ref:`Variant<class_Variant>` 类型,是一个 :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 常量。
- ``class_name`` is the built-in class name (see :ref:`Object.get_class<class_Object_method_get_class>`).
- ``class_name`` 是内置类名(见 :ref:`Object.get_class<class_Object_method_get_class>`\ )。
- ``script`` is the associated script. It must be a :ref:`Script<class_Script>` instance or ``null``.
- ``script`` 是关联的脚本。它必须是 :ref:`Script<class_Script>` 实例或 ``null``\ 。
If ``type`` is not :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TYPE_OBJECT>`, ``class_name`` must be an empty :ref:`StringName<class_StringName>` and ``script`` must be ``null``.
如果 ``type`` 不是 :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TYPE_OBJECT>`\ ,则 ``class_name`` 必须为空的 :ref:`StringName<class_StringName>`\ ,且 ``script`` 必须为 ``null``\ 。
::
@@ -271,9 +271,9 @@ If ``type`` is not :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TY
var c = Array([], TYPE_OBJECT, "Node", Sword) # Array[Sword]
var d = Array([], TYPE_OBJECT, "RefCounted", Stats) # Array[Stats]
The ``base`` array's elements are converted when necessary. If this is not possible or ``base`` is already typed, this constructor fails and returns an empty **Array**.
\ ``base`` 数组的元素在必要时进行转换。如果无法转换或 ``base`` 已被类型化,则该构造函数失败并返回一个空的 **Array**\ 。
In GDScript, this constructor is usually not necessary, as it is possible to create a typed array through static typing:
GDScript 中,这个构造函数通常不是必需的,因为可以通过静态类型创建类型化的数组:
::
@@ -281,7 +281,7 @@ In GDScript, this constructor is usually not necessary, as it is possible to cre
var children: Array[Node] = [$Node, $Sprite2D, $RigidBody3D]
var integers: Array[int] = [0.2, 4.5, -2.0]
print(integers) # Prints [0, 4, -2]
print(integers) # 输出 [0, 4, -2]
.. rst-class:: classref-item-separator
@@ -408,9 +408,9 @@ In GDScript, this constructor is usually not necessary, as it is possible to cre
:ref:`bool<class_bool>` **all**\ (\ method\: :ref:`Callable<class_Callable>`\ ) |const| :ref:`🔗<class_Array_method_all>`
Calls the given :ref:`Callable<class_Callable>` on each element in the array and returns ``true`` if the :ref:`Callable<class_Callable>` returns ``true`` for *all* elements in the array. If the :ref:`Callable<class_Callable>` returns ``false`` for one array element or more, this method returns ``false``.
对数组中的每个元素调用给定的 :ref:`Callable<class_Callable>`\ ,如果 :ref:`Callable<class_Callable>` 为数组中的 *所有* 元素返回 ``true``\ ,则返回 ``true``\ 。如果 :ref:`Callable<class_Callable>` 为一个或多个数组元素返回 ``false``\ ,则此方法返回 ``false``\ 。
The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the current array element) and return a :ref:`bool<class_bool>`.
``method`` 应采用一个 :ref:`Variant<class_Variant>` 参数(当前数组元素)并返回一个 :ref:`bool<class_bool>`\ 。
.. tabs::
@@ -421,13 +421,13 @@ The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the curr
return number > 5
func _ready():
print([6, 10, 6].all(greater_than_5)) # Prints true (3/3 elements evaluate to true).
print([4, 10, 4].all(greater_than_5)) # Prints false (1/3 elements evaluate to true).
print([4, 4, 4].all(greater_than_5)) # Prints false (0/3 elements evaluate to true).
print([].all(greater_than_5)) # Prints true (0/0 elements evaluate to true).
print([6, 10, 6].all(greater_than_5)) # 输出 true 3/3 元素被评估为真)。
print([4, 10, 4].all(greater_than_5)) # 输出 false 1/3 元素被评估为真)。
print([4, 4, 4].all(greater_than_5)) # 输出 false 0/3 元素被评估为真)。
print([].all(greater_than_5)) # 输出 true 0/0 元素被评估为真)。
# Same as the first line above, but using a lambda function.
print([6, 10, 6].all(func(element): return element > 5)) # Prints true
# 与上面的第一行相同,但使用 lambda 函数。
print([6, 10, 6].all(func(element): return element > 5)) # 输出 true
.. code-tab:: csharp
@@ -438,26 +438,26 @@ The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the curr
public override void _Ready()
{
// Prints true (3/3 elements evaluate to true).
// 输出 true 3/3 元素被评估为真)。
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(GreaterThan5));
// Prints false (1/3 elements evaluate to true).
// 输出 false 1/3 元素被评估为真)。
GD.Print(new Godot.Collections.Array>int< { 4, 10, 4 }.All(GreaterThan5));
// Prints false (0/3 elements evaluate to true).
// 输出 false 0/3 元素被评估为真)。
GD.Print(new Godot.Collections.Array>int< { 4, 4, 4 }.All(GreaterThan5));
// Prints true (0/0 elements evaluate to true).
// 输出 true 0/0 元素被评估为真)。
GD.Print(new Godot.Collections.Array>int< { }.All(GreaterThan5));
// Same as the first line above, but using a lambda function.
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // Prints true
// 与上面的第一行相同,但使用 lambda 函数。
GD.Print(new Godot.Collections.Array>int< { 6, 10, 6 }.All(element => element > 5)); // 输出 true
}
See also :ref:`any<class_Array_method_any>`, :ref:`filter<class_Array_method_filter>`, :ref:`map<class_Array_method_map>` and :ref:`reduce<class_Array_method_reduce>`.
另请参见 :ref:`any<class_Array_method_any>`\ 、\ :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`map<class_Array_method_map>` :ref:`reduce<class_Array_method_reduce>`\ 。
\ **Note:** Unlike relying on the size of an array returned by :ref:`filter<class_Array_method_filter>`, this method will return as early as possible to improve performance (especially with large arrays).
\ **注意:**\ 与依赖 :ref:`filter<class_Array_method_filter>` 返回的数组大小不同,此方法会尽可能早地返回以提高性能(尤其是对于大型数组)。
\ **Note:** For an empty array, this method `always <https://en.wikipedia.org/wiki/Vacuous_truth>`__ returns ``true``.
\ **注意:**\ 对于空数组,此方法 `总是 <https://en.wikipedia.org/wiki/Vacuous_truth>`__ 返回 ``true``\ 。
.. rst-class:: classref-item-separator
@@ -469,9 +469,9 @@ See also :ref:`any<class_Array_method_any>`, :ref:`filter<class_Array_method_fil
:ref:`bool<class_bool>` **any**\ (\ method\: :ref:`Callable<class_Callable>`\ ) |const| :ref:`🔗<class_Array_method_any>`
Calls the given :ref:`Callable<class_Callable>` on each element in the array and returns ``true`` if the :ref:`Callable<class_Callable>` returns ``true`` for *one or more* elements in the array. If the :ref:`Callable<class_Callable>` returns ``false`` for all elements in the array, this method returns ``false``.
对数组中的每个元素调用给定的 :ref:`Callable<class_Callable>`\ ,如果 :ref:`Callable<class_Callable>` 为数组中的\ * 一个或多个*\ 元素返回 ``true``\ ,则返回 ``true``\ 。如果 :ref:`Callable<class_Callable>` 为数组中的所有元素返回 ``false``\ ,则该方法返回 ``false``\ 。
The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the current array element) and return a :ref:`bool<class_bool>`.
``method`` 应接受一个 :ref:`Variant<class_Variant>` 参数(当前数组元素)并返回一个 :ref:`bool<class_bool>`\ 。
::
@@ -479,19 +479,19 @@ The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the curr
return number > 5
func _ready():
print([6, 10, 6].any(greater_than_5)) # Prints true (3 elements evaluate to true).
print([4, 10, 4].any(greater_than_5)) # Prints true (1 elements evaluate to true).
print([4, 4, 4].any(greater_than_5)) # Prints false (0 elements evaluate to true).
print([].any(greater_than_5)) # Prints false (0 elements evaluate to true).
print([6, 10, 6].any(greater_than_5)) # 输出 true 3 个元素被评估为真)。
print([4, 10, 4].any(greater_than_5)) #输出 true 1 个元素被评估为真)。
print([4, 4, 4].any(greater_than_5)) # 输出 false 0 个元素被评估为真)。
print([].any(greater_than_5)) # 输出 false 0 个元素被评估为真)。
# Same as the first line above, but using a lambda function.
print([6, 10, 6].any(func(number): return number > 5)) # Prints true
# 与上面的第一行相同,但使用 lambda 函数。
print([6, 10, 6].any(func(number): return number > 5)) # 输出 true
See also :ref:`all<class_Array_method_all>`, :ref:`filter<class_Array_method_filter>`, :ref:`map<class_Array_method_map>` and :ref:`reduce<class_Array_method_reduce>`.
另请参阅 :ref:`all<class_Array_method_all>`\ 、\ :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`map<class_Array_method_map>` :ref:`reduce<class_Array_method_reduce>`\ 。
\ **Note:** Unlike relying on the size of an array returned by :ref:`filter<class_Array_method_filter>`, this method will return as early as possible to improve performance (especially with large arrays).
\ **注意:**\ 与依赖 :ref:`filter<class_Array_method_filter>` 返回的数组大小不同,此方法会尽可能早地返回以提高性能(尤其是对于大型数组)。
\ **Note:** For an empty array, this method always returns ``false``.
\ **注意:**\ 对于一个空数组,这个方法总是返回 ``false``\ 。
.. rst-class:: classref-item-separator
@@ -503,7 +503,7 @@ See also :ref:`all<class_Array_method_all>`, :ref:`filter<class_Array_method_fil
|void| **append**\ (\ value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_append>`
Appends ``value`` at the end of the array (alias of :ref:`push_back<class_Array_method_push_back>`).
``value`` 追加到数组末尾(\ :ref:`push_back<class_Array_method_push_back>` 的别名)。
.. rst-class:: classref-item-separator
@@ -515,14 +515,14 @@ Appends ``value`` at the end of the array (alias of :ref:`push_back<class_Array_
|void| **append_array**\ (\ array\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_method_append_array>`
Appends another ``array`` at the end of this array.
在该数组的末尾追加其他 ``array``\ 。
::
var numbers = [1, 2, 3]
var extra = [4, 5, 6]
numbers.append_array(extra)
print(nums) # Prints [1, 2, 3, 4, 5, 6]
print(numbers) # 输出 [1, 2, 3, 4, 5, 6]
.. rst-class:: classref-item-separator
@@ -546,9 +546,9 @@ Appends another ``array`` at the end of this array.
:ref:`Variant<class_Variant>` **back**\ (\ ) |const| :ref:`🔗<class_Array_method_back>`
Returns the last element of the array. If the array is empty, fails and returns ``null``. See also :ref:`front<class_Array_method_front>`.
返回数组的最后一个元素。如果数组为空,则失败并返回 ``null``\ 。另请参阅 :ref:`front<class_Array_method_front>`\ 。
\ **Note:** Unlike with the ``[]`` operator (``array[-1]``), an error is generated without stopping project execution.
\ **注意:**\ 与 ``[]`` 运算符(\ ``array[-1]``\ )不同,错误生成时不会停止项目执行。
.. rst-class:: classref-item-separator
@@ -560,9 +560,9 @@ Returns the last element of the array. If the array is empty, fails and returns
:ref:`int<class_int>` **bsearch**\ (\ value\: :ref:`Variant<class_Variant>`, before\: :ref:`bool<class_bool>` = true\ ) |const| :ref:`🔗<class_Array_method_bsearch>`
Returns the index of ``value`` in the sorted array. If it cannot be found, returns where ``value`` should be inserted to keep the array sorted. The algorithm used is `binary search <https://en.wikipedia.org/wiki/Binary_search_algorithm>`__.
返回已排序数组中 ``value`` 的索引。如果找不到,则返回应被插入 ``value`` 的位置以保持数组被排序。使用的算法是\ `二分查找算法 <https://zh.wikipedia.org/wiki/%E4%BA%8C%E5%88%86%E6%90%9C%E5%B0%8B%E6%BC%94%E7%AE%97%E6%B3%95>`__\ 。
If ``before`` is ``true`` (as by default), the returned index comes before all existing elements equal to ``value`` in the array.
如果 ``before`` ``true``\ (默认情况下),则返回的索引位于数组中所有等于 ``value`` 的已有元素之前。
::
@@ -570,13 +570,13 @@ If ``before`` is ``true`` (as by default), the returned index comes before all e
var idx = numbers.bsearch(7)
numbers.insert(idx, 7)
print(numbers) # Prints [2, 4, 7, 8, 10]
print(numbers) # 输出 [2, 4, 7, 8, 10]
var fruits = ["Apple", "Lemon", "Lemon", "Orange"]
print(fruits.bsearch("Lemon", true)) # Prints 1, points at the first "Lemon".
print(fruits.bsearch("Lemon", false)) # Prints 3, points at "Orange".
print(fruits.bsearch("Lemon", true)) # 输出 1位于第一个 "Lemon"
print(fruits.bsearch("Lemon", false)) # 输出 3位于 "Orange"
\ **Note:** Calling :ref:`bsearch<class_Array_method_bsearch>` on an *unsorted* array will result in unexpected behavior. Use :ref:`sort<class_Array_method_sort>` before calling this method.
\ **注意:**\ 对\ *未排序的*\ 数组调用 :ref:`bsearch<class_Array_method_bsearch>` 将导致意外行为。调用该方法之前,请使用 :ref:`sort<class_Array_method_sort>`\ 。
.. rst-class:: classref-item-separator
@@ -588,11 +588,11 @@ If ``before`` is ``true`` (as by default), the returned index comes before all e
:ref:`int<class_int>` **bsearch_custom**\ (\ value\: :ref:`Variant<class_Variant>`, func\: :ref:`Callable<class_Callable>`, before\: :ref:`bool<class_bool>` = true\ ) |const| :ref:`🔗<class_Array_method_bsearch_custom>`
Returns the index of ``value`` in the sorted array. If it cannot be found, returns where ``value`` should be inserted to keep the array sorted (using ``func`` for the comparisons). The algorithm used is `binary search <https://en.wikipedia.org/wiki/Binary_search_algorithm>`__.
返回已排序数组中 ``value`` 的索引。如果找不到,则返回 ``value`` 应插入的位置,以保持数组已排序(使用 ``func`` 进行比较)。使用的算法是\ `二分查找算法 <https://zh.wikipedia.org/wiki/%E4%BA%8C%E5%88%86%E6%90%9C%E5%B0%8B%E6%BC%94%E7%AE%97%E6%B3%95>`__\ 。
Similar to :ref:`sort_custom<class_Array_method_sort_custom>`, ``func`` is called as many times as necessary, receiving one array element and ``value`` as arguments. The function should return ``true`` if the array element should be *behind* ``value``, otherwise it should return ``false``.
:ref:`sort_custom<class_Array_method_sort_custom>` 类似,\ ``func`` 会根据需要多次调用,接收一个数组元素和 ``value`` 作为参数。如果数组元素应该在 ``value`` *后面*\ ,则函数应该返回 ``true``\ ,否则应该返回 ``false``\ 。
If ``before`` is ``true`` (as by default), the returned index comes before all existing elements equal to ``value`` in the array.
如果 ``before`` ``true``\ (默认情况下),则返回的索引位于数组中所有等于 ``value`` 的已有元素之前。
::
@@ -605,17 +605,17 @@ If ``before`` is ``true`` (as by default), the returned index comes before all e
var my_items = [["Tomato", 2], ["Kiwi", 5], ["Rice", 9]]
var apple = ["Apple", 5]
# "Apple" is inserted before "Kiwi".
# "Apple" 被插入在 "Kiwi" 之前。
my_items.insert(my_items.bsearch_custom(apple, sort_by_amount, true), apple)
var banana = ["Banana", 5]
# "Banana" is inserted after "Kiwi".
# "Banana" 被插入在 "Kiwi" 之后。
my_items.insert(my_items.bsearch_custom(banana, sort_by_amount, false), banana)
# Prints [["Tomato", 2], ["Apple", 5], ["Kiwi", 5], ["Banana", 5], ["Rice", 9]]
# 输出 [["Tomato", 2], ["Apple", 5], ["Kiwi", 5], ["Banana", 5], ["Rice", 9]]
print(my_items)
\ **Note:** Calling :ref:`bsearch_custom<class_Array_method_bsearch_custom>` on an *unsorted* array will result in unexpected behavior. Use :ref:`sort_custom<class_Array_method_sort_custom>` with ``func`` before calling this method.
\ **注意:**\ 在\ *未排序的*\ 数组上调用 :ref:`bsearch_custom<class_Array_method_bsearch_custom>` 将导致意外行为。在调用该方法之前,请将 :ref:`sort_custom<class_Array_method_sort_custom>` ``func`` 结合使用。
.. rst-class:: classref-item-separator
@@ -627,7 +627,7 @@ If ``before`` is ``true`` (as by default), the returned index comes before all e
|void| **clear**\ (\ ) :ref:`🔗<class_Array_method_clear>`
Removes all elements from the array. This is equivalent to using :ref:`resize<class_Array_method_resize>` with a size of ``0``.
从该数组中移除所有元素。相当于调用 :ref:`resize<class_Array_method_resize>` 时指定大小为 ``0``\ 。
.. rst-class:: classref-item-separator
@@ -651,11 +651,11 @@ Removes all elements from the array. This is equivalent to using :ref:`resize<cl
:ref:`Array<class_Array>` **duplicate**\ (\ deep\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Array_method_duplicate>`
Returns a new copy of the array.
返回数组的新副本。
By default, a **shallow** copy is returned: all nested **Array** and :ref:`Dictionary<class_Dictionary>` elements are shared with the original array. Modifying them in one array will also affect them in the other.
默认情况下返回的是\ **浅拷贝**\ :嵌套的 **Array**:ref:`Dictionary<class_Dictionary>` 元素与原数组共享。对这些元素的修改会影响另一个数组。
If ``deep`` is ``true``, a **deep** copy is returned: all nested arrays and dictionaries are also duplicated (recursively).
如果 ``deep`` ``true`` 则会返回\ **深拷贝**\ :嵌套的数组和字典也会进行(递归的)复制。
.. rst-class:: classref-item-separator
@@ -667,11 +667,11 @@ If ``deep`` is ``true``, a **deep** copy is returned: all nested arrays and dict
|void| **erase**\ (\ value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_erase>`
Finds and removes the first occurrence of ``value`` from the array. If ``value`` does not exist in the array, nothing happens. To remove an element by index, use :ref:`remove_at<class_Array_method_remove_at>` instead.
查找并从数组中移除 ``value`` 的第一个匹配值。如果数组中不存在 ``value``\ ,则什么也不会发生。要通过索引移除元素,请改用 :ref:`remove_at<class_Array_method_remove_at>`\ 。
\ **Note:** This method shifts every element's index after the removed ``value`` back, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ 该方法将移除的 ``value`` 后每个元素的索引移回一位,这可能会产生明显的性能成本,尤其是在较大的数组上。
\ **Note:** Erasing elements while iterating over arrays is **not** supported and will result in unpredictable behavior.
\ **注意:**\ 在迭代数组时移除元素\ **不**\ 受支持,并且将导致不可预测的行为。
.. rst-class:: classref-item-separator
@@ -683,9 +683,9 @@ Finds and removes the first occurrence of ``value`` from the array. If ``value``
|void| **fill**\ (\ value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_fill>`
Assigns the given ``value`` to all elements in the array.
将该数组中的所有元素都设置为给定的 ``value``\ 。
This method can often be combined with :ref:`resize<class_Array_method_resize>` to create an array with a given size and initialized elements:
该方法通常与 :ref:`resize<class_Array_method_resize>` 一起使用,用于创建给定大小的数组并对其元素进行初始化:
.. tabs::
@@ -695,18 +695,18 @@ This method can often be combined with :ref:`resize<class_Array_method_resize>`
var array = []
array.resize(5)
array.fill(2)
print(array) # Prints [2, 2, 2, 2, 2]
print(array) # 输出 [2, 2, 2, 2, 2]
.. code-tab:: csharp
var array = new Godot.Collections.Array();
array.Resize(5);
array.Fill(2);
GD.Print(array); // Prints [2, 2, 2, 2, 2]
GD.Print(array); // 输出 [2, 2, 2, 2, 2]
\ **Note:** If ``value`` is a :ref:`Variant<class_Variant>` passed by reference (:ref:`Object<class_Object>`-derived, **Array**, :ref:`Dictionary<class_Dictionary>`, etc.), the array will be filled with references to the same ``value``, which are not duplicates.
\ **注意:**\ 如果 ``value`` 是通过引用传递的 :ref:`Variant<class_Variant>`\ \ :ref:`Object<class_Object>` 派生类、\ **Array**\ 、\ :ref:`Dictionary<class_Dictionary>` 等),则会用同一个 ``value`` 的引用填充该数组,即不会创建副本。
.. rst-class:: classref-item-separator
@@ -718,9 +718,9 @@ This method can often be combined with :ref:`resize<class_Array_method_resize>`
:ref:`Array<class_Array>` **filter**\ (\ method\: :ref:`Callable<class_Callable>`\ ) |const| :ref:`🔗<class_Array_method_filter>`
Calls the given :ref:`Callable<class_Callable>` on each element in the array and returns a new, filtered **Array**.
在数组中的每个元素上调用给定的 :ref:`Callable<class_Callable>`\ ,并返回一个新的、经过过滤的 **Array**\ 。
The ``method`` receives one of the array elements as an argument, and should return ``true`` to add the element to the filtered array, or ``false`` to exclude it.
``method`` 接收一个数组元素作为参数,并且应返回 ``true`` 以将该元素添加到过滤后的数组中,或返回 ``false`` 以将其排除。
::
@@ -728,12 +728,12 @@ The ``method`` receives one of the array elements as an argument, and should ret
return number % 2 == 0
func _ready():
print([1, 4, 5, 8].filter(is_even)) # Prints [4, 8]
print([1, 4, 5, 8].filter(is_even)) # 输出 [4, 8]
# Same as above, but using a lambda function.
# 与上面相同,但使用 lambda 函数。
print([1, 4, 5, 8].filter(func(number): return number % 2 == 0))
See also :ref:`any<class_Array_method_any>`, :ref:`all<class_Array_method_all>`, :ref:`map<class_Array_method_map>` and :ref:`reduce<class_Array_method_reduce>`.
另请参见 :ref:`any<class_Array_method_any>`\ 、\ :ref:`all<class_Array_method_all>`\ 、\ :ref:`map<class_Array_method_map>` :ref:`reduce<class_Array_method_reduce>`\ 。
.. rst-class:: classref-item-separator
@@ -745,11 +745,11 @@ See also :ref:`any<class_Array_method_any>`, :ref:`all<class_Array_method_all>`,
:ref:`int<class_int>` **find**\ (\ what\: :ref:`Variant<class_Variant>`, from\: :ref:`int<class_int>` = 0\ ) |const| :ref:`🔗<class_Array_method_find>`
Returns the index of the **first** occurrence of ``what`` in this array, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the end of the array.
返回 ``what`` 在该数组中\ **第一次**\ 出现时的索引,不存在时返回 ``-1``\ 。搜索的起点可以使用 ``from`` 指定,终点为数组末尾。
\ **Note:** If you just want to know whether the array contains ``what``, use :ref:`has<class_Array_method_has>` (``Contains`` in C#). In GDScript, you may also use the ``in`` operator.
\ **注意:**\ 如果你只想知道数组中是否包含 ``what``\ ,请使用 :ref:`has<class_Array_method_has>`\ C# 则为 ``Contains``\ )。在 GDScript 中,你还可以使用 ``in`` 运算符。
\ **Note:** For performance reasons, the search is affected by ``what``'s :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`. For example, ``7`` (:ref:`int<class_int>`) and ``7.0`` (:ref:`float<class_float>`) are not considered equal for this method.
\ **注意:**\ 出于性能方面的考虑,搜索时会使用到 ``what`` :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`\ 。例如该方法不会认为 ``7``\ \ :ref:`int<class_int>`\ )和 ``7.0``\ \ :ref:`float<class_float>`\ )相等。
.. rst-class:: classref-item-separator
@@ -761,9 +761,9 @@ Returns the index of the **first** occurrence of ``what`` in this array, or ``-1
:ref:`Variant<class_Variant>` **front**\ (\ ) |const| :ref:`🔗<class_Array_method_front>`
Returns the first element of the array. If the array is empty, fails and returns ``null``. See also :ref:`back<class_Array_method_back>`.
返回数组的第一个元素。如果数组为空,则失败并返回 ``null``\ 。另请参阅 :ref:`back<class_Array_method_back>`\ 。
\ **Note:** Unlike with the ``[]`` operator (``array[0]``), an error is generated without stopping project execution.
\ **注意:**\ 与 ``[]`` 运算符(\ ``array[0]``\ )不同,错误产生时不会停止项目执行。
.. rst-class:: classref-item-separator
@@ -775,7 +775,7 @@ Returns the first element of the array. If the array is empty, fails and returns
:ref:`int<class_int>` **get_typed_builtin**\ (\ ) |const| :ref:`🔗<class_Array_method_get_typed_builtin>`
Returns the built-in :ref:`Variant<class_Variant>` type of the typed array as a :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` constant. If the array is not typed, returns :ref:`@GlobalScope.TYPE_NIL<class_@GlobalScope_constant_TYPE_NIL>`. See also :ref:`is_typed<class_Array_method_is_typed>`.
将类型化数组的内置 :ref:`Variant<class_Variant>` 类型作为 :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 常量返回。如果该数组不是类型化的,则返回 :ref:`@GlobalScope.TYPE_NIL<class_@GlobalScope_constant_TYPE_NIL>`\ 。另请参阅 :ref:`is_typed<class_Array_method_is_typed>`\ 。
.. rst-class:: classref-item-separator
@@ -787,7 +787,7 @@ Returns the built-in :ref:`Variant<class_Variant>` type of the typed array as a
:ref:`StringName<class_StringName>` **get_typed_class_name**\ (\ ) |const| :ref:`🔗<class_Array_method_get_typed_class_name>`
Returns the **built-in** class name of the typed array, if the built-in :ref:`Variant<class_Variant>` type :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TYPE_OBJECT>`. Otherwise, returns an empty :ref:`StringName<class_StringName>`. See also :ref:`is_typed<class_Array_method_is_typed>` and :ref:`Object.get_class<class_Object_method_get_class>`.
如果内置 :ref:`Variant<class_Variant>` 类型为 :ref:`@GlobalScope.TYPE_OBJECT<class_@GlobalScope_constant_TYPE_OBJECT>`\ ,则返回类型数组的\ **内置**\ 类名。否则,返回一个空的 :ref:`StringName<class_StringName>`\ 。另请参阅 :ref:`is_typed<class_Array_method_is_typed>`:ref:`Object.get_class<class_Object_method_get_class>`\ 。
.. rst-class:: classref-item-separator
@@ -799,7 +799,7 @@ Returns the **built-in** class name of the typed array, if the built-in :ref:`Va
:ref:`Variant<class_Variant>` **get_typed_script**\ (\ ) |const| :ref:`🔗<class_Array_method_get_typed_script>`
Returns the :ref:`Script<class_Script>` instance associated with this typed array, or ``null`` if it does not exist. See also :ref:`is_typed<class_Array_method_is_typed>`.
返回与该类型数组关联的 :ref:`Script<class_Script>` 实例,如果不存在则返回 ``null``\ 。另请参阅 :ref:`is_typed<class_Array_method_is_typed>`\ 。
.. rst-class:: classref-item-separator
@@ -811,37 +811,37 @@ Returns the :ref:`Script<class_Script>` instance associated with this typed arra
:ref:`bool<class_bool>` **has**\ (\ value\: :ref:`Variant<class_Variant>`\ ) |const| :ref:`🔗<class_Array_method_has>`
Returns ``true`` if the array contains the given ``value``.
如果该数组包含给定的 ``value``\ ,则返回 ``true``\ 。
.. tabs::
.. code-tab:: gdscript
print(["inside", 7].has("inside")) # Prints true
print(["inside", 7].has("outside")) # Prints false
print(["inside", 7].has(7)) # Prints true
print(["inside", 7].has("7")) # Prints false
print(["inside", 7].has("inside")) # 输出 true
print(["inside", 7].has("outside")) # 输出 false
print(["inside", 7].has(7)) # 输出 true
print(["inside", 7].has("7")) # 输出 false
.. code-tab:: csharp
var arr = new Godot.Collections.Array { "inside", 7 };
// By C# convention, this method is renamed to `Contains`.
GD.Print(arr.Contains("inside")); // Prints true
GD.Print(arr.Contains("outside")); // Prints false
GD.Print(arr.Contains(7)); // Prints true
GD.Print(arr.Contains("7")); // Prints false
// 按照 C# 惯例,该方法重命名为 `Contains`
GD.Print(arr.Contains("inside")); // 输出 true
GD.Print(arr.Contains("outside")); // 输出 false
GD.Print(arr.Contains(7)); // 输出 true
GD.Print(arr.Contains("7")); // 输出 false
In GDScript, this is equivalent to the ``in`` operator:
GDScript 中,这相当于 ``in`` 运算符:
::
if 4 in [2, 4, 6, 8]:
print("4 is here!") # Will be printed.
print("4 is here!") # 将被输出。
\ **Note:** For performance reasons, the search is affected by the ``value``'s :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>`. For example, ``7`` (:ref:`int<class_int>`) and ``7.0`` (:ref:`float<class_float>`) are not considered equal for this method.
\ **注意:**\ 出于性能原因,搜索会受到 ``value`` :ref:`Variant.Type<enum_@GlobalScope_Variant.Type>` 的影响。例如,对于该方法,\ ``7``\ \ :ref:`int<class_int>`\ )和 ``7.0``\ \ :ref:`float<class_float>`\ )不被视为相等。
.. rst-class:: classref-item-separator
@@ -853,9 +853,9 @@ In GDScript, this is equivalent to the ``in`` operator:
:ref:`int<class_int>` **hash**\ (\ ) |const| :ref:`🔗<class_Array_method_hash>`
Returns a hashed 32-bit integer value representing the array and its contents.
返回代表该数组及其内容的散列 32 位整数值。
\ **Note:** Arrays with equal hash values are *not* guaranteed to be the same, as a result of hash collisions. On the countrary, arrays with different hash values are guaranteed to be different.
\ **注意:**\ 由于哈希碰撞的缘故,哈希相同的数组\ *不*\ 保证相同。而相对的是,哈希不同的数组保证不同。
.. rst-class:: classref-item-separator
@@ -867,11 +867,11 @@ Returns a hashed 32-bit integer value representing the array and its contents.
:ref:`int<class_int>` **insert**\ (\ position\: :ref:`int<class_int>`, value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_insert>`
Inserts a new element (``value``) at a given index (``position``) in the array. ``position`` should be between ``0`` and the array's :ref:`size<class_Array_method_size>`.
在数组中给定索引(\ ``position``\ )处插入新元素(\ ``value``\ )。\ ``position`` 应介于 ``0`` 和数组的 :ref:`size<class_Array_method_size>` 之间。
Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, or one of the other :ref:`Error<enum_@GlobalScope_Error>` constants if this method fails.
如果成功,则返回 :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`\ ;如果该方法失败,则返回其他 :ref:`Error<enum_@GlobalScope_Error>` 常量之一。
\ **Note:** Every element's index after ``position`` needs to be shifted forward, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ ``position`` 之后的每个元素的索引都需要向前移动,这可能会产生明显的性能成本,尤其是在较大的数组上。
.. rst-class:: classref-item-separator
@@ -883,7 +883,7 @@ Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, or on
:ref:`bool<class_bool>` **is_empty**\ (\ ) |const| :ref:`🔗<class_Array_method_is_empty>`
Returns ``true`` if the array is empty (``[]``). See also :ref:`size<class_Array_method_size>`.
如果数组为空(\ ``[]``\ ),则返回 ``true``\ 。另请参阅 :ref:`size<class_Array_method_size>`\ 。
.. rst-class:: classref-item-separator
@@ -895,9 +895,9 @@ Returns ``true`` if the array is empty (``[]``). See also :ref:`size<class_Array
:ref:`bool<class_bool>` **is_read_only**\ (\ ) |const| :ref:`🔗<class_Array_method_is_read_only>`
Returns ``true`` if the array is read-only. See :ref:`make_read_only<class_Array_method_make_read_only>`.
如果该数组是只读的,则返回 ``true``\ 。请参阅 :ref:`make_read_only<class_Array_method_make_read_only>`\ 。
In GDScript, arrays are automatically read-only if declared with the ``const`` keyword.
GDScript 中,如果数组是使用 ``const`` 关键字声明的,则该数组自动为只读。
.. rst-class:: classref-item-separator
@@ -909,7 +909,7 @@ In GDScript, arrays are automatically read-only if declared with the ``const`` k
:ref:`bool<class_bool>` **is_same_typed**\ (\ array\: :ref:`Array<class_Array>`\ ) |const| :ref:`🔗<class_Array_method_is_same_typed>`
Returns ``true`` if this array is typed the same as the given ``array``. See also :ref:`is_typed<class_Array_method_is_typed>`.
如果该数组的类型与给定的 ``array`` 相同,则返回 ``true``\ 。另请参阅 :ref:`is_typed<class_Array_method_is_typed>`\ 。
.. rst-class:: classref-item-separator
@@ -921,14 +921,14 @@ Returns ``true`` if this array is typed the same as the given ``array``. See als
:ref:`bool<class_bool>` **is_typed**\ (\ ) |const| :ref:`🔗<class_Array_method_is_typed>`
Returns ``true`` if the array is typed. Typed arrays can only contain elements of a specific type, as defined by the typed array constructor. The methods of a typed array are still expected to return a generic :ref:`Variant<class_Variant>`.
如果数组是类型化的,则返回 ``true``\ 。类型化数组只能包含由类型化数组构造函数定义的特定类型的元素。类型化数组的方法仍应返回通用 :ref:`Variant<class_Variant>`\ 。
In GDScript, it is possible to define a typed array with static typing:
GDScript 中,可以使用静态类型定义类型化数组:
::
var numbers: Array[float] = [0.2, 4.2, -2.0]
print(numbers.is_typed()) # Prints true
print(numbers.is_typed()) # 输出 true
.. rst-class:: classref-item-separator
@@ -940,9 +940,9 @@ In GDScript, it is possible to define a typed array with static typing:
|void| **make_read_only**\ (\ ) :ref:`🔗<class_Array_method_make_read_only>`
Makes the array read-only. The array's elements cannot be overridden with different values, and their order cannot change. Does not apply to nested elements, such as dictionaries.
使数组只读。数组的元素无法使用其他值覆盖,顺序也无法改变。不适用于字典等嵌套的元素。
In GDScript, arrays are automatically read-only if declared with the ``const`` keyword.
GDScript 中,使用 ``const`` 关键字声明的数组会自动变为只读。
.. rst-class:: classref-item-separator
@@ -954,9 +954,9 @@ In GDScript, arrays are automatically read-only if declared with the ``const`` k
:ref:`Array<class_Array>` **map**\ (\ method\: :ref:`Callable<class_Callable>`\ ) |const| :ref:`🔗<class_Array_method_map>`
Calls the given :ref:`Callable<class_Callable>` for each element in the array and returns a new array filled with values returned by the ``method``.
为数组中的每个元素调用给定的 :ref:`Callable<class_Callable>` 并返回一个新数组,其中填充了该 ``method`` 返回的值。
The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the current array element) and can return any :ref:`Variant<class_Variant>`.
\ ``method`` 应该采用一个 :ref:`Variant<class_Variant>` 参数(当前数组元素)并且可以返回任意 :ref:`Variant<class_Variant>`\ 。
::
@@ -964,12 +964,12 @@ The ``method`` should take one :ref:`Variant<class_Variant>` parameter (the curr
return number * 2
func _ready():
print([1, 2, 3].map(double)) # Prints [2, 4, 6]
print([1, 2, 3].map(double)) # 输出 [2, 4, 6]
# Same as above, but using a lambda function.
# 与上面相同,但使用 lambda 函数。
print([1, 2, 3].map(func(element): return element * 2))
See also :ref:`filter<class_Array_method_filter>`, :ref:`reduce<class_Array_method_reduce>`, :ref:`any<class_Array_method_any>` and :ref:`all<class_Array_method_all>`.
另请参见 :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`reduce<class_Array_method_reduce>`\ 、\ :ref:`any<class_Array_method_any>` :ref:`all<class_Array_method_all>`\ 。
.. rst-class:: classref-item-separator
@@ -981,9 +981,9 @@ See also :ref:`filter<class_Array_method_filter>`, :ref:`reduce<class_Array_meth
:ref:`Variant<class_Variant>` **max**\ (\ ) |const| :ref:`🔗<class_Array_method_max>`
Returns the maximum value contained in the array, if all elements can be compared. Otherwise, returns ``null``. See also :ref:`min<class_Array_method_min>`.
如果所有元素都可以比较,则返回数组中包含元素的最大值。否则,返回 ``null``\ 。另请参阅 :ref:`min<class_Array_method_min>`\ 。
To find the maximum value using a custom comparator, you can use :ref:`reduce<class_Array_method_reduce>`.
要使用自定义比较器查找最大值,可以使用 :ref:`reduce<class_Array_method_reduce>`\ 。
.. rst-class:: classref-item-separator
@@ -995,7 +995,7 @@ To find the maximum value using a custom comparator, you can use :ref:`reduce<cl
:ref:`Variant<class_Variant>` **min**\ (\ ) |const| :ref:`🔗<class_Array_method_min>`
Returns the minimum value contained in the array, if all elements can be compared. Otherwise, returns ``null``. See also :ref:`max<class_Array_method_max>`.
如果所有元素都可以比较,则返回数组中包含元素的最小值。否则,返回 ``null``\ 。另请参阅 :ref:`max<class_Array_method_max>`\ 。
.. rst-class:: classref-item-separator
@@ -1007,24 +1007,24 @@ Returns the minimum value contained in the array, if all elements can be compare
:ref:`Variant<class_Variant>` **pick_random**\ (\ ) |const| :ref:`🔗<class_Array_method_pick_random>`
Returns a random element from the array. Generates an error and returns ``null`` if the array is empty.
从该数组中返回一个随机元素。如果数组为空,则生成一个错误并返回 ``null``\ 。
.. tabs::
.. code-tab:: gdscript
# May print 1, 2, 3.25, or "Hi".
# 可能输出 1、2、3.25、或 "Hi"
print([1, 2, 3.25, "Hi"].pick_random())
.. code-tab:: csharp
var array = new Godot.Collections.Array { 1, 2, 3.25f, "Hi" };
GD.Print(array.PickRandom()); // May print 1, 2, 3.25, or "Hi".
GD.Print(array.PickRandom()); // 可能输出 1、2、3.25、或 "Hi"
\ **Note:** Like many similar functions in the engine (such as :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>` or :ref:`shuffle<class_Array_method_shuffle>`), this method uses a common, global random seed. To get a predictable outcome from this method, see :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`.
\ **注意:**\ 与引擎中的许多类似函数(例如 :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>`:ref:`shuffle<class_Array_method_shuffle>`\ )一样,该方法使用通用的全局随机种子。要从该方法获得可预测的结果,请参阅 :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`\ 。
.. rst-class:: classref-item-separator
@@ -1036,9 +1036,9 @@ Returns a random element from the array. Generates an error and returns ``null``
:ref:`Variant<class_Variant>` **pop_at**\ (\ position\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Array_method_pop_at>`
Removes and returns the element of the array at index ``position``. If negative, ``position`` is considered relative to the end of the array. Returns ``null`` if the array is empty. If ``position`` is out of bounds, an error message is also generated.
移除并返回数组中位于 ``position`` 索引处的元素。如果 ``position`` 为负数,则认为是相对于该数组末尾的值。如果数组为空,则返回 ``null``\ ;如果 ``position`` 超出范围,还会生成错误消息。
\ **Note:** This method shifts every element's index after ``position`` back, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ 该方法将 ``position`` 之后每个元素的索引向后移动,这可能会产生明显的性能成本,尤其是在较大的数组上。
.. rst-class:: classref-item-separator
@@ -1050,7 +1050,7 @@ Removes and returns the element of the array at index ``position``. If negative,
:ref:`Variant<class_Variant>` **pop_back**\ (\ ) :ref:`🔗<class_Array_method_pop_back>`
Removes and returns the last element of the array. Returns ``null`` if the array is empty, without generating an error. See also :ref:`pop_front<class_Array_method_pop_front>`.
移除并返回数组中的末尾元素。如果数组为空,则返回 ``null``\ ,而不会生成错误。另见 :ref:`pop_front<class_Array_method_pop_front>`\ 。
.. rst-class:: classref-item-separator
@@ -1062,9 +1062,9 @@ Removes and returns the last element of the array. Returns ``null`` if the array
:ref:`Variant<class_Variant>` **pop_front**\ (\ ) :ref:`🔗<class_Array_method_pop_front>`
Removes and returns the first element of the array. Returns ``null`` if the array is empty, without generating an error. See also :ref:`pop_back<class_Array_method_pop_back>`.
移除并返回数组的第一个元素。如果数组为空,则返回 ``null``\ ,而不会生成错误。另请参阅 :ref:`pop_back<class_Array_method_pop_back>`\ 。
\ **Note:** This method shifts every other element's index back, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ 该方法将每个其他元素的索引向后移动,这可能会产生明显的性能成本,尤其是在较大的数组上。
.. rst-class:: classref-item-separator
@@ -1088,9 +1088,9 @@ Removes and returns the first element of the array. Returns ``null`` if the arra
|void| **push_front**\ (\ value\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_Array_method_push_front>`
Adds an element at the beginning of the array. See also :ref:`push_back<class_Array_method_push_back>`.
在数组的开头添加一个元素。另请参阅 :ref:`push_back<class_Array_method_push_back>`\ 。
\ **Note:** This method shifts every other element's index forward, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ 该方法将每个其他元素的索引向前移动,这可能会产生明显的性能成本,尤其是在较大的数组上。
.. rst-class:: classref-item-separator
@@ -1102,9 +1102,9 @@ Adds an element at the beginning of the array. See also :ref:`push_back<class_Ar
:ref:`Variant<class_Variant>` **reduce**\ (\ method\: :ref:`Callable<class_Callable>`, accum\: :ref:`Variant<class_Variant>` = null\ ) |const| :ref:`🔗<class_Array_method_reduce>`
Calls the given :ref:`Callable<class_Callable>` for each element in array, accumulates the result in ``accum``, then returns it.
为数组中的每个元素调用给定的 :ref:`Callable<class_Callable>`\ ,将结果累积在 ``accum`` 中,然后返回它。
The ``method`` takes two arguments: the current value of ``accum`` and the current array element. If ``accum`` is ``null`` (as by default), the iteration will start from the second element, with the first one used as initial value of ``accum``.
\ ``method`` 接受两个参数:\ ``accum`` 的当前值,以及当前的数组元素。如果 ``accum`` ``null``\ (默认值),则会从第二个元素开始迭代,将第一个元素作为 ``accum`` 的初始值。
::
@@ -1112,13 +1112,13 @@ The ``method`` takes two arguments: the current value of ``accum`` and the curre
return accum + number
func _ready():
print([1, 2, 3].reduce(sum, 0)) # Prints 6
print([1, 2, 3].reduce(sum, 10)) # Prints 16
print([1, 2, 3].reduce(sum, 0)) # 输出 6
print([1, 2, 3].reduce(sum, 10)) # 输出 16
# Same as above, but using a lambda function.
# 与上面相同,但使用 lambda 函数。
print([1, 2, 3].reduce(func(accum, number): return accum + number, 10))
If :ref:`max<class_Array_method_max>` is not desirable, this method may also be used to implement a custom comparator:
如果 :ref:`max<class_Array_method_max>` 不理想,也可以使用该方法来实现自定义比较器:
::
@@ -1126,12 +1126,12 @@ If :ref:`max<class_Array_method_max>` is not desirable, this method may also be
var arr = [Vector2(5, 0), Vector2(3, 4), Vector2(1, 2)]
var longest_vec = arr.reduce(func(max, vec): return vec if is_length_greater(vec, max) else max)
print(longest_vec) # Prints Vector2(3, 4).
print(longest_vec) # 输出 Vector2(3, 4).
func is_length_greater(a, b):
return a.length() > b.length()
See also :ref:`map<class_Array_method_map>`, :ref:`filter<class_Array_method_filter>`, :ref:`any<class_Array_method_any>` and :ref:`all<class_Array_method_all>`.
另见 :ref:`map<class_Array_method_map>`\ 、\ :ref:`filter<class_Array_method_filter>`\ 、\ :ref:`any<class_Array_method_any>`\ 、\ :ref:`all<class_Array_method_all>`\ 。
.. rst-class:: classref-item-separator
@@ -1143,13 +1143,13 @@ See also :ref:`map<class_Array_method_map>`, :ref:`filter<class_Array_method_fil
|void| **remove_at**\ (\ position\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Array_method_remove_at>`
Removes the element from the array at the given index (``position``). If the index is out of bounds, this method fails.
从数组中移除指定索引(\ ``position``\ )处的元素。如果索引超出范围,则该方法失败。
If you need to return the removed element, use :ref:`pop_at<class_Array_method_pop_at>`. To remove an element by value, use :ref:`erase<class_Array_method_erase>` instead.
如果需要返回被移除的元素,请使用 :ref:`pop_at<class_Array_method_pop_at>`\ 。要按值移除元素,请改用 :ref:`erase<class_Array_method_erase>`\ 。
\ **Note:** This method shifts every element's index after ``position`` back, which may have a noticeable performance cost, especially on larger arrays.
\ **注意:**\ 该方法将 ``position`` 之后每个元素的索引向后移,这可能会产生明显的性能成本,尤其是在较大的数组上。
\ **Note:** The ``position`` cannot be negative. To remove an element relative to the end of the array, use ``arr.remove_at(arr.size() - (i + 1))``. To remove the last element from the array, use ``arr.resize(arr.size() - 1)``.
\ **注意:**\ ``position`` 不能为负数。要移除相对于数组末尾的元素,请使用 ``arr.remove_at(arr.size() - (i + 1))``\ 。要从数组中移除最后一个元素,请使用 ``arr.resize(arr.size() - 1)``\ 。
.. rst-class:: classref-item-separator
@@ -1161,11 +1161,11 @@ If you need to return the removed element, use :ref:`pop_at<class_Array_method_p
:ref:`int<class_int>` **resize**\ (\ size\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Array_method_resize>`
Sets the array's number of elements to ``size``. If ``size`` is smaller than the array's current size, the elements at the end are removed. If ``size`` is greater, new default elements (usually ``null``) are added, depending on the array's type.
将数组的元素数设置为 ``size``\ 。如果 ``size`` 小于数组的当前大小,则移除末尾的元素。如果 ``size`` 大于数组的当前大小,则添加新的默认元素(通常为 ``null``\ ),具体取决于数组的类型。
Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, or one of the other :ref:`Error<enum_@GlobalScope_Error>` constants if this method fails.
如果成功,则返回 :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>`\ ;如果该方法失败,则返回其他 :ref:`Error<enum_@GlobalScope_Error>` 常量之一。
\ **Note:** Calling this method once and assigning the new values is faster than calling :ref:`append<class_Array_method_append>` for every new element.
\ **注意:**\ 调用该方法一次并分配新值,要比为每个新元素调用 :ref:`append<class_Array_method_append>` 更快。
.. rst-class:: classref-item-separator
@@ -1177,7 +1177,7 @@ Returns :ref:`@GlobalScope.OK<class_@GlobalScope_constant_OK>` on success, or on
|void| **reverse**\ (\ ) :ref:`🔗<class_Array_method_reverse>`
Reverses the order of all elements in the array.
反转数组中所有元素的顺序。
.. rst-class:: classref-item-separator
@@ -1189,7 +1189,7 @@ Reverses the order of all elements in the array.
:ref:`int<class_int>` **rfind**\ (\ what\: :ref:`Variant<class_Variant>`, from\: :ref:`int<class_int>` = -1\ ) |const| :ref:`🔗<class_Array_method_rfind>`
Returns the index of the **last** occurrence of ``what`` in this array, or ``-1`` if there are none. The search's start can be specified with ``from``, continuing to the beginning of the array. This method is the reverse of :ref:`find<class_Array_method_find>`.
返回该数组中 ``what`` **最后一次**\ 出现时的索引,不存在时则为 ``-1``\ 。搜索的起点可以用 ``from`` 指定,终点为该数组的开头。该方法与 :ref:`find<class_Array_method_find>` 相对。
.. rst-class:: classref-item-separator
@@ -1201,9 +1201,9 @@ Returns the index of the **last** occurrence of ``what`` in this array, or ``-1`
|void| **shuffle**\ (\ ) :ref:`🔗<class_Array_method_shuffle>`
Shuffles all elements of the array in a random order.
随机打乱数组中所有元素的顺序。
\ **Note:** Like many similar functions in the engine (such as :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>` or :ref:`pick_random<class_Array_method_pick_random>`), this method uses a common, global random seed. To get a predictable outcome from this method, see :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`.
\ **注意:**\ 与引擎中很多类似的函数一样(例如 :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>` :ref:`pick_random<class_Array_method_pick_random>`\ ),该方法使用的是通用的全局随机数种子。如何获取可预知的结果见 :ref:`@GlobalScope.seed<class_@GlobalScope_method_seed>`\ 。
.. rst-class:: classref-item-separator
@@ -1215,7 +1215,7 @@ Shuffles all elements of the array in a random order.
:ref:`int<class_int>` **size**\ (\ ) |const| :ref:`🔗<class_Array_method_size>`
Returns the number of elements in the array. Empty arrays (``[]``) always return ``0``. See also :ref:`is_empty<class_Array_method_is_empty>`.
返回该数组中元素的数量。空数组(\ ``[]``\ )始终返回 ``0``\ 。另请参阅 :ref:`is_empty<class_Array_method_is_empty>`\ 。
.. rst-class:: classref-item-separator
@@ -1227,24 +1227,24 @@ Returns the number of elements in the array. Empty arrays (``[]``) always return
:ref:`Array<class_Array>` **slice**\ (\ begin\: :ref:`int<class_int>`, end\: :ref:`int<class_int>` = 2147483647, step\: :ref:`int<class_int>` = 1, deep\: :ref:`bool<class_bool>` = false\ ) |const| :ref:`🔗<class_Array_method_slice>`
Returns a new **Array** containing this array's elements, from index ``begin`` (inclusive) to ``end`` (exclusive), every ``step`` elements.
返回一个新的 **Array**\ ,其中包含该数组的元素,从索引 ``begin``\ (含)到 ``end``\ (不含),每个 ``step`` 个元素。
If either ``begin`` or ``end`` are negative, their value is relative to the end of the array.
如果 ``begin`` ``end`` 为负数,则它们的值相对于数组的末尾。
If ``step`` is negative, this method iterates through the array in reverse, returning a slice ordered backwards. For this to work, ``begin`` must be greater than ``end``.
如果 ``step`` 为负数,则该方法反向遍历数组,返回按反向顺序排列的切片数组。要使其起作用,\ ``begin`` 必须大于 ``end``\ 。
If ``deep`` is ``true``, all nested **Array** and :ref:`Dictionary<class_Dictionary>` elements in the slice are duplicated from the original, recursively. See also :ref:`duplicate<class_Array_method_duplicate>`).
如果 ``deep`` ``true``\ ,则切片数组中所有嵌套的 **Array**:ref:`Dictionary<class_Dictionary>` 元素都将从原始元素中递归复制。另请参阅 :ref:`duplicate<class_Array_method_duplicate>`)。
::
var letters = ["A", "B", "C", "D", "E", "F"]
print(letters.slice(0, 2)) # Prints ["A", "B"]
print(letters.slice(2, -2)) # Prints ["C", "D"]
print(letters.slice(-2, 6)) # Prints ["E", "F"]
print(letters.slice(0, 2)) # 输出 ["A", "B"]
print(letters.slice(2, -2)) # 输出 ["C", "D"]
print(letters.slice(-2, 6)) # 输出 ["E", "F"]
print(letters.slice(0, 6, 2)) # Prints ["A", "C", "E"]
print(letters.slice(4, 1, -1)) # Prints ["E", "D", "C"]
print(letters.slice(0, 6, 2)) # 输出 ["A", "C", "E"]
print(letters.slice(4, 1, -1)) # 输出 ["E", "D", "C"]
.. rst-class:: classref-item-separator
@@ -1256,7 +1256,7 @@ If ``deep`` is ``true``, all nested **Array** and :ref:`Dictionary<class_Diction
|void| **sort**\ (\ ) :ref:`🔗<class_Array_method_sort>`
Sorts the array in ascending order. The final order is dependent on the "less than" (``>``) comparison between elements.
按升序对数组进行排序。最终顺序取决于元素之间的“小于”(\ ``>``\ )比较。
.. tabs::
@@ -1265,17 +1265,17 @@ Sorts the array in ascending order. The final order is dependent on the "less th
var numbers = [10, 5, 2.5, 8]
numbers.sort()
print(numbers) # Prints [2.5, 5, 8, 10]
print(numbers) # 输出 [2.5, 5, 8, 10]
.. code-tab:: csharp
var numbers = new Godot.Collections.Array { 10, 5, 2.5, 8 };
numbers.Sort();
GD.Print(numbers); // Prints [2.5, 5, 8, 10]
GD.Print(numbers); // 输出 [2.5, 5, 8, 10]
\ **Note:** The sorting algorithm used is not `stable <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__. This means that equivalent elements (such as ``2`` and ``2.0``) may have their order changed when calling :ref:`sort<class_Array_method_sort>`.
\ **注意:**\ 使用的排序算法并不\ `稳定 <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__\ 。这意味着等效元素(例如 ``2`` ``2.0``\ )在调用 :ref:`sort<class_Array_method_sort>` 时可能会改变其顺序。
.. rst-class:: classref-item-separator
@@ -1287,9 +1287,9 @@ Sorts the array in ascending order. The final order is dependent on the "less th
|void| **sort_custom**\ (\ func\: :ref:`Callable<class_Callable>`\ ) :ref:`🔗<class_Array_method_sort_custom>`
Sorts the array using a custom :ref:`Callable<class_Callable>`.
使用自定义的 :ref:`Callable<class_Callable>` 对数组进行排序。
\ ``func`` is called as many times as necessary, receiving two array elements as arguments. The function should return ``true`` if the first element should be moved *behind* the second one, otherwise it should return ``false``.
\ ``func`` 可根据需要多次调用,接收两个数组元素作为参数。如果第一个元素应移到第二个元素的\ *前面*\ ,则该函数应返回 ``true``\ ,否则应返回 ``false``\ 。
::
@@ -1301,25 +1301,25 @@ Sorts the array using a custom :ref:`Callable<class_Callable>`.
func _ready():
var my_items = [["Tomato", 5], ["Apple", 9], ["Rice", 4]]
my_items.sort_custom(sort_ascending)
print(my_items) # Prints [["Rice", 4], ["Tomato", 5], ["Apple", 9]]
print(my_items) # 输出 [["Rice", 4], ["Tomato", 5], ["Apple", 9]]
# Sort descending, using a lambda function.
# 使用 lambda 函数按降序排序。
my_items.sort_custom(func(a, b): return a[0] > b[0])
print(my_items) # Prints [["Apple", 9], ["Tomato", 5], ["Rice", 4]]
print(my_items) # 输出 [["Apple", 9], ["Tomato", 5], ["Rice", 4]]
It may also be necessary to use this method to sort strings by natural order, with :ref:`String.naturalnocasecmp_to<class_String_method_naturalnocasecmp_to>`, as in the following example:
可能还需要使用该方法按自然顺序对字符串进行排序,使用 :ref:`String.naturalnocasecmp_to<class_String_method_naturalnocasecmp_to>`\ ,如下例所示:
::
var files = ["newfile1", "newfile2", "newfile10", "newfile11"]
files.sort_custom(func(a, b): return a.naturalnocasecmp_to(b) < 0)
print(files) # Prints ["newfile1", "newfile2", "newfile10", "newfile11"]
print(files) # 输出 ["newfile1", "newfile2", "newfile10", "newfile11"]
\ **Note:** In C#, this method is not supported.
\ **注意:**\ 在 C# 中,不支持该方法。
\ **Note:** The sorting algorithm used is not `stable <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__. This means that values considered equal may have their order changed when calling this method.
\ **注意:**\ 使用的排序算法并不是\ `稳定的 <https://en.wikipedia.org/wiki/Sorting_algorithm#Stability>`__\ 。这意味着在调用该方法时,被视为相等的值的顺序可能会发生变化。
\ **Note:** You should not randomize the return value of ``func``, as the heapsort algorithm expects a consistent result. Randomizing the return value will result in unexpected behavior.
\ **注意:**\ 不应随机化 ``func`` 的返回值,因为堆排序算法需要一致的结果。随机化返回值将导致意外行为。
.. rst-class:: classref-section-separator
@@ -1336,7 +1336,7 @@ It may also be necessary to use this method to sort strings by natural order, wi
:ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_neq_Array>`
Returns ``true`` if the array's size or its elements are different than ``right``'s.
如果该数组的大小或其元素与 ``right`` 不同,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
@@ -1348,7 +1348,7 @@ Returns ``true`` if the array's size or its elements are different than ``right`
:ref:`Array<class_Array>` **operator +**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_sum_Array>`
Appends the ``right`` array to the left operand, creating a new **Array**. This is also known as an array concatenation.
``right`` 数组追加到左操作数,会创建一个新的 **Array**\ 。这也称为数组拼接。
.. tabs::
@@ -1357,18 +1357,18 @@ Appends the ``right`` array to the left operand, creating a new **Array**. This
var array1 = ["One", 2]
var array2 = [3, "Four"]
print(array1 + array2) # Prints ["One", 2, 3, "Four"]
print(array1 + array2) # 输出 ["One", 2, 3, "Four"]
.. code-tab:: csharp
// Note that concatenation is not possible with C#'s native Array type.
// 请注意C# 的原生数组类型无法进行拼接。
var array1 = new Godot.Collections.Array{"One", 2};
var array2 = new Godot.Collections.Array{3, "Four"};
GD.Print(array1 + array2); // Prints ["One", 2, 3, "Four"]
GD.Print(array1 + array2); // 输出 ["One", 2, 3, "Four"]
\ **Note:** For existing arrays, :ref:`append_array<class_Array_method_append_array>` is much more efficient than concatenation and assignment with the ``+=`` operator.
\ **注意:**\ 对于已有数组,\ :ref:`append_array<class_Array_method_append_array>` 比使用 ``+=`` 运算符的拼接和赋值效率高得多。
.. rst-class:: classref-item-separator
@@ -1380,9 +1380,9 @@ Appends the ``right`` array to the left operand, creating a new **Array**. This
:ref:`bool<class_bool>` **operator <**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_lt_Array>`
Compares the elements of both arrays in order, starting from index ``0`` and ending on the last index in common between both arrays. For each pair of elements, returns ``true`` if this array's element is less than ``right``'s, ``false`` if this element is greater. Otherwise, continues to the next pair.
按顺序比较两个数组的元素,从索引 ``0`` 开始,到两个数组共同的最后一个索引结束。对于每对元素,如果该数组的元素小于 ``right`` 的元素,则返回 ``true``\ ;如果该元素大于 ``right`` 的元素,则返回 ``false``\ 。否则,继续下一对。
If all searched elements are equal, returns ``true`` if this array's size is less than ``right``'s, otherwise returns ``false``.
当所有搜索到的元素都相等时,如果该数组的大小小于 ``right`` 的大小,则返回 ``true``\ ,否则返回 ``false``\ 。
.. rst-class:: classref-item-separator
@@ -1394,9 +1394,9 @@ If all searched elements are equal, returns ``true`` if this array's size is les
:ref:`bool<class_bool>` **operator <=**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_lte_Array>`
Compares the elements of both arrays in order, starting from index ``0`` and ending on the last index in common between both arrays. For each pair of elements, returns ``true`` if this array's element is less than ``right``'s, ``false`` if this element is greater. Otherwise, continues to the next pair.
按顺序比较两个数组的元素,从索引 ``0`` 开始,到两个数组共同的最后一个索引结束。对于每对元素,如果该数组的元素小于 ``right`` 的元素,则返回 ``true``\ ;如果该元素较大则返回 ``false``\ 。否则,继续下一对。
If all searched elements are equal, returns ``true`` if this array's size is less or equal to ``right``'s, otherwise returns ``false``.
当所有搜索到的元素都相等时,如果该数组的大小小于或等于 ``right`` 的大小,则返回 ``true``\ ,否则返回 ``false``\ 。
.. rst-class:: classref-item-separator
@@ -1420,9 +1420,9 @@ If all searched elements are equal, returns ``true`` if this array's size is les
:ref:`bool<class_bool>` **operator >**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_gt_Array>`
Compares the elements of both arrays in order, starting from index ``0`` and ending on the last index in common between both arrays. For each pair of elements, returns ``true`` if this array's element is greater than ``right``'s, ``false`` if this element is less. Otherwise, continues to the next pair.
按顺序比较两个数组的元素,从索引 ``0`` 开始,到两个数组共同的最后一个索引结束。对于每对元素,如果该数组的元素大于 ``right`` 的元素,则返回 ``true``\ ;如果该元素较小则返回 ``false``\ 。否则,继续下一对。
If all searched elements are equal, returns ``true`` if this array's size is greater than ``right``'s, otherwise returns ``false``.
当所有搜索到的元素都相等时,如果该数组的大小大于 ``right`` 的大小,则返回 ``true``\ ,否则返回 ``false``\ 。
.. rst-class:: classref-item-separator
@@ -1434,9 +1434,9 @@ If all searched elements are equal, returns ``true`` if this array's size is gre
:ref:`bool<class_bool>` **operator >=**\ (\ right\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_Array_operator_gte_Array>`
Compares the elements of both arrays in order, starting from index ``0`` and ending on the last index in common between both arrays. For each pair of elements, returns ``true`` if this array's element is greater than ``right``'s, ``false`` if this element is less. Otherwise, continues to the next pair.
按顺序比较两个数组的元素,从索引 ``0`` 开始,到两个数组共同的最后一个索引结束。对于每对元素,如果该数组的元素大于 ``right`` 的元素,则返回 ``true``\ ,如果该元素较小则返回 ``false``\ 。否则,继续下一对。
If all searched elements are equal, returns ``true`` if this array's size is greater or equal to ``right``'s, otherwise returns ``false``.
当所有搜索到的元素都相等时,如果该数组的大小大于或等于 ``right`` 的大小,则返回 ``true``\ ,否则返回 ``false``\ 。
.. rst-class:: classref-item-separator
@@ -1448,7 +1448,7 @@ If all searched elements are equal, returns ``true`` if this array's size is gre
:ref:`Variant<class_Variant>` **operator []**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Array_operator_idx_int>`
Returns the :ref:`Variant<class_Variant>` element at the specified ``index``. Arrays start at index 0. If ``index`` is greater or equal to ``0``, the element is fetched starting from the beginning of the array. If ``index`` is a negative value, the element is fetched starting from the end. Accessing an array out-of-bounds will cause a run-time error, pausing the project execution if run from the editor.
返回指定 ``index`` 处的 :ref:`Variant<class_Variant>` 元素。数组从索引 0 开始。如果 ``index`` 大于或等于 ``0``\ ,则从数组开头开始获取元素。如果 ``index`` 为负值,则从末尾开始获取元素。越界访问数组将导致运行时错误,从编辑器中运行时会暂停项目执行。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ArrayMesh.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/ArrayMesh.xml.
.. _class_ArrayMesh:
@@ -197,9 +197,9 @@ ArrayMesh
- |void| **set_shadow_mesh**\ (\ value\: :ref:`ArrayMesh<class_ArrayMesh>`\ )
- :ref:`ArrayMesh<class_ArrayMesh>` **get_shadow_mesh**\ (\ )
An optional mesh which can be used for rendering shadows and the depth prepass. Can be used to increase performance by supplying a mesh with fused vertices and only vertex position data (without normals, UVs, colors, etc.).
可选网格可用于渲染阴影和预深度阶段。可通过提供融合顶点和仅顶点位置数据不含法线、UV、颜色等的网格来提高性能。
\ **Note:** This mesh must have exactly the same vertex positions as the source mesh (including the source mesh's LODs, if present). If vertex positions differ, then the mesh will not draw correctly.
\ **注意:**\ 该网格必须具有与源网格完全相同的顶点位置(包括源网格的 LOD如果存在。如果顶点位置不同则网格将无法正确绘制。
.. rst-class:: classref-section-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/ArrayOccluder3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/ArrayOccluder3D.xml.
.. _class_ArrayOccluder3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AspectRatioContainer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AspectRatioContainer.xml.
.. _class_AspectRatioContainer:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStar2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStar2D.xml.
.. _class_AStar2D:
@@ -287,7 +287,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
返回一个数组,其中包含构成由 AStar2D 在给定点之间找到的路径的点的 ID。数组从路径的起点到终点进行排序。
如果目标没有有效路径,并且\ ``allow_partial_path``\ 为\ ``true``\ ,则返回到最接近可到达目标点的路径。
如果没有能够到达目标的有效路径,并且 ``allow_partial_path`` 为\ ``true``\ ,则返回能够到达的最接近目标点的路径。
.. tabs::
@@ -319,7 +319,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
int[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
@@ -376,7 +376,7 @@ A\* 算法的一种实现,用于在 2D 空间中的连通图上找到两个顶
astar.ConnectPoints(1, 2, true);
astar.ConnectPoints(1, 3, true);
int[] neighbors = astar.GetPointConnections(1); // 返回 [2, 3]
long[] neighbors = astar.GetPointConnections(1); // 返回 [2, 3]

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStar3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStar3D.xml.
.. _class_AStar3D:
@@ -324,7 +324,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
返回一个数组,其中包含构成 AStar3D 在给定点之间找到的路径中的点的 ID。数组从路径的起点到终点排序。
如果没有通往目标的有效路径并且 ``allow_partial_path````true``\ ,则返回通往距离目标最近的可达点的路径。
如果没有能够到达目标的有效路径并且 ``allow_partial_path``\ ``true``\ ,则返回能够到达的最接近目标点的路径。
.. tabs::
@@ -355,7 +355,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
astar.ConnectPoints(2, 3, false);
astar.ConnectPoints(4, 3, false);
astar.ConnectPoints(1, 4, false);
int[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
long[] res = astar.GetIdPath(1, 3); // 返回 [1, 2, 3]
@@ -411,7 +411,7 @@ A\*A 星)是一种计算机算法,用于寻路和图遍历,即穿过一
astar.ConnectPoints(1, 2, true);
astar.ConnectPoints(1, 3, true);
int[] neighbors = astar.GetPointConnections(1); // 返回 [2, 3]
long[] neighbors = astar.GetPointConnections(1); // 返回 [2, 3]

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AStarGrid2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AStarGrid2D.xml.
.. _class_AStarGrid2D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AtlasTexture.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AtlasTexture.xml.
.. _class_AtlasTexture:
@@ -116,7 +116,7 @@ AtlasTexture
- |void| **set_region**\ (\ value\: :ref:`Rect2<class_Rect2>`\ )
- :ref:`Rect2<class_Rect2>` **get_region**\ (\ )
The region used to draw the :ref:`atlas<class_AtlasTexture_property_atlas>`. If either dimension of the region's size is ``0``, the value from :ref:`atlas<class_AtlasTexture_property_atlas>` size will be used for that axis instead.
绘制 :ref:`atlas<class_AtlasTexture_property_atlas>` 的区域。如果区域在某个方向上大小为 ``0``\ ,则该方向会使用 :ref:`atlas<class_AtlasTexture_property_atlas>` 的大小。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioBusLayout.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioBusLayout.xml.
.. _class_AudioBusLayout:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffect.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffect.xml.
.. _class_AudioEffect:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectAmplify.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectAmplify.xml.
.. _class_AudioEffectAmplify:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectBandLimitFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectBandLimitFilter.xml.
.. _class_AudioEffectBandLimitFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectBandPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectBandPassFilter.xml.
.. _class_AudioEffectBandPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectCapture.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectCapture.xml.
.. _class_AudioEffectCapture:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectChorus.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectChorus.xml.
.. _class_AudioEffectChorus:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectCompressor.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectCompressor.xml.
.. _class_AudioEffectCompressor:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectDelay.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectDelay.xml.
.. _class_AudioEffectDelay:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectDistortion.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectDistortion.xml.
.. _class_AudioEffectDistortion:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ.xml.
.. _class_AudioEffectEQ:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ10.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ10.xml.
.. _class_AudioEffectEQ10:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ21.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ21.xml.
.. _class_AudioEffectEQ21:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectEQ6.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectEQ6.xml.
.. _class_AudioEffectEQ6:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectFilter.xml.
.. _class_AudioEffectFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHardLimiter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHardLimiter.xml.
.. _class_AudioEffectHardLimiter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHighPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHighPassFilter.xml.
.. _class_AudioEffectHighPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectHighShelfFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectHighShelfFilter.xml.
.. _class_AudioEffectHighShelfFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectInstance.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectInstance.xml.
.. _class_AudioEffectInstance:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLimiter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLimiter.xml.
.. _class_AudioEffectLimiter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLowPassFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLowPassFilter.xml.
.. _class_AudioEffectLowPassFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectLowShelfFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectLowShelfFilter.xml.
.. _class_AudioEffectLowShelfFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectNotchFilter.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectNotchFilter.xml.
.. _class_AudioEffectNotchFilter:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPanner.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPanner.xml.
.. _class_AudioEffectPanner:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPhaser.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPhaser.xml.
.. _class_AudioEffectPhaser:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectPitchShift.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectPitchShift.xml.
.. _class_AudioEffectPitchShift:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectRecord.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectRecord.xml.
.. _class_AudioEffectRecord:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectReverb.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectReverb.xml.
.. _class_AudioEffectReverb:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectSpectrumAnalyzer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectSpectrumAnalyzer.xml.
.. _class_AudioEffectSpectrumAnalyzer:
@@ -19,11 +19,11 @@ AudioEffectSpectrumAnalyzer
描述
----
This audio effect does not affect sound output, but can be used for real-time audio visualizations.
这种音频效果不影响声音输出,但可以用于实时音频可视化。
This resource configures an :ref:`AudioEffectSpectrumAnalyzerInstance<class_AudioEffectSpectrumAnalyzerInstance>`, which performs the actual analysis at runtime. An instance can be acquired with :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>`.
该资源配置了一个 :ref:`AudioEffectSpectrumAnalyzerInstance<class_AudioEffectSpectrumAnalyzerInstance>`\ ,它在运行时执行实际分析。可以使用 :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>` 获取实例。
See also :ref:`AudioStreamGenerator<class_AudioStreamGenerator>` for procedurally generating sounds.
使用程序生成声音请参阅 :ref:`AudioStreamGenerator<class_AudioStreamGenerator>`\ 。
.. rst-class:: classref-introduction-group

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectSpectrumAnalyzerInstance.xml.
.. _class_AudioEffectSpectrumAnalyzerInstance:
@@ -12,16 +12,16 @@ AudioEffectSpectrumAnalyzerInstance
**继承:** :ref:`AudioEffectInstance<class_AudioEffectInstance>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Queryable instance of an :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>`.
:ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>` 的可查询实例。
.. rst-class:: classref-introduction-group
描述
----
The runtime part of an :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>`, which can be used to query the magnitude of a frequency range on its host bus.
:ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>` 的运行时部分,可以用来查询宿主总线上某个频率范围内的幅度。
An instance of this class can be acquired with :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>`.
可以使用 :ref:`AudioServer.get_bus_effect_instance<class_AudioServer_method_get_bus_effect_instance>` 获取该类的实例。
.. rst-class:: classref-introduction-group
@@ -63,7 +63,7 @@ enum **MagnitudeMode**: :ref:`🔗<enum_AudioEffectSpectrumAnalyzerInstance_Magn
:ref:`MagnitudeMode<enum_AudioEffectSpectrumAnalyzerInstance_MagnitudeMode>` **MAGNITUDE_AVERAGE** = ``0``
Use the average value across the frequency range as magnitude.
使用频率范围内的平均值作为幅度。
.. _class_AudioEffectSpectrumAnalyzerInstance_constant_MAGNITUDE_MAX:
@@ -71,7 +71,7 @@ Use the average value across the frequency range as magnitude.
:ref:`MagnitudeMode<enum_AudioEffectSpectrumAnalyzerInstance_MagnitudeMode>` **MAGNITUDE_MAX** = ``1``
Use the maximum value of the frequency range as magnitude.
使用频率范围内的最大值作为幅度。
.. rst-class:: classref-section-separator
@@ -88,9 +88,9 @@ Use the maximum value of the frequency range as magnitude.
:ref:`Vector2<class_Vector2>` **get_magnitude_for_frequency_range**\ (\ from_hz\: :ref:`float<class_float>`, to_hz\: :ref:`float<class_float>`, mode\: :ref:`MagnitudeMode<enum_AudioEffectSpectrumAnalyzerInstance_MagnitudeMode>` = 1\ ) |const| :ref:`🔗<class_AudioEffectSpectrumAnalyzerInstance_method_get_magnitude_for_frequency_range>`
Returns the magnitude of the frequencies from ``from_hz`` to ``to_hz`` in linear energy as a Vector2. The ``x`` component of the return value represents the left stereo channel, and ``y`` represents the right channel.
返回从 ``from_hz`` ``to_hz`` 频率范围内的幅度,使用线性能量单位,返回的是 Vector2。返回值的 ``x`` 分量代表左声道、\ ``y`` 分量代表右声道。
\ ``mode`` determines how the frequency range will be processed. See :ref:`MagnitudeMode<enum_AudioEffectSpectrumAnalyzerInstance_MagnitudeMode>`.
\ ``mode`` 决定的是频率范围的处理方式,见 :ref:`MagnitudeMode<enum_AudioEffectSpectrumAnalyzerInstance_MagnitudeMode>`\ 。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioEffectStereoEnhance.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioEffectStereoEnhance.xml.
.. _class_AudioEffectStereoEnhance:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioListener2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioListener2D.xml.
.. _class_AudioListener2D:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioListener3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioListener3D.xml.
.. _class_AudioListener3D:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioSample.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioSample.xml.
.. _class_AudioSample:
@@ -14,14 +14,14 @@ AudioSample
**继承:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Base class for audio samples.
音频样本的基类。
.. rst-class:: classref-introduction-group
描述
----
Base class for audio samples.
音频样本的基类。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioSamplePlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioSamplePlayback.xml.
.. _class_AudioSamplePlayback:
@@ -14,14 +14,14 @@ AudioSamplePlayback
**继承:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Meta class for playing back audio samples.
用于播放音频样本的元类。
.. rst-class:: classref-introduction-group
描述
----
Meta class for playing back audio samples.
用于播放音频样本的元类。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioServer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioServer.xml.
.. _class_AudioServer:
@@ -238,7 +238,7 @@ enum **PlaybackType**: :ref:`🔗<enum_AudioServer_PlaybackType>`
**实验性:** 未来版本中可能会修改或移除该常量。
The playback will be considered of the type declared at :ref:`ProjectSettings.audio/general/default_playback_type<class_ProjectSettings_property_audio/general/default_playback_type>`.
播放将被视为在 :ref:`ProjectSettings.audio/general/default_playback_type<class_ProjectSettings_property_audio/general/default_playback_type>` 处声明的类型。
.. _class_AudioServer_constant_PLAYBACK_TYPE_STREAM:
@@ -248,7 +248,7 @@ The playback will be considered of the type declared at :ref:`ProjectSettings.au
**实验性:** 未来版本中可能会修改或移除该常量。
Force the playback to be considered as a stream.
强制将播放视为流。
.. _class_AudioServer_constant_PLAYBACK_TYPE_SAMPLE:
@@ -258,11 +258,11 @@ Force the playback to be considered as a stream.
**实验性:** 未来版本中可能会修改或移除该常量。
Force the playback to be considered as a sample. This can provide lower latency and more stable playback (with less risk of audio crackling), at the cost of having less flexibility.
强制将播放视为样本。这可以提供更低的延迟和更稳定的播放(音频噼啪声的风险更小),但代价是灵活性较低。
\ **Note:** Only currently supported on the web platform.
\ **注意:**\ 目前仅支持 Web 平台。
\ **Note:** :ref:`AudioEffect<class_AudioEffect>`\ s are not supported when playback is considered as a sample.
\ **注意:**\ 将播放视为样本时不支持 :ref:`AudioEffect<class_AudioEffect>`\
.. _class_AudioServer_constant_PLAYBACK_TYPE_MAX:
@@ -272,7 +272,7 @@ Force the playback to be considered as a sample. This can provide lower latency
**实验性:** 未来版本中可能会修改或移除该常量。
Represents the size of the :ref:`PlaybackType<enum_AudioServer_PlaybackType>` enum.
代表 :ref:`PlaybackType<enum_AudioServer_PlaybackType>` 枚举的大小。
.. rst-class:: classref-section-separator
@@ -658,9 +658,9 @@ Represents the size of the :ref:`PlaybackType<enum_AudioServer_PlaybackType>` en
**实验性:** 未来版本中可能会修改或移除该方法。
If ``true``, the stream is registered as a sample. The engine will not have to register it before playing the sample.
如果为 ``true``\ ,则该流已被注册为样本。引擎无需在播放样本之前对其进行注册。
If ``false``, the stream will have to be registered before playing it. To prevent lag spikes, register the stream as sample with :ref:`register_stream_as_sample<class_AudioServer_method_register_stream_as_sample>`.
如果为 ``false``\ ,则必须在播放之前注册该流。为防止延迟峰值,请使用 :ref:`register_stream_as_sample<class_AudioServer_method_register_stream_as_sample>` 将流注册为样本。
.. rst-class:: classref-item-separator
@@ -700,9 +700,9 @@ If ``false``, the stream will have to be registered before playing it. To preven
**实验性:** 未来版本中可能会修改或移除该方法。
Forces the registration of a stream as a sample.
强制将流注册为样本。
\ **Note:** Lag spikes may occur when calling this method, especially on single-threaded builds. It is suggested to call this method while loading assets, where the lag spike could be masked, instead of registering the sample right before it needs to be played.
\ **注意:**\ 调用该方法时可能会出现延迟峰值,尤其是在单线程构建中。建议在加载资产时调用该方法,这样可以掩盖延迟峰值,而不是在需要播放样本之前才注册样本。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStream.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStream.xml.
.. _class_AudioStream:
@@ -194,7 +194,7 @@ AudioStream
**实验性:** 未来版本中可能会修改或移除该方法。
Returns if the current **AudioStream** can be used as a sample. Only static streams can be sampled.
返回当前 **AudioStream** 是否可以用作样本。仅可对静态流进行采样。
.. rst-class:: classref-item-separator
@@ -208,7 +208,7 @@ Returns if the current **AudioStream** can be used as a sample. Only static stre
**实验性:** 未来版本中可能会修改或移除该方法。
Generates an :ref:`AudioSample<class_AudioSample>` based on the current stream.
根据当前流生成 :ref:`AudioSample<class_AudioSample>`\ 。
.. rst-class:: classref-item-separator
@@ -244,7 +244,7 @@ Generates an :ref:`AudioSample<class_AudioSample>` based on the current stream.
:ref:`bool<class_bool>` **is_meta_stream**\ (\ ) |const| :ref:`🔗<class_AudioStream_method_is_meta_stream>`
Returns ``true`` if the stream is a collection of other streams, ``false`` otherwise.
如果该流是其他流的集合,则返回 ``true``\ ,否则返回 ``false``\ 。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamGenerator.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamGenerator.xml.
.. _class_AudioStreamGenerator:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamGeneratorPlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamGeneratorPlayback.xml.
.. _class_AudioStreamGeneratorPlayback:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamInteractive.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamInteractive.xml.
.. _class_AudioStreamInteractive:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamMicrophone.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamMicrophone.xml.
.. _class_AudioStreamMicrophone:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/minimp3/doc_classes/AudioStreamMP3.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/minimp3/doc_classes/AudioStreamMP3.xml.
.. _class_AudioStreamMP3:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/vorbis/doc_classes/AudioStreamOggVorbis.xml.
.. _class_AudioStreamOggVorbis:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayback.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayback.xml.
.. _class_AudioStreamPlayback:
@@ -203,7 +203,7 @@ AudioStreamPlayback
**实验性:** 未来版本中可能会修改或移除该方法。
Returns the :ref:`AudioSamplePlayback<class_AudioSamplePlayback>` associated with this **AudioStreamPlayback** for playing back the audio sample of this stream.
返回与该 **AudioStreamPlayback** 相关联的、用于播放该流的音频样本的 :ref:`AudioSamplePlayback<class_AudioSamplePlayback>`\ ,。
.. rst-class:: classref-item-separator
@@ -217,7 +217,7 @@ Returns the :ref:`AudioSamplePlayback<class_AudioSamplePlayback>` associated wit
**实验性:** 未来版本中可能会修改或移除该方法。
Associates :ref:`AudioSamplePlayback<class_AudioSamplePlayback>` to this **AudioStreamPlayback** for playing back the audio sample of this stream.
:ref:`AudioSamplePlayback<class_AudioSamplePlayback>` 与该 **AudioStreamPlayback** 关联以播放该流的音频样本。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackInteractive.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackInteractive.xml.
.. _class_AudioStreamPlaybackInteractive:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/vorbis/doc_classes/AudioStreamPlaybackOggVorbis.xml.
.. _class_AudioStreamPlaybackOggVorbis:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackPlaylist.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackPlaylist.xml.
.. _class_AudioStreamPlaybackPlaylist:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlaybackPolyphonic.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlaybackPolyphonic.xml.
.. _class_AudioStreamPlaybackPolyphonic:
@@ -85,13 +85,13 @@ AudioStreamPlaybackPolyphonic
:ref:`int<class_int>` **play_stream**\ (\ stream\: :ref:`AudioStream<class_AudioStream>`, from_offset\: :ref:`float<class_float>` = 0, volume_db\: :ref:`float<class_float>` = 0, pitch_scale\: :ref:`float<class_float>` = 1.0, playback_type\: :ref:`PlaybackType<enum_AudioServer_PlaybackType>` = 0, bus\: :ref:`StringName<class_StringName>` = &"Master"\ ) :ref:`🔗<class_AudioStreamPlaybackPolyphonic_method_play_stream>`
Play an :ref:`AudioStream<class_AudioStream>` at a given offset, volume, pitch scale, playback type, and bus. Playback starts immediately.
以给定的偏移量、音量、音高比例、播放类型、和总线播放 :ref:`AudioStream<class_AudioStream>`\ 。播放立即开始。
The return value is a unique integer ID that is associated to this playback stream and which can be used to control it.
返回值是与该播放流关联的唯一整数 ID可用于控制该播放流。
This ID becomes invalid when the stream ends (if it does not loop), when the **AudioStreamPlaybackPolyphonic** is stopped, or when :ref:`stop_stream<class_AudioStreamPlaybackPolyphonic_method_stop_stream>` is called.
当流结束(不循环)、\ **AudioStreamPlaybackPolyphonic** 停止或 :ref:`stop_stream<class_AudioStreamPlaybackPolyphonic_method_stop_stream>` 被调用时,该 ID 将失效。
This function returns :ref:`INVALID_ID<class_AudioStreamPlaybackPolyphonic_constant_INVALID_ID>` if the amount of streams currently playing equals :ref:`AudioStreamPolyphonic.polyphony<class_AudioStreamPolyphonic_property_polyphony>`. If you need a higher amount of maximum polyphony, raise this value.
如果当前播放的流的数量等于 :ref:`AudioStreamPolyphonic.polyphony<class_AudioStreamPolyphonic_property_polyphony>`\ ,则该函数将返回 :ref:`INVALID_ID<class_AudioStreamPlaybackPolyphonic_constant_INVALID_ID>`\ 。如果需要更大的最大复音数,请提高该值。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlaybackResampled.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlaybackResampled.xml.
.. _class_AudioStreamPlaybackResampled:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaybackSynchronized.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaybackSynchronized.xml.
.. _class_AudioStreamPlaybackSynchronized:

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer.xml.
.. _class_AudioStreamPlayer:
@@ -262,7 +262,7 @@ enum **MixTarget**: :ref:`🔗<enum_AudioStreamPlayer_MixTarget>`
**实验性:** 未来版本中可能会修改或移除该属性。
The playback type of the stream player. If set other than to the default value, it will force that playback type.
流播放器的播放类型。如果设置为非默认值,则将强制使用该播放类型。
.. rst-class:: classref-item-separator

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer2D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer2D.xml.
.. _class_AudioStreamPlayer2D:
@@ -272,7 +272,7 @@ AudioStreamPlayer2D
**实验性:** 未来版本中可能会修改或移除该属性。
The playback type of the stream player. If set other than to the default value, it will force that playback type.
流播放器的播放类型。如果设置为非默认值,则将强制使用该播放类型。
.. rst-class:: classref-item-separator

View File

@@ -5,8 +5,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPlayer3D.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPlayer3D.xml.
.. _class_AudioStreamPlayer3D:
@@ -488,7 +488,7 @@ enum **DopplerTracking**: :ref:`🔗<enum_AudioStreamPlayer3D_DopplerTracking>`
**实验性:** 未来版本中可能会修改或移除该属性。
The playback type of the stream player. If set other than to the default value, it will force that playback type.
流播放器的播放类型。如果设置为非默认值,则将强制使用该播放类型。
.. rst-class:: classref-item-separator

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/interactive_music/doc_classes/AudioStreamPlaylist.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/modules/interactive_music/doc_classes/AudioStreamPlaylist.xml.
.. _class_AudioStreamPlaylist:

View File

@@ -2,8 +2,8 @@
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AudioStreamPolyphonic.xml.
.. Generator: https://github.com/godotengine/godot/tree/4.3/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.3/doc/classes/AudioStreamPolyphonic.xml.
.. _class_AudioStreamPolyphonic:

Some files were not shown because too many files have changed in this diff Show More