This repository has been archived on 2023-04-11. You can view files and clone it, but cannot push or open issues or pull requests.
family-lineage/client/scripts/singletons/ServerConnection.gd
2020-08-15 17:42:49 -04:00

32 lines
926 B
GDScript

extends Node
const KEY := "defaultkey"
const SERVER_ENDPOINT := "nakama.cloudsumu.com"
var _session : NakamaSession
var _client : NakamaClient = Nakama.create_client(KEY, SERVER_ENDPOINT, 7350, "http")
func authenticate_async(email : String, password : String) -> NakamaException:
var result : NakamaException = null
var new_session : NakamaSession = yield(_client.authenticate_email_async(email, password, null, false), "completed")
if not new_session.is_exception():
_session = new_session
else:
result = new_session.get_exception()
return result
func signup_async(email : String, password : String) -> NakamaException:
var result : NakamaException = null
var new_session : NakamaSession = yield(_client.authenticate_email_async(email, password, null, true), "completed")
if not new_session.is_exception():
_session = new_session
else:
result = new_session.get_exception()
return result