function ResultScore(){//リザルト画面
	SetCommonData("ResultTime",1);
	let Y=cy-200;
	let GetIce = GetCommonData("GetIce");
	Result_main(0,Y,GetPlayerLife-1, 5000000);//プレイヤー
	Y+=74;
	Result_main(1,Y,GetPlayerBomb, 1000000);//ボム
	Y+=74;
	Result_main(2,Y,GetGraze,	  1000);//グレイズ
	Y+=74;
	Result_main(3,Y,GetPoint,	  2000);//アイテム
	Y+=74;
	Result_main(4,Y,GetIce,		   100);//アイス
	Y+=80;
	Result_2(6,Y,cx -105);//最終スコア文字
	Result_4(Y,cx - 20,1);    //＝
	loop(400){yield}
	Result_5(Y,cx+150);//合計
	if(IsReplay == false){SAVE;}
	loop(60){yield}
	loop{
		if(GetKeyState(VK_SHOT )==KEY_PUSH || GetKeyState(VK_BOMB)==KEY_PUSH){break;}
		yield;
	}
}

task Result_main(i,Y,num_1,num_2){//リザルト画面
	Result_2(i,Y,cx -105);//文字
	Result_3(Y,cx - 30,num_1);//固定数字
	Result_4(Y,cx + 0,0);    //×
	Result_3(Y,cx + 110,num_2);//数字
	Result_4(Y+30,cx + 20,1);    //＝
	Result_3(Y+30,cx +150,num_1 * num_2);  //合計

	let P_Score = num_1 * num_2;
	loop(400){
		let S = GetCommonData("Score");
		SetCommonData("Score",S + P_Score/400);//点追加
		yield;
	}
}



task Result_2(i,Y,X){//文字
	let PY=i*32;
	let obj=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj,false);
	ObjEffect_SetTexture(obj,Result);
	ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj,4);
	ObjEffect_SetVertexXY(obj,0,-64,-16);
	ObjEffect_SetVertexXY(obj,1, 64,-16);
	ObjEffect_SetVertexXY(obj,2,-64, 16);
	ObjEffect_SetVertexXY(obj,3, 64, 16);
	ObjEffect_SetVertexColor(obj,0,255,255,255,255);
	ObjEffect_SetVertexColor(obj,1,255,255,255,255);
	ObjEffect_SetVertexColor(obj,2,255,255,255,255);
	ObjEffect_SetVertexColor(obj,3,255,255,255,255);
	ObjEffect_SetVertexUV(obj,0,  0, 0+PY);
	ObjEffect_SetVertexUV(obj,1,128, 0+PY);
	ObjEffect_SetVertexUV(obj,2,  0,32+PY);
	ObjEffect_SetVertexUV(obj,3,128,32+PY);
	ObjEffect_SetLayer(obj,7);
	Obj_SetPosition(obj,X,Y);
}

task Result_3(Y,X,Score){//数字
	let num=[];
	let i_end = trunc(log10( Score ))+1;
	ascent(let i in 0..i_end + 1){
		let S=[truncate( Score / ( (10^i_end) / 10^i) )- truncate( Score / ( (10^i_end)*10 /10^i) ) * 10];
		num = num ~ S;
	}
	let Num_X=[144,128,144,160,176,192,208,224,240,128];
	let Num_Y=[128, 96, 96, 96, 96, 96, 96, 96, 96,128];
	let PX= 0;
	let i = i_end;
	loop(i_end){//桁数だけループ
		Nun(X,Y,Num_X[num[i]],Num_Y[num[i]],PX);
		PX-=14;
		i--;
	}
	if(Score == 0){ Nun( X, Y, Num_X[ 0 ], Num_Y[ 0 ], PX); }

	task Nun(X,Y,Nun_X,Nun_Y,PX){
		let PY=60;
		let a=0;
		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetAutoDelete(obj,false);
		ObjEffect_SetTexture(obj,imgScore);
		ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj,4);
		ObjEffect_SetLayer(obj,5);
		ObjEffect_SetVertexXY(obj,0,-8,-16);
		ObjEffect_SetVertexXY(obj,1, 8,-16);
		ObjEffect_SetVertexXY(obj,2,-8, 16);
		ObjEffect_SetVertexXY(obj,3, 8, 16);
		ObjEffect_SetVertexUV(obj,0,Nun_X   ,Nun_Y);
		ObjEffect_SetVertexUV(obj,1,Nun_X+16,Nun_Y);
		ObjEffect_SetVertexUV(obj,2,Nun_X   ,Nun_Y+32);
		ObjEffect_SetVertexUV(obj,3,Nun_X+16,Nun_Y+32);
		Obj_SetPosition(obj,X+PX,Y);
		loop{
			ObjEffect_SetVertexColor(obj,0,255,255,255,255);
			ObjEffect_SetVertexColor(obj,1,255,255,255,255);
			ObjEffect_SetVertexColor(obj,2,255,255,255,255);
			ObjEffect_SetVertexColor(obj,3,255,255,255,255);
			yield;
		}
	}

}

