Ejemplo n.º 1
0
    /// <summary>
    /// Create the button used to return to the main menu, and save the curriculum and
    /// load the main menu if it has been clicked.
    /// </summary>
    private void CreateMainMenuBtn()
    {
        // Create the button used to create a new lesson.  If it was clicked...
        if (GUI.Button(new Rect(Screen.width - (200 * scaleFactor), Screen.height - (90 * scaleFactor), (150 * scaleFactor), (40 * scaleFactor)), "Main Menu", mainMenuButtonStyle))
        {
            GameStateUtilities.Save(playerData);

            // Return to the main menu
            Application.LoadLevel("MainMenu");
        }
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 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();
            }
        }
    }
Ejemplo n.º 4
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);
        }
    }
Ejemplo n.º 5
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
        }
    }