Sexual selection is influenced by both developmental and adult environments