Files
netease-modsdk-wiki/docs/mcdocs/2-Apollo/4-SDK/3-功能服事件.md
2025-03-18 14:46:12 +08:00

89 lines
2.1 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
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类型keystr服务器id的字符串valuestr服务器状态字符串。服务器状态如下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
- 描述
服务器配置发生变化时触发,具体包括:新增或删服服务器;服务器相关配置变化;日志等级发生变化
- 返回值