public void Handler(EventType type, string msg) { // { "type": 2, "data": { "userId": "ID", "point": 2000, "genre": 2 } } if (type == EventType.ProblemSolved) { Event <EventDetail> e = JsonUtility.FromJson <Event <EventDetail> >(msg); try { userManager.AddScore(e.data.userId, e.data.genre, e.data.point); } catch (MissingFieldException err) { Debug.LogError(err); } try { rankingManager.Update(userManager.usersDictionary[e.data.userId]); } catch (Exception err) { Debug.LogError(err); } return; } }
IEnumerator AddPoint() { yield return(new WaitForSeconds(2f)); for (int i = 0; i < 100; i++) { string v = Random.Range(0, userManager.usersDictionary.Count - 1).ToString(); var genre = (VisualizerSystem.ProblemSolvedEvent.Genre)Random.Range(0, 10); var score = Random.Range(100, 1000); userManager.AddScore(v, genre, score); rankingManager.Update(userManager.usersDictionary[v]); yield return(new WaitForSeconds(Random.Range(2f, 3f))); } }