checheche/Robo-Bus-A31-HMI/common/ui.gd

52 lines
2.1 KiB
GDScript3
Raw Normal View History

2024-12-06 21:22:11 +08:00
extends CanvasLayer
@onready var control = $Control
var highlight = 0.0
# Called when the node enters the scene tree for the first time.
func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
var tween = create_tween()
tween.set_loops()
tween.tween_property(self,"highlight",1.0,0.5)
tween.tween_property(self,"highlight",0.0,0.01)
tween.tween_property(self,"highlight",0.0,3)
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
$Control/TextureRect.position = $Control.get_local_mouse_position()+ Vector2(-8,-4)
$Control/TextureRect.material.set_shader_parameter("shine_progress",highlight)
%Label.text = Global.scene.selected_build_id
#var post = Global.scene.tile_map.local_to_map(Global.scene.get_global_mouse_position())
#if Global.scene.reiki_data.has(post):
#%reiki.visible = true
#%reiki.value = Global.scene.reiki_data[post].concentration
#else:
#%reiki.visible = false
pass
#func _input(event):
#if event is InputEventMouseButton:
#if event.button_index == MOUSE_BUTTON_LEFT and event.pressed:
#var node = preload("res://gui/selector.tscn").instantiate()
##node.material.set_shader_parameter("thickness_scalar",0.)
#Global.scene.add_child(node)
#node.global_position = Global.scene.get_global_mouse_position()
#node.z_index = 100
##var tween = create_tween()
##tween.tween_property(node.material,"shader_parameter/thickness_scalar",0.7,0.1)
##tween.tween_property(node.material,"shader_parameter/thickness_scalar",0.7,0.8)
##tween.tween_property(node.material,"shader_parameter/thickness_scalar",0,0.1)
#await get_tree().create_timer(1).timeout
#node.queue_free()
#func mouser_mode(mode):""
#match mode:""
#"正常":
#$Control/TextureRect.texture = load("res://game/knapsack/res/pointer.png")
#$Control/TextureRect.modulate ""= Color("ffffff")
#"战斗":
#$Control/TextureRect.texture = load("res://game/knapsack/res/attack.png")
#$Control/TextureRect.modulate = Color("ff0000")
#$Control/TextureRect/TextureRect.texture = $Control/TextureRect.texture