task Result_4(Y,X,AorB){//×か＝
	let UV_X = 0;
	if(AorB == 1){
		UV_X = 32;
	}
	let obj=Obj_Create(OBJ_EFFECT);
	Obj_SetAutoDelete(obj,false);
	ObjEffect_SetTexture(obj,Result);
	ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj,4);
	ObjEffect_SetVertexXY(obj,0,-16,-16);
	ObjEffect_SetVertexXY(obj,1, 16,-16);
	ObjEffect_SetVertexXY(obj,2,-16, 16);
	ObjEffect_SetVertexXY(obj,3, 16, 16);
	ObjEffect_SetVertexColor(obj,0,255,255,255,255);
	ObjEffect_SetVertexColor(obj,1,255,255,255,255);
	ObjEffect_SetVertexColor(obj,2,255,255,255,255);
	ObjEffect_SetVertexColor(obj,3,255,255,255,255);
	ObjEffect_SetVertexUV(obj,0,UV_X     ,223);
	ObjEffect_SetVertexUV(obj,1,UV_X + 32,223);
	ObjEffect_SetVertexUV(obj,2,UV_X     ,255);
	ObjEffect_SetVertexUV(obj,3,UV_X + 32,255);
	ObjEffect_SetLayer(obj,7);
	Obj_SetPosition(obj,X,Y);
}

task Result_5(Y,X){//最終スコア専用
	PlaySE(power33);
	let GS=GetCommonData("Score");
	let GS2=GetCommonData("Score_2");
	let S0 = truncate(GS2/1000)-truncate(GS2/10000)*10;
	let S1 = truncate(GS2/100)- truncate(GS2/1000)*10;
	let S2 = truncate(GS2/10)-  truncate(GS2/100)*10;
	let S3 = truncate(GS2)-     truncate(GS2/10)*10;
	let S4 = truncate(GS/100000)-    truncate(GS/1000000)*10;
	let S5 = truncate(GS/10000)-     truncate(GS/100000)*10;
	let S6 = truncate(GS/1000)-      truncate(GS/10000)*10;
	let S7 = truncate(GS/100)-       truncate(GS/1000)*10;
	let S8 = truncate(GS/10)-        truncate(GS/100)*10;
	let S9 = truncate(GS/1)-         truncate(GS/10)*10;
	let nun=[S0,S1,S2,S3,S4,S5,S6,S7,S8,S9];	
	let Num_X=[144,128,144,160,176,192,208,224,240,128];
	let Num_Y=[128, 96, 96, 96, 96, 96, 96, 96, 96,128];
	let PX= 0;
	let i = 9;
	loop(10){//桁数だけループ
		Nun(X,Y,Num_X[nun[i]],Num_Y[nun[i]],PX);
		PX-=14;
		i--;
	}
	task Nun(X,Y,Nun_X,Nun_Y,PX){
		let PY=60;
		let a=0;
		let obj = Obj_Create(OBJ_EFFECT);
		Obj_SetAutoDelete(obj,false);
		ObjEffect_SetTexture(obj,imgScore);
		ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLESTRIP);
		ObjEffect_CreateVertex(obj,4);
		ObjEffect_SetLayer(obj,7);
		ObjEffect_SetVertexXY(obj,0,-8,-16);
		ObjEffect_SetVertexXY(obj,1, 8,-16);
		ObjEffect_SetVertexXY(obj,2,-8, 16);
		ObjEffect_SetVertexXY(obj,3, 8, 16);
		ObjEffect_SetVertexUV(obj,0,Nun_X   ,Nun_Y);
		ObjEffect_SetVertexUV(obj,1,Nun_X+16,Nun_Y);
		ObjEffect_SetVertexUV(obj,2,Nun_X   ,Nun_Y+32);
		ObjEffect_SetVertexUV(obj,3,Nun_X+16,Nun_Y+32);
		Obj_SetPosition(obj,X+PX,Y);
		loop{
			ObjEffect_SetVertexColor(obj,0,255,255,255,255);
			ObjEffect_SetVertexColor(obj,1,255,255,255,255);
			ObjEffect_SetVertexColor(obj,2,255,255,255,255);
			ObjEffect_SetVertexColor(obj,3,255,255,255,255);
			yield;
		}
	}
}

task SAVE{
	let GS=GetCommonData("Score");//今回のスコア
	let GS2=GetCommonData("Score_2");	
	let High1 = 0;
	let High2 = 0;
	if(GetCommonData("AnotherMode") == 0){//hard
		if(GetPlayerScriptName == "cirnoA.txt"){
			High1 = GetCommonDataDefault("H_HighScoreA",0);//雪
			High2 = GetCommonDataDefault("H_HighScoreA_2",0);
			if(GS2 > High2 || GS2 == High2 && GS > High1){
				SetCommonData("H_HighScoreA",GS);//雪
				SetCommonData("H_HighScoreA_2",GS2);
			}
		}
		if(GetPlayerScriptName == "cirnoB.txt"){
			High1 = GetCommonDataDefault("H_HighScoreB",0);//凍
			High2 = GetCommonDataDefault("H_HighScoreB_2",0);
			if(GS2 > High2 || GS2 == High2 && GS > High1){		
				SetCommonData("H_HighScoreB",GS);//凍
				SetCommonData("H_HighScoreB_2",GS2);
			}
		}
	}
	if(GetCommonData("AnotherMode") == 1){//easy
		if(GetPlayerScriptName == "cirnoA.txt"){
			High1 = GetCommonDataDefault("E_HighScoreA",0);//雪
			High2 = GetCommonDataDefault("E_HighScoreA_2",0);
			if(GS2 > High2 || GS2 == High2 && GS > High1){
				SetCommonData("E_HighScoreA",GS);//雪
				SetCommonData("E_HighScoreA_2",GS2);
			}
		}
		if(GetPlayerScriptName == "cirnoB.txt"){
			High1 = GetCommonDataDefault("E_HighScoreB",0);//凍
			High2 = GetCommonDataDefault("E_HighScoreB_2",0);
			if(GS2 > High2 || GS2 == High2 && GS > High1){		
				SetCommonData("E_HighScoreB",GS);//凍
				SetCommonData("E_HighScoreB_2",GS2);
			}
		}
	}
	SaveCommonData();
}



