Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
TextureProgressBar
繼承: Range < Control < CanvasItem < Node < Object
基於紋理的進度條。適用於載入螢幕和生命或體力條。
說明
TextureProgressBar 的工作方式類似於 ProgressBar,但最多使用 3 個紋理,不使用 Godot 的 Theme 資源。可用於建立水平、垂直和徑向進度條。
屬性
|
||
mouse_filter |
|
|
|
||
|
||
|
||
|
||
BitField[SizeFlags] |
size_flags_vertical |
|
step |
|
|
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
get_stretch_margin(margin: Side) const |
|
void |
set_stretch_margin(margin: Side, value: int) |
列舉
enum FillMode: 🔗
FillMode FILL_LEFT_TO_RIGHT = 0
texture_progress 從左到右填充。
FillMode FILL_RIGHT_TO_LEFT = 1
texture_progress 從右到左填充。
FillMode FILL_TOP_TO_BOTTOM = 2
texture_progress 從上到下填充。
FillMode FILL_BOTTOM_TO_TOP = 3
texture_progress 自下而上填充。
FillMode FILL_CLOCKWISE = 4
將節點變成徑向條形。texture_progress 順時針填充。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
FillMode FILL_COUNTER_CLOCKWISE = 5
將節點變成徑向條形。texture_progress逆時針填充。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
FillMode FILL_BILINEAR_LEFT_AND_RIGHT = 6
texture_progress從中心開始填充,向左和向右擴充。
FillMode FILL_BILINEAR_TOP_AND_BOTTOM = 7
texture_progress從中心開始填充,同時向頂部和底部擴充。
FillMode FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE = 8
將節點變成徑向條形。texture_progress從中心徑向填充,順時針和逆時針擴充。參閱radial_center_offset、radial_initial_angle和radial_fill_degrees來控制條形填充的方式。
屬性說明
填充方向。可能的取值見 FillMode。
bool nine_patch_stretch = false 🔗
如果為 true,Godot 會像在 NinePatchRect 中那樣處理進度條的紋理。請使用 stretch_margin_bottom 等 stretch_margin_* 屬性來設定九宮格的 3×3 網格。當使用徑向的 fill_mode 時,該設定將為 texture_progress 啟用拉伸,texture_under 和 texture_over 則進行類似於 NinePatchRect 的處理。
Vector2 radial_center_offset = Vector2(0, 0) 🔗
fill_mode 為 FILL_CLOCKWISE、FILL_COUNTER_CLOCKWISE 或 FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE 時, texture_progress 的偏移。
注意:有效的徑向中心始終保持在 texture_progress 的範圍內。如果需要將其移動到紋理的邊界之外,請修改 texture_progress,讓該紋理包含所需的額外空白空間。
float radial_fill_degrees = 360.0 🔗
fill_mode 為 FILL_CLOCKWISE、FILL_COUNTER_CLOCKWISE 或 FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE 時, texture_progress 的填充上限。當節點的 value 等於其 max_value 時,則紋理將會填充到這個角度。
見 Range.value、Range.max_value。
float radial_initial_angle = 0.0 🔗
fill_mode 為 FILL_CLOCKWISE、FILL_COUNTER_CLOCKWISE 或 FILL_CLOCKWISE_AND_COUNTER_CLOCKWISE 時,texture_progress 填充的起始角度。當節點的 value 等於其 min_value 時,紋理根本不會顯示出來。當 value 增加時,紋理填充並趨向於 radial_fill_degrees。
注意:radial_initial_angle 會在 0 到 360 度之間環繞(包含兩端)。
int stretch_margin_bottom = 0 🔗
九宮格底部一行的高度。邊距為 16 意味著九宮格的底角和側面將有 16 像素的高度。你可以單獨設定所有 4 個邊距值,來建立邊框不均一的面板。僅在 nine_patch_stretch 為 true 時有效。
九宮格左側一列的寬度。僅在 nine_patch_stretch 為 true 時有效。
int stretch_margin_right = 0 🔗
九宮格右側一列的寬度。僅在 nine_patch_stretch 為 true 時有效。
九宮格頂部一行的高度。僅在 nine_patch_stretch 為 true 時有效。
在進度條至上繪製的 Texture2D。可用於新增高光,也可用於新增遮擋部分 texture_progress 的上層邊框。
被裁剪的 Texture2D。裁剪基於該節點的 value 和 fill_mode。隨著 value 的增加,該紋理將被填滿。當 value 達到 max_value 時,它將完整顯示。如果 value 等於 min_value,則它根本不顯示。
value 屬性來自 Range。參見 Range.value、Range.min_value、Range.max_value。
Vector2 texture_progress_offset = Vector2(0, 0) 🔗
texture_progress 的偏移量。對於帶有花哨的邊框的 texture_over 和 texture_under 很有用,可以避免進度紋理的邊緣透明。
在進度條下繪製的 Texture2D。該進度條的背景。
Color tint_over = Color(1, 1, 1, 1) 🔗
將與該進度條的 texture_over 紋理的顏色相乘。其效果類似於 CanvasItem.modulate ,只是它只影響這個特定的紋理,而不是整個節點。
Color tint_progress = Color(1, 1, 1, 1) 🔗
將與該進度條的 texture_progress 紋理的顏色相乘。
Color tint_under = Color(1, 1, 1, 1) 🔗
將與該進度條的 texture_under 紋理的顏色相乘。
方法說明
int get_stretch_margin(margin: Side) const 🔗
返回給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。
void set_stretch_margin(margin: Side, value: int) 🔗
設定給定索引的拉伸邊距。見 stretch_margin_bottom 及相關屬性。