Skip to main content

Auki::ConjureKit::Session

Abstracts the shared state of a ConjureKit multiplayer session.

Public Functions

Name
EntityGetEntity(uint entityId)
Gets Entity object for a given Entity identifier.
EntityGetLocalParticipantEntity()
Gets local Participant Entity.
voidAddEntity(Action< Entity > onComplete, Action< string > onError)
Call when you want to add an Entity.
voidAddEntity(Pose pose, Action< Entity > onComplete, Action< string > onError)
Call when you want to add an Entity.
voidAddEntity(Pose pose, bool persistent, Action< Entity > onComplete, Action< string > onError)
Call when you want to add an Entity.
voidAddEntity(Pose pose, bool persistent, EntityFlag
Call when you want to add an Entity to the current Session.
voidDeleteEntity(uint entityId, Action onComplete)
Call when you want to delete an Entity.
uintGetComponentTypeIdCached(string componentTypeName)
voidGetComponentTypeId(string componentTypeName, Action< uint > onComplete, Action< string > onError =null)
Gets the id of a component type by name.
voidGetComponentTypeName(uint componentTypeId, Action< string > onComplete, Action< string > onError =null)
Gets the name of a component type by id.
voidAddComponentType(string componentTypeName, Action< uint > onComplete, Action< string > onError =null)
Adds a component type.
voidAddComponent(string componentTypeName, uint entityId, byte[] data, Action onComplete, Action< string > onError =null)
Adds a component with a given name to an Entity.
voidAddComponent(uint componentTypeId, uint entityId, byte[] data, Action onComplete, Action< string > onError =null)
Adds a component with a given id to an Entity.
voidDeleteComponent(string componentTypeName, uint entityId, Action onComplete, Action< string > onError =null)
Deletes a component with a given name from an Entity.
voidDeleteComponent(uint componentTypeId, uint entityId, Action onComplete, Action< string > onError =null)
Deletes a component with a given id from an Entity.
List< EntityComponent >GetComponentsCached(uint componentTypeId)
Gets a cached list of components for a component type id in the Session.
voidGetComponents(uint componentTypeId, Action< List< EntityComponent > > onComplete, Action< string > onError =null)
Gets all components for a component type id in the Session.
boolUpdateComponent(string componentTypeName, uint entityId, byte[] data)
Update component data by component type name for a particular Entity.
boolUpdateComponent(uint componentTypeId, uint entityId, byte[] data)
Update component data by component type id for a particular Entity.
voidSubscribeToComponentType(uint componentTypeId, Action onComplete, Action< string > onError =null)
Subscribe to updates of a component type by component type id.
voidUnsubscribeToComponentType(uint componentTypeId, Action onComplete, Action< string > onError =null)
Unsubscribe to updates of a component type by component type id.
PoseGetEntityPose(uint entityId)
Gets the Pose for an Entity by its id.
PoseGetEntityPose(Entity entity)
Gets the Pose for an Entity.
voidSetEntityPose(uint entityId, Pose pose)
Sets the Pose for an Entity.
EntityComponentGetEntityComponent(uint entityId, string componentName)
Gets EntityComponent for an Entity by component type name.
EntityComponentGetEntityComponent(uint entityId, uint componentId)
Gets EntityComponent for an Entity by component type id.
intGetEntityCount()
Gets total number of Entity objects.
List< Entity >GetEntities()
Gets a list of all Entity objects.
intGetParticipantCount()
Gets total number of Participant objects.
List< uint >GetParticipantsIds()
Gets a list of Participant ids.
List< Participant >GetParticipants()
Gets a list of all Participant objects.
List< Entity >GetParticipantEntities(uint participantId)
Gets a list of all Entities that are owned by a specific Participant.
voidRegisterSystem(ISystem system, Action onComplete)
Registers a System.
voidUnregisterSystem(ISystem system)
Unregisters a System.
voidUnregisterAllSystems()
Unregisters all Systems.
IList< ISystem >GetRegisteredSystemsForComponentType(string componentTypeName)
Gets a list of all registered Systems that have a specific component type by its name.
override stringToString()
Prints the state of a Session into a readable string.

Public Properties

Name
stringTag
Write-once string that may be set by code that calls ConjureKit.Connect() to mark the connection origin of the Session. For best practices, set .Tag in the onComplete callback of ConjureKit.Connect(). The session's .Tag is automatically prepended by a string "X:" where X is a counter for the overall number of locally instantiated sessions.

Public Attributes

Name
stringId
Session identifier.
stringUuid
(Internal) Session backend UUID.
uintParticipantId
Participant identifier for the currently connected user.
bool
Returns, if available, a component Type Id given a component Type Name.

Public Functions Documentation

function GetEntity

Entity GetEntity(
uint entityId
)

Gets Entity object for a given Entity identifier.

Parameters:

  • entityId Entity identifier

Return: Entity object if such Entity exists or null if it doesn't

function GetLocalParticipantEntity

Entity GetLocalParticipantEntity()

Gets local Participant Entity.

Return: Entity object if such entity exists or null if it doesn't

function AddEntity

void AddEntity(
Action< Entity > onComplete,
Action< string > onError
)

Call when you want to add an Entity.

Parameters:

  • onComplete Callback on success
  • onError Callback on error

function AddEntity

void AddEntity(
Pose pose,
Action< Entity > onComplete,
Action< string > onError
)

Call when you want to add an Entity.

Parameters:

  • pose Desired Pose of Entity
  • onComplete Callback on success
  • onError Callback on error

function AddEntity

void AddEntity(
Pose pose,
bool persistent,
Action< Entity > onComplete,
Action< string > onError
)

Call when you want to add an Entity.

Parameters:

  • pose Desired Pose of Entity
  • persistent true if the Entity should persist when you've left the Session, false if it should be removed
  • onComplete Callback on success
  • onError Callback on error

function AddEntity

void AddEntity(
Pose pose,
bool persistent,
EntityFlag entityFlag,
Action< Entity > onComplete,
Action< string > onError
)

Call when you want to add an Entity to the current Session.

Parameters:

  • pose Desired Pose of Entity
  • persistent true if the Entity should persist when you've left the Session, false if it should be removed
  • entityFlag Entity flag for the added Entity
  • onComplete Callback on success
  • onError Callback on error

function DeleteEntity

void DeleteEntity(
uint entityId,
Action onComplete
)

Call when you want to delete an Entity.

Parameters:

  • entityId Entity id
  • onComplete Callback on success

function GetComponentTypeIdCached

uint GetComponentTypeIdCached(
string componentTypeName
)

function GetComponentTypeId

void GetComponentTypeId(
string componentTypeName,
Action< uint > onComplete,
Action< string > onError =null
)

Gets the id of a component type by name.

Parameters:

  • componentTypeName Component type name
  • onComplete Callback on success
  • onError Callback on error

function GetComponentTypeName

void GetComponentTypeName(
uint componentTypeId,
Action< string > onComplete,
Action< string > onError =null
)

Gets the name of a component type by id.

Parameters:

  • componentTypeId Component type id
  • onComplete Callback on success
  • onError Callback on error

function AddComponentType

void AddComponentType(
string componentTypeName,
Action< uint > onComplete,
Action< string > onError =null
)

Adds a component type.

Parameters:

  • componentTypeName Component type name
  • onComplete Callback on success that returns component type id
  • onError Callback on error

function AddComponent

void AddComponent(
string componentTypeName,
uint entityId,
byte[] data,
Action onComplete,
Action< string > onError =null
)

Adds a component with a given name to an Entity.

Parameters:

  • componentTypeName Component type name
  • entityId Id of Entity to which the component will be attached
  • data Component data
  • onComplete Callback on success
  • onError Callback on error

function AddComponent

void AddComponent(
uint componentTypeId,
uint entityId,
byte[] data,
Action onComplete,
Action< string > onError =null
)

Adds a component with a given id to an Entity.

Parameters:

  • componentTypeId Component type id
  • entityId Id of Entity to which the component will be attached
  • data Component data
  • onComplete Callback on success
  • onError Callback on error

function DeleteComponent

void DeleteComponent(
string componentTypeName,
uint entityId,
Action onComplete,
Action< string > onError =null
)

Deletes a component with a given name from an Entity.

Parameters:

  • componentTypeName Component type name
  • entityId Id of Entity to which the component will be attached
  • onComplete Callback on success
  • onError Callback on error

function DeleteComponent

void DeleteComponent(
uint componentTypeId,
uint entityId,
Action onComplete,
Action< string > onError =null
)

Deletes a component with a given id from an Entity.

Parameters:

  • componentTypeId Component type id
  • entityId Id of Entity to which the component will be attached
  • onComplete Callback on success
  • onError Callback on error

function GetComponentsCached

List< EntityComponent > GetComponentsCached(
uint componentTypeId
)

Gets a cached list of components for a component type id in the Session.

Parameters:

  • componentTypeId Component type id

function GetComponents

void GetComponents(
uint componentTypeId,
Action< List< EntityComponent > > onComplete,
Action< string > onError =null
)

Gets all components for a component type id in the Session.

Parameters:

  • componentTypeId Component type id
  • onComplete Callback on success with a list of EntityComponents
  • onError Callback on error

function UpdateComponent

bool UpdateComponent(
string componentTypeName,
uint entityId,
byte[] data
)

Update component data by component type name for a particular Entity.

Parameters:

  • componentTypeName Component type name
  • entityId Entity id which should have its component data updated
  • data Component data

Return: bool indicating success or failure of putting update message on send queue

function UpdateComponent

bool UpdateComponent(
uint componentTypeId,
uint entityId,
byte[] data
)

Update component data by component type id for a particular Entity.

Parameters:

  • componentTypeId Component type id
  • entityId Entity id which should have its component data updated
  • data Component data

Return: bool indicating success or failure of putting update message on send queue

function SubscribeToComponentType

void SubscribeToComponentType(
uint componentTypeId,
Action onComplete,
Action< string > onError =null
)

Subscribe to updates of a component type by component type id.

Parameters:

  • componentTypeId Component type id
  • onComplete Callback on success
  • onError Callback on error

function UnsubscribeToComponentType

void UnsubscribeToComponentType(
uint componentTypeId,
Action onComplete,
Action< string > onError =null
)

Unsubscribe to updates of a component type by component type id.

Parameters:

  • componentTypeId Component type id
  • onComplete Callback on success
  • onError Callback on error

function GetEntityPose

Pose GetEntityPose(
uint entityId
)

Gets the Pose for an Entity by its id.

Parameters:

  • entityId Entity id

Return: Pose of Entity

function GetEntityPose

Pose GetEntityPose(
Entity entity
)

Gets the Pose for an Entity.

Parameters:

  • entity Entity object

Return: Pose of Entity

function SetEntityPose

void SetEntityPose(
uint entityId,
Pose pose
)

Sets the Pose for an Entity.

Parameters:

  • entityId Entity id
  • pose Desired new Pose

function GetEntityComponent

EntityComponent GetEntityComponent(
uint entityId,
string componentName
)

Gets EntityComponent for an Entity by component type name.

Parameters:

  • entityId Entity id
  • componentName Component type name

Return: EntityComponent if it exists or null if it doesn't

function GetEntityComponent

EntityComponent GetEntityComponent(
uint entityId,
uint componentId
)

Gets EntityComponent for an Entity by component type id.

Parameters:

  • entityId Entity id
  • componentId Component type id

Return: EntityComponent if it exists or null if it doesn't

function GetEntityCount

int GetEntityCount()

Gets total number of Entity objects.

Return: Total count of Entity objects

function GetEntities

List< Entity > GetEntities()

Gets a list of all Entity objects.

Return: List of Entity objects

function GetParticipantCount

int GetParticipantCount()

Gets total number of Participant objects.

Return: Total count of Participant objects

function GetParticipantsIds

List< uint > GetParticipantsIds()

Gets a list of Participant ids.

Return: List of Participant ids

function GetParticipants

List< Participant > GetParticipants()

Gets a list of all Participant objects.

Return: List of Participant objects

function GetParticipantEntities

List< Entity > GetParticipantEntities(
uint participantId
)

Gets a list of all Entities that are owned by a specific Participant.

Parameters:

  • participantId Participant identifier

Return: List of Entity objects

function RegisterSystem

void RegisterSystem(
ISystem system,
Action onComplete
)

Registers a System.

Parameters:

  • system System that will be registered
  • onComplete Callback on success

function UnregisterSystem

void UnregisterSystem(
ISystem system
)

Unregisters a System.

Parameters:

  • system System that will be unregistered

function UnregisterAllSystems

void UnregisterAllSystems()

Unregisters all Systems.

function GetRegisteredSystemsForComponentType

IList< ISystem > GetRegisteredSystemsForComponentType(
string componentTypeName
)

Gets a list of all registered Systems that have a specific component type by its name.

Parameters:

  • componentTypeName Component type name

Return: List of registered Systems with given component type

function ToString

override string ToString()

Prints the state of a Session into a readable string.

Return: Printable string of the Session

Public Property Documentation

property Tag

string Tag;

Write-once string that may be set by code that calls ConjureKit.Connect() to mark the connection origin of the Session. For best practices, set .Tag in the onComplete callback of ConjureKit.Connect(). The session's .Tag is automatically prepended by a string "X:" where X is a counter for the overall number of locally instantiated sessions.

Public Attributes Documentation

variable Id

string Id;

Session identifier.

variable Uuid

string Uuid;

(Internal) Session backend UUID.

variable ParticipantId

uint ParticipantId;

Participant identifier for the currently connected user.

variable bool

bool;

Returns, if available, a component Type Id given a component Type Name.

Parameters:

  • componentTypeName The component type name

Return: If a type id was already present in cache, true is returned with its type id