chore:完善项目目录结构和基础框架
- 添加核心系统框架目录结构 - 创建游戏模块化组织架构 - 添加数据配置和本地化支持 - 建立脚本分类管理体系 - 创建场景预制件管理目录
This commit is contained in:
31
scripts/network/NetworkTest.gd
Normal file
31
scripts/network/NetworkTest.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends Node
|
||||
|
||||
# 简单的API测试脚本
|
||||
const API_BASE_URL = "https://whaletownend.xinghangee.icu"
|
||||
|
||||
func _ready():
|
||||
print("API测试脚本已加载")
|
||||
print("服务器地址: ", API_BASE_URL)
|
||||
|
||||
# 测试服务器连接
|
||||
test_server_status()
|
||||
|
||||
func test_server_status():
|
||||
var http_request = HTTPRequest.new()
|
||||
add_child(http_request)
|
||||
http_request.request_completed.connect(_on_status_request_completed)
|
||||
|
||||
print("正在测试服务器连接...")
|
||||
var error = http_request.request(API_BASE_URL)
|
||||
if error != OK:
|
||||
print("请求失败: ", error)
|
||||
|
||||
func _on_status_request_completed(result: int, response_code: int, headers: PackedStringArray, body: PackedByteArray):
|
||||
var response_text = body.get_string_from_utf8()
|
||||
print("服务器状态响应: ", response_code)
|
||||
print("响应内容: ", response_text)
|
||||
|
||||
if response_code == 200:
|
||||
print("✅ 服务器连接正常")
|
||||
else:
|
||||
print("❌ 服务器连接失败")
|
||||
Reference in New Issue
Block a user