package com.dubiousoft.sakana;

import android.content.Context;
import android.content.SharedPreferences;

public class ScoreStore {

	private final SharedPreferences m_sharedPref;
	
	ScoreStore( Context context ) {
		m_sharedPref = context.getSharedPreferences( "com.dubiousoft.sakana.high_scores", Context.MODE_PRIVATE);
	}
	
	public void storeScore( String sceneName, int score ) {
		SharedPreferences.Editor editor = m_sharedPref.edit();
		editor.putInt(sceneName, score);
		editor.commit();	
	}
	
	public int getScore( String sceneName ) {
		return m_sharedPref.getInt( sceneName, -100 );
	}
	
	public void DEBUG_clearScores( SceneManager manager ) {
		for (int i=0; i<manager.getSize(); ++i) {
			storeScore( manager.getNode(i).name, -999 );
		}
	}
}
