Ejemplo n.º 1
0
    // saves the game settings
    public void SaveSettings()
    {
        // uses the metric logger to save the settings
        MetricsLogger prefLog = new MetricsLogger();

        // adjusts the volume
        // TODO: maybe move this function or put it into this game settings file.
        SettingsInterface.AdjustVolume();

        // Saving Content to Fle
        // sets the logger file
        prefLog.SetLoggerFile(FILE_NAME);

        // TODO: add function to metrics to see if the file exists.
        // see what happens if the file isn't there.

        // adds the contents
        // master volume
        prefLog.AddMetricToLogger(LBL_MASTER_VOL, masterVolume);

        // bgm volume
        prefLog.AddMetricToLogger(LBL_BGM_VOL, bgmVolume);

        // sound effects
        prefLog.AddMetricToLogger(LBL_SFX_VOL, sfxVolume);

        // saves the data
        prefLog.SaveMetrics();
    }
Ejemplo n.º 2
0
    // loads the game settings
    public void LoadSettings()
    {
        MetricsLogger prefLog = new MetricsLogger();

        // sets the logger file
        prefLog.SetLoggerFile(FILE_NAME);
        prefLog.LoadMetrics();

        // get the contents
        float value;

        // master volume
        value = prefLog.GetMetricFromLogger(LBL_MASTER_VOL);
        SetMasterVolume(value);

        // bgm
        value = prefLog.GetMetricFromLogger(LBL_BGM_VOL);
        SetBgmVolume(value);

        // sound effects
        value = prefLog.GetMetricFromLogger(LBL_SFX_VOL);
        SetSfxVolume(value);

        // adjust all volume settings
        SettingsInterface.AdjustVolume();
    }