簡易的回合制多人遊戲系統 - 透過 Parse
TurnBasedGame 資料表設計
curl -X POST \
-H "X-Parse-Application-Id: ${APPLICATION_ID}" \
-H "X-Parse-REST-API-Key: ${REST_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"Participants":[${USER_OBJ_A}...],"CurrentPlayer": ${USER_ID_A},"NextDeadline":${TIMESTAMP},"GameData":${DATA_OBJ},"GameStatus":"Active"}' \
https://YOUR.PARSE-SERVER.HERE/parse/classes/TurnBasedGamevar query = new Parse.Query(Parse.Installation)
query.equalTo('user', {'__type': 'Pointer', 'className': 'User', 'objectId': ${USER ID}})
Parse.Push.send({
where: query,
data: {
alert: 'TURN'
}
}, { useMasterKey: true }).then(
function () {
response.success()
},
function (error) {
response.error(error)
}
)Last updated