

task PRdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+56-56;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+72;
	let TempRate=[0,0];
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(5){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+92)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+72)
	{
	by2-=0.5;
	}
}
let Rate=PurityRate*10;

Bnum[0]=trunc(Rate%10);
Bnum[1]=trunc(Rate%100/10);

if(Rate>10 && bx>=GetClipMinX)
{
MagicCounternum3(bx-23,by2,Bnum[0],0.6,1);
MagicCounternum3(bx-39,by2,Bnum[1],0.6,1);

MagicCounternum3(bx-50,by2,13,0.6,1);
MagicCounternum3(bx-29,by2,10,0.6,1);
	if(bx<GetClipMinX+56)
	{
	bx+=2;
	}
TempRate[0]=Bnum[0];
TempRate[1]=Bnum[1];
}
else
{
	if(bx>GetClipMinX)
	{
	MagicCounternum3(bx-23,by2,TempRate[0],0.6,2);
	MagicCounternum3(bx-39,by2,TempRate[1],0.6,2);

	MagicCounternum3(bx-50,by2,13,0.6,2);
	MagicCounternum3(bx-29,by2,10,0.6,2);
	bx-=2;
	}
}


		yield;
}
}

task PRCdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+70;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+8+64;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let Bnum=[];
loop(4){Bnum=Bnum~[0];}
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+28+64)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+8+64)
	{
	by2-=0.5;
	}
}
Bnum[0]=trunc(PurityRateCount%10);
Bnum[1]=trunc(PurityRateCount%100/10);
Bnum[2]=trunc(PurityRateCount%1000/100);
Bnum[3]=trunc(PurityRateCount%10000/1000);

//MagicCounternum3(bx,by2,Bnum[0],0.45);


ascent(let i in 0..4)
{
	if(PurityRateCount>=10^i)
	{
		MagicCounternum3(bx-i*9,by2,Bnum[i],0.45,1);
	}
}

		yield;


}
}

task MagicCounternum3(x,y,num,sc,type)
{
		let scx=sc;
		let scy=sc;
		let obj0 = Obj_Create(OBJ_EFFECT);

		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		if(num==13)
		{
			num=12;
			ObjEffect_SetAngle(obj0,0,0,45);
		}
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		let Alpha=255;
		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
		//	MagicCounternum4(x,GetClipMaxY-8-64,255-Alpha,num,sc);
		}
		if(Alpha<50){Alpha=50;}
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,255);
		if(PurityRate>=4 && sc==0.6)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,50);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,50);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,50);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,50);
		}
		else if(sc==0.45)
		{
		if(PurityRateCount>=100)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,255);
		}
		else if(PurityRateCount>=50)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,80,80);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,80,80);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,80,80);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,80,80);
		}
		else if(PurityRateCount>=0)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,0,0);
		}
		}

		if(type==2)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,0,0);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,0,0);
		}
		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,3);
		wait(1);
		Obj_Delete(obj0);
}


task Bdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMinX+56;
	let by=GetClipMaxY-14;
	let by2=GetClipMinY+8;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}

let DrawCount=600;
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by2<GetClipMinY+28)
	{
	by2+=0.5;
	}
}
else
{
	if(by2>GetClipMinY+8)
	{
	by2-=0.5;
	}
}

if(DrawCount>=600)
{
ascent(i in 0..6)
{
MagicCounternum2(i);
}
DrawCount=0;
}
DrawCount+=1;
yield;

}

task MagicCounternum2(digit)
{
		let x;
		let Alpha=255;
		let scx=0.5;
		let scy=0.5;
		let obj0 = Obj_Create(OBJ_EFFECT);

		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);

		ObjEffect_SetLayer(obj0,3);
		ObjEffect_SetScale(obj0, scx,scy);

		let num;

		if(digit==5)
		{
			num=12;
		}

		loop(600)
		{
		num=trunc(MagicCounter%(10^(digit+1))/(10^digit));
		if(digit==5){num=12;}
		x=bx-digit*10;

		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);


		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
			if(MagicCounter>=10^digit || digit==5)
			{
			MagicCounternum(x,GetClipMaxY-8,255-Alpha,num);
			}
		}

		if(Alpha<50){Alpha=50;}

		if(MagicCounter<10^digit && digit!=5 &&digit!=0){Alpha=0;}

		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,255);
		if(MagicCounter>=10000)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,1,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,2,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,3,Alpha,ColorRed,ColorGreen,ColorBlue);
		}
		Obj_SetPosition(obj0,x,by2+5);
		wait(1);
		}

		Obj_Delete(obj0);
}

task MagicCounternum(x,y,Alpha,num)
{
		let scx=0.5;
		let scy=0.5;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		ObjEffect_SetVertexColor(obj0,0,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,1,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,2,Alpha,255,255,255);
		ObjEffect_SetVertexColor(obj0,3,Alpha,255,255,255);

		if(MagicCounter>=10000)
		{
		ObjEffect_SetVertexColor(obj0,0,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,1,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,2,Alpha,ColorRed,ColorGreen,ColorBlue);
		ObjEffect_SetVertexColor(obj0,3,Alpha,ColorRed,ColorGreen,ColorBlue);
		}

		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y-5);
		ObjEffect_SetLayer(obj0,3);
		wait(1);
		Obj_Delete(obj0);
}

}


task Rankdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=270;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+12;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let DrawCount=600;
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+32)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+12)
	{
	by-=0.5;
	}
}

if(DrawCount>=600)
{
ascent(i in 0..6)
{
tBonusnum(i);
}
DrawCount=0;
}
DrawCount+=1;
yield;


}

