gpg::ParticipantResults

#include <participant_results.h>

包含 TurnBasedMatch 每位參與者結果的資料結構。

摘要

建構函式和解構函式

ParticipantResults()
ParticipantResults(std::shared_ptr< const ParticipantResultsImpl > impl)
shared_ptr 建構 ParticipantResults 物件至 ParticipantResultsImpl
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_ptr 建構 ParticipantResults 物件至 ParticipantResultsImpl

適用於 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

operator=

ParticipantResults & operator=(
  const ParticipantResults & copy_from
)

從其他物件指派這個 ParticipantResults 物件。

operator=

ParticipantResults & operator=(
  ParticipantResults && move_from
)

透過移動另一個物件來指派這個ParticipantResults物件。