extends TextureRect var station_array:Array[String]=["测试站点1","测试站点2","测试站点3","测试站点4","测试站点5","测试站点6"] @export var scroll_text_tscn:PackedScene @export var StationIndicatorIcon:Texture2D var StationInsicatorScale:Array[float]=[1,0.85,0.65,0.45] @export var StationIndicatorNode:Array[Control]=[] @export var StationIndicatorText:Array[Control]=[] var indicator_node:Array=[null,null,null,null] #当前下一站指向的station_index var now_index:int=0 var animation_time:float=0.5 #通过给的station arr完成初始化 func init(): for i in indicator_node.size(): if indicator_node[i]!=null: indicator_node[i][0].queue_free() indicator_node[i][1].queue_free() indicator_node[i]=null if station_array.size()>=4: for i in 4: var new_sprite=Sprite2D.new() new_sprite.scale=Vector2(1,1)*StationInsicatorScale[i] new_sprite.global_position=StationIndicatorNode[i].global_position var new_text=scroll_text_tscn.instantiate() new_text.global_position=StationIndicatorText[i].global_position new_text.size=StationIndicatorText[i].size new_text.text=station_array[i] if i==0: new_text.font_size=60 else: new_text.font_size=50 new_sprite.texture=StationIndicatorIcon add_child(new_sprite) add_child(new_text) indicator_node[i]=[new_sprite,new_text] now_index=0 func _ready() -> void: init() func next(): var now_next_station_index:int=now_index+1 if now_next_station_index>=station_array.size(): return if indicator_node[3]!=null: var sprite=indicator_node[3][0] var text=indicator_node[3][1] var tween=create_tween() tween.set_parallel().tween_property(sprite,"global_position",StationIndicatorNode[2].global_position,animation_time) tween.set_parallel().tween_property(sprite,"scale",Vector2(1,1)*StationInsicatorScale[2],animation_time) tween.set_parallel().tween_property(text,"global_position",StationIndicatorText[2].global_position,animation_time) tween.set_parallel().tween_property(text,"size",StationIndicatorText[2].size,animation_time) if indicator_node[2]!=null: var sprite=indicator_node[2][0] var text=indicator_node[2][1] var tween=create_tween() tween.set_parallel().tween_property(sprite,"global_position",StationIndicatorNode[1].global_position,animation_time) tween.set_parallel().tween_property(sprite,"scale",Vector2(1,1)*StationInsicatorScale[1],animation_time) tween.set_parallel().tween_property(text,"global_position",StationIndicatorText[1].global_position,animation_time) tween.set_parallel().tween_property(text,"size",StationIndicatorText[1].size,animation_time) if indicator_node[1]!=null: var sprite=indicator_node[1][0] var text=indicator_node[1][1] var tween=create_tween() tween.set_parallel().tween_property(sprite,"global_position",StationIndicatorNode[0].global_position,animation_time) tween.set_parallel().tween_property(sprite,"scale",Vector2(1,1)*StationInsicatorScale[0],animation_time) tween.set_parallel().tween_property(text,"global_position",StationIndicatorText[0].global_position,animation_time) tween.set_parallel().tween_property(text,"font_size",60,animation_time) tween.set_parallel().tween_property(text,"size",StationIndicatorText[0].size,animation_time) if indicator_node[0]!=null: var sprite=indicator_node[0][0] var text=indicator_node[0][1] var tween=create_tween() tween.set_parallel().tween_property(sprite,"global_position",%mark_bottom.global_position,animation_time) tween.set_parallel().tween_property(text,"global_position",%text_mark_bottom.global_position,animation_time) tween.set_parallel().tween_property(text,"size",%text_mark_bottom.size,animation_time) tween.set_parallel(false).tween_callback(sprite.queue_free) tween.set_parallel(false).tween_callback(text.queue_free) var need_new_station_index:int=now_index+4 if need_new_station_index void: next() pass # Replace with function body.