-- xxx: oni is broken

local iIndex = Var("GameCommand"):GetIndex();
local sName = Var("GameCommand"):GetName();

local yPos = THEME:GetMetric(Var "LoadingScreen","IconCommonY");

local tModeColor = {
	Normal = cBlue,
	Nonstop = cGreen,
	Survival = DarkColor(cRed),
	Oni = LightColor(cPurple),
	Endless = cOrange,
	-- For Styles:
	Single = cBlue,
	Double = cGreen,
	Versus = cRed,
	Couple = LightColor(cPurple),
	Solo = cBlue,
};

local sExplanationStrings = {
	"Pick 3 songs from your library and start playing!",
	"Normal Life Requirement! Play by standard rules",
	"EX Mode Enabled: Play well and get extra stages!",
};

local t = Def.ActorFrame {};

t[#t+1] = Def.ActorFrame {
-- Tracers
 InitCommand=cmd(Center);
 GainFocusCommand=cmd(visible,true);
 LoseFocusCommand=cmd(visible,false);
	LoadActor( THEME:GetPathG("_logo", "normal/under") ) .. {
		InitCommand=cmd(y,-40;zoomtowidth,SCREEN_WIDTH;zoomy,1.2;pulse;effecttiming,2,0,0,0;effectmagnitude,1.2,1,1;effectclock,'beat';blend,bmAdd;diffusealpha,0.5);
-- 		OnCommand=cmd(fadeleft,1);
	};
	LoadActor( THEME:GetPathG("_logo", "normal/under") ) .. {
		InitCommand=cmd(y,-40;zoomtowidth,SCREEN_WIDTH;diffuse,LightColor(tModeColor[sName]);glow,1,1,1,0.5;diffusealpha,1);
-- 		OnCommand=cmd(fadeleft,1);
	};
	LoadActor( THEME:GetPathG("_logo", "normal/under") ) .. {
		InitCommand=cmd(y,-40;zoomtowidth,SCREEN_WIDTH;zoomy,1.2;diffuse,tModeColor[sName];diffusealpha,0.25);
-- 		OnCommand=cmd(fadeleft,1);
	};
	
};

