Esempio n. 1
0
		public AnimationChannel (string nodeName, AnimationBehavior preState, AnimationBehavior postState, PositionKey[] posKeys, RotationKey[] rotKeys, ScalingKey[] scaleKeys) {
			_nodeName = nodeName;
			_preState = preState;
			_postState = postState;
			_posKeys = posKeys;
			_rotKeys = rotKeys;
			_scaleKeys = scaleKeys;
		}
Esempio n. 2
0
        private System.Windows.Controls.Image AddImageAttachment(string url, int?width, int?height)
        {
            System.Windows.Controls.Image image = new System.Windows.Controls.Image();
            image.HorizontalAlignment = HorizontalAlignment.Left;
            image.VerticalAlignment   = VerticalAlignment.Top;
            if (width.HasValue)
            {
                image.MaxWidth = width.Value;
            }
            if (height.HasValue)
            {
                image.MaxHeight = height.Value;
            }
            image.Stretch = Stretch.Uniform;

            if (System.IO.Path.GetExtension(url) == ".gif")
            {
                AnimationBehavior.SetSourceUri(image, new Uri(url));

                image.MouseEnter += (o, e) =>
                {
                    AnimationBehavior.GetAnimator(image).Play();
                };

                image.MouseLeave += (o, e) =>
                {
                    AnimationBehavior.GetAnimator(image).Pause();
                };
            }
            else
            {
                image.Source = Images.GetImage(url);
            }
            image.ContextMenu = GetAttachmentContextMenu(url);

            image.Visibility = Visibility.Collapsed;
            mainContent.Children.Add(image);

            MouseDown += (o, e) =>
            {
                if (e.LeftButton == MouseButtonState.Pressed)
                {
                    if (image.Visibility == Visibility.Collapsed)
                    {
                        image.Visibility = Visibility.Visible;
                    }
                    else
                    {
                        image.Visibility = Visibility.Collapsed;
                        try
                        {
                            Animator anim = AnimationBehavior.GetAnimator(image);
                            if (anim != null)
                            {
                                anim.Rewind();
                            }
                        }
                        catch { }
                    }
                }
            };

            return(image);
        }
Esempio n. 3
0
 private void ErrorLoadingGraphic(DependencyObject d, AnimationErrorEventArgs e)
 {
     // Set graphic to Decamark icon if the url couldn't be loaded
     AnimationBehavior.SetSourceUri((Image)d, new Uri("https://cdn.bulbagarden.net/upload/archive/8/8e/20090709005535%21Spr_3r_000.png"));
 }
Esempio n. 4
0
 private void btnRun_Click(object sender, RoutedEventArgs e)
 {
     AnimationBehavior.SetSourceStream(holder, imgs[2].StreamSource);
     StartRepeatChecker(durations[2]);
 }
