gpg::ParticipantResults

#include <participant_results.h>

一个数据结构,包含有关 TurnBasedMatch 中每位参与者结果的数据。

摘要

构造函数和析构函数

ParticipantResults()
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
构造从 shared_ptrParticipantResultsImplParticipantResults 对象。
ParticipantResults(const ParticipantResults & copy_from)
创建现有 ParticipantResults 对象的副本。
ParticipantResults(ParticipantResults && move_from)
移动现有的 ParticipantResults 对象。

公共函数

HasResultsForParticipant(const std::string & participant_id) const
bool
如果此 ParticipantResults 对象与指定 MultiplayerParticipant 的结果相符,则返回 true。
MatchResultForParticipant(const std::string & participant_id) const
返回 TurnBasedMatch 内指定参与者的 MatchResult
PlaceForParticipant(const std::string & participant_id) const
uint32_t
返回指定参与者在 TurnBasedMatch 中的位置。
Valid() const
bool
如果此 ParticipantResults 对象填充了数据,则返回 true。
WithResult(const std::string & participant_id, uint32_t placing, MatchResult result) const
创建一个新的 ParticipantResults,其中包含所有现有结果以及传递到此函数的其他结果数据。
operator=(const ParticipantResults & copy_from)
从另一个对象分配此 ParticipantResults 对象。
operator=(ParticipantResults && move_from)
通过将另一个对象移入该对象来分配此 ParticipantResults 对象。

公共函数

HasResultsForParticipant

bool HasResultsForParticipant(
  const std::string & participant_id
) const 

如果此 ParticipantResults 对象与指定 MultiplayerParticipant 的结果相符,则返回 true。

Valid 必须返回 true,此函数才可用。

MatchResultForParticipant

MatchResult MatchResultForParticipant(
  const std::string & participant_id
) const 

返回 TurnBasedMatch 内指定参与者的 MatchResult

请注意,并非所有参与者都有 MatchResult;如果 HasResultsForParticipant 未返回 true,此函数将返回 MatchResult::NONEValid 必须返回 true,此函数才可用。

ParticipantResults

 ParticipantResults()

ParticipantResults

 ParticipantResults(
  std::shared_ptr< const ParticipantResultsImpl > impl
)

构造从 shared_ptrParticipantResultsImplParticipantResults 对象。

供 API 内部使用。

ParticipantResults

 ParticipantResults(
  const ParticipantResults & copy_from
)

创建现有 ParticipantResults 对象的副本。

ParticipantResults

 ParticipantResults(
  ParticipantResults && move_from
)

移动现有的 ParticipantResults 对象。

PlaceForParticipant

uint32_t PlaceForParticipant(
  const std::string & participant_id
) const 

返回指定参与者在 TurnBasedMatch 中的位置。

请注意,并非所有参与者都有结果;如果 HasResultsForParticipant 未返回 true,则此函数将针对尚未排名的玩家返回 0。Valid 必须返回 true,此函数才可用。

有效

bool Valid() const 

如果此 ParticipantResults 对象填充了数据,则返回 true。

必须为 true,此 ParticipantResults 对象上的 getter 函数(PlaceForParticipantMatchResultForParticipant 等)才可用。

WithResult

ParticipantResults WithResult(
  const std::string & participant_id,
  uint32_t placing,
  MatchResult result
) const 

创建一个新的 ParticipantResults,其中包含所有现有结果以及传递到此函数的其他结果数据。

请注意,同一参与者只能设置一次结果。如果尝试设置多个结果,系统将记录错误,且 ParticipantResults 将保持不变。Valid 必须返回 true,此函数才可用。

具体说明
参数
participant_id
要为其添加结果的 MultiplayerParticipant
placing
参与者在比赛中的排名。
result
比赛中参与者的 MatchResult

运算符=

ParticipantResults & operator=(
  const ParticipantResults & copy_from
)

从另一个对象分配此 ParticipantResults 对象。

运算符=

ParticipantResults & operator=(
  ParticipantResults && move_from
)

通过将另一个对象移入该对象来分配此 ParticipantResults 对象。