Hierarchy

  • Player

Constructors

  • Returns Player

Properties

bindFunction: Function
serverConfig: {
    apiKey: any;
    eventId: any;
    spaceId: any;
} = ...

Type declaration

  • apiKey: any
  • eventId: any
  • spaceId: any

Methods

  • Monitor the behavior of specified users

    Example

    If you wanna moniter join, leave, and move infomation of all users.

    
    

    Throws

    Error message

    Parameters

    • pidArr: string[]

      pid list of users receiving notifications, [] means all users

    • signal: string

      listening content, binary, can be combined arbitrarily: {join: '00000001', leave: '00000010', move: '00000100', transfer: '00001000', animation: '00010000', chat: '00100000', game: '01000000', robot: '10000000'}

    • bindFunction: Function

      Custom function for accepting server push

    Returns Promise<boolean>

  • Get user information list.

    Example

    If you wanna get the information of all users.

    app.player.getPlayerInfo([])
    

    Throws

    Error message

    Parameters

    • pidArr: string[]

      pid list of users receiving notifications, [] means all users

    Returns Promise<IPosition[]>

  • Get users standing on a special area.

    Example

    If you wanna get all users standing on a special area which index is 1.

    app.player.getSpecialAreaPlayerInfo(1)
    

    Throws

    Error message

    Parameters

    • index: number

      the index of a special area (data in Scene.getSpaceMapInfo())

    Returns Promise<string[]>

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Parameters

    • data: Uint8Array

    Returns void

  • Remove monitor

    Example

    If you wanna remove your moniter

    app.player.removeListener()
    

    Throws

    Error message

    Returns Promise<boolean>

  • Set avatar animation.

    Example

    If you wanna set the avatar to wave to the front

    app.player.setPlayerAnimation("000001", 11)
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • animation: number

      number of animation, options: [0 - 24], details in pb.AnimationType

    Returns Promise<boolean>

  • Parameters

    • pid: string
    • image: string

    Returns Promise<unknown>

  • Set avatar direction.

    Example

    If you wanna set avatar direction to right

    app.player.setPlayerDirection("000001", 1)
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • direction: number

      number of direction, options: [0, 1, 2, 3], 0:left, 1:right, 2: up, 3:down

    Returns Promise<boolean>

  • Set the following target of the avatar

    Example

    If you wanna set avatar follow someone.

    app.player.setPlayerFollow("000001", "000002")
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • followPid: string

      target id

    Returns Promise<boolean>

  • Set avatar move mode.

    Example

    If you wanna set the avatar to fly mode to through others

    app.player.setPlayerMoveMode("000001", 1)
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • moveMode: number

      number of move mode, options: [0, 1], 0:NORMAL_MODE 1:FLY_MODE

    Returns Promise<boolean>

  • Set avatar location to specified coordinates in this space.

    Example

    If you wanna set avatar location to specified coordinates.

    app.player.setPlayerPosition("000001", [10, 20])
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • position: [x: number, y: number]

      x & y coordinates

    Returns Promise<boolean>

  • Set avatar speed

    Example

    If you wanna make avatar faster for 3 seconds

    app.player.setPlayerSpeed("000001", 1.5, 3000)
    

    Throws

    Error message

    Parameters

    • pid: string

      user id

    • speed: number

      number of speed, range in [0, 2]

    • duration: number

      the duration of new speed, milliseconds

    Returns Promise<boolean>

Generated using TypeDoc