|
|
@@ -404,7 +404,7 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
|
|
|
string response = CallOnlineDatabaseWithResponse("OnlineGames.php", form);
|
|
|
if (response.Equals("")) {
|
|
|
- Debug.Log("Something wrong with getting current player for game with id: " + gameId);
|
|
|
+ Debug.Log("Something wrong with getting round for game with id: " + gameId);
|
|
|
}
|
|
|
Int32.TryParse(response, out int round);
|
|
|
return round;
|
|
|
@@ -420,6 +420,7 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
Debug.Log("Something wrong with getting players from game with id: " + gameId);
|
|
|
}
|
|
|
|
|
|
+ response = response = "{\"playerInfoList\" : " + response + " }";
|
|
|
GamePlayerInfos gpi = new GamePlayerInfos();
|
|
|
JsonUtility.FromJsonOverwrite(response, gpi);
|
|
|
|
|
|
@@ -438,21 +439,16 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
public string CategoryString { get => categoryString; set => categoryString = value; }
|
|
|
|
|
|
internal int GetQuestionsLost(int gameId, string playerName) {
|
|
|
- string sql = "SELECT questionsLost FROM localGamePlayers WHERE gameId = " + gameId + " AND playerId = (SELECT id from localUsers WHERE name = '" + playerName + "')";
|
|
|
- IDbConnection conn = new SqliteConnection(databaseUrl);
|
|
|
- conn.Open();
|
|
|
- IDbCommand cmd = conn.CreateCommand();
|
|
|
- cmd.CommandText = sql;
|
|
|
- IDataReader reader = cmd.ExecuteReader();
|
|
|
- int returnValue = 0;
|
|
|
- while (reader.Read()) {
|
|
|
- returnValue = reader.GetInt32(0);
|
|
|
- }
|
|
|
- reader.Close();
|
|
|
- cmd.Dispose();
|
|
|
- conn.Close();
|
|
|
+ WWWForm form = new WWWForm();
|
|
|
+ form.AddField("f", "GetQuestionsLost");
|
|
|
+ form.AddField("userName", playerName);
|
|
|
|
|
|
- return returnValue;
|
|
|
+ string response = CallOnlineDatabaseWithResponse("OnlineGames.php", form);
|
|
|
+ if (response.Equals("")) {
|
|
|
+ Debug.Log("Something wrong with getting questions lost from game with id: " + gameId + " and playername " + playerName);
|
|
|
+ }
|
|
|
+ Int32.TryParse(response, out int questionsLost);
|
|
|
+ return questionsLost;
|
|
|
}
|
|
|
|
|
|
public string GetGameMode(int gameId) {
|