예제 #1
0
    void RecordData()
    {
        foreach (HollowBlock block in hollowBlocks)
        {
            if (block.IsSolved())
            {
                currentKey = new Tuple <string, int> ("Hollow Block", PlayerDatav2.hollowBlockIndex);
                DataManagerv2.CreateEmptyEntry(currentKey);
                HollowBlockEntry entry = new HollowBlockEntry();
                entry.name  = "Hollow Block " + PlayerDatav2.hollowBlockIndex;
                entry.topic = sceneTag.GetSceneTopic();
                foreach (SkyFragmentPiece piece in block.GetSkyPieceContainer().GetSkyPieces())
                {
                    AttemptedAnswer attempt = new AttemptedAnswer();
                    attempt.SetNumerator(piece.GetNumerator());
                    attempt.SetDenominator(piece.GetDenominator());
                    entry.attemptedAnswers.Add(attempt);
                }
                DataManagerv2.UpdateHollowBlockEntry(DataManagerv2.GetHollowBlockLastKey(), entry);
                PlayerDatav2.IncrementHollowBlockIndex();
            }
//			entry.correctAttempts = new List<int> ();
        }
        DataManagerv2.PrintHollowBlockDictionary();
    }
예제 #2
0
    /// <summary>
    /// Saves name of last scene visited and current levels for each topic of the player
    /// </summary>
    void SaveUserData()
    {
        userData.lastSceneVisited = SceneManager.GetActiveScene().name;

        if (!doesSceneExist && sceneTag != null)
        {
            userData.currentAdditionSimilarFractionsLevel    = currentASLevel;
            userData.currentSubtractionSimilarFractionsLevel = currentSSLevel;
            userData.currentDissimilarFractionsLevel         = currentDLevel;
            if (sceneTag.GetSceneTopic().Equals(SceneTopic.SIMILAR_ADD))
            {
                Debug.Log("Inside if add");
                currentASLevel++;
//				userData.currentAdditionSimilarFractionsLevel = currentASLevel++;
            }
            else if (sceneTag.GetSceneTopic().Equals(SceneTopic.SIMILAR_SUB))
            {
                currentSSLevel++;
//				userData.currentSubtractionSimilarFractionsLevel = currentSSLevel++;
            }
            else if (sceneTag.GetSceneTopic().Equals(SceneTopic.DISSIMILAR_ADD) || sceneTag.GetSceneTopic().Equals(SceneTopic.DISSIMILAR_SUB) ||
                     sceneTag.GetSceneTopic().Equals(SceneTopic.EQUIVALENT_ADD) || sceneTag.GetSceneTopic().Equals(SceneTopic.EQUIVALENT_SUB))
            {
                currentDLevel++;
//				userData.currentDissimilarFractionsLevel = currentDLevel++;
            }
        }
//		else {
//			userData.currentAdditionSimilarFractionsLevel = currentASLevel;
//			userData.currentSubtractionSimilarFractionsLevel = currentSSLevel;
//			userData.currentDissimilarFractionsLevel = currentDLevel;
//		}
        userData.currentAdditionSimilarFractionsLevel    = currentASLevel;
        userData.currentSubtractionSimilarFractionsLevel = currentSSLevel;
        userData.currentDissimilarFractionsLevel         = currentDLevel;

        string newData = JsonUtility.ToJson(userData, true);

        File.WriteAllText(userDataPath, newData);
        userData = new UserData();

        Debug.Log("Saved user data");
    }