gpg:: ParticipantResults
#include <participant_results.h>
一种数据结构,包含有关 TurnBasedMatch 的每位参与者结果的数据。
摘要
构造函数和析构函数 |
|
|---|---|
ParticipantResults()
|
|
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
|
|
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 对象分配此 ParticipantResults 对象。 |
operator=(ParticipantResults && move_from)
|
通过将另一个
ParticipantResults 对象移入此 ParticipantResults 对象来对其进行赋值。 |
公共函数
HasResultsForParticipant
bool HasResultsForParticipant( const std::string & participant_id ) const
如果此 ParticipantResults 对象针对给定 MultiplayerParticipant 有结果,则返回 true。
有效必须返回 true,此函数才能使用。
MatchResultForParticipant
MatchResult MatchResultForParticipant( const std::string & participant_id ) const
返回 TurnBasedMatch 中指定参与者的 MatchResult。
请注意,并非所有参与者都有 MatchResult;如果 HasResultsForParticipant 未返回 true,此函数将返回 MatchResult::NONE。有效必须返回 true,此函数才能使用。
ParticipantResults
ParticipantResults()
ParticipantResults
ParticipantResults( std::shared_ptr< const ParticipantResultsImpl > impl )
将 shared_ptr 转换为 ParticipantResultsImpl,从而构建 ParticipantResults 对象。
供 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。有效必须返回 true,此函数才能使用。
有效
bool Valid() const
如果此 ParticipantResults 对象已填充数据,则返回 true。
必须为 true,才能使用此 ParticipantResults 对象上的 getter 函数(PlaceForParticipant、MatchResultForParticipant 等)。
WithResult
ParticipantResults WithResult( const std::string & participant_id, uint32_t placing, MatchResult result ) const
创建一个新的 ParticipantResults,其中包含所有现有结果以及传入此函数的其他结果数据。
请注意,每个参与者只能设置一次结果。如果尝试设置多个结果,系统会记录错误,并保持 ParticipantResults 不变。有效必须返回 true,此函数才能使用。
| 详细信息 | |||||||
|---|---|---|---|---|---|---|---|
| 参数 |
|
||||||
operator=
ParticipantResults & operator=( const ParticipantResults & copy_from )
从另一个 ParticipantResults 对象分配此 ParticipantResults 对象。
operator=
ParticipantResults & operator=( ParticipantResults && move_from )
通过将另一个 ParticipantResults 对象移入此 ParticipantResults 对象来对其进行赋值。