//ステージ選択ステージ

stage = new GameStage();

stage.stageNameList = new Array();

stage.runStage = function(){
	GameStage.prototype.runStage.apply(this, []);
	
	var that = this;
	var stageSelectorClosed = function(retv){
		var tryAgain = true;
		if(retv){
			if(retv.length == 1){
				tryAgain = false;
			}
		}
		if(tryAgain){
			//もう一度選択させる
			var sw = new SelectWidgetClass(mainManager, [that.stageNameList, stageSelectorClosed, false, 0, true]);
			sw.enableCancel = false;
			mainManager.addWidget(sw);
		} else{
			//次のステージへ移動
			mainManager.loadStageFromNetwork(retv[0].stgName);
		}
	};
	
	var stageSelector = new SelectWidgetClass(mainManager, [this.stageNameList, stageSelectorClosed, false, 0, true]);
	stageSelector.enableCancel = false;
	mainManager.addWidget(stageSelector);
};

stage.addSelectWidgetItemFromStageName = function(title, stgName, selected, nanido){
	var item = new SelectWidgetItemClass(false, title, null, selected, title + "ステージへ移動します。\n難易度: " + nanido);
	item.size.x = 60;
	item.size.y = 90;
	item.stgName = stgName;
	this.stageNameList.push(item);
};

var s;
//ステージ
s = stage.addSelectWidgetItemFromStageName("city.png","city", true, "★☆☆☆☆");
s = stage.addSelectWidgetItemFromStageName("cave.png","fukushima",false, "★★★★☆");
s = stage.addSelectWidgetItemFromStageName("yama.png","koenma",false, "★★☆☆☆");
s = stage.addSelectWidgetItemFromStageName("farm.png","okubo",false, "★★★☆☆");
s = stage.addSelectWidgetItemFromStageName("mori.png","pengin",false, "★★★☆☆");
s = stage.addSelectWidgetItemFromStageName("ike.png","sea",false, "★☆☆☆☆");

stage;
