public void GetAchievement(String achievementCode) { if (!ApiReady() || !IsLoggedIn()) { return; } string url = _baseURL + "/achievement?code=" + achievementCode; QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_GetAchievemnt); }
public void GetAllAchievements() { if (!ApiReady() || !IsLoggedIn()) { return; } string url = _baseURL + "/achievements?game=" + _gameKey; QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_GetAllAchievements); }
public void GetPlayerScore() { if (!ApiReady() || !IsLoggedIn()) { return; } string url = _baseURL + "/score?leaderboard=" + _leaderboardKey; QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_GetPlayerScore); }
public void GetAllScores(int page, int size) { if (!ApiReady() || !IsLoggedIn()) { return; } string url = _baseURL + "/scores?leaderboard=" + _leaderboardKey + "&page=" + page + "&size=" + size; QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_GetAllScores); }
public void SilentLogin() { if (!ApiReady() && PlayerPrefs.HasKey("_authToken")) { return; } string url = _baseURL + "/player"; _authToken = PlayerPrefs.GetString("_authToken"); QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_Login); }
public void UnlockAchievement(String achievementCode) { if (!ApiReady() || !IsLoggedIn()) { return; } string url = _baseURL + "/unlockachievement"; QGCAchievementUnlockSend pls = new QGCAchievementUnlockSend(); pls.AchievementCode = achievementCode; string userObj = JsonConvert.SerializeObject(pls); QGCNio.CreateSubmitWWW(url, userObj, _authToken, CategoryType.QGC_UnlockAchievement); }
public void Login(string username, string password) { if (!ApiReady()) { return; } if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password)) { API.LogWarning("Username/Pass must not be empty"); return; } string url = _baseURL + "/player"; _authToken = encodeAuth(username + ":" + password); QGCNio.CreateSubmitWWW(url, null, _authToken, CategoryType.QGC_Login); }
public void UpdateProfile(QGCPlayerSend pls) { if (!ApiReady()) { return; } if (string.IsNullOrEmpty(pls.PlayerDisplayName)) { API.LogWarning("Mandatory fields must be completed"); return; } string url = _baseURL + "/update"; string userObj = JsonConvert.SerializeObject(pls); QGCNio.CreateSubmitWWW(url, userObj, _authToken, CategoryType.QGC_UpdateProfile); }
public void Register(QGCPlayerSend pls) { if (!ApiReady()) { return; } if (string.IsNullOrEmpty(pls.PlayerUsername) || string.IsNullOrEmpty(pls.PlayerPassword) || string.IsNullOrEmpty(pls.PlayerDisplayName)) { API.LogWarning("Mandatory fields must be completed"); return; } string url = _baseURL + "/register"; pls.PlayerPlatform = QGCUtils.GetSystem(); string userObj = JsonConvert.SerializeObject(pls); _authToken = encodeAuth(pls.PlayerUsername + ":" + pls.PlayerPassword); QGCNio.CreateSubmitWWW(url, userObj, CategoryType.QGC_Register); }
public void SubmitScore(int score) { if (!ApiReady() || !IsLoggedIn()) { return; } if (score < 0) { API.LogWarning("Score must not be negative"); return; } string url = _baseURL + "/score"; QGCPlayerScoreSend pls = new QGCPlayerScoreSend(); pls.LeaderboardId = _leaderboardKey; pls.PlayerScore = score; string userObj = JsonConvert.SerializeObject(pls); QGCNio.CreateSubmitWWW(url, userObj, _authToken, CategoryType.QGC_SubmitScore); }