/// <summary> /// Returns the next Problem for the Player as an instance of the Problem class. If there aren't /// enough Problems left in the queue, an asynchronous task will retrieve more from the Senseix /// server. /// </summary> public static Problem NextProblem() { if (AllAnswerPartsGiven() && !GetMostRecentProblem().HasBeenSubmitted()) { ThinksyPlugin.GetMostRecentProblem().SubmitAnswer(); } Senseix.Message.Problem.ProblemData protobufsProblem = Senseix.SenseixSession.PullProblem(); Senseix.Logger.BasicLog("Next problem! Problem ID: " + protobufsProblem.uuid + " Category: " + protobufsProblem.category_name); //Debug.Log ("Next problem! Problem ID: " + protobufsProblem.uuid + " Category: " + protobufsProblem.category_name); mostRecentProblem = new Problem(protobufsProblem); ThinksyQuestionDisplay.DisplayCurrentQuestion(); return(mostRecentProblem); }
static public bool ParseGetSpecifiedProblemResponse(byte[] responseBytes) { Problem.SpecifiedProblemGetResponse getProblemResponse = Deserialize(responseBytes, typeof(Problem.SpecifiedProblemGetResponse)) as Problem.SpecifiedProblemGetResponse; if (getProblemResponse.problems.Count == 0) { throw new Exception("no problems in specified problem response."); } global::Problem[] problems = new global::Problem[getProblemResponse.problems.Count]; for (int i = 0; i < getProblemResponse.problems.Count; i++) { Senseix.Message.Problem.ProblemData problemData = getProblemResponse.problems[i]; problems[i] = new global::Problem(problemData); } ThinksyEvents.InvokeSpecifiedProblemsReceived(problems); return(true); }
/// <summary> /// Don't use this unless you know what you're doing- instead get a problem from /// SenseixPlugin.NextProblem(). /// </summary> public Problem(Senseix.Message.Problem.ProblemData newProtobufsProblemBuilder) { protobufsProblemData = newProtobufsProblemBuilder; }
/// <summary> /// Don't use this unless you know what you're doing- instead get a problem from /// SenseixPlugin.NextProblem(). /// </summary> public Problem(Senseix.Message.Problem.ProblemData newProtobufsProblemBuilder) { protobufsProblemData = newProtobufsProblemBuilder; }