|
@@ -10,7 +10,7 @@ var data = {
|
|
"varsion": "1.0.0",
|
|
"varsion": "1.0.0",
|
|
"mode": "",
|
|
"mode": "",
|
|
"server": {
|
|
"server": {
|
|
- "port": 7020,
|
|
|
|
|
|
+ "port": 9000,
|
|
"address": "game.makeryang.com"
|
|
"address": "game.makeryang.com"
|
|
},
|
|
},
|
|
"account": {
|
|
"account": {
|
|
@@ -31,7 +31,9 @@ func _ready() -> void:
|
|
data["mode"] = "client"
|
|
data["mode"] = "client"
|
|
Request.on_server_ping()
|
|
Request.on_server_ping()
|
|
var error = Client.create_client()
|
|
var error = Client.create_client()
|
|
- if error != OK:
|
|
|
|
|
|
+ if error == OK:
|
|
|
|
+ print("[服务器连接成功]")
|
|
|
|
+ else:
|
|
printerr("[服务器连接失败]")
|
|
printerr("[服务器连接失败]")
|
|
|
|
|
|
# 是否为服务器模式
|
|
# 是否为服务器模式
|
|
@@ -45,6 +47,10 @@ func is_server() -> bool:
|
|
func get_server_port() -> int:
|
|
func get_server_port() -> int:
|
|
return data["server"]["port"]
|
|
return data["server"]["port"]
|
|
|
|
|
|
|
|
+# 获取服务器IP
|
|
|
|
+func get_server_ip() -> String:
|
|
|
|
+ return data["server"]["ip"]
|
|
|
|
+
|
|
# 获取服务器端口
|
|
# 获取服务器端口
|
|
func get_server_address() -> String:
|
|
func get_server_address() -> String:
|
|
return data["server"]["address"]
|
|
return data["server"]["address"]
|