var MySetting = function(){}
//モラルデータ
MySetting.prototype.Moral = {};
//イメージ設定
//立ち絵イメージ1
MySetting.prototype.Img = [];
//起動フラグ
MySetting.prototype.START_FLG = true;
//会話内容(シナリオ用)
//音楽ON、OFF
//myProc.music(音楽No,ON/OFF（0/1）);
//文章以外の表現方法は関数で
/*["FUNC",function(){			
	//ここに処理を書く
}],*/
//背景含め全パーツを含めてのイメージ表示パッケージ
//myProc.changeImage(表示NO,背景No（falseなら背景は変えない）,暗転フラグ);
MySetting.prototype.BGM_ON = 0;
MySetting.prototype.BGM_OFF = 1;
MySetting.prototype.BGM_ALLOFF = 2;
MySetting.prototype.BGM_GET_STATUS = 3;
//会話用
MySetting.prototype.TalkMsg = "";
MySetting.prototype.TalkMsgSelect = 0;
MySetting.prototype.Talk = [
	//No0/街中央・通行人1
	[
		["FUNC",function(){myBT.MenuHidden();}],
	],
];
//命令用
MySetting.prototype.Talk2 = [
	//No0/街中央・通行人1
	[
		["FUNC",function(){myBT.MenuHidden();}],
	],
];
//イベント用
MySetting.prototype.evt_img_idx = 0;
MySetting.prototype.EventSelect = {0:0,1:0,"win":0,"lose":0,"result":0};
MySetting.prototype.EventImage = new Image();
//イメージズームアップ
MySetting.prototype.BastUp = 0;
MySetting.prototype.UnderUp = 1;
MySetting.prototype.BastUnderUp = 2;
MySetting.prototype.ImageZoomIndex = MySetting.BastUp;
MySetting.prototype.zoomWidth = 350;
MySetting.prototype.zoomHeight = 150;
MySetting.prototype.zoomXstart = 25;
MySetting.prototype.zoomYstart = 175;
MySetting.prototype.ImageZoomUp = function(view=true,imgIdx=-1){
	var width = myST.zoomWidth;
	var height = myST.zoomHeight;
	var zoomWidth = myST.zoomWidth;
	var zoomHeight = myST.zoomHeight;
	var zoomXstart = myST.zoomXstart;
	var zoomYstart = myST.zoomYstart;
	if(view){
		if(imgIdx == -1)imgIdx = myImg.GetIndexPos("body");
		myST.EventImage.src = myImg.GetImgUrl("body",imgIdx);
		myST.EventImage.onload = function(){
			var idx = myImg.GetCanvasTarget("Other2");
			var ctx = _self.GetCtx(idx);
			if(myST.ImageZoomIndex == myST.BastUnderUp)height =225;
			ctx.strokeRect(zoomXstart,zoomYstart,zoomWidth,height);
			ctx.fillRect((zoomXstart+1),(zoomYstart+1),(zoomWidth-1),height-1);
			if(myST.ImageZoomIndex == myST.BastUp){
				ctx.drawImage(this,(zoomHeight-5),(zoomWidth-5),zoomWidth,height,zoomXstart,zoomYstart,width,height);
			}else if(myST.ImageZoomIndex == myST.UnderUp){
				ctx.drawImage(this,(zoomHeight-5),570,zoomWidth,height,zoomXstart,zoomYstart,width,height);
			}else{
				ctx.drawImage(this,(zoomHeight-5),(zoomWidth-5),zoomWidth,height,zoomXstart,zoomYstart,width,height);
			}
		}
	}else{
		var idx = myImg.GetCanvasTarget("Other2");
		var ctx = _self.GetCtx(idx);
		ctx.clearRect(zoomXstart,zoomYstart,zoomWidth,zoomHeight);		
	}
}
//胸もみ
MySetting.prototype.HImageSet = function(flg=true){
	if(!flg){
		myRpg.WearBreak2(myRpg.Charctor);
		return;
	}
	imgIdx = myImg.GetIndexPos("body");
	if(imgIdx == 1)imgIdx = 35;
	if(imgIdx == 2)imgIdx = 36;
	if(imgIdx == 3)imgIdx = 37;
	if(imgIdx == 9)imgIdx = 38;
	if(imgIdx == 10)imgIdx = 39;
	if(imgIdx == 13)imgIdx = 40;
	if(imgIdx == 14)imgIdx = 41;
	if(imgIdx == 15)imgIdx = 42;
	if(imgIdx == 16)imgIdx = 43;
	if(imgIdx == 17)imgIdx = 44;
	if(imgIdx == 19)imgIdx = 46;
	if(imgIdx == 27)imgIdx = 48;
	myST.CheageImage("body",imgIdx);
}
//立ち絵レイプ
MySetting.prototype.HImageSet2Value = -1;//元立ち絵インデックス
MySetting.prototype.HImageSet2Orign = -1;//元のシーン
MySetting.prototype.HImageSet2Next = -1;//次のシーン
MySetting.prototype.HImageSet2GetNext = function(screen){
	myST.HImageSet2(screen,false);
	var val = myST.HImageSet2Next;
	myST.HImageSet2Next = -1;
	myST.HImageSet2Orign = -1;
	return val;
}
MySetting.prototype.HImageSet2 = function(Scene=0,flg1=true,flg2=true){
	var res = true;
	if(!flg2){
		myRpg.WearBreak2(myRpg.Charctor);
		return false;
	}
	Scene = parseInt(Scene);
	if(myST.HImageSet2Value==-1){
		imgIdx = myImg.GetIndexPos("body");
		myST.HImageSet2Value = imgIdx;
	}else{
		imgIdx = myST.HImageSet2Value;
	}
	
	if(imgIdx == 1){
		imgIdx = 84
		imgIdx += Scene;
	}
	if(imgIdx == 2){
		imgIdx = 92
		imgIdx += Scene;
	}
	if(imgIdx == 3){
		imgIdx = 100;
		if(Scene>=1){
			imgIdx = 92;
			imgIdx += Scene;
		}
	}
	if(imgIdx == 9){
		imgIdx = 101;
		imgIdx += Scene;
	}
	if(imgIdx == 10){
		imgIdx = 109;
		if((Scene==1)||(Scene==2)){
			res = false;
			if(flg1)return false;
		}else if(Scene!=0){
			imgIdx += (Scene-2);
		}
	}
	if(imgIdx == 13){
		imgIdx = 116;
		if((Scene==1)||(Scene==2)){
			res = false;
			if(flg1)return false;
		}else if(Scene!=0){
			imgIdx = 109;
			imgIdx += (Scene-2);
		}
	}
	if(imgIdx == 14){
		imgIdx = 117;
		if((Scene==1)||(Scene==2)){
			res = false;
			if(flg1)return false;
		}else if(Scene!=0){
			imgIdx = 117;
			imgIdx += (Scene-2);
		}
	}
	if(imgIdx == 15){
		imgIdx = 118;
		if((Scene==1)||(Scene==2)||(Scene==3)){
			res = false;
			if(flg1)return false;
		}else if(Scene!=0){
			imgIdx += (Scene-3);
		}
	}
	if(imgIdx == 16){
		imgIdx = 124;
		if((Scene==1)||(Scene==2)||(Scene==3)){
			res = false;
			if(flg1)return false;
		}else if(Scene!=0){
			imgIdx = 118;
			imgIdx += (Scene-3);
		}
	}
	if(imgIdx == 17){
		imgIdx = 119;
		if((Scene>=1)&&(Scene<=3)){
			res = false;
			if(flg1)return false;
		}else if((Scene!=0)&&(Scene!=4)){
			imgIdx = 120;
			imgIdx += (Scene-5);
			if(Scene==5)imgIdx = 120;
		}
	}
	if(imgIdx == 19){
		imgIdx = 125;
		if((Scene>=1)&&(Scene<=3)){
			res = false;
			if(flg1)return false;
		}else if((Scene!=0)&&(Scene!=4)){
			imgIdx += (Scene-4);
		}
	}
	if(imgIdx == 27){
		imgIdx = 130;
		if((Scene>=1)&&(Scene<=3)||(Scene==5)){
			res = false;
			if(flg1)return false;
		}else{
			if(Scene==4)imgIdx += (Scene-3);
			if(Scene==6)imgIdx += (Scene-4);
			if(Scene==7)imgIdx += (Scene-4);
		}
	}
	if(flg1){
		myST.CheageImage("body",imgIdx);
		if(Scene==0){//1
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",1);
		}
		if(Scene==1){//2
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",1);
		}
		if(Scene==2){//2
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
		}
		if(Scene==3){//4
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
			myST.CheageImage("body_face_fk",1);
		}
		if(Scene==4){//4
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
			myST.CheageImage("body_face_fk",1);
		}
		if(Scene==5){//4
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
			myST.CheageImage("body_face_fk",1);
		}
		if(Scene==6){//4
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
			myST.CheageImage("body_face_fk",1);
		}
		if(Scene==7){//4
			myST.CheageImage("body_fr_hair",4);
			myST.CheageImage("body_face_bk",2);
			myST.CheageImage("body_face_fk",2);
		}
		console.log("imgIdx:"+imgIdx);
		console.log("Scene:"+Scene);
		return true;
	}else if(Scene<=8){
		//次のシーン設定
		var Orign = myST.HImageSet2Orign;
		var Next = myST.HImageSet2Next;
		if((Next==-1)&&(Orign!=-1)&&res)myST.HImageSet2Next = Scene;	
		if(Orign==-1)myST.HImageSet2Orign = Scene;
		return myST.HImageSet2((Scene+1),flg1);
	}else{
		return myST.HImageSet2Next;
	}
}
//エロイベントデータ
MySetting.prototype.HEventData = [
	//イベントNo0
	[//宿屋・エロ処女バージョン
		["FUNC",function(){}
		],
	],
]
//イベントデータ
MySetting.prototype.GameOverFlg = false;
MySetting.prototype.EventData = [
	//イベントNo0
	[//宿屋・初回
		["FUNC",function(){}
		],
	]
];
MySetting.prototype.WaitProcess = function(func){
	_self.setTimer(function(func){
		if(func()){
			return;
		}else{
			myST.WaitProcess(func);
		}
	},100,func);
}
//スキップ処理
MySetting.prototype.EventStorySkip = function(Message="シーンをスキップしますか？"){
	//スキップ選択
	if(myBE.EventSkip){
		_self.HiddenBox("msgBox");
		var parent = _self.Elm("operation",_self.TypeID);
		myBT.yesNoBox(parent,Message,
		function(){
			_self.ViewBox("msgBox");
			myBT.messageCount = myBT.Message.length-2;
		},
		function(){
			_self.ViewBox("msgBox");
			myBT.messageCount--;
			myBE.EventSkip = false;
		});
	}	
}
//ストーリー用
MySetting.prototype.Story = [
	[//プロローグ/0
		["FUNC",function(){	
		}],
	],
];
MySetting.prototype.selectEvent = function(selectData=null){
	var func = function(id){
		if(id==0){
			myBE.Flg[myBE.eventIndex] = 1;
		}else if(id==1){
			myBE.Flg[myBE.eventIndex] = 2;
		}else{
			myBE.Flg[myBE.eventIndex] = 3;
		}
	}
	if(selectData==null){
		return func;
	}
	_self.setTimer(function(){
		document.onmousedown = null;
		document.ontouchdown = null;
	},110);
	var parent = _self.Elm("operation",_self.TypeID);
	var selectId = myBT.selectBox(parent,selectData);
	var idxLengthMax = selectData.length;
	//選択肢毎のクリック/タッチ処理
	for(var idxLength = 0;idxLength<=idxLengthMax;idxLength++){
		//クリック
		_self.Elm("."+selectId[idxLength]).onmousedown = function(e){
			if(!_self.CheckTouchEvent()){
				var idx = this.id.substr(this.id.length-1,1);
				selectData[idx][1](idx);
				_self.HiddenBox("selectBox");
				myBT.setMessage(myBT.Message);
			}
		}
		//タッチ
		_self.Elm("."+selectId[idxLength]).ontouchdown = function(){
			if(!_self.CheckTouchEvent()){
				var idx = this.id.substr(this.id.length-1,1);
				selectData[idx][1](idx);
				_self.HiddenBox("selectBox");
				myBT.setMessage(myBT.Message);
			}
		}
		if(idxLengthMax==idxLength)break;
	}
}
//エンディングデータ
MySetting.prototype.EndingData = [
	[//ハッピーエンド
		["FUNC",function(){//0
			//エンディング到達イベントフラグ保存
			var idx = myProc.LoadIndex;
			myRpg.RestDataSet("save");
			myDataCtrl.SetSaveData("EventEndFlg"+idx,myBE.EndFlg);
			myDataCtrl.Save();			
			//音楽切り替え
			myST.EDFlg = true;
			myProc.music(0,1);
			myProc.music(7,0);
			myST.CheageImage("body",1);
			myST.CheageImage("body_fr_hair",2);
			myST.CheageImage("body_face_bk",1);			
			myBT.MenuHidden();
			_self.HiddenBox("lbMenu");//メニューを消す
			_self.HiddenBox("msgBox");//メッセージボックスを消す
			_self.HiddenBox(myBT.IDDayTime);
			_self.Elm("anmaku").className = "background_change2";			
			//クリック/タッチを無効か
			document.onmousedown = null;
			//エンディング開始
			_self.setTimer(function(){
				myBT.MenuHidden();
				_self.HiddenBox("lbMenu");//メニューを消す
				_self.HiddenBox("msgBox");//メッセージボックスを消す
				_self.Elm(myBT.MsgBox,_self.TypeID).innerHTML = "▼";				
				myProc.moveSet("街中央");
				myImg.SetIndexPos("back",1);
				var func = function(){
						var Img = myST.Img[8];
						for(var loop in Img){
							key = loop;
							myImg.SetIndexPos(key,1);
							if(key=="back"){
								var data = myProc.getmoveData(1);
								var setTemp = [data[2].x,data[2].y];
								myImg.SetImgPos(key,setTemp);
							}
							myImg.ClearImage(key);
						}
						//画像描画
						myImg.AllImageView(true,false,false);		
				}
				//特殊イベント用処理
				myST.EventExeSP(func);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"画像素材<br>T.O.P.（彩 雅介様）<br><br>みにくる背景CG素材集<br>（株式会社キューン・プラント様)");
				_self.setTimer(myBT.setMessage,10000,myBT.Message);
			},500);
			/*_self.ViewBox("anmaku");
			_self.Elm("anmaku").className = "background_change2";
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("街中央");
				myImg.SetIndexPos("back",1);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"画像素材<br>T.O.P.（彩 雅介様）");
				//画像描画
				myImg.AllImageView(true,true,false);
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
				_self.setTimer(myBT.setMessage,10000,myBT.Message);				
			},5900);*/		
		}],
		["FUNC",function(){//1
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("宿屋");
				myImg.SetIndexPos("back",5);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"");				
				//画像描画
				myImg.AllImageView(true,true,false);
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
				_self.setTimer(myBT.setMessage,5000,myBT.Message);				
			},5900);			
		}],
		["FUNC",function(){//2
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("宿・部屋");
				myImg.SetIndexPos("back",9);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"画像素材<br>智之ソフト様 (tomono soft)<br><br>明様（Blue Forest）");				
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//3
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("遺跡(ダンジョン)");
				myImg.SetIndexPos("back",13);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"");				
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//4
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("路地");
				myImg.SetIndexPos("back",47);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"画像素材<br>TORaIKI様（http://www.toraiki.com/）<br><br>Prism++様");				
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//5
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("街・西地区");
				myImg.SetIndexPos("back",21);
				myImg.SetIndexPos("back",47);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"");					
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//6
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("仕事紹介所");
				myImg.SetIndexPos("back",25);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"音楽<br>TORaIKI様（http://www.toraiki.com/）<br><br>Prism++様");				
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//7
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				myProc.moveSet("闘技場");
				myImg.SetIndexPos("back",37);
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent,"企画<br>プログラミング<br>シナリオ<br><br>kazuya2009<br>サークル	 littleambition");				
				
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],		
		["FUNC",function(){//8
			_self.ViewBox("anmaku");
			_self.setTimer(function(){
				var parent = _self.Elm("operation",_self.TypeID);
				myBT.EndingBox(parent);
				myImg.SetIndexPos("back",49);
				//画像描画
				myImg.AllImageView(true,true,false);
				_self.setTimer(myBT.setMessage,5000,myBT.Message);								
			},3100);			
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
			},5900);			
		}],
		["FUNC",function(){//9
			_self.ViewBox("msgBox");
			myBT.showMessage("一度再起動、もしくは再読み込みをしてください。<br>ゲームは継続可能です。");
			myProc.talkIndex = 32;
			document.onmousedown = null;
			_self.Elm("anmaku").className = "background_change";
		}],
	]
];
MySetting.prototype.EDindex = 0;
MySetting.prototype.EDFlg = false;
MySetting.prototype.GetEnding = function(){
	var res = 0;
	if(this.EDindex<this.EndingData.length){
		res = this.EDindex++;
	}
	return this.EndingData[res][1]();
}
//会話内容
MySetting.prototype.LockCount = 0;
MySetting.prototype.Lock = [
	function(){//誰もいない
		var cnt = myST.LockCount;
		var body = myImg.imgIndex["body"];
		if(body!=0){
			if(cnt==0)myBT.showMessage("サーシャ<br>「...特になにもないわ？」");
			if(cnt==1)myBT.showMessage("サーシャ<br>「...何もないよ？」");
			if(cnt==2)myBT.showMessage("サーシャ<br>「...何もないんだけど...」");
			if(cnt>=3)myBT.showMessage("サーシャ<br>「...一点を見つめてもなにも出てこないよ？」");
			myST.LockCount++;
		}
	}
]
//タッチメッセージ用処理
MySetting.prototype.TouchDataFunc = function(){
	if(myProc.OutPutFlg)return;
	var val = (myProc.GetStatusData("性感度"))[2];
	var valAfter = myProc.StatusParam.Proc("性感度",2,0);
	var val2 = (myProc.GetStatusData("抵抗力"))[2];
	var val2After = myProc.StatusParam.Proc("抵抗力",1,1);
	var Msg = "";
	if(val<100){
		Msg = "性感度が2上がった。<br>"+val+"→"+valAfter+"<br>"
	}else{
		Msg = "性感度はMAXだ。<br>"
	}
	if(val2>0){
		Msg += "抵抗力が1下がった。<br>"+val2+"→"+val2After+"<br>";
	}else{
		Msg += "抵抗力はもうない。<br>";
	}
	var JudgValue = valAfter;
		//破損なし
		if(JudgValue>=60){
			var val3 = (myProc.GetStatusData("淫乱度"))[2];
			var valAfter3 = myProc.StatusParam.Proc("淫乱度",2,0);			
			if(val3<100){
				Msg = Msg+"淫乱度が2上がった。<br>"+val3+"→"+valAfter3;
			}else{
				Msg = Msg+"淫乱度はMAXだ。";
			}
		}
	myBT.showMessage(Msg);
	myBT.chgDayTime();
}
//タッチ時メッセージ
MySetting.prototype.TouchMsgData = [
	[
		[//破損なし0
			["FUNC",function(){
			}],
		]
	],	
];
//淫乱度アップ
MySetting.prototype.UpInrandon = function(Msg=""){
	var inran = myRpg.Charctor.INRAN;
	var inran2 = 0;
	var Msg = "";
	myRpg.Charctor.INRAN++;
	//myRpg.Charctor.INRAN += parseInt(myRpg.Charctor.INRAN*0.1);
	inran2 = myRpg.Charctor.INRAN;
	Msg = "淫乱度が上がりました。<br>"+inran+"→"+inran2;
	return Msg;
}
//胸タッチ位置
var Touch_up_x1 = 105;
var Touch_up_x2 = 225;
var Touch_up_y1 = 175;
var Touch_up_y2 = 230;
//アソコタッチ位置
var Touch_down_x1 = 150;
var Touch_down_x2 = 200;
var Touch_down_y1 = 310;
var Touch_down_y2 = 325;
MySetting.prototype.TouchDataFlg = true;
MySetting.prototype.TouchData = [
	//タッチ座標(x1,x2,y1,y2)/タッチ処理/option
	[//0
		{//0
			x1:(Touch_up_x1*_self.zoom_value),
			x2:(Touch_up_x2*_self.zoom_value),
			y1:(Touch_up_y1*_self.zoom_value),
			y2:(Touch_up_y2*_self.zoom_value)
		},//タッチ座標(x1,x2,y1,y2)
		function(){//タッチ処理/1
			var body = myImg.imgIndex["body"];
			var bodyMargn = myImg.imgMagn["body"];
			if(myBE.eventIndex!=-1)return false;
			if(body==0)return false;
			if(myST.SexFlg)return false;
			if(bodyMargn!=margin)return false;
			if(myBT.messageCount)return false;
			if(myRpg.SleepFlg)return false;
			if(_self.GetBoxStatus("guildUndertakeMenu"))return false;
			if(_self.GetBoxStatus("guildUndertakeMenu"))return false;
			if(_self.GetBoxStatus("guildMenu"))return false;
			if(_self.GetBoxStatus("statusMenu"))return false;
			if(_self.GetBoxStatus("storeMenu"))return false;
			if(_self.GetBoxStatus("itmeMenu"))return false;
			if(_self.GetBoxStatus("ArenaMenu"))return false;
			/*if(myProc.DayActCount<=0){
				myBT.showMessage("行動回数不足です。");
				return;
			}*/
			if(!myST.TouchDataFlg)return;
			if(myRpg.Enemy2Index!=-1)return;
			var data = myST.TouchMsgData[0];
			
			//メッセージインデックス取得
			var res = "";
			var index = 0;
			var JudgValue = (myProc.GetStatusData("性感度"))[2];
			if(myProc.OrgasmModeFlg){//絶頂モード
				index = -1;
				res = [];
				var OrgasmMsg = myST.TouchData[myST.TouchData.length-2]();
				var Touch2 = myProc.TouchCount2;
				if(((Touch2%10)==0)){
					index = 0;
					if(Touch2>=100){
						myProc.TouchCount2 = 70;
					}
				}
				var FuncExe = null;
				if(myProc.TouchCount!=0)index = parseInt(myProc.TouchCount2/10);
				if(myProc.TouchCount>=0)FuncExe = OrgasmMsg[index];
				FuncExe = OrgasmMsg[index];
				FuncExe[1]();
				myProc.TouchCount++;
				myProc.TouchCount2++;
			}else{//タッチモード
				//破損なし
				if(JudgValue<20){
					index = 0;
				}
				else if(JudgValue<40){
					index = 1;
				}
				//破損なし
				else if(JudgValue<60){
					index = 2;
				}
				//破損なし
				else if(JudgValue<80){
					index = 3;
				}			
				//破損なし
				else if(JudgValue<=100){
					index = 4;
				}
				//メッセージ取得
				index = 0;//まだメッセージがない。
				res = data[index];
				myProc.DayActCount--;
			}
			return res;
		},
		0,//タッチカウント/2
		100,//最大タッチカウント/3
	],
	[//1
		{//0
			x1:(Touch_down_x1*_self.zoom_value),
			x2:(Touch_down_x2*_self.zoom_value),
			y1:(Touch_down_y1*_self.zoom_value),
			y2:(Touch_down_y2*_self.zoom_value)
		},//タッチ座標(x1,x2,y1,y2)
		function(){//タッチ処理/1
			var body = myImg.imgIndex["body"];
			var bodyMargn = myImg.imgMagn["body"];
			if(myBE.eventIndex!=-1)return false;
			if(body==0)return false;
			if(myST.SexFlg)return false;
			if(bodyMargn!=margin)return false;
			if(myBT.messageCount)return false;
			if(_self.GetBoxStatus("guildUndertakeMenu"))return false;
			if(_self.GetBoxStatus("guildMenu"))return false;
			if(_self.GetBoxStatus("statusMenu"))return false;
			if(_self.GetBoxStatus("storeMenu"))return false;
			if(_self.GetBoxStatus("itmeMenu"))return false;
			if(_self.GetBoxStatus("ArenaMenu"))return false;
			/*if(myProc.DayActCount<=0){
				myBT.showMessage("行動回数不足です。");
				return;
			}*/
			if(!myST.TouchDataFlg)return;
			if(myRpg.Enemy2Index!=-1)return;
			var data = myST.TouchMsgData[1];
			
			//メッセージインデックス取得
			var res = "";
			var index = 0;
			var JudgValue = (myProc.GetStatusData("性感度"))[2];
			if(myProc.OrgasmModeFlg){//絶頂モード
				index = -1;
				res = [];
				var OrgasmMsg = myST.TouchData[myST.TouchData.length-2]();
				var Touch2 = myProc.TouchCount2;
				if(((Touch2%10)==0)){
					index = 0;
					if(Touch2>=100){
						myProc.TouchCount2 = 70;
					}
				}
				if(myProc.TouchCount!=0)index = parseInt(myProc.TouchCount2/10);
				if(myProc.TouchCount>=0)res[0] = OrgasmMsg[index];
				res[0] = OrgasmMsg[index];
				myProc.TouchCount++;
				myProc.TouchCount2++;
			}else{//タッチモード
				//破損なし
				if(JudgValue<20){
					index = 0;
				}
				else if(JudgValue<40){
					index = 1;
				}
				//破損なし
				else if(JudgValue<60){
					index = 2;
				}
				//破損なし
				else if(JudgValue<80){
					index = 3;
				}			
				//破損なし
				else if(JudgValue<=100){
					index = 4;
				}
				//メッセージ取得
				res = data[index];
				myProc.DayActCount--;
			}
			return res;
		},
		0,//タッチカウント/2
		100,//最大タッチカウント/3
	],
	function(){ return [//胸タッチ/絶頂モード/強気/2
		["FUNC",function(){//触り始め
		}],
		["FUNC",function(){//20回タッチ
		}],
		["FUNC",function(){//50回タッチ
		}],
		["FUNC",function(){//70回タッチ
		}],
		["FUNC",function(){//100回タッチ
		}],
		["FUNC",function(){//110回タッチ
		}],		
		["FUNC",function(){//120回タッチ
		}],		
		["FUNC",function(){//150回タッチ
		}],		
		["FUNC",function(){//170回タッチ
		}],		
		["FUNC",function(){//200回タッチ
		}],
	];},
	function(){//3
		if(myST.JudgValue==undefined)myST.JudgValue = 0;
		myST.JudgValue = (myProc.GetStatusData("淫乱度"))[2]; 
	},
];
//パンティ染み処理(GirlPrison2より)
MySetting.prototype.PantyWeatCount = 0;
MySetting.prototype.PantyWeat = function(){
	var tmp = myImg.GetIndexPos("panty");
	if((tmp>0)&&tmp<5){
		myST.CheageImage("panty",tmp+1);
	}
	tmp = myST.PantyWeatCount++;
	if((tmp>0)&&(tmp<3)){
		myST.CheageImage("siru",1);		
	}else{
		myST.CheageImage("siru",2);		
	}
}
//イチャラブエッチモード
MySetting.prototype.SexFunc = false;
MySetting.prototype.SexFlg = false;
MySetting.prototype.SexSounyuu = false;
MySetting.prototype.SexBack = 0;
MySetting.prototype.Sex =function(){
	//通常立ち絵→H立ち絵
	if(!myST.SexFlg){
		var touchXY1 = {x1:165,x2:300,y1:270,y2:345};//タッチ座標(x1,x2,y1,y2)
		var touchXY2 = {x1:140,x2:255,y1:280,y2:330};//タッチ座標(x1,x2,y1,y2)
		//自室（今後は押し倒せる場所）かチェック
		myST.TouchData[1][0] = touchXY1;
		if(myImg.GetIndexPos("back")==1){
			myST.TouchData[1][0] = touchXY2;
		}
		//脱がす/捲る設定値初期化
		myST.WearIndex = 0x00;
		myST.UnderIndex = 0x00;
		_self.Elm(myBT.CommandWaer,_self.TypeID).innerText = "上着";
		_self.Elm(myBT.CommandUnder,_self.TypeID).innerText = "スカート";
		_self.Elm(myBT.CommandMakuru,_self.TypeID).innerText = "上着を捲る";
		//メッセージボックス
		var elm = _self.Elm("msgBox",_self.TypeID);
		elm.style.height = "50px";
		myST.SexBack = myImg.GetIndexPos("back");
		myST.AntenImageView(function(){
			myImg.ClearImage("body");
			if(myProc.moveIndex==1)myImg.SetIndexPos("body",4);
			if(myProc.moveIndex!=1)myImg.SetIndexPos("body",1);
			if(myProc.moveIndex==1)myImg.SetIndexPos("shatu",7);
			if(myProc.moveIndex==1)myImg.SetIndexPos("sukart",3);
			myImg.SetIndexPos("burager",1);
			myImg.SetIndexPos("body_face_bk",2);
			myImg.SetIndexPos("body_face_fk",8);
			if(myProc.moveIndex==1)myImg.SetIndexPos("back",34);
			if(myProc.moveIndex==1)myST.ImageMagnChange(0.35,[0,30]);			
			//画像描画
			myImg.AllImageView(true,true,false);
		});
		//押し倒した時のメッセ―jい
		myBT.showMessage("「マサルちゃん...」");
		//イチャラブモードON
		myST.SexFlg = true;
		//メニュー再描画
		myBT.MenuHidden();
		myBT.MenuView();
		_self.ViewBox(myBT.CommandNugasu);
		_self.Elm(myBT.CommandSex,_self.TypeID).innerText = "やめる";
		myImg.CreateGraph("Orgasm");
		
	}else{
		var elm = _self.Elm("msgBox",_self.TypeID);
		elm.style.height = "150px";		
		myST.ImageMagnChange(0.4,[0,0]);
		myST.AntenImageView(function(){
			var index = myProc.getmoveData(myProc.moveIndex);
			myImg.SetIndexPos("back",index);
			myImg.SetIndexPos("body",1);
			myImg.SetIndexPos("body_face_bk",2);
			myImg.SetIndexPos("body_face_fk",4);	
			myImg.SetIndexPos("shatu",1);
			myImg.SetIndexPos("sukart",1);
			myImg.SetIndexPos("seieki",0);
			myImg.SetIndexPos("manko",0);
			myImg.SetIndexPos("panty",1);
			//画像描画
			myImg.AllImageView(true,true,false);
		});			
		_self.HiddenBox(myBT.CommandNugasu);
		_self.HiddenBox(myBT.CommandWaer);
		_self.HiddenBox(myBT.CommandUnder);
		myProc.talkIndex = 33;
		myST.SexSounyuu = false;
		myST.SexFlg = false;
		myBT.MenuHidden();
		myBT.MenuView();
		_self.Elm(myBT.CommandSex,_self.TypeID).innerText = "押し倒す";
		myImg.ClearGraph("Orgasm");
	}
}
//脱衣機能ー脱がす方
MySetting.prototype.WearIndex = 0x00;
MySetting.prototype.UnderIndex = 0x00;
MySetting.prototype.WearUnder =function(index){
	if(index == "wear"){
		if(myST.WearIndex==0x00)_self.Elm(myBT.CommandWaer,_self.TypeID).innerText = "上着";
		if(myImg.GetIndexPos("shatu")!=0){
			myST.CheageImage("shatu",0);
			myST.WearIndex = 0x11;
			_self.Elm(myBT.CommandWaer,_self.TypeID).innerText = "ブラジャー";
		}else if((myImg.GetIndexPos("shatu")==0)&&(myImg.GetIndexPos("burager")!=0)){
			if(_self.sample2_flg)return;			
			myST.CheageImage("burager",0);
			myST.WearIndex = 0x21;
			_self.Elm(myBT.CommandWaer,_self.TypeID).innerText = "上着";
		}
	}else if(index == "under"){
		if(myST.UnderIndex==0x00)_self.Elm(myBT.CommandUnder,_self.TypeID).innerText = "スカート";
		if(myImg.GetIndexPos("sukart")!=0){
			myST.CheageImage("sukart",0);
			myST.UnderIndex = 0x11;
			_self.Elm(myBT.CommandUnder,_self.TypeID).innerText = "パンティ";
		}else if((myImg.GetIndexPos("sukart")==0)&&(myImg.GetIndexPos("panty")!=0)){
			if(_self.sample2_flg)return;
			myST.CheageImage("panty",0);
			myST.UnderIndex = 0x21;
			_self.Elm(myBT.CommandUnder,_self.TypeID).innerText = "スカート";
			myBT.setMessage([//パンツ脱がしたとき/10
					"「あ...」",
					"「さすがに、恥ずかしいな...」",
			]);
		}
	}else if(index == "makuru"){
		if(myST.WearIndex==0x00)_self.Elm(myBT.CommandMakuru,_self.TypeID).innerText = "上着を捲る";
		if((myImg.GetIndexPos("shatu")!=0)&&(myST.WearIndex==0x00)){
			if(myProc.moveIndex==1)myST.CheageImage("shatu",9);
			if(myProc.moveIndex!=1)myST.CheageImage("shatu",3);			
			myST.WearIndex = 0x31;
			_self.Elm(myBT.CommandMakuru,_self.TypeID).innerText = "ブラを取る";
		}else if((myST.WearIndex==0x30)&&(myImg.GetIndexPos("burager")!=0)){
			if(_self.sample2_flg)return;
			myST.CheageImage("burager",0);
			myST.WearIndex = 0x41;
			_self.Elm(myBT.CommandMakuru,_self.TypeID).innerText = "上着を捲る";
		}
	}
}
//挿入機能
MySetting.prototype.SounyuuCount = 0;
MySetting.prototype.ShaseiCount = 0;
MySetting.prototype.SounyuuOrgasm = 0;
MySetting.prototype.Sounyuu = function(){
	//挿入時
	if(myImg.GetIndexPos("seieki")!=0)return;
	if(!myST.SexFlg){
		myImg.SetIndexPos("penis",0);
		myImg.SetIndexPos("manko",0);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",1);
	}else if(myST.SexSounyuu&&(myImg.GetIndexPos("manko")==0)&&(myImg.GetIndexPos("penis")==0)){
		myST.SounyuuCount = 0;
		myImg.SetIndexPos("penis",1);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",6);
		myST.SounyuuMag[0][1]();
	}else if(myST.SexSounyuu&&(myImg.GetIndexPos("manko")==0)&&(myImg.GetIndexPos("penis")!=0)){
		myImg.SetIndexPos("penis",2);
		myImg.SetIndexPos("manko",1);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",6);
		myST.SounyuuMag[1][1]();
	}else if(myST.SexSounyuu&&(myImg.GetIndexPos("penis")!=3)&&(myST.SounyuuCount<100)){
		myImg.SetIndexPos("manko",1);
		myImg.SetIndexPos("penis",3);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",6);
		myST.SounyuuMag[2][1]();
	}else if(myST.SexSounyuu&&(myST.SounyuuCount<100)){
		myImg.SetIndexPos("manko",1);
		myImg.SetIndexPos("penis",2);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",6);
		myST.SounyuuMag[3][1]();
	}else if((myST.SounyuuCount<=100)&&(!myST.SexSounyuu)){
		myImg.SetIndexPos("penis",0);
		myImg.SetIndexPos("manko",0);
		if(myImg.GetIndexPos("panty")!=0)myImg.SetIndexPos("panty",6);
		myST.SounyuuMag[1][1]();
	}else if((myST.SounyuuCount>=100)&&(myST.SexSounyuu)){
		if(myST.SounyuuCount==100){
			myST.SounyuuMag[4][1]();
			if(myST.SounyuuOrgasm==0)myImg.SetIndexPos("siru",1);
			if(myST.SounyuuOrgasm>=1)myImg.SetIndexPos("siru",2);
		}else if(myST.SounyuuCount==120){
			myST.SounyuuMag[5][1]();
			myST.SounyuuOrgasm++;
		}else if(myST.SounyuuCount==140){
			myST.SounyuuMag[6][1]();
		}else if(myST.SounyuuCount==160){
			myST.SounyuuCount = 70;
			if(myST.SounyuuOrgasm==1){
				myImg.SetIndexPos("body_face_fk",1);
			}else{
				myImg.SetIndexPos("body_face_fk",2);
			}	
		}
		if(myImg.GetIndexPos("penis")!=3){
			myImg.SetIndexPos("penis",3);
		}else{
			if(myImg.GetIndexPos("penis")==3)myImg.SetIndexPos("penis",2);
		}
	}
	if(myST.SexFlg){
		myST.SounyuuCount++;
		myST.ShaseiCount++
	}
	if(myST.ShaseiCount>=50){
		_self.ViewBox(myBT.CommandShasei);
		myST.ShaseiFlg = true;
	}
	myImg.AllImageView(true,true,false);
}
//挿入メッセージ
MySetting.prototype.SounyuuMag = [
	["FUNC",function(){//入れる前
	}],	
	["FUNC",function(){//入れた瞬間
	}],	
	["FUNC",function(){//突く１
	}],	
	["FUNC",function(){//突く2
	}],
	["FUNC",function(){//イク前
	}],	
	["FUNC",function(){//イク
	}],
	["FUNC",function(){//イッた後
	}],
];
//挿入機能
MySetting.prototype.ShaseiFlg = false;
MySetting.prototype.Shasei = function(){
	//挿入時
	if(!myST.ShaseiFlg)return;
	myImg.SetIndexPos("seieki",1);
	myImg.AllImageView(true,true,false);
	var shaseiMsg = [//パンツ脱がしたとき/10
		[
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			["FUNC",function(){
				myST.ShaseiFlg = false;
				myImg.SetIndexPos("seieki",0);
				_self.setTimer(function(){
					if(_self.CheckTouchEvent()) {
						//タッチ対応
						_self.doc.ontouchdown = myST.Sounyuu;
					} else {
						//タッチ非対応
						_self.doc.onmousedown = myST.Sounyuu;
					}
				},100);
			}],
		],
		[//
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			["FUNC",function(){
				myST.ShaseiFlg = false;
				myImg.SetIndexPos("seieki",0);
				_self.setTimer(function(){
					if(_self.CheckTouchEvent()) {
						//タッチ対応
						_self.doc.ontouchdown = myST.Sounyuu;
					} else {
						//タッチ非対応
						_self.doc.onmousedown = myST.Sounyuu;
					}
				},100);			
			}],
		],		
		[
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			["FUNC",function(){
				myST.ShaseiFlg = false;
				myImg.SetIndexPos("seieki",0);
				_self.setTimer(function(){
					if(_self.CheckTouchEvent()) {
						//タッチ対応
						_self.doc.ontouchdown = myST.Sounyuu;
					} else {
						//タッチ非対応
						_self.doc.onmousedown = myST.Sounyuu;
					}
				},100);			
			}],
		],
		[
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			[["FUNC"],function(){
			}],
			["FUNC",function(){
				myST.ShaseiFlg = false;
				myImg.SetIndexPos("seieki",0);
				_self.setTimer(function(){
					if(_self.CheckTouchEvent()) {
						//タッチ対応
						_self.doc.ontouchdown = myST.Sounyuu;
					} else {
						//タッチ非対応
						_self.doc.onmousedown = myST.Sounyuu;
					}
				},100);
			}],
		]		
	];
	var msg = null;
	if(myST.JudgValue>=0)msg = shaseiMsg[0];
	if(myST.JudgValue>=20)msg = shaseiMsg[1];
	if(myST.JudgValue>=40)msg = shaseiMsg[2];
	if(myST.JudgValue>=80)msg = shaseiMsg[3];	
	myBT.setMessage(msg);
}
//画像単品変更
//イベント設定
MySetting.prototype.CheageImage = function(key,index){
	myImg.SetIndexPos(key,index);
	myImg.ImageView(key,true,true);	
}
//立ち絵ON
MySetting.prototype.TatieOn = function(anten = true){
	myST.TatieOnOff(true,anten);
}
//立ち絵OFF
MySetting.prototype.TatieOff = function(anten = true){
	myST.TatieOnOff(false,anten);
}
//立ち絵ONOFF設定
MySetting.prototype.TatieSetting = function(flg=true,anten = true,sitem=true){
	Img = myImg.imgIndex;
	for(var loop in Img){
		key = loop;
		if(key=="back"){
			var data = myProc.getmoveData(Img[loop]);
			var setTemp = [data[2].x,data[2].y];
			myImg.SetImgPos(key,setTemp);
		}else{
			var value = 0;
			if(flg)value = 1;
			if(sitem)myImg.SetIndexPos(key,value);
			if(key=="seieki")myImg.SetIndexPos(key,0);
			if(key!="sitem")myImg.SetIndexPos(key,value);
			if((key=="sitem")&&(value==0))myImg.SetIndexPos(key,value);
		}
		if(anten)myImg.ClearImage(key);
	}	
}
//
MySetting.prototype.ParamAIV = [];
MySetting.prototype.AntenImageView = function(func,time1=510,time2=200){
		_self.ViewBox("anmaku");
		_self.setTimer(function(){
			func();
			//描画200msec待ち後暗転解除
			_self.setTimer(function(){
				_self.HiddenBox("anmaku");
				myProc.talkLock = false;
			},time2);	
		},time1);
}
//立ち絵ONOFF実行
MySetting.prototype.TatieOnOff = function(flg=true,anten = true){
	//暗転待ち
	if(anten)_self.ViewBox("anmaku");
	_self.setTimer(function(){
		Img = myImg.imgIndex;
		myST.TatieSetting(flg,anten,false);
		//画像描画
		myImg.AllImageView(true,false,false);
		//描画200msec待ち後暗転解除
		_self.setTimer(function(){
			_self.HiddenBox("anmaku")
			myProc.talkLock = false;
		},200);
	},510);	
}
//特殊イベント用(オープニング)
MySetting.prototype.EventExeSP = function(func = function(){
		var Img = myST.Img[8];
		for(var loop in Img){
			key = loop;
			myImg.SetIndexPos(key,Img[loop]);
			if(key=="back"){
				var data = myProc.getmoveData(Img[loop]);
				var setTemp = [data[2].x,data[2].y];
				myImg.SetImgPos(key,setTemp);
			}
			myImg.ClearImage(key);
		}
		//画像描画
		myImg.AllImageView(true,false,false);		
}){
	var elm = _self.Elm(".anmaku");
	elm.classList.remove("background_change");
	elm.classList.add("background_change2");
	_self.ViewBox("anmaku");
	_self.setTimer(function(){
		func();
	},3100);
	_self.setTimer(function(){
		_self.HiddenBox("anmaku");
	},5900);	
}
//イベント設定
MySetting.prototype.GetEvent = function(){
	var storyFlg = true;
	//共通関数
	var commnFunc = function(EventNo,MsgNo=-1,mvPos=-1){
		//イベント構造体取得
		var Event = myBE.getEventDataStruct();
		//メッセージを一度クリア
		myBT.messageCount = 0;
		//イベントフラグ
		myBE.setEventFlg(EventNo,false);
		//イベント設定
		Event[myBE.ID] = EventNo;
		Event[myBE.JudgePos] = mvPos;
		//実行前判定
		Event[myBE.Before] = function(value){
			if(value == -1)return false;
			if(Event[myBE.End])return false;
			if(mvPos == myProc.moveIndex){
				if((!myST.START_FLG)||(Event[myBE.ID]==0)){			
					myST.START_FLG = false;
					return true;
				}	
				myST.START_FLG = false;
			}
			return false;
		}
		//メッセージ設定
		Event[myBE.Message] = [""];
		if(storyFlg){
			Event[myBE.Message] = myST.Story[0];
		}else if(MsgNo!=-1){
			Event[myBE.Message] = myST.EventData[MsgNo];
		}
		//実行中
		Event[myBE.Excute] = function(MenuFlg=true){
			if(myBT.messageCount!=0){
				if(MenuFlg)myBT.MenuHidden();
				if(MenuFlg)_self.HiddenBox(myBT.Menu);
				if(myImg.GetIndexPos("Other2")!=0)_self.ViewBox(myBT.CommandBoxnone);
				var evNo = myBE.eventIndex;
				var event = myBE.getBaseEvent(evNo);
				_self.setTimer(event[myBE.Excute],1000);
			}else{
				myBE.eventEnd();
				if(MenuFlg)_self.ViewBox(myBT.Menu);
				if(MenuFlg)myBT.MenuView();
			}
		}
		//実行後
		Event[myBE.After] = function(){
			var evNo = myBE.eventIndex;
			var event = myBE.getBaseEvent(evNo);				
			event[myBE.End] = true;
			return true;
		}
		return Event;
	}
	//イベントデータ
	//commnFunc(イベントNo,TalkNo,背景No)
	var EventData = [
		function(){//プロローグ/体育倉庫:0
			var returnProc = function(){
				var evt = commnFunc(0,0,0);
				var func = evt[myBE.Before];
				var func2 = evt[myBE.After];							
				evt[myBE.After] = function(){
					var res = func2();
					myBT.DayTime();
					_self.ViewBox(myBT.IDOrgasm);
					prologFlg = false;
					return res;
				}
				return evt;
			}
			return returnProc();
		},
	];
	
	return EventData;
}
//共通イベント処理
MySetting.prototype.commnProcess = function(evt){
	var func = evt[myBE.Before];
	var func2 = evt[myBE.After];
	evt[myBE.Before] = function(){
		var res = false;
		if(myST.EventSelect["result"]){
			res = func();
		}
		return res;
	}
	evt[myBE.After] = function(){
		var res = func2();
		_self.ViewBox("menu1");
		return res;
	}
	return evt;
}
//タッチ
MySetting.prototype.BodyTouch = function(e){
	var debug = true;
	var inX = (e.x);
	var inY = (e.y);
	if(debug){
		console.log("x:"+inX);
		console.log("y:"+inY);
	}
	var data = myST.TouchData;
	for(var loop in data){
		var obj = data[loop][0];
		if(obj==undefined)continue;
		var checkX = (obj.x2>=inX)&&(obj.x1<=inX)?true:false;
		var checkY = (obj.y2>=inY)&&(obj.y1<=inY)?true:false;
		if(checkX&&checkY){
			var res = data[loop][1]();
			if(!res)continue;
			myBT.setMessage(res);
		}
	}
	//戦闘時ターゲットON用
	if(myRpg.BattleFlg){
		var data = myRpg.TargetBoxFunc.length;
		if(data==0)return;
		for(var loop=1;loop<=3;loop++){
			if(myRpg.BattleEnemy.length<loop)return;
			if(myRpg.TargetBoxFunc[(loop-1)].func == undefined)continue;
			myRpg.TargetBoxFunc[(loop-1)].func(e,(loop-1));
		}
	}
}
//サイズ変更
MySetting.prototype.ImageMagnChange = function(marg,xy_value){
	var imgKey = myImg.imgKeyArry;
	for(var loop in imgKey){
		if((imgKey[loop]=="back")||(imgKey[loop]=="sitem"))continue;
		myImg.SetImageMagn(imgKey[loop],marg);
		myImg.SetImgPos(imgKey[loop],xy_value);
	}	
}
myST = new MySetting();