t[#t+1] = Def.ActorFrame {
 InitCommand=cmd(Center);
 GainFocusCommand=cmd(visible,true);
 LoseFocusCommand=cmd(visible,false);
	LoadActor("selector margin") .. {
		InitCommand=cmd(x,-260;y,-40);
		GainFocusCommand=cmd(linear,0.2;diffuse,tModeColor[sName]);
		LoseFocusCommand=cmd(diffuse,1,1,1,1);
	};
	LoadActor("selector margin") .. {
		InitCommand=cmd(x,-260;y,-40);
		GainFocusCommand=cmd(blend,bmAdd;diffusealpha,0.5;diffuseramp;effectcolor1,DarkColor(DarkColor(tModeColor[sName]));effectcolor2,LightColor(tModeColor[sName]);effectperiod,1;effectclock,'beat');
		LoseFocusCommand=cmd();
	};
--[[ 	LoadActor(THEME:GetPathB("_shared","background original/Common Scanlines")) .. {
		InitCommand=cmd(zoomto,60-8,152-8;x,-260;y,-40;setcustomtexturerect,0,0,(60-8)/640,(152-8)/480);
		OnCommand=cmd(diffusealpha,0.25;texcoordvelocity,0,-0.4);
	}; --]]
	-- Title
	LoadFont("_regra black 50px") .. {
		Text=Var("GameCommand"):GetName();
		InitCommand=cmd(shadowlength,1;vertalign,bottom;horizalign,left;x,-260+30;y,(-152/2)+20.5);
		GainFocusCommand=cmd(finishtweening;addx,20;
			diffuse,tModeColor[sName];diffusetopedge,LightColor(tModeColor[sName]);glowshift;effecttiming,0,0,2,0;effectclock,'beat';
			zoom,1.2;decelerate,0.3;zoom,1;addx,-20;);
		LoseFocusCommand=cmd(stopeffect);
	};
	-- Seperator
	Def.Quad {
		InitCommand=cmd(zoomto,520,2;x,30;y,-43;diffuse,LightColor(tModeColor[sName]);diffusealpha,0.5;;shadowlength,1);
	};
	-- Explanations
	LoadFont("Common Normal") .. {
		Text=ScreenString(sName);
-- 		Text="• Explanation Line 1.\n• Explanation Line 2.\n• Explanation Line 3.";
		InitCommand=cmd(x,-260+30;horizalign,left;vertalign,top;y,-36;NoStroke;shadowlength,1;maxwidth,SCREEN_WIDTH-130+30);
		GainFocusCommand=cmd(stoptweening;diffusealpha,0.5;accelerate,0.4;diffusealpha,1;);
	}; 
	-- Dynamic:
--[[ 	for i=1,#sExplanationStrings do
		t[#t+1] = LoadFont("Common Normal") .. {
			Text="• " .. sExplanationStrings[i];
			InitCommand=cmd(x,-260+30;horizalign,left;vertalign,top;y,-36+(i*20);NoStroke;shadowlength,1);
			GainFocusCommand=cmd(stoptweening;diffusealpha,0.5;accelerate,0.4;diffusealpha,1;);
		};
	end --]]
--[[  	Def.ActorFrame {
	 InitCommand=cmd(x,240);
		LoadActor("icon " .. sName) .. {
			OnCommand=cmd(zoom,1;diffusealpha,1;decelerate,0.2;zoom,1.2;diffusealpha,0;sleep,0.3;queuecommand,"On");
		};
		LoadActor("icon " .. sName);
	};  --]]
	-- Song Num!
	Def.ActorFrame {
		LoadFont("_regra black 50px") .. {
			Text=SONGMAN:GetNumSongs();
			InitCommand=cmd(shadowlength,1;vertalign,bottom;horizalign,right;x,260-38;y,(-152/2)+20.5);
			GainFocusCommand=cmd(finishtweening;addx,-20;
				;diffusetopedge,0.8,0.8,0.8,1;
				zoom,1;smooth,0.3;zoom,1;addx,20;);
			LoseFocusCommand=cmd(stopeffect);
			Condition=(sName) == "Normal";
		};
		LoadFont("Common Normal") .. {
			Text="Songs";
			InitCommand=cmd(NoStroke;shadowlength,1;vertalign,bottom;horizalign,left;x,260-32;y,(-152/2)+20);
			GainFocusCommand=cmd(finishtweening;addx,-20;
				;diffusetopedge,0.8,0.8,0.8,1;
				zoom,0.75;smooth,0.3;zoom,0.75;addx,20;);
			LoseFocusCommand=cmd(stopeffect);
			Condition=(sName) == "Normal";
		};
	 Condition=(Var "LoadingScreen") == "ScreenSelectStyle";
	};
	-- Courses Num!
	Def.ActorFrame {
		LoadFont("_regra black 50px") .. {
			Text=SONGMAN:GetNumCourses();
			InitCommand=cmd(shadowlength,1;vertalign,bottom;horizalign,right;x,260-56;y,(-152/2)+20.5);
			GainFocusCommand=cmd(finishtweening;addx,-20;
				;diffusetopedge,0.8,0.8,0.8,1;
				zoom,1;smooth,0.3;zoom,1;addx,20;);
			LoseFocusCommand=cmd(stopeffect);
			Condition=(sName) ~= "Normal";
		};
		LoadFont("Common Normal") .. {
			Text="Courses";
			InitCommand=cmd(NoStroke;shadowlength,1;vertalign,bottom;horizalign,left;x,260-50;y,(-152/2)+20);
			GainFocusCommand=cmd(finishtweening;addx,-20;
				;diffusetopedge,0.8,0.8,0.8,1;
				zoom,0.75;smooth,0.3;zoom,0.75;addx,20;);
			LoseFocusCommand=cmd(stopeffect);
			Condition=(sName) ~= "Normal";
		};
	 Condition=(Var "LoadingScreen") == "ScreenSelectStyle";
	};
};

--[[ ICONS ]]

