-- net evaluation. it sucks.

local TNSNames = {
	THEME:GetString("TapNoteScore","W1"),
	THEME:GetString("TapNoteScore","W2"),
	THEME:GetString("TapNoteScore","W3"),
	THEME:GetString("TapNoteScore","W4"),
	THEME:GetString("TapNoteScore","W5"),
	THEME:GetString("TapNoteScore","Miss"),
	"Holds",
	"Max Combo"
};

local function JudgeLabels()
	local l = Def.ActorFrame{};

	for i=1,#TNSNames do
		l[#l+1] = AutoText("frutiger")..{
			InitCommand=cmd(shadowlength,1;NoStroke;zoom,0.833);
			BeginCommand=function(self)
				self:y((i-1)*24);
				self:settext(TNSNames[i]);
				if i < 6 then -- W1-W5
					self:diffuse( JudgeColor('TapNoteScore_W'..i) );
				elseif i == 6 then -- Miss
					self:diffuse( JudgeColor('TapNoteScore_Miss') );
				elseif i == 7 then -- holds
					self:diffuse( JudgeColor('TapNoteScore_W1') );
				elseif i == 8 then -- max combo
					self:diffuse( PlayerColor(PLAYER_1) );
				end;
			end;
		};
	end;

	return l;
end;

local function StepsType(pn)
	if not GAMESTATE:IsPlayerEnabled(pn) then
		return Def.Actor{};
	end;

	local StepsOrTrail;
	if GAMESTATE:IsCourseMode() then
		StepsOrTrail = GAMESTATE:GetCurrentTrail(pn);
	else
		StepsOrTrail = GAMESTATE:GetCurrentSteps(pn);
	end;

	local StepsType = StepsOrTrail:GetStepsType();
	local stringloc = string.sub(StepsType,11);

	local ret = Def.ActorFrame{};
	if StepsOrTrail then
		ret[#ret+1] = AutoText("frutiger")..{
			Text=THEME:GetString("StepsType",stringloc);
			InitCommand=cmd(Stroke,color("0.2,0.2,0.2,0.35");shadowlength,1;zoom,0.666);
		};
	end;

	return ret;
end;

local t = Def.ActorFrame{
	-- song/course title bg
	Def.Quad{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_TOP+27;zoomto,SCREEN_WIDTH,36;diffuse,color("0,0,0,0.75");fadeleft,0.5;faderight,0.5);
	};
	-- song/course title text
	AutoText("frutiger",true)..{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_TOP+26;NoStroke;shadowlength,1;zoom,0.55);
		BeginCommand=function(self)
			local song = GAMESTATE:GetCurrentSong();
			local s = song:GetDisplayFullTitle() .. "\n" .. song:GetDisplayArtist();

			-- apply title fun, but only if we have a song.
			if song then
				-- DVNO is four capital letters printed in gold.
				if song:GetDisplayFullTitle() == "DVNO" then
					local attribDVNO = {
						Length = 4;
						Diffuse = color("1,0.8,0,1");
					};
					self:AddAttribute(0,attribDVNO);
				end;
			end;

			self:settext(s);
		end;
	};

	JudgeLabels()..{
		InitCommand=cmd(x,SCREEN_CENTER_X;y,SCREEN_CENTER_Y-24);
	};

	-- Player 1!
	Def.ActorFrame{
		Name="P1Results";
		BeginCommand=function(self)
			if GAMESTATE:IsSideJoined(PLAYER_1) then self:visible(true); return; end;
			self:visible(false);
		end;

		-- percentage
		--[[
		Percentage(PLAYER_1)..{
			InitCommand=cmd(x,SCREEN_CENTER_X-80;y,SCREEN_CENTER_Y-80);
		};
		--]]

		-- steps type
		StepsType(PLAYER_1)..{
			InitCommand=cmd(x,SCREEN_CENTER_X-108;y,SCREEN_CENTER_Y-56);
		};

		-- Option Icons
		--[[
		LoadActor("OptionIcons",PLAYER_1)..{
			InitCommand=cmd(x,SCREEN_CENTER_X*0.25;y,SCREEN_HEIGHT*0.25);
		};
		--]]
	};

	-- Player 2!
	Def.ActorFrame{
		Name="P2Results";
		BeginCommand=function(self)
			if GAMESTATE:IsSideJoined(PLAYER_2) then self:visible(true); return; end;
			self:visible(false);
		end;

		-- percentage
		--[[
		Percentage(PLAYER_2)..{
			InitCommand=cmd(x,SCREEN_CENTER_X+80;y,SCREEN_CENTER_Y-80);
		};
		--]]

		-- steps type
		StepsType(PLAYER_2)..{
			InitCommand=cmd(x,SCREEN_CENTER_X+108;y,SCREEN_CENTER_Y-56);
		};

		-- Option Icons
		--[[
		LoadActor("OptionIcons",PLAYER_2)..{
			InitCommand=cmd(x,SCREEN_CENTER_X*1.75;y,SCREEN_HEIGHT*0.25);
		};
		--]]
	};
};

return t;