Exemplo n.º 1
0
        public EvolutionWindow(IPokemon pokemon, ushort evolutionDexID)
        {
            InitializeComponent();

            this.pokemon        = pokemon;
            this.evolutionDexID = evolutionDexID;
            this.evolved        = false;

            this.evolutionState = 0;

            this.timer          = new DispatcherTimer();
            this.timer.Tick    += OnTick;
            this.timer.Interval = TimeSpan.FromSeconds(1.5);
            this.timer.Start();

            this.storyboard                      = new Storyboard();
            this.storyboard.Completed           += OnStoryboardCompleted;
            this.imagePrevolution.Source         = PokemonDatabase.GetPokemonImageFromDexID(pokemon.DexID, pokemon.IsShiny);
            this.imageEvolution.Source           = PokemonDatabase.GetPokemonImageFromDexID(evolutionDexID, pokemon.IsShiny);
            this.rectMaskPrevolution.OpacityMask = new ImageBrush(PokemonDatabase.GetPokemonImageFromDexID(pokemon.DexID, pokemon.IsShiny));
            this.rectMaskEvolution.OpacityMask   = new ImageBrush(PokemonDatabase.GetPokemonImageFromDexID(evolutionDexID, pokemon.IsShiny));
            this.rectMaskPrevolution.Opacity     = 0;
            this.textBlockMessage.Text           = "What?\nYour " + pokemon.Nickname + " is evolving!";
            playerCry                      = new MediaPlayer();
            playerCry.MediaEnded          += OnMediaEnded;
            playerCry.Volume               = PokeManager.Settings.MutedVolume;
            playerEvolutionCry             = new MediaPlayer();
            playerEvolutionCry.MediaEnded += OnMediaEnded;
            playerEvolutionCry.Volume      = PokeManager.Settings.MutedVolume;
            playerMusic                    = new MediaPlayer();
            playerMusic.MediaEnded        += OnMediaEnded;
            playerMusic.Volume             = PokeManager.Settings.MutedVolume;

            if (PokeManager.Settings.IsMuted)
            {
                imageVolume.Source = ResourceDatabase.GetImageFromName("IconVolumeMute");
            }
            else
            {
                imageVolume.Source = ResourceDatabase.GetImageFromName("IconVolumeOn");
            }

            CreateAnimation();
            string cryFile = PokemonDatabase.FindCryFile(pokemon.DexID);

            try {
                if (cryFile != null)
                {
                    playerCry.Open(new Uri(cryFile));
                }
                else
                {
                    playerCry = null;
                }
            } catch (Exception) {
                playerCry = null;
            }
            cryFile = PokemonDatabase.FindCryFile(evolutionDexID);
            try {
                if (cryFile != null)
                {
                    playerEvolutionCry.Open(new Uri(cryFile));
                }
                else
                {
                    playerEvolutionCry = null;
                }
            } catch (Exception) {
                playerEvolutionCry = null;
            }
            playerMusic.Open(new Uri(System.IO.Path.Combine(PokeManager.ApplicationDirectory, "Resources", "Audio", "Evolution.wav")));
        }