private SignalRService(HubConnection client) { _client = client; CurrentAnswer = _client .Observe <Answer, DateTime>(nameof(CurrentAnswer)) .Log(this, nameof(CurrentAnswer)) .Publish(); CurrentAnswer .Connect() .DisposeWith(_disposable); CurrentLeaderboard = _client .Observe <IList <Player> >(nameof(CurrentLeaderboard)) .Log(this, nameof(CurrentLeaderboard)) .Publish(); CurrentLeaderboard .Connect() .DisposeWith(_disposable); PlayerCountUpdated = _client .Observe <int>(nameof(PlayerCountUpdated)) .Log(this, nameof(PlayerCountUpdated)) .Publish(); PlayerCountUpdated .Connect().DisposeWith(_disposable); }
IEnumerator Upload(string init, int total_score, int land_saved_score, int human_protection_score, int animal_protection_score) { ScoreEntry se = new ScoreEntry(init, total_score); bool entrySuccess = CurrentLeaderboard.AddEntry(se); Debug.Log("Form upload complete!"); // scoreboard.getScoresAgain(); slide = !slide; slideDisable = false; slideButton.enabled = slideDisable; initials.text = ""; output = ""; return(null); }
IEnumerator getScores() { scoreEntries = CurrentLeaderboard.GetLeaderboard(); Debug.Log("Just got scores from CurrentLeaderboard.cs"); Debug.Log(scoreEntries[0].player_initials); string scoretext = ""; bool setScore = false; for (int i = 0; i < scoreEntries.Count; i++) { if ((int)ScoreCalculator.netScore > (int)scoreEntries[i].total_score && !setScore) { scorePlace = i + 1; break; } else if (!setScore) { scorePlace = i + 2; } } Debug.Log(scoreEntries.Count); Debug.Log("PLACE IN RANK"); Debug.Log(scorePlace); int leaderBoardLength = 10; for (int i = 0; i < leaderBoardLength; i++) { if (i == leaderBoardLength - 1) { scoretext += " <size=30>" + (i + 1) + ".</size> " + scoreEntries[i].player_initials + " " + scoreEntries[i].total_score; } else { scoretext += " <size=30>" + (i + 1) + ".</size> " + scoreEntries[i].player_initials + " " + scoreEntries[i].total_score + "\n"; } Debug.Log(i + ": " + scoreEntries[i].player_initials + ": " + scoreEntries[i].total_score); } Debug.Log("LEADERBOARD"); Debug.Log(leaderboards.text); Debug.Log(scoretext); leaderboards.text = scoretext; scoreText = scoretext; return(null); }