Esempio n. 5
0
        public void BattleUpdated()
        {
            Dispatcher.InvokeAsync(delegate
            {
                lock (_bot)
                {
                    if (_bot.Game != null && _bot.Game.ActiveBattle != null)
                    {
                        string opponent = PokemonNamesManager.Instance.Names[_bot.Game.ActiveBattle.OpponentId];

                        if (_lastOpponentName != opponent)
                        {
                            _lastOpponentName = opponent;
                            string sprite     = _nameCleaner.Replace(opponent.ToLowerInvariant(), "");
                            if (_bot.Game.ActiveBattle.IsShiny)
                            {
                                sprite = $"{_spriteDatabasePrefix}/shiny/{sprite}.gif";
                            }
                            else
                            {
                                sprite = $"{_spriteDatabasePrefix}/{sprite}.gif";
                            }
                            AnimationBehavior.SetSourceUri(OpponentGraphic, new Uri(sprite));
                        }

                        if (_bot.Game.ActiveBattle.IsShiny)
                        {
                            opponent = "Shiny " + opponent;
                        }
                        if (_bot.Game.ActiveBattle.IsWild)
                        {
                            opponent = "Wild " + opponent;
                        }
                        OpponentName.Text             = opponent;
                        OpponentCaughtIcon.Visibility = _bot.Game.ActiveBattle.AlreadyCaught ? Visibility.Visible : Visibility.Hidden;
                        OpponentLevel.Text            = _bot.Game.ActiveBattle.OpponentLevel.ToString();
                        OpponentMaxHealth.Text        = _bot.Game.ActiveBattle.OpponentHealth.ToString();
                        OpponentCurrentHealth.Text    = _bot.Game.ActiveBattle.CurrentHealth.ToString();

                        if (_bot.Game.ActiveBattle.OpponentStatus.ToLowerInvariant() == "none")
                        {
                            OpponentStatus.Text = "";
                        }
                        else
                        {
                            OpponentStatus.Text = _bot.Game.ActiveBattle.OpponentStatus;
                        }

                        OpponentType1.Text = TypesManager.Instance.Type1[_bot.Game.ActiveBattle.OpponentId].ToString();
                        OpponentType2.Text = TypesManager.Instance.Type2[_bot.Game.ActiveBattle.OpponentId].ToString();

                        string gender       = _bot.Game.ActiveBattle.OpponentGender;
                        OpponentGender.Icon = gender == "M" ? FontAwesomeIcon.Mars : gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                        OpponentForm.Text   = _bot.Game.ActiveBattle.AlternateForm.ToString();

                        PokemonStats stats = EffortValuesManager.Instance.BattleValues[_bot.Game.ActiveBattle.OpponentId];
                        List <string> evs  = new List <string>();

                        foreach (StatType type in Enum.GetValues(typeof(StatType)).Cast <StatType>())
                        {
                            int ev = stats.GetStat(type);
                            if (ev > 0)
                            {
                                evs.Add($"{type}: {ev}");
                            }
                        }

                        OpponentEVs.ToolTip = string.Join(Environment.NewLine, evs);

                        Pokemon active           = _bot.Game.Team[_bot.Game.ActiveBattle.SelectedPokemonIndex];
                        ActiveName.Text          = active.Name;
                        ActiveLevel.Text         = active.Level.ToString();
                        ActiveMaxHealth.Text     = active.MaxHealth.ToString();
                        ActiveCurrentHealth.Text = active.CurrentHealth.ToString();

                        if (_lastActiveName != active.Name)
                        {
                            _lastActiveName = active.Name;
                            string sprite   = _nameCleaner.Replace(active.Name.ToLowerInvariant(), "");
                            if (active.IsShiny)
                            {
                                sprite = $"{_spriteDatabasePrefix}/shiny/back/{sprite}.gif";
                            }
                            else
                            {
                                sprite = $"{_spriteDatabasePrefix}/back/{sprite}.gif";
                            }
                            AnimationBehavior.SetSourceUri(PlayerGraphic, new Uri(sprite));
                        }

                        if (active.Experience.CurrentLevel == 100)
                        {
                            NextLevel.Visibility = Visibility.Hidden;
                        }
                        else
                        {
                            NextLevel.Visibility = Visibility.Visible;
                            NextLevel.Text       = $"To level {active.Experience.CurrentLevel + 1}: {active.Experience.RemainingExperience}";
                        }

                        if (active.Status.ToLowerInvariant() == "none")
                        {
                            ActiveStatus.Text = "";
                        }
                        else
                        {
                            ActiveStatus.Text = active.Status;
                        }

                        ActiveType1.Text = TypesManager.Instance.Type1[active.Id].ToString();
                        ActiveType2.Text = TypesManager.Instance.Type2[active.Id].ToString();

                        ActiveGender.Icon = active.Gender == "M" ? FontAwesomeIcon.Mars : active.Gender == "F" ? FontAwesomeIcon.Venus : FontAwesomeIcon.Question;
                    }
                }
            });
        }