local i = Def.ActorFrame {};

i[#i+1] = Def.ActorFrame {
-- Enabled
--[[ 	Def.ActorFrame {
	 InitCommand=cmd(x,THEME:GetMetric(Var "LoadingScreen",Var("GameCommand"):GetName() .. "X");y,THEME:GetMetric(Var "LoadingScreen","IconCommonY"));
	 EnabledCommand=cmd(visible,true);
	 DisabledCommand=cmd(visible,false);
		LoadActor( THEME:GetPathG("_frame", "1D"),{ 1/3, 1/3, 1/3 },LoadActor(THEME:GetPathG("_1d","frames/transparent"))) .. {
			Name="Frame";
			GainFocusCommand=cmd(stoptweening;playcommand,"SetSize",{ Width=(640/8)*1.25; tween=cmd(finishtweening;linear,0.3;diffuse,1,1,1,1); });
			LoseFocusCommand=cmd(stoptweening;playcommand,"SetSize",{ Width=(640/8)*1.25; tween=cmd(finishtweening;linear,0.3;diffuse,0.5,0.5,0.5,1); });
		};

		LoadFont("Common Normal") .. {
			Text=Var("GameCommand"):GetName();
			InitCommand=cmd(shadowlength,1;y,-2;zoom,0.5);
		};
	};
-- Disabled
	Def.ActorFrame {
	 InitCommand=cmd(x,THEME:GetMetric(Var "LoadingScreen",Var("GameCommand"):GetName() .. "X");y,THEME:GetMetric(Var "LoadingScreen","IconCommonY"));
	 EnabledCommand=cmd(visible,false);
	 DisabledCommand=cmd(visible,true);
		LoadActor( THEME:GetPathG("_frame", "1D"),{ 1/3, 1/3, 1/3 },LoadActor(THEME:GetPathG("_1d","frames/transparent"))) .. {
			Name="Frame";
			InitCommand=cmd(playcommand,"SetSize",{ Width=(640/8)*1.25; tween=cmd(finishtweening;linear,0.3;diffuse,DarkColor(cRed)); });
		};

		LoadFont("Common Normal") .. {
			Text=Var("GameCommand"):GetName();
			InitCommand=cmd(NoStroke;shadowlength,1;y,-2;diffuse,cRed;zoom,0.5);
		};
	}; --]]
	Def.ActorFrame {
-- 	 InitCommand=cmd(x,THEME:GetMetric(Var "LoadingScreen",Var("GameCommand"):GetName() .. "X"));
	 InitCommand=cmd(x,THEME:GetMetric(Var "LoadingScreen",Var("GameCommand"):GetName() .. "X");y,yPos);
		-- Container Frame
		Def.ActorFrame {
		 GainFocusCommand=cmd(stoptweening;decelerate,0.3;y,-10);
		 LoseFocusCommand=cmd(stoptweening;decelerate,0.3;y,10);
		 EnabledCommand=cmd(visible,true);
		 DisabledCommand=cmd(visible,false);
		 PlayerJoinedMessageCommand=function(self,param)
			if GAMESTATE:GetNumPlayersEnabled() > 1 then
				if sName == "Versus" or sName == "Double" or sName == "Couple" then
					self:playcommand("Enabled");
				elseif sName == "Single" or sName == "Solo" then
					self:playcommand("Disabled");
				end;
			end;
		 end;
			LoadActor("small category") .. {
				InitCommand=cmd(diffusealpha,0.5);
			};
			-- Whitener
			LoadActor("small category") .. {
				InitCommand=cmd(blend,bmAdd;fadeleft,1;diffuse,LightColor(tModeColor[sName]));
			};
			--
			LoadActor("small margin") .. {
				InitCommand=cmd(diffuse,tModeColor[sName];diffusetopedge,LightColor(tModeColor[sName]));
			};
			--
			LoadActor("small margin") .. {
				InitCommand=cmd(blend,bmAdd;diffusealpha,0.5);
				GainFocusCommand=cmd(stoptweening;diffuseramp;effectcolor1,DarkColor(DarkColor(tModeColor[sName]));effectcolor2,LightColor(tModeColor[sName]);effectperiod,1;effectclock,'beat');
				LoseFocusCommand=cmd(stoptweening;stopeffect);
			};
			--
			LoadFont("_regra black 50px") .. {
				Text=sName;
				InitCommand=cmd(x,4;shadowlength,1;zoom,0.35;diffuse,tModeColor[sName];diffusetopedge,LightColor(tModeColor[sName]););
				GainFocusCommand=cmd(stoptweening;pulse;effectmagnitude,1,1.15,1;effectclock,'beat';effecttiming,0,0,0.75,1.25);
				LoseFocusCommand=cmd(stoptweening;stopeffect);
			};
		};
		Def.ActorFrame {
		 GainFocusCommand=cmd(stoptweening;decelerate,0.3;y,-10);
		 LoseFocusCommand=cmd(stoptweening;decelerate,0.3;y,10);
		 EnabledCommand=cmd(visible,false);
		 DisabledCommand=cmd(visible,true);
		 PlayerJoinedMessageCommand=function(self,param)
			if GAMESTATE:GetNumPlayersEnabled() > 1 then
				if sName == "Versus" or sName == "Double" or sName == "Couple" then
					self:playcommand("Enabled");
				elseif sName == "Single" or sName == "Solo" then
					self:playcommand("Disabled");
				end;
			end;
		 end;

			LoadActor("small category") .. {
				InitCommand=cmd(diffusealpha,0.5);
			};
			-- Whitener
			LoadActor("small category") .. {
				InitCommand=cmd(fadeleft,1;diffuse,cRed);
			};
			--
			LoadActor("small margin") .. {
				InitCommand=cmd();
				DisabledCommand=cmd(stoptweening;diffuseramp;effectcolor1,DarkColor(cRed);effectcolor2,cRed;effectperiod,1;effectclock,'beat');
				EnabledCommand=cmd(stoptweening;stopeffect);
			};
			--
			LoadFont("_regra black 50px") .. {
				Text="NO ENTRY";
				InitCommand=cmd(x,4;y,-4;shadowlength,1;zoom,0.325;diffuse,DarkColor(cRed);diffusetopedge,cRed;);
				GainFocusCommand=cmd(stoptweening;pulse;effectmagnitude,1,1.15,1;effectclock,'beat';effecttiming,0,0,0.75,1.25);
				LoseFocusCommand=cmd(stoptweening;stopeffect);
			};
			LoadFont("Common Normal") .. {
				Text=sName;
				InitCommand=cmd(x,4;y,10;NoStroke;shadowlength,1;zoom,0.5;diffuse,DarkColor(cRed);diffusetopedge,cRed;);
				GainFocusCommand=cmd(stoptweening;pulse;effectmagnitude,1,1.15,1;effectclock,'beat';effecttiming,0,0,0.75,1.25);
				LoseFocusCommand=cmd(stoptweening;stopeffect);
			};
		};
		-- Decider!
		Def.ActorFrame {
-- 		 InitCommand=cmd(y,yPos);
			Def.Quad {
				InitCommand=cmd(y,20;zoomto,96,16;fadeleft,0.25;faderight,0.25;diffuse,cOrange);
				GainFocusCommand=cmd(stoptweening;diffusealpha,0;linear,0.2;diffusealpha,1);
				LoseFocusCommand=cmd(stoptweening;linear,0.25;diffusealpha,0);
			};
			LoadFont("Common Normal") .. {
				Text="DECIDE?";
				InitCommand=cmd(NoStroke;shadowlength,1;y,20;zoom,0.5;diffusebottomedge,LightColor(cOrange));
				GainFocusCommand=cmd(stoptweening;diffusealpha,0;zoomx,1.2*0.5;decelerate,0.2;zoomx,1*0.5;diffusealpha,1);
				LoseFocusCommand=cmd(stoptweening;linear,0.2;diffusealpha,0);
			};
		};
	};
};



local z = Def.ActorFrame {};

z[#z+1] = t;
z[#z+1] = i;

return z