Keys in cc.RESOURCE_TYPE should match types used in switches, otherwise it won't work with advanced compilation level