예제 #1
0
        public GenrePage()
        {
            InitializeComponent();

            var sunAnimation = this.Resources["SunAnimation"] as RotateToAnimation;

            if (sunAnimation != null && Device.RuntimePlatform != Device.UWP)
            {
                Sun.Animate(sunAnimation);
            }

            var cloud1Animation = this.Resources["Cloud1Animation"] as StoryBoard;

            if (cloud1Animation != null)
            {
                Cloud1.Animate(cloud1Animation);
            }

            var cloud2Animation = this.Resources["Cloud2Animation"] as StoryBoard;

            if (cloud2Animation != null)
            {
                Cloud2.Animate(cloud2Animation);
            }
        }
예제 #2
0
    void displayWeather(int weather)
    {
        var main = rain.GetComponent <ParticleSystem>().main;

        if (weather < 300)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(true);
            Cloud3.SetActive(true);
            rain.SetActive(false);
            main.maxParticles = 15;
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(true);
            weatherText.GetComponent <TextMeshPro>().text = "Thunderstorm";
            return;
        }
        if (weather < 520)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(true);
            Cloud3.SetActive(true);
            rain.SetActive(true);
            main.maxParticles = 7;
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Rain";
            return;
        }
        if (weather < 600)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(true);
            Cloud3.SetActive(true);
            rain.SetActive(true);
            main.maxParticles = 15;
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Showers";
            return;
        }
        if (weather < 700)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(true);
            Cloud3.SetActive(true);
            rain.SetActive(false);
            snow.SetActive(true);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Snow";
            return;
        }
        if (weather < 800)
        {
            Cloud1.SetActive(false);
            Cloud2.SetActive(false);
            Cloud3.SetActive(false);
            rain.SetActive(true);
            main.maxParticles = 7;
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Mist";
            return;
        }
        if (weather == 800)
        {
            Cloud1.SetActive(false);
            Cloud2.SetActive(false);
            Cloud3.SetActive(false);
            rain.SetActive(false);
            snow.SetActive(false);
            lightning.SetActive(false);
            sun.SetActive(true);
            weatherText.GetComponent <TextMeshPro>().text = "Clear";
            return;
        }
        if (weather == 801)
        {
            Cloud1.SetActive(false);
            Cloud2.SetActive(false);
            Cloud3.SetActive(true);
            rain.SetActive(false);
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Few Clouds";
            return;
        }
        if (weather == 802)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(false);
            Cloud3.SetActive(true);
            rain.SetActive(false);
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Scattered Clouds";
            return;
        }
        if (weather == 803 || weather == 805)
        {
            Cloud1.SetActive(true);
            Cloud2.SetActive(true);
            Cloud3.SetActive(true);
            rain.SetActive(false);
            snow.SetActive(false);
            sun.SetActive(false);
            lightning.SetActive(false);
            weatherText.GetComponent <TextMeshPro>().text = "Overcast";
            return;
        }
    }