跳到主要内容

游戏模式

适用版本:中国版 3.10。仅中国版可用。

本文主要记录游戏模式相关的接口,共 2 个。

网易官方文档

GetPlayerGameType​

服务端

该接口只能在服务端脚本(mod.server.extraServerApi)中调用。
GameComponentServer

获取组件:serverApi.GetEngineCompFactory().CreateGame(levelId)

获取指定玩家的游戏模式。

GetPlayerGameType(playerId: str) -> int
  • playerId: str,玩家 id。

返回值:int,GameType 枚举。

客户端

该接口只能在客户端脚本(mod.client.extraClientApi)中调用。
GameComponentClient

获取组件:clientApi.GetEngineCompFactory().CreateGame(levelId)

获取指定玩家的游戏模式。

GetPlayerGameType(playerId: str) -> int
  • playerId: str,玩家 id。

返回值:int,GameType 枚举。


SetPlayerGameType​

服务端

该接口只能在服务端脚本(mod.server.extraServerApi)中调用。
PlayerCompServer

获取组件:serverApi.GetEngineCompFactory().CreatePlayer(playerId)

设置玩家个人游戏模式。

SetPlayerGameType(gameType: int) -> bool

返回值:bool,是否设置成功。

备注

  • 极限模式不可修改玩家个人游戏模式。