|
@@ -532,18 +532,13 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
|
|
|
|
|
internal int GetWinCondition(int gameId) {
|
|
internal int GetWinCondition(int gameId) {
|
|
|
if (winAmount == -1) {
|
|
if (winAmount == -1) {
|
|
|
- string sql = "SELECT winNumber FROM game WHERE id = " + gameId;
|
|
|
|
|
- IDbConnection conn = new SqliteConnection(databaseUrl);
|
|
|
|
|
- conn.Open();
|
|
|
|
|
- IDbCommand cmd = conn.CreateCommand();
|
|
|
|
|
- cmd.CommandText = sql;
|
|
|
|
|
- IDataReader reader = cmd.ExecuteReader();
|
|
|
|
|
- while (reader.Read()) {
|
|
|
|
|
- this.winAmount = reader.GetInt32(0);
|
|
|
|
|
- }
|
|
|
|
|
- reader.Close();
|
|
|
|
|
- cmd.Dispose();
|
|
|
|
|
- conn.Close();
|
|
|
|
|
|
|
+ WWWForm form = new WWWForm();
|
|
|
|
|
+ form.AddField("gameId", gameId);
|
|
|
|
|
+
|
|
|
|
|
+ string response = CallOnlineDatabaseWithResponse("OnlineGames.php", form);
|
|
|
|
|
+
|
|
|
|
|
+ Int32.TryParse(response, out int winAmount);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
return this.winAmount;
|
|
return this.winAmount;
|
|
|
}
|
|
}
|
|
@@ -611,21 +606,7 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
|
|
|
|
|
questions.Add(qc);
|
|
questions.Add(qc);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- /*
|
|
|
|
|
-
|
|
|
|
|
- q.SetAnswerText(reader.GetInt32(2).ToString());
|
|
|
|
|
- q.SetQuestionText(reader.GetString(1));
|
|
|
|
|
- q.idString = reader.GetInt32(0).ToString();
|
|
|
|
|
- Color32 questionCategoryColor = new Color32((byte)reader.GetInt32(7), (byte)reader.GetInt32(8), (byte)reader.GetInt32(9), (byte)reader.GetInt32(10));
|
|
|
|
|
-
|
|
|
|
|
- q.SetQuestionCategoryColor(questionCategoryColor);
|
|
|
|
|
-
|
|
|
|
|
- questions.Add(q);
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- */
|
|
|
|
|
- // TODO Fix online call to question
|
|
|
|
|
return questions;
|
|
return questions;
|
|
|
}
|
|
}
|
|
|
|
|
|