static public string PlayerSeedPath() { string PlayerName = SenseixSession.GetCurrentPlayerID(); string playerSeedPath = System.IO.Path.Combine(Application.persistentDataPath, PlayerName + SEED_FILE_EXTENSION); return(playerSeedPath); }
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; }
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(); }
static public bool SubmitAnswer(Message.Problem.ProblemData answeredProblemData, Answer answer, bool correct) { Message.Problem.ProblemPost problem = new Message.Problem.ProblemPost(); problem.correct = correct; //set Problem's answers to given ones string[] answerIDStrings = answer.GetAnswerIDs(); Senseix.Message.Problem.AnswerIdentifier givenAnswerIDs = new Senseix.Message.Problem.AnswerIdentifier(); foreach (string answerID in answerIDStrings) { givenAnswerIDs.uuid.Add(answerID); } problem.problem_id = answeredProblemData.uuid; problem.answer_ids = givenAnswerIDs; problem.player_id = SenseixSession.GetCurrentPlayerID(); problem.answered_at_unix_time = UnixTimeNow(); AddAnsweredProblem(problem, answer); return(correct); }
public static void GetProblems(uint numberOfProblems) { Message.Request.GetSingletonInstance().StartCoroutine( Message.Request.GetProblems(SenseixSession.GetCurrentPlayerID(), numberOfProblems)); }