Skip to main content
Version: 1.x

Class OdinClient

Client Wrapper for ODIN ffi OdinNative.Core.OdinLibrary.NativeMethods

Declaration
public class OdinClient : IDisposable

Properties

Rooms

A collection of all OdinNative.Odin.Room.Room

Declaration
public RoomCollection Rooms { get; }

EndPoint

Connection EndPoint. Default from OdinEditorConfig.

Declaration
public Uri EndPoint { get; }

AccessKey

Client AccessKey for all new rooms. Default from OdinHandler config.

Declaration
public string AccessKey { get; }

UserData

Client custom UserData

Declaration
public IUserData UserData { get; set; }

Methods

ReloadLibrary(bool)

Internal library reload

Declaration
protected void ReloadLibrary(bool init = true)
Parameters
TypeNameDescription
System.BooleaninitIdicates to directly initialize the library again after release

JoinRoom(string, string)

Join or create a OdinNative.Odin.Room.Room by name via a gateway

Declaration
public Task<Room> JoinRoom(string name, string userId)
Returns

Global.Task<OdinNative.Odin.Room.Room>: OdinNative.Odin.Room.Room or null

Parameters
TypeNameDescription
System.StringnameRoom name
System.StringuserIdUser ID

JoinRoom(string, string, Action<Room>)

Join or create a OdinNative.Odin.Room.Room by name via a gateway

Declaration
public Task<Room> JoinRoom(string name, string userId, Action<Room> setup = null)
Returns

Global.Task<OdinNative.Odin.Room.Room>: OdinNative.Odin.Room.Room or null

Parameters
TypeNameDescription
System.StringnameRoom name
System.StringuserIdOdin client ID
Global.Action<OdinNative.Odin.Room.Room>setupwill invoke to setup a room before adding or joining

JoinRoom(string, string, IUserData, Action<Room>)

Join or create a OdinNative.Odin.Room.Room by name via a gateway

Declaration
public Task<Room> JoinRoom(string name, string userId, IUserData userData, Action<Room> setup)
Returns

Global.Task<OdinNative.Odin.Room.Room>: OdinNative.Odin.Room.Room or null

Parameters
TypeNameDescription
System.StringnameRoom name
System.StringuserIdOdin client ID
OdinNative.Odin.IUserDatauserDataSet new OdinNative.Odin.OdinClient.UserData on room join
Global.Action<OdinNative.Odin.Room.Room>setupwill invoke to setup a room before adding or joining

JoinNamedRoom(string, string, IUserData, Action<Room>)

Join or create a named OdinNative.Odin.Room.Room by token via a gateway

Declaration
public Task<Room> JoinNamedRoom(string roomalias, string token, IUserData userData = null, Action<Room> setup = null)
Returns

Global.Task<OdinNative.Odin.Room.Room>: OdinNative.Odin.Room.Room or null

Parameters
TypeNameDescription
System.StringroomaliasRoom alias
System.StringtokenRoom token
OdinNative.Odin.IUserDatauserDataSet new OdinNative.Odin.OdinClient.UserData on room join
Global.Action<OdinNative.Odin.Room.Room>setupwill invoke to setup a room before adding or joining

JoinRoom(string, IUserData, Action<Room>)

Join or create a OdinNative.Odin.Room.Room by token via a gateway

Declaration
public Task<Room> JoinRoom(string token, IUserData userData, Action<Room> setup)
Returns

Global.Task<OdinNative.Odin.Room.Room>: OdinNative.Odin.Room.Room or null

Parameters
TypeNameDescription
System.StringtokenRoom token
OdinNative.Odin.IUserDatauserDataSet new OdinNative.Odin.OdinClient.UserData on room join
Global.Action<OdinNative.Odin.Room.Room>setupwill invoke to setup a room before adding or joining

UpdateUserData(IUserData)

Updates the OdinNative.Odin.OdinClient.UserData for all OdinNative.Odin.OdinClient.Rooms for the current peer

Declaration
public void UpdateUserData(IUserData userData)
Parameters
TypeNameDescription
OdinNative.Odin.IUserDatauserDataOdinNative.Odin.UserData

SetPositionScale(float)

Updates the OdinNative.Odin.Room.Room.SetPositionScale(float) for all OdinNative.Odin.OdinClient.Rooms

Declaration
public void SetPositionScale(float scale)
Parameters
TypeNameDescription
System.SinglescalePer default, the room will use a distance of 1.0 fo proximity calculation

UpdatePosition(float, float)

Updates the OdinNative.Odin.Room.Room.UpdatePosition(System.Single,System.Single) for all OdinNative.Odin.OdinClient.Rooms

Declaration
public void UpdatePosition(float x, float y)
Parameters
TypeNameDescription
System.Singlexx postition
System.Singleyy postition

LeaveRoom(string)

Leave a joined Room

Declaration
public Task<bool> LeaveRoom(string name)
Returns

Global.Task<System.Boolean>: true if removed from OdinNative.Odin.OdinClient.Rooms or false

Parameters
TypeNameDescription
System.StringnameRoom name

Close()

Completly closes this Client and all OdinNative.Odin.Room.Room associated.

Declaration
public void Close()

Dispose(bool)

On dispose will free all OdinNative.Odin.Room.Room and OdinNative.Core.Imports.NativeMethods.Shutdown

Declaration
protected virtual void Dispose(bool disposing)
Parameters
TypeNameDescription
System.BooleandisposingIndicates to dispose the library

~OdinClient()

Default deconstructor

Declaration
protected ~OdinClient()

Dispose()

On dispose will free all OdinNative.Odin.Room.Room and OdinNative.Core.Imports.NativeMethods.Shutdown

Declaration
public void Dispose()