gpg:: TurnBasedMatch
#include <turn_based_match.h>
包含 TurnBasedMatch
当前状态的相关数据的数据结构。
摘要
构造函数和析构函数 |
|
---|---|
TurnBasedMatch()
|
|
TurnBasedMatch(std::shared_ptr< const TurnBasedMatchImpl > impl)
|
|
TurnBasedMatch(const TurnBasedMatch & copy_from)
创建现有
TurnBasedMatch 的副本。 |
|
TurnBasedMatch(TurnBasedMatch && move_from)
移动现有的
TurnBasedMatch 。 |
公共函数 |
|
---|---|
AutomatchingSlotsAvailable() const
|
uint32_t
返回匹配的可用自动匹配槽数。
|
CreatingParticipant() const
|
返回创建此匹配的参与者。
|
CreationTime() const
|
std::chrono::milliseconds
返回此
TurnBasedMatch was created 的时间(以自 Unix 纪元起经过的毫秒数表示)。 |
Data() const
|
const std::vector< uint8_t > &
如果
HasData() 为 true,则返回匹配数据。 |
Description() const
|
const std::string &
返回服务器生成的匹配状态摘要。
|
HasData() const
|
bool
如果此对象在上一轮中设置了数据,则为 true。
|
HasPreviousMatchData() const
|
bool
如果这是重赛的第一轮,则为 true,并且前一个 Valid 中的数据必须返回 true 才可用。
|
HasRematchId() const
|
bool
如果该匹配已重新匹配,则返回 true。
|
Id() const
|
const std::string &
返回唯一标识此
TurnBasedMatch 的 ID。 |
LastUpdateTime() const
|
返回此
TurnBasedMatch 的上次更新时间(以自 Unix 纪元以来的毫秒数表示)。 |
LastUpdatingParticipant() const
|
返回最近更新此匹配项的参与者。
|
Number() const
|
uint32_t
一个数字,表示在重新匹配之前有多少匹配。
|
ParticipantResults() const
|
const gpg::ParticipantResults &
返回匹配的结果。
|
Participants() const
|
const std::vector< MultiplayerParticipant > &
此匹配中所有参与者的矢量。
|
PendingParticipant() const
|
返回轮到哪位参与者时更新此对局。
|
PreviousMatchData() const
|
const std::vector< uint8_t > &
来自上一个匹配的数据(如果 HasPreviousMatchData())。
|
RematchId() const
|
const std::string &
返回该匹配的 ID(如果有的话)。
|
Status() const
|
返回本地参与者的匹配状态。
|
SuggestedNextParticipant() const
|
一个辅助函数,用于从已加入、可邀请和自动匹配的参与者集中选择有效参与者。
|
Valid() const
|
bool
如果此
TurnBasedMatch 填充有数据,则返回 true。 |
Variant() const
|
uint32_t
返回游戏专用的变体标识符,游戏可使用该标识符识别不同的游戏模式。
|
Version() const
|
uint32_t
严格递增的 ID,每次修改匹配时都会更新。
|
operator=(const TurnBasedMatch & copy_from)
|
通过从其他实例复制来分配此
TurnBasedMatch 。 |
operator=(TurnBasedMatch && move_from)
|
通过将另一个对象移入
TurnBasedMatch 来分配此对象。 |
公共函数
AutomatchingSlotsAvailable
uint32_t AutomatchingSlotsAvailable() const
返回匹配的可用自动匹配槽数。
此数字等于创建对局的自动匹配空档数量减去通过自动匹配功能添加的参与者人数。Valid 必须返回 true,此函数才可用。
CreatingParticipant
MultiplayerParticipant CreatingParticipant() const
返回创建此匹配的参与者。
Valid 必须返回 true,此函数才可用。
CreationTime
std::chrono::milliseconds CreationTime() const
返回此 TurnBasedMatch was created
的时间(以自 Unix 纪元起经过的毫秒数表示)。
Valid 必须返回 true,此函数才可用。
HasPreviousMatchData
bool HasPreviousMatchData() const
如果这是重赛的第一轮,则为 true,并且前一个 Valid 中的数据必须返回 true 才可用。
HasRematchId
bool HasRematchId() const
如果该匹配已重新匹配,则返回 true。
ID
const std::string & Id() const
返回唯一标识此 TurnBasedMatch
的 ID。
与 TurnBasedMultiplayerManager::FetchMatch
结合使用可在稍后检索此匹配项。Valid 必须返回 true,此函数才可用。
LastUpdateTime
Timestamp LastUpdateTime() const
返回此 TurnBasedMatch
的上次更新时间(以自 Unix 纪元以来的毫秒数表示)。
Valid 必须返回 true,此函数才可用。
LastUpdatingParticipant
MultiplayerParticipant LastUpdatingParticipant() const
返回最近更新此匹配项的参与者。
Valid 必须返回 true,此函数才可用。
数字
uint32_t Number() const
一个数字,表示在重新匹配之前有多少匹配。
首次对局时设为 1,每次重赛时递增 1。
ParticipantResults
const gpg::ParticipantResults & ParticipantResults() const
返回匹配的结果。
可通过 TurnBasedMultiplayerManager::TakeMyTurn
、TurnBasedMultiplayerManager::FinishDuringMyTurn
和其他相关函数设置结果。始终使用 ParticipantResults().WithResult(...)
创建与任何现有对象一致的新 ParticipantResults
对象。Valid 必须返回 true,此函数才可用。
参与者
const std::vector< MultiplayerParticipant > & Participants() const
此匹配中所有参与者的矢量。
Valid 必须返回 true,此函数才可用。
PendingParticipant
MultiplayerParticipant PendingParticipant() const
返回轮到哪位参与者时更新此对局。
Valid 必须返回 true,此函数才可用。
PreviousMatchData
const std::vector< uint8_t > & PreviousMatchData() const
来自上一个匹配的数据(如果 HasPreviousMatchData())。
仅当 Valid 返回 true 时才能调用。
RematchId
const std::string & RematchId() const
返回该匹配的 ID(如果有的话)。
SuggestedNextParticipant
MultiplayerParticipant SuggestedNextParticipant() const
一个辅助函数,用于从已加入、可邀请和自动匹配的参与者集中选择有效参与者。
如果此功能始终用于选择下一位参与者,则播放会按顺序对所有参与者进行,并可在必要时重复。只有在 Status() 为 MatchStatus::MY_TURN 时,才能调用此函数,因为只有这一次,此函数的结果可以有意义。如果调用不正确,此函数将返回无效参与者 (MultiplayerParticipant::Valid() == false
)。
TurnBasedMatch
TurnBasedMatch()
TurnBasedMatch
TurnBasedMatch( std::shared_ptr< const TurnBasedMatchImpl > impl )
构造从 shared_ptr
到 TurnBasedMatchImpl
的 TurnBasedMatch
。
供 API 内部使用。
有效
bool Valid() const
如果此 TurnBasedMatch
填充有数据,则返回 true。
必须返回 true 才能使 TurnBasedMatch
对象(Id
、CreationTime
等)的 getter 函数可用。
版本
uint32_t Version() const
严格递增的 ID,每次修改匹配时都会更新。