示例#1
0
        private void SelectSkill(object Sender, SelectionChangedEventArgs E)
        {
            var Skill = SkillListBox.SelectedItem as Skill;

            if (Skill == null)
            {
                CurrentSkill             = null;
                ContentViewer.Visibility = Visibility.Hidden;
                DeleteButton.Visibility  = Visibility.Hidden;
                return;
            }
            if (CurrentSkill != null)
            {
                SaveSkill();
            }

            SkillImg              = null;
            CurrentSkill          = Skill;
            SkillName.Text        = Skill.Name;
            SkillDescription.Text = Skill.Description;
            if (Skill.Image != null)
            {
                SkillImg = Skill.Image;
                using (MemoryStream Stream = new MemoryStream())
                {
                    Skill.Image.Save(Stream, ImageFormat.Png);
                    BitmapImage Temp = new BitmapImage();
                    Temp.BeginInit();
                    Temp.CacheOption  = BitmapCacheOption.OnLoad;
                    Temp.StreamSource = Stream;
                    Temp.EndInit();
                    SkillImage.Source = Temp;
                }
            }
            else
            {
                SkillImage.Source = null;
            }

            SkillProbability.SetValue(Skill.Probability);
            ActiveCheckBox.IsChecked        = Skill.IsActive;
            DefendableCheckBox.IsChecked    = Skill.IsDefendable;
            SkillTargetsListBox.ItemsSource = Skill.TargetSelections
                                              .Select(O => SkillTargetConverter.ConverterDictionary[O]);
            LaunchScriptBox.Document.Blocks.Clear();
            LaunchScriptBox.Document.Blocks.Add(new Paragraph(
                                                    new Run(Skill.LaunchScript)));
            CountCheckBox.IsChecked    = Skill.TotalCount != -1;
            CountText.Text             = Skill.TotalCount.ToString();
            DurationCheckBox.IsChecked = Skill.Duration != 0;
            DurationText.Text          = Skill.Duration.ToString();
            CoolDownCheckBox.IsChecked = Skill.CoolDown != 0;
            CoolDownText.Text          = Skill.CoolDown.ToString();

            DeleteButton.Visibility = Visibility.Visible;
            if (ContentViewer.Visibility == Visibility.Hidden)
            {
                ContentViewer.Visibility = Visibility.Visible;
                ContentViewer.BeginAnimation(OpacityProperty, new DoubleAnimation()
                {
                    From           = 0,
                    To             = 1,
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseOut
                    }
                });
            }
        }
示例#2
0
        public void PageLeave()
        {
            if (ContentViewer.Visibility == Visibility.Visible)
            {
                ContentViewer.BeginAnimation(OpacityProperty, new DoubleAnimation()
                {
                    From           = 1,
                    To             = 0,
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    }
                });
            }

            var SkillListMarginAnimation = new ThicknessAnimation()
            {
                From           = SkillListGrid.Margin,
                To             = new Thickness(-300, 100, 0, 0),
                Duration       = TimeSpan.FromSeconds(0.3),
                EasingFunction = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseIn
                }
            };

            SkillListMarginAnimation.Completed += delegate
            {
                DispatcherTimer Timer = new DispatcherTimer()
                {
                    Interval = TimeSpan.FromSeconds(0.75)
                };
                Timer.Tick += delegate
                {
                    LeaveAction?.Invoke();
                    Timer.Stop();
                };
                TitleGrid.BeginAnimation(OpacityProperty, new DoubleAnimation()
                {
                    From           = 1,
                    To             = 0,
                    Duration       = TimeSpan.FromSeconds(0.75),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    }
                });
                TitleGrid.BeginAnimation(MarginProperty, new ThicknessAnimation()
                {
                    From = TitleGrid.Margin,
                    To   = new Thickness(
                        TitleGrid.Margin.Left + 50,
                        TitleGrid.Margin.Top,
                        TitleGrid.Margin.Right - 50,
                        TitleGrid.Margin.Bottom),
                    Duration       = TimeSpan.FromSeconds(0.75),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseIn
                    }
                });
                Timer.Start();
            };
            SkillListGrid.BeginAnimation(MarginProperty, SkillListMarginAnimation);
        }
