mirror of
https://github.com/tonytins/dressupzack
synced 2025-05-05 13:34:48 -04:00
This is the start of a major rewrite of the game, using varies add-ons whenever possible instead of reinventing the wheel. Not that it wasn't a good learning experience, but, yeah, glad Godot 4 is finally here.
19 lines
525 B
GDScript
19 lines
525 B
GDScript
extends Window
|
|
|
|
@onready var news_list = $News
|
|
@onready var http_request = $NewsBtns/HTTPRequest
|
|
|
|
func _on_HTTPRequest_request_completed(result, response_code, headers, body):
|
|
var test_json_conv = JSON.new()
|
|
test_json_conv.parse(body.get_string_from_utf8())
|
|
var api_request = test_json_conv.get_data()
|
|
|
|
if api_request["feed"] != null:
|
|
var news_items = api_request["feed"]
|
|
|
|
for news in news_items:
|
|
news_list.add_item(news)
|
|
|
|
func _on_SyncBtn_pressed():
|
|
news_list.clear()
|
|
http_request.request(GameData.NEWS_API)
|