Files
game-driver/readme.md
2024-11-01 17:40:34 +08:00

87 lines
1.6 KiB
Markdown

# 边缘盒子
topic 中的 `location` 指景区编码, `point` 指景区内具体点位
## 1. 接收启动
Topic: `server/${location}/${point}/play`
Payload:
```json
{
"timeout": 30, // 设备超时时长(s)
"power": true, // 是否需要整体电源控制
"bgm": "", // 游戏中背景音乐(file://本地文件地址、http://远程文件地址)
"volume": 0.5, // 整体设备音量(0-1)
"default-print": "", // 屏幕默认打印(设备待机时展示文本)
"tts": { // 文本转语音整体控制
"start": "", // 开始语音
"end": "", // 结束语音
"stop": "", // 终止语音
"timer": [ // 固定节点语音
{
"time": 10, // 时间节点(s)
"value": "" // 语音文字
}
]
},
"print": [ // 屏幕打印控制
{
"time": 10, // 时间节点(s)
"text": "", // 展示文字
"duration": 10 // 持续时长(s)
}
],
"game": {} // 根据具体游戏特定
}
```
[游戏节点报文](./game.md)
#### 例: 入口欢迎播报
```json
{
"volume": 1,
"tts": {
"start": "欢迎前来挑战!"
}
}
```
## 2. 事件反馈
### 状态变更
Topic: `device/${location}/${point}/status`
Payload:
```bash
0 # 0 待机; 1 使用中; -1 状态异常
```
## 3. 接收指令
### 终止
Topic: `server/${location}/${point}/command`
Payload:
```bash
stop
```
### 查询状态
Topic: `server/${location}/${point}/command`
Payload:
```bash
status
```
设备接收到该指令会立即向 `device/${location}/${point}/status` 发送一次当前状态