#include "std.mi"

Function Fn_ReSizeGroup(Group g, int TargetX, int TargetY, Float Speed, int TargetA);
Function Fn_ReSizeGroup2(Group g, Float Speed, int TargetA);

Global Group	grpMain;
//Global Group	grpFukidasi;
Global Group	grpChara;
Global Group	grpCompoButton;
Global Group	grpRepeatButton;
Global Group	grpPlayButton;
Global Group	grpSongWindow;
Global Group	grpRing1;
Global Group	grpRing2;
Global Group	grpAniVu;
Global Group	grpAlbumA;
Global Group	grpAniItm;
Global Timer	tmrAction;
Global int	intNomber;

System.onScriptLoaded(){

	grpMain 	= getScriptGroup();
	grpChara	= grpMain.getObject("Chara.Group");
	grpPlayButton	= grpMain.getObject("PlayButton.Group");
	grpCompoButton	= grpMain.getObject("CompoButton.Group");
	grpRepeatButton	= grpMain.getObject("RepeatButton.Group");
	grpSongWindow	= grpMain.getObject("SongWindow.Group");
//	grpFukidasi	= grpMain.getObject("Fukidasi.Group");
	grpRing1	= grpMain.getObject("aisha_Ring1.Group");
	grpRing2	= grpMain.getObject("aisha_Ring2.Group");
	grpAniVu	= grpMain.getObject("AniName.Group");
	grpAlbumA	= grpMain.getObject("AlbumArt.Group");
	grpAniItm	= grpMain.getObject("Ani_Item01.Group");

	tmrAction   = new Timer;
	tmrAction.setDelay(50);
	tmrAction.start();
}

System.onScriptUnloading() {

	tmrAction.Stop();
	delete tmrAction;
}

tmrAction.onTimer() {

	tmrAction.Stop();

	if(getStatus() == 0){
		if(intNomber == 0) {
			Fn_ReSizeGroup(grpRing2, 10, 35, 0.1, 255);
		}
	}
	else {
		if(intNomber == 0) {
			Fn_ReSizeGroup(grpRing2, 10, 35, 1.0, 255);
		}
	}

	intNomber = 1;
}
grpRing2.onTargetReached(){

	if(getStatus() == 0){
		if(intNomber == 1) {
			Fn_ReSizeGroup(grpRing1, 10, 35, 0.1, 255);
		}
	}
	else {
		if(intNomber == 1) {
			Fn_ReSizeGroup(grpRing1, 10, 35, 1.0, 255);
		}
	}

	intNomber = 2;
}
grpRing1.onTargetReached(){

	if(intNomber == 2) {
		Fn_ReSizeGroup(grpChara, 0, 0, 1.0, 255);
//		Fn_ReSizeGroup2(grpFukidasi, 1.0, 255);
		intNomber = 3;
	}
}
grpChara.onTargetReached(){

	if(intNomber == 3) {
		Fn_ReSizeGroup2(grpSongWindow, 0.5, 255);
		intNomber = 4;
	}
}
grpSongWindow.onTargetReached(){

	if(intNomber == 4) {
		Fn_ReSizeGroup2(grpPlayButton, 0.5, 255);
		intNomber = 5;
	}
}
grpPlayButton.onTargetReached(){

	if(intNomber == 5) {
		Fn_ReSizeGroup2(grpCompoButton, 0.3, 255);
		intNomber = 6;
	}
}
grpCompoButton.onTargetReached(){

	if(intNomber == 6) {
		Fn_ReSizeGroup2(grpRepeatButton, 0.3, 255);
		intNomber = 7;
	}
}
grpRepeatButton.onTargetReached(){

	if(intNomber == 7) {
		Fn_ReSizeGroup2(grpAniVu, 0.3, 255);
		intNomber = 8;
	}
}
grpAniVu.onTargetReached(){

	if(intNomber == 8) {
		Fn_ReSizeGroup2(grpAlbumA, 0.3, 255);
		intNomber = 9;
	}
}
grpAlbumA.onTargetReached(){

	if(intNomber == 9) {
		Fn_ReSizeGroup2(grpAniItm, 0.3, 255);
		intNomber = 10;
	}
}


Fn_ReSizeGroup(Group g, int TargetX, int TargetY, Float Speed, int TargetA){

        g.setTargetX(TargetX);
        g.setTargetY(TargetY);
        g.setTargetSpeed(Speed);
        g.setTargetA(TargetA);
        g.gotoTarget();
}

Fn_ReSizeGroup2(Group g, Float Speed, int TargetA){

        g.setTargetSpeed(Speed);
        g.setTargetA(TargetA);
        g.gotoTarget();
}