dp-s_doc/Object/World/World.md

101 lines
2.3 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.

## 一、根据 UID 获取 Session
### 函数签名
- `function GetSessionByUid(Uid)`
### 参数
- `Uid`:整数,表示用户 ID
### 返回值
- 返回一个 Session 对象,表示根据用户 ID 获取到的 Session。
---
## 二、根据 Session 获取玩家
### 函数签名
- `function GetUserBySession(Session)`
### 参数
- `Session`Session 对象
### 返回值
- 如果找到对应的用户,返回一个 User 对象;否则返回 null。
---
## 三、根据 UID 获取玩家
### 函数签名
- `function GetUserByUid(Uid)`
### 参数
- `Uid`:整数,表示用户 ID
### 返回值
- 如果找到对应的用户,返回一个 User 对象;否则返回 null。
---
## 四、根据名字获取玩家
### 函数签名
- `function GetUserByName(Name)`
### 参数
- `Name`:字符串,表示用户名字
### 返回值
- 如果找到对应的用户,返回一个 User 对象;否则返回 null。
---
## 五、获取玩家数量
### 函数签名
- `function GetUserCount()`
### 返回值
- 整数,表示玩家数量。
---
## 六、给所有玩家发包
### 函数签名
- `function SendAll(Pack)`
### 参数
- `Pack`:数据包对象
---
## 七、给所有玩家发送公告
### 函数签名
- `function SendNotiPacketMessage(String, Type)`
### 参数
- `String`:字符串,表示公告内容
- `Type`:整数,表示公告类型
---
## 八、发送公告消息(带颜色)
### 函数签名
- `function SendNotiForColorPacketMessage(StringArr, Type)`
### 参数
- `StringArr`:字符串数组
- `Type`:整数,表示公告类型
---
## 九、发送公告消息(带颜色和 ID
### 函数签名
- `function SendNotiForColorAIdPacketMessage(StringArr, Type)`
### 参数
- `StringArr`:字符串数组
- `Type`:整数,表示公告类型
---
## 十、通过 UID 和 CID 获取玩家
### 函数签名
- `function GetUserByUidCid(Uid, Cid)`
### 参数
- `Uid`:整数,表示用户 ID
- `Cid`:整数,表示角色 ID
### 返回值
- 如果找到对应的用户,返回一个 User 对象;否则返回 null。
---
## 十一、获取在线玩家列表
### 函数签名
- `function GetOnlinePlayer()`
### 返回值
- 在线玩家的数组。
---