GetMostRecentProblem() public static method

Returns the most recent Problem returned by the NextProblem() function.
public static GetMostRecentProblem ( ) : Problem,
return Problem,
    private void UpdateAnswers()
    {
        availableAnswers.Clear();
        ProblemPart[] wrongAnswers = new ProblemPart[answerButtonTexts.Length - 1];

        if (ThinksyPlugin.GetMostRecentProblem().CountDistractors() >= wrongAnswers.Length)
        {
            wrongAnswers = ThinksyPlugin.GetMostRecentProblem().GetDistractors(wrongAnswers.Length);
        }
        else
        {
            for (int i = 0; i < wrongAnswers.Length; i++)
            {
                wrongAnswers [i] = ThinksyPlugin.GetMostRecentProblem().GetDistractor();
            }
        }

        foreach (ProblemPart wrongAnswer in wrongAnswers)
        {         //add the number of buttons minus one wrong answers
            availableAnswers.Add(wrongAnswer);
        }
        availableAnswers.Add(ThinksyPlugin.GetMostRecentProblem().GetCurrentCorrectAnswerPart());
        //add the one right answer

        Shuffle(availableAnswers);
    }
 public void ButtonClick(int choiceIndex)
 {
     ThinksyPlugin.GetMostRecentProblem().AddGivenAnswerPart((ProblemPart)availableAnswers [choiceIndex]);
     if (ThinksyPlugin.AllAnswerPartsGiven())
     {
         SubmitAnswers();
     }
     else
     {
         UpdateDisplay();
     }
 }
 /// <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);
 }
 private void SubmitAnswers()
 {
     if (ThinksyPlugin.GetMostRecentProblem().SubmitAnswer())
     {
         AudioManager.audioManager.PlaySuccess();
         CorrectLight.LightShow();
     }
     else
     {
         AudioManager.audioManager.PlayFailure();
     }
     NextProblem();
 }
        public static IEnumerator InitializeSenseix(string newAccessToken)
        {
            //Debug.Log ("initializing");

            if (isInitializing)
            {
                Logger.BasicLog("already initializing");
                yield break;
            }
            isInitializing = true;

            yield return(GetSingletonInstance().StartCoroutine(WaitForWebGLInitializing()));

            SetSessionState(true);

            accessToken = newAccessToken;
            if (CheckAccessToken() == -1)
            {
                throw new Exception("The Thinksy Token you have provided is not of a valid length, please" +
                                    " register at https://developer.thinksylearn.com/ to create a valid key.  Then, fill " +
                                    "in the Game Access Token field of the ThinksyPlugin script on the Thinksy Prefab." +
                                    "  You can also test offline by checking the testing mode boolean on the Thinksy Prefab.");
            }

            //Creates a temporary account based on device id
            //returns an auth token. This is Syncronous.
            //Debug.Log("registering device");
            yield return(GetSingletonInstance().StartCoroutine(RegisterDevice()));

            //Debug.Log ("listing players");
            yield return(GetSingletonInstance().StartCoroutine(ListPlayers()));

            //Debug.Log("register all players");
            yield return(GetSingletonInstance().StartCoroutine(RegisterAllPlayers()));

            //Debug.Log("submit cache");
            SenseixSession.CheckProblemPostCacheSubmission();
            //SenseixPlugin.ShowEmergencyWindow ("testing");

            //yield return GetSingletonInstance().StartCoroutine(Message.Request.UpdatePlayerScore (GetCurrentPlayerID(), 0));
            //yield return GetSingletonInstance().StartCoroutine(Message.Request.GetPlayerRank (GetCurrentPlayerID ()));

            yield return(Message.Request.GetSingletonInstance().StartCoroutine(
                             Message.Request.GetProblems(SenseixSession.GetCurrentPlayerID(), ProblemKeeper.PROBLEMS_PER_PULL)));

            ThinksyPlugin.GetMostRecentProblem();
            isInitializing = false;
        }
示例#6
0
        public static IEnumerator InitializeSenseix(string newAccessToken)
        {
            //Debug.Log ("initializing");

            yield return(GetSingletonInstance().StartCoroutine(LimitedInitializeSenseix(newAccessToken)));

            //Debug.Log("submit cache");
            SenseixSession.CheckProblemPostCacheSubmission();
            //SenseixPlugin.ShowEmergencyWindow ("testing");

            //yield return GetSingletonInstance().StartCoroutine(Message.Request.UpdatePlayerScore (GetCurrentPlayerID(), 0));
            //yield return GetSingletonInstance().StartCoroutine(Message.Request.GetPlayerRank (GetCurrentPlayerID ()));

            yield return(Message.Request.GetSingletonInstance().StartCoroutine(
                             Message.Request.GetProblems(SenseixSession.GetCurrentPlayerID(), ProblemKeeper.PROBLEMS_PER_PULL)));

            ThinksyPlugin.GetMostRecentProblem();
            EndInitialize();
        }
 private void InstanceDisplayCurrentQuestion()
 {
     DisplayProblem(ThinksyPlugin.GetMostRecentProblem());
 }