9 #ifndef INCLUDE_FUNAPI_SERVICE_MATCHMAKING_H_ 10 #define INCLUDE_FUNAPI_SERVICE_MATCHMAKING_H_ 26 struct FUNAPI_DLL_VISIBILITY
Player {
32 struct FUNAPI_DLL_VISIBILITY
Match {
33 explicit Match(Type _type);
34 explicit Match(
const MatchId &_match_id, Type _type);
36 const MatchId match_id;
39 std::vector<Player> players;
56 typedef function<void(
const string & ,
58 MatchResult )> MatchCallback;
60 typedef function<void(
const string & ,
63 const string & )> ProgressCallback;
65 typedef function<void(
const string & ,
68 const string & )> ProgressCallback2;
70 typedef function<void(
const string & ,
71 CancelResult )> CancelCallback;
74 enum TargetServerSelection {
83 bool want_more_players;
86 typedef std::vector<MatchmakingServerInfo> MatchmakingServerInfoVector;
88 static const WallClock::Duration kNullTimeout;
89 static const ProgressCallback kNullProgressCallback;
90 static const ProgressCallback2 kNullProgressCallback2;
92 static MatchmakingServerInfoVector GetMatchmakingServerInfo();
94 static void StartMatchmaking(
const Type &type,
const string &player_id,
95 const Json &player_context,
const MatchCallback &match_callback,
96 const TargetServerSelection &target_server = kRandom,
97 const ProgressCallback &progress_callback = kNullProgressCallback,
98 const WallClock::Duration &timeout = kNullTimeout) ASSERT_NO_ROLLBACK;
100 static void StartMatchmaking(
const Type &type,
const string &player_id,
101 const Json &player_context,
const MatchCallback &match_callback,
102 const Rpc::PeerId &target_server,
103 const ProgressCallback &progress_callback = kNullProgressCallback,
104 const WallClock::Duration &timeout = kNullTimeout) ASSERT_NO_ROLLBACK;
106 static void StartMatchmaking2(
const Type &type,
const string &player_id,
107 const Json &player_context,
const MatchCallback &match_callback,
108 const TargetServerSelection &target_server = kRandom,
109 const ProgressCallback2 &progress_callback2 = kNullProgressCallback2,
110 const WallClock::Duration &timeout = kNullTimeout) ASSERT_NO_ROLLBACK;
112 static void StartMatchmaking2(
const Type &type,
const string &player_id,
113 const Json &player_context,
const MatchCallback &match_callback,
114 const Rpc::PeerId &target_server,
115 const ProgressCallback2 &progress_callback2 = kNullProgressCallback2,
116 const WallClock::Duration &timeout = kNullTimeout) ASSERT_NO_ROLLBACK;
118 static void CancelMatchmaking(
const Type &type,
const string &player_id,
119 const CancelCallback &cancel_callback) ASSERT_NO_ROLLBACK;
121 static void UpdateMatchPlayerContext(
const Type &type,
122 const string &player_id,
const Json &new_context) ASSERT_NO_ROLLBACK;
128 typedef MatchmakingClient::MatchId MatchId;
129 typedef MatchmakingClient::Type Type;
132 typedef MatchmakingClient::MatchResult MatchResult;
133 typedef MatchmakingClient::CancelResult CancelResult;
136 kMatchNeedMorePlayer = 0,
140 typedef function<bool(
const Player & ,
141 const Match & )> MatchChecker;
143 typedef function<MatchState(
const Match & )> CompletionChecker;
145 typedef function<void(
const Player & ,
146 Match * )> JoinCallback;
148 typedef function<void(
const Player & ,
149 Match * )> LeaveCallback;
151 static void Start(
const MatchChecker &match_checker,
152 const CompletionChecker &completion_checker,
153 const JoinCallback &join_cb,
const LeaveCallback &leave_cb);
158 #endif // INCLUDE_FUNAPI_SERVICE_MATCHMAKING_H_
Definition: matchmaking.h:80
Definition: matchmaking.h:126
boost::uuids::uuid Uuid
UUID type used throughout Funapi.
Definition: types.h:56
Definition: matchmaking.h:21
Definition: matchmaking.h:26
Definition: matchmaking.h:32