示例#3
0
        private void SelectAi(object Sender, SelectionChangedEventArgs E)
        {
            var Ai = AiListBox.SelectedItem as AI;

            if (Ai == null)
            {
                CurrentAi = null;
                ContentViewer.Visibility = Visibility.Hidden;
                DeleteButton.Visibility  = Visibility.Hidden;
                return;
            }
            if (CurrentAi != null)
            {
                SaveAi();
            }

            Avator             = null;
            Drawing            = null;
            CurrentAi          = Ai;
            AiName.Text        = Ai.Name;
            AiDescription.Text = Ai.Introduction;
            if (Ai.Avator != null)
            {
                Avator = Ai.Avator;
                using (MemoryStream Stream = new MemoryStream())
                {
                    Ai.Avator.Save(Stream, ImageFormat.Png);
                    BitmapImage Temp = new BitmapImage();
                    Temp.BeginInit();
                    Temp.CacheOption  = BitmapCacheOption.OnLoad;
                    Temp.StreamSource = Stream;
                    Temp.EndInit();
                    AvatorImage.ImageSource = Temp;
                }
            }
            else
            {
                AvatorImage.ImageSource = Resources["EmptyIcon"] as BitmapImage;
            }
            if (Ai.Drawing != null)
            {
                Drawing = Ai.Drawing;
                using (MemoryStream Stream = new MemoryStream())
                {
                    Ai.Drawing.Save(Stream, ImageFormat.Png);
                    BitmapImage Temp = new BitmapImage();
                    Temp.BeginInit();
                    Temp.CacheOption  = BitmapCacheOption.OnLoad;
                    Temp.StreamSource = Stream;
                    Temp.EndInit();
                    DrawingImage.Source = Temp;
                }
                SetDrawingButton.Visibility = Visibility.Hidden;
            }
            else
            {
                DrawingImage.Source         = null;
                SetDrawingButton.Visibility = Visibility.Visible;
            }
            switch (Ai.Inclination)
            {
            default:
            case AttackInclination.Random:
                ((RadioButton)InclinationPanel.Children[0]).IsChecked = true;
                break;

            case AttackInclination.Bloody:
                ((RadioButton)InclinationPanel.Children[1]).IsChecked = true;
                break;

            case AttackInclination.Relentless:
                ((RadioButton)InclinationPanel.Children[2]).IsChecked = true;
                break;

            case AttackInclination.Jealous:
                ((RadioButton)InclinationPanel.Children[3]).IsChecked = true;
                break;

            case AttackInclination.Vindictive:
                ((RadioButton)InclinationPanel.Children[4]).IsChecked = true;
                break;

            case AttackInclination.TargetHard:
                ((RadioButton)InclinationPanel.Children[5]).IsChecked = true;
                break;
            }

            SkillListBox.ItemsSource    = Ai.SkillPool.Keys;
            DeleteSkillButton.IsEnabled = false;
            RadicalSlider.Value         = Ai.RadicalRatio;
            RadicalText.Text            = (Ai.RadicalRatio * 100) + "%";
            DeleteButton.Visibility     = Visibility.Visible;
            if (ContentViewer.Visibility == Visibility.Hidden)
            {
                ContentViewer.Visibility = Visibility.Visible;
                ContentViewer.BeginAnimation(OpacityProperty, new DoubleAnimation()
                {
                    From           = 0,
                    To             = 1,
                    Duration       = TimeSpan.FromSeconds(0.3),
                    EasingFunction = new ExponentialEase()
                    {
                        EasingMode = EasingMode.EaseOut
                    }
                });
            }
        }