task tBonusnum(digit)
{
		let x;
		let Alpha=255;
		let scx=0.6;
		let scy=0.6;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetScale(obj0, scx,scy);
		ObjEffect_SetLayer(obj0,3);

		let num;

		loop(600)
		{
		num=trunc(MagicFragment%(10^(digit+1))/(10^digit));
		x=bx-digit*12;

		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
		}
		if(Alpha<50){Alpha=50;}
		if(MagicFragment<10^digit &&digit!=0){Alpha=0;}

		let R=150;let G=255;let B=150;
		ObjEffect_SetVertexColor(obj0,0,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,1,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,2,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,3,Alpha,R,G,B);
		
		Obj_SetPosition(obj0,x,by+5);
		yield;
		}
		Obj_Delete(obj0);
}


}

task SectionRankdraw//ボーナスポイント表示のタスク
{
	let bx=GetClipMaxX+190;
	let by=GetClipMinY+227;
	let bx=GetClipMaxX-20;
	let by=GetClipMinY+36;
wait(5);
while(GetCommonDataDefault("TitleMenu",false)){yield;}
if(GetCommonDataDefault("SELECTEDDIFFICULT","None")=="None")
{return;}
let DrawCount=600;
loop{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
	if(by<GetClipMinY+56)
	{
	by+=0.5;
	}
}
else
{
	if(by>GetClipMinY+36)
	{
	by-=0.5;
	}
}

if(DrawCount>=600)
{
ascent(i in 0..6)
{
tBonusnum(i);
}
DrawCount=0;
}
DrawCount+=1;

yield;


}

task tBonusnum(digit)
{
		let x;
		let Alpha=255;
		let scx=0.6;
		let scy=0.6;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetScale(obj0, scx,scy);
		ObjEffect_SetLayer(obj0,3);

		let num;

		loop(600)
		{
		num=trunc(SectionMagicFragment%(10^(digit+1))/(10^digit));
		x=bx-digit*12;

		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		if((GetPlayerY>GetClipMinY+150))
		{
			Alpha=255;
		}
		if((GetPlayerY<GetClipMinY+150))
		{
			Alpha=255+300*(GetPlayerY-(GetClipMinY+150))/(GetClipMinY+150);
		}
		if(Alpha<50){Alpha=50;}
		if(SectionMagicFragment<10^digit &&digit!=0){Alpha=0;}

		let R=150;let G=150;let B=255;
		ObjEffect_SetVertexColor(obj0,0,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,1,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,2,Alpha,R,G,B);
		ObjEffect_SetVertexColor(obj0,3,Alpha,R,G,B);
		
		Obj_SetPosition(obj0,x,by+5);
		yield;
		}
		Obj_Delete(obj0);
}

}


task DeleteShotNumdraw(Dnum,x,y,type)//ボーナスポイント表示のタスク
{
if(IsBossExisting || GetCommonDataDefault("IsMSDBossExisting",false))
{
x=GetPlayerX;
y=GetPlayerY-30;
}
let Bnum=[];
let number=1;
loop(4){Bnum=Bnum~[0];}

Bnum[0]=trunc(Dnum%10);
Bnum[1]=trunc(Dnum%100/10);
Bnum[2]=trunc(Dnum%1000/100);
Bnum[3]=trunc(Dnum%10000/1000);

DeleteBonusnum(x-0*12,y,Bnum[0],type);

ascent(let i in 1..4)
{
	if(Dnum>=10^i)
	{
		DeleteBonusnum(x-i*12,y,Bnum[i],type);
		number=i+1;
	}
}


DeleteBonusnum(x-number*12,y,12,type);

}

task DeleteBonusnum(x,y,num,type)
{
		let Alpha=0;
		let R;let G;let B;
		if(type==1)
		{
			R=255;G=127;B=127;
		}
		if(type==2)
		{
			R=127;G=127;B=255;
		}
		if(type==3)
		{
			R=255;G=255;B=255;
		}
		let scx=0.6;
		let scy=0.6;
		let obj0 = Obj_Create(OBJ_EFFECT);
		ObjEffect_SetTexture(obj0,imgNumber);
		ObjEffect_SetPrimitiveType(obj0, PRIMITIVE_TRIANGLEFAN);
		ObjEffect_SetRenderState(obj0, ADD); 
		ObjEffect_CreateVertex(obj0, 4);
		ObjEffect_SetVertexXY(obj0, 0, -13, -16);
		ObjEffect_SetVertexXY(obj0, 1, 13,  -16);
		ObjEffect_SetVertexXY(obj0, 2, 13, 16);
		ObjEffect_SetVertexXY(obj0, 3,  -13,  16);
		
		ObjEffect_SetVertexUV(obj0, 0,  0+40*num,  6);
		ObjEffect_SetVertexUV(obj0, 1,  26+40*num, 6);
		ObjEffect_SetVertexUV(obj0, 2, 26+40*num,  38);
		ObjEffect_SetVertexUV(obj0, 3, 0+40*num, 38);

		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		
		ObjEffect_SetScale(obj0, scx,scy);
		Obj_SetPosition(obj0,x,y+5);
		ObjEffect_SetLayer(obj0,8);
		loop(30)
		{
		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		Alpha+=8;
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		yield;
		}
		loop(30)
		{
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		yield;
		}
		loop(30)
		{
		ascent(let i in 0..4)
		{	
			ObjEffect_SetVertexColor(obj0,i,Alpha,R,G,B);
		}
		Obj_SetY(obj0,Obj_GetY(obj0)-0.1);
		Alpha-=8;
		yield;
		}
		Obj_Delete(obj0);
}
