LargeScreen/Modules/tunnel_panel.gd
2025-01-13 14:39:58 +08:00

32 lines
1003 B
GDScript

extends Control
signal search_click(str:String)
signal request_hide()
func get_input()->String:
return $TextureRect2/TextureRext/LineEdit.text
func _on_terminal_search_button_pressed() -> void:
search_click.emit(get_input())
$HTTPRequest.request("https://pixconsole.pixmoving.city/api/device/car_list?imsi=" + %LineEdit.text )
request_hide.emit()
pass # Replace with function body.
func _on_tunnel_close_pressed() -> void:
request_hide.emit()
pass # Replace with function body.
func _on_http_request_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray) -> void:
Global.urlArr = []
var response = str_to_var(body.get_string_from_utf8())
if response.data.items.size() > 0:
var advert = str_to_var(response.data.items[0].advert)
for url in advert:
Global.urlArr.append(url.url)
# 将打印 HTTPRequest 节点使用的用户代理字符串(由 httpbin.org 识别)。
print(Global.urlArr)
pass # Replace with function body.