local ScreenName = Var "LoadingScreen";
local stageDisplayTypes = {
	ScreenSelectMusic = "selmusic",
	ScreenSelectCourse = "selmusic",
	ScreenSelectCourseNonstop = "selmusic",
	ScreenSelectCourseOni = "selmusic",
	ScreenSelectCourseEndless = "selmusic",
	-------------------------------------
	ScreenGameplay = "gameplay",
	ScreenGameplayCourse = nil,
	ScreenGameplayExtra = "gameplay",
	ScreenDemonstration = "gameplay",
	ScreenJukebox = "gameplay",
	-------------------------------------
	ScreenEvaluation = "selmusic",
	ScreenEvaluationStage = "selmusic",
	ScreenEvaluationNonstop = nil,
	ScreenEvaluationOni = nil,
	ScreenEvaluationEndless = nil,
};
local stageDisplayType = stageDisplayTypes[ScreenName];
if stageDisplayType == nil then return Def.Actor{}; end;

local StageDisplay = Def.ActorFrame{
	BeginCommand=cmd(playcommand,"Set";);
	CurrentSongChangedMessageCommand=cmd(finishtweening;playcommand,"Set";);
};

for s in ivalues(Stage) do
	StageDisplay[#StageDisplay+1] = LoadActor( THEME:GetPathG("","_stages/_"..stageDisplayType.." "..s) ) .. {
		SetCommand=function(self, params)
			local Stage = GAMESTATE:GetCurrentStage();
			local StageIndex = GAMESTATE:GetCurrentStageIndex();
			local screen = SCREENMAN:GetTopScreen();
			if screen and screen.GetStageStats then
				local ss = screen:GetStageStats();
				Stage = ss:GetStage();
				StageIndex = ss:GetStageIndex();
			end
			self:visible( Stage == s );
		end;
	}
end

return StageDisplay;