extends Control @onready var date: Label = $TextureRect/date @onready var time: Label = $TextureRect/time @onready var weather: Label = $TextureRect/weather @onready var pos: Label = $TextureRect/pos @onready var h_box_container: HBoxContainer = $ScrollContainer/HBoxContainer @onready var scroll_container: ScrollContainer = $ScrollContainer @onready var map_0 @onready var map_1 @onready var map_2 @onready var map_now @onready var map_add_pos: MarginContainer = $ScrollContainer/HBoxContainer/map_add_pos @onready var pointer: Label = $ScrollContainer/HBoxContainer/map_add_pos/pointer_map/pointer var map_tween:Array=[null,null] func recreate_map_tween(): for i in map_tween.size(): if map_tween[i]==null: map_tween[i]=get_tree().create_tween() else: map_tween[i].stop() map_tween[i].kill() map_tween[i]=get_tree().create_tween() func show_map_animation(map_from,map_next): recreate_map_tween() map_from.modulate.a=1 map_next.modulate.a=1 var map=[map_0,map_1,map_2] for i in map: if not i in [map_from,map_next]: i.hide() i.modulate.a=1 else: i.show() map_tween[0].tween_property(map_from,"modulate:a",0,0.1) map_tween[0].tween_callback(map_from.hide) map_tween[1].tween_property(map_next,"modulate:a",1,0.1) #map_from.hide() #map_next.show() pass signal scene_change(scene_id:String) var scale_rag:float=1: set(val): if val>scale_index_1 and valscale_index_2): show_map_animation(map_now,map_1) map_now=map_1 elif val<=scale_index_1 and scale_rag>scale_index_1: show_map_animation(map_now,map_0) map_now=map_0 elif val>scale_index_2 and scale_rag void: set_map("map_01") update_time() get_window().size_changed.connect(resize_map.bindv([scale_rag,scale_rag,get_global_mouse_position(),init_size])) Global.time_changed.connect(update_time) h_box_container.custom_minimum_size=init_size pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: init_size=get_viewport().size update_pointer() pass var keep_tween:Tween func _gui_input(event: InputEvent) -> void: if event is InputEventMouseMotion and Input.is_action_pressed("mouse_left"): var relative:Vector2=event.relative scroll_container.scroll_horizontal-=relative.x scroll_container.scroll_vertical-=relative.y if Input.is_action_pressed("mouse_up"): if keep_tween==null: keep_tween=get_tree().create_tween() else: keep_tween.stop() keep_tween.kill() keep_tween=get_tree().create_tween() keep_tween.tween_property(self,"scale_rag",clamp(scale_rag+0.2,scale_limit_min,scale_limit_max),0.1) if Input.is_action_just_pressed("mouse_down"): if keep_tween==null: keep_tween=get_tree().create_tween() else: keep_tween.stop() keep_tween.kill() keep_tween=get_tree().create_tween() keep_tween.tween_property(self,"scale_rag",clamp(scale_rag-0.2,scale_limit_min,scale_limit_max),0.1) func _on_back_pressed() -> void: set_process(false) self.hide() pass # Replace with function body. func _on_visibility_changed() -> void: #当地图开始显示的时候 if visible: var tween=create_tween() tween.tween_property(self,"scale_rag",2,0.1) pass