|
|
@@ -550,17 +550,17 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
|
|
|
public NewQuestion GetNewQuestion(List<int> userAnsweredQuestions, string userName) {
|
|
|
int gameId = GameObject.Find("GameManager").GetComponent<GameManagerScript>().GameId;
|
|
|
- Color32 questionCategoryColor = new Color32(0, 0, 20, 20);
|
|
|
|
|
|
- GetQuestionData(false);
|
|
|
- NewQuestion q = NewQuestion.Instance();
|
|
|
- q.questionString = questionString;
|
|
|
- q.answerString = answerString;
|
|
|
- q.categoryString = categoryString;
|
|
|
- q.idString = idString;
|
|
|
- q.SetQuestionCategoryColor(questionCategoryColor);
|
|
|
+ Question q = GetQuestionData(false);
|
|
|
+ NewQuestion nq = NewQuestion.Instance();
|
|
|
+ nq.questionString = q.question;
|
|
|
+ nq.answerString = q.answer;
|
|
|
+ nq.categoryString = q.category;
|
|
|
+ nq.idString = q.id;
|
|
|
+ Color32 questionCategoryColor = new Color32((byte)q.r, (byte)q.g, (byte)q.b, (byte)q.a);
|
|
|
+ nq.SetQuestionCategoryColor(questionCategoryColor);
|
|
|
|
|
|
- return q;
|
|
|
+ return nq;
|
|
|
}
|
|
|
|
|
|
public void SavePlayersQuestion(string questionId, string playerNameValue, int gameId) {
|
|
|
@@ -592,7 +592,7 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
form.AddField("userName", playerName);
|
|
|
|
|
|
string response = CallOnlineDatabaseWithResponse("OnlineGameInfo.php", form);
|
|
|
- response = "{\"questionsList\" : [" + response + "]}";
|
|
|
+ response = "{\"questionsList\" : " + response + "}";
|
|
|
|
|
|
Questions ql = new Questions();
|
|
|
|
|
|
@@ -629,22 +629,19 @@ public class OnlineDatabase : MonoBehaviour {
|
|
|
return questions;
|
|
|
}
|
|
|
|
|
|
- private void GetQuestionData(bool showAnswer) {
|
|
|
+ private Question GetQuestionData(bool showAnswer) {
|
|
|
WWWForm form = new WWWForm();
|
|
|
|
|
|
string response = CallOnlineDatabaseWithResponse("Question.php", form);
|
|
|
|
|
|
- // Show result
|
|
|
-
|
|
|
- response = "{\"questionsList\" : [ " + response + " ]}";
|
|
|
+ // Show result
|
|
|
|
|
|
- Questions qe = new Questions();
|
|
|
- JsonUtility.FromJsonOverwrite(response, qe);
|
|
|
+ response = "{\"questionsList\" : [ " + response + " ]}";
|
|
|
|
|
|
- questionString = qe.questionsList[0].question;
|
|
|
- answerString = qe.questionsList[0].answer;
|
|
|
- idString = qe.questionsList[0].id;
|
|
|
- categoryString = qe.questionsList[0].category;
|
|
|
+ Questions qe = new Questions();
|
|
|
+ JsonUtility.FromJsonOverwrite(response, qe);
|
|
|
+
|
|
|
+ return qe.questionsList[0];
|
|
|
}
|
|
|
|
|
|
public List<UserName> GetUsersToInvite(string searchString) {
|