//public void SendScore(String name, bool isHost, long id, long time, long score, String roomCode) public void SendScore(long time, long score, bool hasDied) { SubmitScore submitScore = new SubmitScore { name = profile.name, isHost = profile.isHost, id = profile.id, time = time, score = score, roomCode = profile.roomCode, hasDied = hasDied }; string Message = JsonConvert.SerializeObject(submitScore, Formatting.Indented); String serverResponse = SendServerMessage(Message); JObject serverJSONResponse = JObject.Parse(serverResponse); // If other player is not done, wait. Otherwise, print score if (serverJSONResponse.GetValue("response").ToString() == "NotDone") { stupidFix(Message); } else { enemyTime = long.Parse(serverJSONResponse.GetValue("enemyTime").ToString()); enemyScore = long.Parse(serverJSONResponse.GetValue("enemyScore").ToString()); enemyDeath = Boolean.Parse(serverJSONResponse.GetValue("enemyDeath").ToString()); PlayerPrefs.SetString("enemyName", serverJSONResponse.GetValue("enemyName").ToString()); Debug.Log(serverJSONResponse.GetValue("enemyName").ToString()); PlayerPrefs.SetString("roomCode", ""); finished = true; } }
public void SubmitRankInfo(int score) { RankInfo rankinfo = new RankInfo(); rankinfo.username = accountInfo.username; rankinfo.score = score; SubmitScore submitScore = new SubmitScore(); submitScore.action = "SubmitScore"; submitScore.data = rankinfo; string senddata = JsonUtility.ToJson(submitScore); Send(senddata); }
public static void SetHighscore(int score) { int actual = PlayerPrefs.GetInt(Constants.HighScore_Pref); if (score > actual) { PlayerPrefs.SetInt(Constants.HighScore_Pref, score); } try { SubmitScore.SubmitHighScore(score); } catch { Debug.LogWarning("No conectado a kongregate"); } }
private IEnumerable<SubmitScore> GetTopTen(int p) { SubmitScore[] ar = new SubmitScore[Math.Min(MyScores.TopTen.Count, 10)]; var x = MyScores.TopTen.Where(a => a.LevelHashCode == p).ToList(); x.Sort(); for (int i = 0; i < Math.Min(x.Count(), 10); i++) ar[i] = x[i];//ar[i] = MyScores.TopTen[i]; return ar; }
public void SendScoreEvent(ulong channelId, SubmitScore score) { var channel = _client.GetChannel(channelId) as SocketTextChannel; channel?.SendMessageAsync($"{score.Score.Username} has scored {score.Score._Score}{(score.Score.FullCombo ? " (Full Combo!)" : "")} on {score.Score.Parameters.Beatmap.Name}!"); }
public void SendScoreEvent(ulong channelId, SubmitScore score) { var channel = _client.GroupChannels.FirstOrDefault(x => x.Id == channelId); channel?.SendMessageAsync($"{score.Score.Username} has scored {score.Score.Score_}{(score.Score.FullCombo ? "(Full Combo!)" : "")} on {score.Score.Parameters.Beatmap.Name}!"); }