Create custom match plugin
Rename world_control Fix package name Attempt with main package Go world_control debug Go world_control debug Added get world RPC method Remove '_' from module Nakama plugin testing Nakama plugin testing Nakama plugin testing Try updated pipeline Nakama plugin testing Update pipeline Rework plugin dir Fix path Fix imports Fix imports Load match Load match work Server changes Server changes Server changes Changes basic upon helpful suggestions Client side get match
This commit is contained in:
@ -5,6 +5,7 @@ const SERVER_ENDPOINT := "nakama.cloudsumu.com"
|
||||
|
||||
var _session : NakamaSession
|
||||
var _client : NakamaClient = Nakama.create_client(KEY, SERVER_ENDPOINT, 7350, "http")
|
||||
var _socket : NakamaSocket
|
||||
|
||||
func authenticate_async(email : String, password : String) -> NakamaException:
|
||||
var result : NakamaException = null
|
||||
@ -21,7 +22,7 @@ func authenticate_async(email : String, password : String) -> NakamaException:
|
||||
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")
|
||||
var new_session : NakamaSession = yield(_client.authenticate_email_async(email, password, email, true), "completed")
|
||||
|
||||
if not new_session.is_exception():
|
||||
_session = new_session
|
||||
@ -29,3 +30,23 @@ func signup_async(email : String, password : String) -> NakamaException:
|
||||
result = new_session.get_exception()
|
||||
|
||||
return result
|
||||
|
||||
func connect_to_server_async() -> NakamaException:
|
||||
_socket = Nakama.create_socket_from(_client)
|
||||
var result : NakamaAsyncResult = yield(_socket.connect_async(_session), "completed")
|
||||
if not result.is_exception():
|
||||
_socket.connect("closed", self, "_on_socket_closed")
|
||||
return null
|
||||
return result.exception
|
||||
|
||||
func join_world_async() -> Dictionary:
|
||||
var world : NakamaAPI.ApiRpc = yield(_client.rpc_async(_session, "get_world_id", ""), "completed")
|
||||
if world.is_exception():
|
||||
print("Join world error occured: %s" % world.exception.message)
|
||||
return {}
|
||||
var _world_id : String = world.payload
|
||||
print(_world_id)
|
||||
return {}
|
||||
|
||||
func _on_socket_closed():
|
||||
_socket = null
|
||||
|
Reference in New Issue
Block a user