package com.xjd.wolfpuzzle;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class MainActivity extends Activity implements OnClickListener{
	private Button start;
	private Button end;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		start = (Button)findViewById(R.id.start);
		end = (Button)findViewById(R.id.end);
		start.setOnClickListener(this);
		end.setOnClickListener(this);
		
		
	}

	@Override
	public void onClick(View v) {
		// TODO 自动生成的方法存根
		switch (v.getId()) {
		case R.id.start:
			Intent intent = new Intent(this, SelectActivity.class);
			startActivity(intent);
			break;
		case R.id.end:
			finish();
			break;
			
		default:
			break;
		}
		
	}

	
	public static int getMissionVer(Context context,String key){
		int value = 1;
		SharedPreferences perf = context.getSharedPreferences("mission", 1);
		value = perf.getInt(key, 1);
		return value;
	}
	public static void setMissionVer(Context context,String key,int value){
		SharedPreferences perf = context.getSharedPreferences("mission", 1);
		Editor editor = perf.edit();
		editor.putInt(key, value);
		editor.commit();
	}
}
