function Update()

end

function HandleEvent( event )
	if event:GetID() == "Event_SelectionWheelSelection" then
		if not OWNER:HasAttribute( "name" ) then
			OWNER:SetString( "name", "" )
		end
		
		local name = OWNER:GetString( "name" )
		
		if event:GetSelection() == 28 then
			rotator.SendEvent_NewHighscore( name, GAME:GetGameState():GetEntityManager():GetEntity( "timer" ):GetFloat( "time" ) )
		elseif event:GetSelection() == 0 then
			if string.len( name ) > 0 then
				name = string.sub( name, 0, string.len( name ) - 1 )
			end
		elseif event:GetSelection() == 1 then
			name = name .. " "
		else
			name = name .. rotator.GetCharForSelection( event:GetSelection() )
		end
		
		OWNER:SetString( "name", name )
		game.ConvertToVisualText( OWNER:GetSubEntity( "name" ):GetVisual() ):SetText( name )
	elseif event:GetID() == "Event_KeyboardButtonPressed" then
		if not OWNER:HasAttribute( "name" ) then
			OWNER:SetString( "name", "" )
		end
		
		local name = OWNER:GetString( "name" )
		
		if event:GetButton() == game.K_ESCAPE or event:GetButton() == game.K_ENTER then
			rotator.SendEvent_NewHighscore( name, GAME:GetGameState():GetEntityManager():GetEntity( "timer" ):GetFloat( "time" ) )
		end
	end
end