improve ui and bug fix

This commit was merged in pull request #30.
This commit is contained in:
2026-06-06 14:19:27 +00:00
parent f049c538bd
commit d80aa93bb9
87 changed files with 1777 additions and 209 deletions

View File

@@ -20,6 +20,7 @@ enum AnimateOrder {
@export var show_on_start: bool = false
@export var hide_on_finish: bool = false
@export var reset_state_on_start: bool = true
@export var max_targets: int = 9
var _tween_generation: int = 0
var is_running: bool = false
@@ -51,6 +52,9 @@ func start_tween() -> void:
return
if is_instance_valid(target):
target.set_meta("pre_tween_mouse_filter", target.mouse_filter)
target.mouse_filter = Control.MOUSE_FILTER_IGNORE
if reset_state_on_start:
target.scale = Vector2.ONE
target.modulate.a = 1.0
@@ -74,6 +78,7 @@ func start_tween() -> void:
if current_gen == _tween_generation:
is_running = false
_restore_mouse_filters(sorted_targets)
finished.emit()
@@ -81,22 +86,31 @@ func stop_tween() -> void:
is_running = false
_tween_generation += 1
var current_targets: Array[Control] = _get_current_targets()
_restore_mouse_filters(current_targets)
for target in current_targets:
if is_instance_valid(target):
TweenFX.stop_all(target)
func _restore_mouse_filters(targets_array: Array[Control]) -> void:
for target in targets_array:
if is_instance_valid(target) and target.has_meta("pre_tween_mouse_filter"):
target.mouse_filter = target.get_meta("pre_tween_mouse_filter")
target.remove_meta("pre_tween_mouse_filter")
func _get_current_targets() -> Array[Control]:
if !targets.is_empty():
return targets.duplicate()
var current_targets: Array[Control] = []
if runtime_target_parent == null:
return current_targets
if not targets.is_empty():
current_targets = targets.duplicate()
elif runtime_target_parent != null:
for child in runtime_target_parent.get_children():
var target := child as Control
if target != null:
current_targets.append(target)
for child in runtime_target_parent.get_children():
var target := child as Control
if target != null:
current_targets.append(target)
if max_targets > 0 and current_targets.size() > max_targets:
return current_targets.slice(0, max_targets)
return current_targets