void generatePushWithServerCode() { printToConsole("Requesting server to send push..."); GamedoniaScripts.Run("sendpush", new Dictionary <string, object>(), delegate(bool success, object data) { if (success) { printToConsole("Push requested successfully"); } else { printToConsole("Failed request for server push"); } } ); }
public Question setRandomQuestion(int categoryID) { StartCoroutine(processTimer()); currentQuestion = null; //string[] questionIds = MatchManager.I.GetQuestionsInMatch ("5778fdfee4b006e8d75e6c3c"); string[] questionIds = MatchManager.I.GetQuestionsInMatch(); Dictionary <string, object> parameters = new Dictionary <string, object>() { { "cId", categoryID } }; parameters.Add("qIds", questionIds); GamedoniaScripts.Run("getrandomquestion", parameters, delegate(bool success, object data) { if (success) { if (data != null && data != "undefined") { Dictionary <string, object> question = (Dictionary <string, object>)data; currentQuestion = new Question( question["_id"].ToString(), int.Parse(question["cId"].ToString()), question["qT"].ToString(), question["qA"].ToString(), question["qB"].ToString(), question["qC"].ToString(), question["qD"].ToString(), question["qCA"].ToString(), question["sID"].ToString(), int.Parse(question["qAp"].ToString()) ); questionLoaded = true; } else { setRandomQuestion(categoryID); //TODO: the script throwed an error } } }); return(currentQuestion); }