예제 #1
0
    /// <summary>
    /// Saves user's current game preferences, scores, and HP
    /// </summary>
    private void SaveGamePreferences()
    {
        PlayerData dataToSave = GameStateUtilities.Load();

        dataToSave.Curriculum        = Context.Curriculum;
        dataToSave.CurrentLessonId   = Context.CurrentLessonId;
        dataToSave.LifeCount         = (int)Context.PlayerHealth.CurHealth;
        dataToSave.CurrentScore      = Context.CurrentScore.Score;
        dataToSave.EnemyDifficultyId = Context.EnemyDifficulty.ID;
        GameStateUtilities.Save(dataToSave);
    }
예제 #2
0
    /// <summary>
    /// Initialize the data needed to build this page when it is first loaded
    /// </summary>
    void Start()
    {
        // If the player's Lessons and WordSets have not been loaded from
        // persistent storage, do so
        if (playerData == null)
        {
            playerData = GameStateUtilities.Load();

            if (playerData.Curriculum.Lessons.Count == 0)
            {
                playerData.Curriculum.CreateSampleLessons();
            }
        }
    }
예제 #3
0
    /// <summary>
    /// Initialize the data needed to build this page when it is first loaded
    /// </summary>
    void Start()
    {
        // If the player's Lessons and WordSets have not been loaded from
        // persistent storage, do so
        if (playerData == null)
        {
            playerData = GameStateUtilities.Load();

            if (playerData.Curriculum.Lessons.Count == 0)
            {
                playerData.Curriculum.CreateSampleLessons();
            }

            // Cache the difficulty level button's backgrounds (and such) so they can be interchanged when clicked,
            // and reset their styles to be as if no buttons was selected
            BuildDifficultyLevelStyleCache(true);
        }
    }
예제 #4
0
    /// <summary>
    /// Populate the Context from the save file
    /// </summary>
    /// <param name="desiredData">The type of data to load from the save file</param>
    private static void LoadDataFromSaveFile(DataToLoad desiredData)
    {
        // Retrieve all data from the save file
        PlayerData tmpPlayerData = GameStateUtilities.Load();

        // If the curriculum should be loaded...
        if (desiredData == DataToLoad.Curriculum || desiredData == DataToLoad.Everything)
        {
            // Copy the lessons to the Context
            _curriculum = tmpPlayerData.Curriculum;
            // If the user has not created any lessons, create a sample lesson to work with
            if (_curriculum.Lessons.Count == 0)
            {
                _curriculum.CreateSampleLessons();
            }
        }

        // If the game state should be loaded (ie the user is loading a saved game)...
        if (desiredData == DataToLoad.GameState || desiredData == DataToLoad.Everything)
        {
            // PLACEHOLDER: This code has not yet been implimented
        }
    }