After login is sent, you can obtain a list of existing scores for each game of the user from the database. Note that the userscore table in the DB should only contain records of score <> 0, that is, at least once a game is played.
After the game ends, update the score field of the userscore table in the DB. If no record exists, add a new one. The table will not be updated for the draw. (This is an SP named pr_updatescore .)
When the game ends, the score record of the table user in the clienttable of the server is updated.
When the game ends, the server sends a new score to all Hall users of the game.
After login ends, the user will response the existing Score list of each game to the client and store it in list <gamescore>. There are two fields: gameid and score.
After,
Joinhall extracts the score of the game corresponding to the hall from the client and adds it to the clienttable. This step is crucial.
Leavehall removes userhallinfo from the clienttable.
When the game ends, the list <gamescore> of the client is updated.
* Sometimes the singleordefault method is better than single.