Why Does Rain Decrease the Taste of Melons and Fruits in Their Mature Period?

Melons and fruits maturing in a summer when there is much rain taste less sweet. How can that be? Besides water, the other major ingredient in a melon or fruit is sugar. The taste is closely related to the quantity of sugar: the more sugar, the tastier it is. However, the quantity of sugar can only be produced by leaves, with the help of sunshine, so plenty of sunshine means plenty of sugar. The surplus sugar will be preserved in the melons and fruits. If there are many rainy and cloudy days during the maturation period, the plants will not get enough sunshine to produce sugar and therefore they will taste less sweet.