API List
Regarding the translation
This document was translated by ChatGPT-4, and the content may contain inaccuracies.
[10000] Register Model Event Listener
Description
Register a model event listener.
Example
{
"msg": 10000,
"msgId": 1
}
Response
{
"msg": 10000,
"msgId": 1
}
[10001] Unregister Model Event Listener
Description
Unregister a model event listener.
Example
{
"msg": 10001,
"msgId": 1
}
[10002] Receive Model Event Notification
Description
When the model triggers an event, a notification message is sent to the registered client.
Response
{
"msg": 10002,
"msgId": 1,
"data": {
"type": 0,
"id": 0,
"modelId": "myModelId",
"hitArea": "myHitArea"
}
}
Parameter |
Type |
Description |
type |
int |
Event type. |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
modelId |
string |
Model ID, defined by the model creator. Can be empty. |
hitArea |
string |
Triggered hit area name. Can be empty. |
Event List
Type |
Description |
0 |
Tap Event |
[11000] Display Bubble Text
Description
Display a text bubble for the specified model.
Example
{
"msg": 11000,
"msgId": 1,
"data": {
"id": 0,
"text": "Hello this is control panel.",
"choices": [
"Open Baidu",
"Open Google"
],
"textFrameColor": 0x000000,
"textColor": 0xFFFFFF,
"duration": 3000
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
text |
string |
Text to display. Supports tags: Rich Text. |
choices |
array |
Button options. |
textFrameColor |
int |
Text box color, RGB integer value (e.g., 0xFFFFFF). |
textColor |
int |
Text color, RGB integer value (e.g., 0xFFFFFF). |
duration |
int |
Display duration in milliseconds. If set to -1, the bubble will not disappear automatically. |
Response
{
"msg": 11000,
"msgId": 1,
"data": 0 // Index of the clicked button.
}
[12010] Set Background
Description
Set a regular background.
Example
{
"msg": 12010,
"msgId": 1,
"data": {
"id": 1,
"file": "D:\\Wallpaper\\360background.png"
}
}
Parameter |
Type |
Description |
id |
int |
Monitor index, starting from 0 (e.g., monitor #1 has an index of 0). |
file |
string |
Background file path. |
Type |
Format |
Image |
".png", ".jpg", ".jpeg" |
Video |
".mp4", ".mkv", ".mov", ".avi", ".webm", ".wmv" |
Web |
".html", ".htm", ".xhtml" |
[12110] Set 360° Panoramic Background
Description
Set a 360° panoramic background.
Example
{
"msg": 12110,
"msgId": 1,
"data": {
"id": 1,
"file": "D:\\Wallpaper\\360background.png"
}
}
Parameter |
Type |
Description |
id |
int |
Monitor index, starting from 0 (e.g., monitor #1 has an index of 0). |
file |
string |
Background file path. |
Type |
Format |
Image |
".png", ".jpg", ".jpeg" |
Video |
".mp4", ".mkv", ".mov", ".avi", ".webm", ".wmv" |
[13000] Set Model
Description
Set a model. Currently only supports JSON models.
Example
{
"msg": 13000,
"msgId": 1,
"data": {
"id": 1,
"file": "D:\\Unity Works\\Sample\\Kurumi\\kurumi.model.json"
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
file |
string |
Path to the *.model.json file. |
[13100] Remove Model
Description
Example
{
"msg": 13100,
"msgId": 1,
"data": 1
}
Parameter |
Type |
Description |
data |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
[13200] Trigger Motion
Description
Example
{
"msg": 13200,
"msgId": 1,
"data": {
"id": 1,
"type": 0,
"mtn": "group:motion"
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
type |
int |
Motion type. |
mtn |
string |
If type is 0, format as "group:motion", e.g., "tap:mtn1" . ※ If no specific motion is provided, only the group name is required, e.g., "tap" .
If type is 1, provide the absolute path of the motion file, e.g., "C:\\mtn.motion3.json" . |
[13300] Set Expression
Description
Example
{
"msg": 13300,
"msgId": 1,
"data": {
"id": 1,
"expId": 1
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
expId |
int |
Expression ID. |
[13301] Next Expression
Description
Switch to the next expression.
Example
{
"msg": 13301,
"msgId": 1,
"data": 0
}
Parameter |
Type |
Description |
data |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
[13302] Clear Expression
Description
Clear the current expression.
Example
{
"msg": 13302,
"msgId": 1,
"data": 0
}
Parameter |
Type |
Description |
data |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
[13400] Set Position
Description
Set the position of the model.
Example
{
"msg": 13400,
"msgId": 1,
"data": {
"id": 0,
"posX": 200,
"posY": 300
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
posX |
int |
Horizontal pixel coordinate on the screen (origin at the bottom-left corner). |
posY |
int |
Vertical pixel coordinate on the screen (origin at the bottom-left corner). |
[13500] Play Sound
Description
Play sound. Supports MP3, OGG, and WAV formats.
Example
{
"msg": 13500,
"msgId": 1,
"data": {
"id": 0,
"channel": 0,
"volume": 1,
"delay": 0,
"loop": false,
"type":0,
"sound":"C:\\test.mp3"
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
channel |
int |
Sound channel, can be 0, 1, or 2. |
volume |
float |
Volume, range is 0-1. |
delay |
int |
Delay before playback, in milliseconds (ms). |
loop |
bool |
Whether to loop playback, can be true or false. |
type |
int |
Data type |
sound |
string |
When type is 0, provide the absolute file path
When type is 1, provide the Base64 string of the sound's binary data |
Tips
- Switching models will stop all audio on all channels.
- By default, models use channel 0 for voice playback. Triggering voice playback will interrupt the audio currently playing on channel 0. If you wish to loop background music, it is recommended to use channel 1 or 2.
- When using the
sound
field to pass binary data, MP3 or OGG formats are recommended to reduce data size.
[13501] Stop Sound
Description
Example
{
"msg": 13501,
"msgId": 1,
"data": {
"id": 0,
"channel": 0
}
}
Parameter |
Type |
Description |
id |
int |
Model index, starting from 0 (e.g., model #1 has an index of 0). |
channel |
int |
Sound channel, can be 0, 1, or 2. |
[14000] Set Effect
Description
Set effect and remove other effects
Example
{
"msg": 14000,
"msgId": 1,
"data": 100100
}
Parameter |
Type |
Description |
data |
int |
effect Id, refer to ID List below |
ID List
ID |
Description |
100100 |
Rain |
100110 |
Snow |
[14100] Add Effect
Description
Example
{
"msg": 14100,
"msgId": 1,
"data": 100100
}
Parameter |
Type |
Description |
data |
int |
effect ID, refer to ID List |
[14200] Remove Effect
Description
Remove effect with specific ID, set to -1 to remove all effects
Example
{
"msg": 14200,
"msgId": 1,
"data": 100100
}
Parameter |
Type |
Description |
data |
int |
effect ID, refer to ID List |