89 lines
2.1 KiB
Markdown
89 lines
2.1 KiB
Markdown
---
|
||
sidebarDepth: 1
|
||
---
|
||
|
||
# <span id="3-功能服事件"></span>3-功能服事件
|
||
|
||
|
||
事件的定义。
|
||
|
||
<span id="服务器"></span>
|
||
## 服务器
|
||
|
||
<span id="ServerConnectedEvent"></span>
|
||
### ServerConnectedEvent
|
||
|
||
- 描述
|
||
|
||
lobby/game/proxy成功建立连接时触发
|
||
|
||
- 参数
|
||
|
||
| 参数名 | 数据类型 | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| serverId | int | 服务器id |
|
||
| protocolVersion | int | 协议版本号 |
|
||
- 返回值
|
||
|
||
无
|
||
<span id="ServerDisconnectEvent"></span>
|
||
### ServerDisconnectEvent
|
||
|
||
- 描述
|
||
|
||
lobby/game/proxy断开连接时触发
|
||
|
||
- 参数
|
||
|
||
| 参数名 | 数据类型 | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| serverId | int | 服务器id |
|
||
- 返回值
|
||
|
||
无
|
||
<span id="UpdateServerStatusEvent"></span>
|
||
### UpdateServerStatusEvent
|
||
|
||
- 描述
|
||
|
||
lobby/game/proxy状态发生变化时触发
|
||
|
||
- 参数
|
||
|
||
| 参数名 | 数据类型 | 说明 |
|
||
| :--- | :--- | :--- |
|
||
| dict类型,key:str,服务器id的字符串,value:str,服务器状态字符串。服务器状态如下:‘1’ | 就绪状态,‘2’ | 停止状态,‘3’ 准备状态。服务器状态为'1'时,服务器才可用,其他状态下,服务器不可用。 |
|
||
- 返回值
|
||
|
||
无
|
||
- 示例
|
||
|
||
```python
|
||
class TestService(ServiceSystem):
|
||
def __init__(self, namespace, systemName):
|
||
ServiceSystem.__init__(self, namespace, systemName)
|
||
self.ListenForEvent(
|
||
serviceApi.GetEngineNamespace(),
|
||
serviceApi.GetEngineSystemName(),
|
||
"UpdateServerStatusEvent",
|
||
self,
|
||
self.OnUpdateServerStatusEvent)
|
||
def OnUpdateServerStatusEvent(self, args):
|
||
print args
|
||
# 结果的一个示例:{'1000000':'1', '2000000':'3'}
|
||
# 含义:服务器id为1000000的服务器正常运行,服务器id为2000000的服务器处于准备状态。
|
||
```
|
||
<span id="配置"></span>
|
||
## 配置
|
||
|
||
<span id="NetGameCommonConfChangeEvent"></span>
|
||
### NetGameCommonConfChangeEvent
|
||
|
||
- 描述
|
||
|
||
服务器配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化
|
||
|
||
- 返回值
|
||
|
||
无
|