Esempio n. 1
0
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(PointAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (_areKeyTimesValid &&
                sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone();
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (PointKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (PointKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Implementation of <see cref="System.Windows.Freezable.GetCurrentValueAsFrozenCore(Freezable)">Freezable.GetCurrentValueAsFrozenCore</see>.
        /// </summary>
        protected override void GetCurrentValueAsFrozenCore(Freezable source)
        {
            PointAnimationUsingKeyFrames sourceAnimation = (PointAnimationUsingKeyFrames)source;

            base.GetCurrentValueAsFrozenCore(source);

            CopyCommon(sourceAnimation, /* isCurrentValueClone = */ true);
        }
Esempio n. 3
0
        /// <summary>
        /// Implementation of <see cref="System.Windows.Freezable.CloneCore(System.Windows.Freezable)">Freezable.CloneCore</see>.
        /// </summary>
        protected override void CloneCore(Freezable sourceFreezable)
        {
            PointAnimationUsingKeyFrames sourceAnimation = (PointAnimationUsingKeyFrames)sourceFreezable;

            base.CloneCore(sourceFreezable);

            CopyCommon(sourceAnimation, /* isCurrentValueClone = */ false);
        }
Esempio n. 4
0
        /// <summary>
        /// CreatePointAnimation
        /// </summary>
        /// <param name="target">Target object to animate</param>
        /// <param name="property">Property to animate</param>
        /// <param name="beginTime">Animation begin time</param>
        /// <param name="frameTimes">Animation frame times</param>
        /// <param name="values">List of values</param>
        /// <param name="splines">List of animation splines</param>
        /// <returns>PointAnimationUsingKeyFrames</returns>
        private static PointAnimationUsingKeyFrames CreatePointAnimation(DataSeries currentDataSeries, DataPoint currentDataPoint, DependencyObject target, String property, Double beginTime, List<Double> frameTimes, List<Point> values, List<KeySpline> splines)
        {
            PointAnimationUsingKeyFrames da = new PointAnimationUsingKeyFrames();
#if WPF
            target.SetValue(FrameworkElement.NameProperty, target.GetType().Name +  Guid.NewGuid().ToString().Replace('-', '_'));
            Storyboard.SetTargetName(da, target.GetValue(FrameworkElement.NameProperty).ToString());

            currentDataSeries.Chart._rootElement.RegisterName((string)target.GetValue(FrameworkElement.NameProperty), target);
            currentDataPoint.Chart._rootElement.RegisterName((string)target.GetValue(FrameworkElement.NameProperty), target);
#else
            Storyboard.SetTarget(da, target);
#endif
            Storyboard.SetTargetProperty(da, new PropertyPath(property));

            da.BeginTime = TimeSpan.FromSeconds(beginTime);

            for (Int32 index = 0; index < splines.Count; index++)
            {
                SplinePointKeyFrame keyFrame = new SplinePointKeyFrame();
                keyFrame.KeySpline = splines[index];
                keyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(frameTimes[index]));
                keyFrame.Value = values[index];
                da.KeyFrames.Add(keyFrame);
            }

            return da;
        }
Esempio n. 5
0
        /// <summary>
        /// Create PointAnimation
        /// </summary>
        /// <param name="parentObj">Storyboard parent object</param>
        /// <param name="target">Animation target object</param>
        /// <param name="property">Property path to animate</param>
        /// <param name="beginTime">Animation begin time</param>
        /// <param name="frameTime">Frame time collection</param>
        /// <param name="values">Target value collection</param>
        /// <param name="splines">List of KeySpline</param>
        /// <returns>PointAnimationUsingKeyFrames</returns>
        internal static PointAnimationUsingKeyFrames CreatePointAnimation(FrameworkElement parentObj, DependencyObject target, String property, Double beginTime, DoubleCollection frameTime, PointCollection values, List<KeySpline> splines)
        {
            PointAnimationUsingKeyFrames da = new PointAnimationUsingKeyFrames();
            
#if WPF
            target.SetValue(FrameworkElement.NameProperty, target.GetType().Name + Guid.NewGuid().ToString().Replace('-', '_'));
            Storyboard.SetTargetName(da, target.GetValue(FrameworkElement.NameProperty).ToString());

            (parentObj as ObservableObject).Chart._rootElement.RegisterName((string)target.GetValue(FrameworkElement.NameProperty), target);
#else


            Storyboard.SetTarget(da, target);
#endif
            Storyboard.SetTargetProperty(da, new PropertyPath(property));

            da.BeginTime = TimeSpan.FromSeconds(beginTime);

            for (Int32 index = 0; index < values.Count; index++)
            {
                SplinePointKeyFrame keyFrame = new SplinePointKeyFrame();
                
                if (splines != null)
                    keyFrame.KeySpline = splines[index];

                keyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(frameTime[index]));
                keyFrame.Value = values[index];
                da.KeyFrames.Add(keyFrame);
            }

            return da;
        }
Esempio n. 6
0
        private static void AnimateImage(MultiScaleSubImage currentImage, Point futurePosition, Storyboard _moveStoryboard)
        {
            // Create Keyframe
            SplinePointKeyFrame endKeyframe = new SplinePointKeyFrame();
            endKeyframe.Value = futurePosition;
            endKeyframe.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1));

            KeySpline ks = new KeySpline();
            ks.ControlPoint1 = new Point(0, 1);
            ks.ControlPoint2 = new Point(1, 1);
            endKeyframe.KeySpline = ks;

            // Create Animation
            PointAnimationUsingKeyFrames moveAnimation = new PointAnimationUsingKeyFrames();
            moveAnimation.KeyFrames.Add(endKeyframe);

            Storyboard.SetTarget(moveAnimation, currentImage);
            Storyboard.SetTargetProperty(moveAnimation, new PropertyPath("ViewportOrigin"));

            _moveStoryboard.Children.Add(moveAnimation);
        }
        /// <summary>
        /// Helper used by the four Freezable clone methods to copy the resolved key times and 
        /// key frames. The Get*AsFrozenCore methods are implemented the same as the Clone*Core
        /// methods; Get*AsFrozen at the top level will recursively Freeze so it's not done here.
        /// </summary>
        /// <param name="sourceAnimation"></param>
        /// <param name="isCurrentValueClone"></param>
        private void CopyCommon(PointAnimationUsingKeyFrames sourceAnimation, bool isCurrentValueClone)
        {    
            _areKeyTimesValid = sourceAnimation._areKeyTimesValid;

            if (   _areKeyTimesValid 
                && sourceAnimation._sortedResolvedKeyFrames != null)
            {
                // _sortedResolvedKeyFrames is an array of ResolvedKeyFrameEntry so the notion of CurrentValueClone doesn't apply
                _sortedResolvedKeyFrames = (ResolvedKeyFrameEntry[])sourceAnimation._sortedResolvedKeyFrames.Clone(); 
            }

            if (sourceAnimation._keyFrames != null)
            {
                if (isCurrentValueClone)
                {
                    _keyFrames = (PointKeyFrameCollection)sourceAnimation._keyFrames.CloneCurrentValue();
                }
                else
                {
                    _keyFrames = (PointKeyFrameCollection)sourceAnimation._keyFrames.Clone();
                }

                OnFreezablePropertyChanged(null, _keyFrames);
            }
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
     switch (connectionId)
     {
     case 1:
     this.myWind = ((ProWPF_C.Ch16_AdvancedAnimation.AnimateRadialGradient)(target));
     return;
     case 2:
     this.myStoryBoard = ((System.Windows.Media.Animation.Storyboard)(target));
     return;
     case 3:
     this.myPoint = ((System.Windows.Media.Animation.PointAnimationUsingKeyFrames)(target));
     return;
     case 4:
     this.myGrid = ((System.Windows.Controls.Grid)(target));
     return;
     case 5:
     this.ellipse = ((System.Windows.Shapes.Ellipse)(target));
     return;
     case 6:
     this.txtPointA = ((System.Windows.Controls.TextBlock)(target));
     return;
     case 7:
     this.txtPointB = ((System.Windows.Controls.TextBlock)(target));
     return;
     }
     this._contentLoaded = true;
 }
Esempio n. 9
0
        /// <summary>
        /// 初始化系统控制台
        /// </summary>
        void InitializeConsole()
        {
            timer.Tick += delegate {
                //if (leader != null) {
                //    leader.FullName = ParallelDownloader.Error + " " + ParallelDownloader.error + " " + SerialDownloader.count;
                //}
                Dispatcher.BeginInvoke(() => {
                    textBlock36.Text = ObjectTracker.GetAllLiveTrackedObjects().Count().ToString();
                    if (childCanvas0.Visibility == Visibility.Visible && tabCanvas0.Visibility == Visibility.Visible) {
                        textBlock48.Text = string.Format("串行下载中[{0}] 未完成[{1}]", SerialDownloader.LoadingUri.Count, SerialDownloader.WaitingUri.Count);
                        textBlock51.Text = string.Format("并行下载中[{0}] 未完成[{1}]", ParallelDownloader.LoadingUri.Count, ParallelDownloader.WaitingUri.Count);
                        textBlock52.Text = string.Format("共完成下载[{0}] 失败[{1}]", DownloadBase.LoadedUri.Count, DownloadBase.Error);
                        rectangle0.Clip = new RectangleGeometry() { Rect = new Rect() { Width = 80 * (SerialDownloader.ProgressPercentage / 100d), Height = 10 } };
                        rectangle1.Clip = new RectangleGeometry() { Rect = new Rect() { Width = 80 * (ParallelDownloader.ProgressPercentage / 100d), Height = 10 } };
                        listBox0.Children.Clear();
                        for (int i = 0; i < SerialDownloader.LoadingUri.Count; i++) {
                            TextBlock textBlock = new TextBlock() { Text = SerialDownloader.LoadingUri[i], Foreground = new SolidColorBrush(Colors.Cyan) };
                            listBox0.Children.Add(textBlock);
                            Canvas.SetLeft(textBlock, 0);
                            Canvas.SetTop(textBlock, i * 18);
                        }
                        listBox1.Children.Clear();
                        for (int i = 0; i < ParallelDownloader.LoadingUri.Count; i++) {
                            TextBlock textBlock = new TextBlock() { Text = ParallelDownloader.LoadingUri[i], Foreground = new SolidColorBrush(Colors.Cyan) };
                            listBox1.Children.Add(textBlock);
                            Canvas.SetLeft(textBlock, 0);
                            Canvas.SetTop(textBlock, i * 16);
                            if (i > 8) { textBlock.Text = "......"; break; }
                        }
                    }
                });
            };
            timer.Start();

            ToolTipService.SetToolTip(textBlock6, "Number of roles in scene");
            ToolTipService.SetToolTip(textBlock35, "Number of objects in memory");
            ToolTipService.SetToolTip(textBlock36, "Number of objects in memory");
            ToolTipService.SetToolTip(textBlock48, "Number of serial downloads and serial waitings");
            ToolTipService.SetToolTip(textBlock51, "Number of parallel downloads and parallel waitings");
            ToolTipService.SetToolTip(textBlock52, "Number of total downloads and error downloads");

            ToolTipService.SetToolTip(rectangle0, "Serial download progress");
            ToolTipService.SetToolTip(rectangle1, "Parallel download progress");

            ToolTipService.SetToolTip(arrowButton, "Download status");

            ToolTipService.SetToolTip(tabItem0, "Scene Console");
            ToolTipService.SetToolTip(tabItem1, "Leader Console");
            ToolTipService.SetToolTip(tabItem2, "Other Console");
            ToolTipService.SetToolTip(button0, "Full Screen/Window Mode");
            ToolTipService.SetToolTip(button1, "Installed to the local");
            ToolTipService.SetToolTip(button2, "Attack");
            ToolTipService.SetToolTip(button3, "Injure");
            ToolTipService.SetToolTip(button4, "Null");
            ToolTipService.SetToolTip(button5, "Add roles to scene");
            ToolTipService.SetToolTip(button6, "Clear all roles");
            ToolTipService.SetToolTip(comboBox0, "State:Siting/Walking/Riding");
            ToolTipService.SetToolTip(comboBox1, "Profession:Archer/Assassin/Warrior/Magician");
            ToolTipService.SetToolTip(comboBox2, "Select Armor");
            ToolTipService.SetToolTip(comboBox3, "Select Weapon");
            ToolTipService.SetToolTip(comboBox4, "Select Ride");
            ToolTipService.SetToolTip(comboBox5, "Select Armor");
            ToolTipService.SetToolTip(comboBox6, "Select Weapon");
            ToolTipService.SetToolTip(comboBox7, "Select Ride");
            ToolTipService.SetToolTip(comboBox8, "Shadow:None/Simple/Simulation");
            ToolTipService.SetToolTip(comboBox9, "Day/Night/Memories");
            ToolTipService.SetToolTip(comboBox10, "Simple/Simulation");
            ToolTipService.SetToolTip(comboBox11, "Weather:None/Rain/Wind/Snow/Cloud/God Punished");
            ToolTipService.SetToolTip(comboBox12, "Body Shield");
            ToolTipService.SetToolTip(comboBox13, "Bottom Shield");
            ToolTipService.SetToolTip(comboBox14, "Rendering");
            ToolTipService.SetToolTip(comboBox15, "ChasingShadowEffect:None/Body/Armor Only/Weapon Only");
            ToolTipService.SetToolTip(comboBox16, "FlowLightEffect:None/Body/Armor Only/Weapon Only");
            ToolTipService.SetToolTip(comboBox17, "Select Armor");
            ToolTipService.SetToolTip(comboBox18, "Select Weapon");
            ToolTipService.SetToolTip(comboBox19, "Select Ride");
            ToolTipService.SetToolTip(comboBox20, "Close-up");
            ToolTipService.SetToolTip(comboBox21, "Music:OFF/ON");
            ToolTipService.SetToolTip(comboBox22, "SpaceLayer:Ground/Sky");
            ToolTipService.SetToolTip(comboBox23, "Select Armor");
            ToolTipService.SetToolTip(comboBox24, "Select Weapon");
            ToolTipService.SetToolTip(comboBox25, "Select Ride");
            ToolTipService.SetToolTip(comboBox26, "Mouse Move Hit Role:By pixel/By range");
            ToolTipService.SetToolTip(comboBox27, "Weapon emit particles:Normal/Smoke/Ice/Flame");
            ToolTipService.SetToolTip(comboBox28, "Particles Source:Body/Armor Only/Weapon Only");
            ToolTipService.SetToolTip(comboBox29, "Role located space position:Random/Ground/Sky");
            ToolTipService.SetToolTip(comboBox31, "MapViewPortMode:Synchronization/Easing");
            ToolTipService.SetToolTip(comboBox32, "Role Camp:Random/NPC Mode/KindHearted/Neutrality/Eval");
            ToolTipService.SetToolTip(comboBox33, "Role Profession:Random/Archer/Assassin/Warrior/Magician");
            ToolTipService.SetToolTip(comboBox34, "Role State:Random/Walking/Riding");
            ToolTipService.SetToolTip(comboBox35, "TacticAI:Random/Guard/GoalLeader/FreeFighting/TeamAttack/MartialBattle");
            ToolTipService.SetToolTip(comboBox36, "ActionAI:Random/Simple/Witty/Persistent/Cowardice");
            ToolTipService.SetToolTip(comboBox37, "Terrain:Static/Dynamic");
            ToolTipService.SetToolTip(comboBox38, "Mouse right button click casting:Magic Level");
            ToolTipService.SetToolTip(comboBox39, "Select magic,mouse right button click casting");
            ToolTipService.SetToolTip(comboBox40, "MouseWheel lead to viewport zooming(Rate) Mode:Continuous/SpecialEffect");

            ToolTipService.SetToolTip(slider0, "Refresh Leader/Monster Number");
            ToolTipService.SetToolTip(slider1, "Weather Strength");
            ToolTipService.SetToolTip(slider2, "Color");
            ToolTipService.SetToolTip(slider3, "Color");
            ToolTipService.SetToolTip(slider4, "Color");
            ToolTipService.SetToolTip(slider5, "Coefficient");
            ToolTipService.SetToolTip(slider6, "Color");
            ToolTipService.SetToolTip(slider7, "Coefficient");
            ToolTipService.SetToolTip(slider8, "MouseWheel lead to viewport zooming(Rate):roll up scaling and roll down restore");
            ToolTipService.SetToolTip(slider9, "Scaling");
            ToolTipService.SetToolTip(slider10, "MusicVolume");
            ToolTipService.SetToolTip(slider11, "Particle Color");
            ToolTipService.SetToolTip(slider12, "Number of particles");
            ToolTipService.SetToolTip(slider13, "Magic/Skill Casting Frequency");
            ToolTipService.SetToolTip(slider14, "Drama dialog speed");
            ToolTipService.SetToolTip(slider15, "Parallel download Limit");

            LayoutRoot.Children.Add(consoleWindow);
            consoleWindow.Position = new Point(12, 130);
            consoleWindow.BodyPosition = new Point3D(0, 25, 0);
            consoleWindow.CloserPosition = new Point3D(294, 5, 0);
            consoleWindow.Head = tabCanvas;
            //设置默认选项卡
            consoleWindow.Body = tabCanvas0; tabItem0.Effect = new MonoChrome() { FilterColor = Color.FromArgb(255, 190, 167, 113) };
            consoleWindow.Closer = closer;
            ToolTipService.SetToolTip(closer, "Hide/Display");
            closer.MouseLeftButtonDown += (s, e) => {
                if (consoleWindow.Body != null) {
                    consoleWindow.Body = null;
                    closer.Source = GlobalMethod.GetImage("UI/Close0.png", UriType.Project);
                } else {
                    consoleWindow.Body = tabCanvas0;
                    tabItem0.Effect = new MonoChrome() { FilterColor = Color.FromArgb(255, 190, 167, 113) };
                    tabItem1.Effect = null;
                    tabItem2.Effect = null;
                    closer.Source = GlobalMethod.GetImage("UI/Close1.png", UriType.Project);
                }
                e.Handled = true;
            };
            tabCanvas.Children.Add(new Rectangle() { Stroke = new SolidColorBrush(Colors.Gray), Width = 310, Height = 26, RadiusX = 5, RadiusY = 5, Fill = new SolidColorBrush(Color.FromArgb(160, 90, 90, 90)) });
            TextBlock consoleText = new TextBlock() { Text = "Console", FontSize = 18, Foreground = new SolidColorBrush(Colors.Gray) };
            tabCanvas.Children.Add(consoleText); Canvas.SetLeft(consoleText, 210); Canvas.SetTop(consoleText, 4);
            tabCanvas0.Children.Add(new Rectangle() { Stroke = new SolidColorBrush(Colors.Gray), Width = 310, Height = 290, RadiusX = 5, RadiusY = 5, Fill = new SolidColorBrush(Color.FromArgb(160, 60, 60, 60)) });
            tabCanvas0.Children.Add(arrowButton); Canvas.SetLeft(arrowButton, 298); Canvas.SetTop(arrowButton, 133); Canvas.SetZIndex(arrowButton, 10);
            arrowButton.MouseLeftButtonDown += (s, e) => {
                e.Handled = true;
                childCanvas0.Visibility = childCanvas0.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
                arrowButton.RenderTransform = childCanvas0.Visibility == Visibility.Visible ? null : new ScaleTransform() { CenterX = arrowButton.ActualWidth / 2, ScaleX = -1 };
            };
            tabCanvas1.Children.Add(new Rectangle() { Stroke = new SolidColorBrush(Colors.Gray), Width = 310, Height = 290, RadiusX = 5, RadiusY = 5, Fill = new SolidColorBrush(Color.FromArgb(160, 60, 60, 60)) });
            tabCanvas2.Children.Add(new Rectangle() { Stroke = new SolidColorBrush(Colors.Gray), Width = 310, Height = 290, RadiusX = 5, RadiusY = 5, Fill = new SolidColorBrush(Color.FromArgb(160, 60, 60, 60)) });
            childCanvas0.Children.Add(new Rectangle() { Stroke = new SolidColorBrush(Colors.Gray), Width = 160, Height = 290, RadiusX = 5, RadiusY = 5, Fill = new SolidColorBrush(Color.FromArgb(160, 60, 60, 60)) });
            tabCanvas.Children.Add(tabItem0); Canvas.SetLeft(tabItem0, 10); Canvas.SetTop(tabItem0, 4);
            tabCanvas.Children.Add(tabItem1); Canvas.SetLeft(tabItem1, 60); Canvas.SetTop(tabItem1, 4);
            tabCanvas.Children.Add(tabItem2); Canvas.SetLeft(tabItem2, 116); Canvas.SetTop(tabItem2, 4);
            tabItem0.MouseLeftButtonDown += (s, e) => {
                consoleWindow.Body = tabCanvas0;
                tabItem0.Effect = new MonoChrome() { FilterColor = Color.FromArgb(255, 190, 167, 113) };
                tabItem1.Effect = null;
                tabItem2.Effect = null;
                closer.Source = GlobalMethod.GetImage("UI/Close1.png", UriType.Project);
                e.Handled = true;
            };
            tabItem1.MouseLeftButtonDown += (s, e) => {
                consoleWindow.Body = tabCanvas1;
                tabItem0.Effect = null;
                tabItem1.Effect = new MonoChrome() { FilterColor = Color.FromArgb(255, 190, 167, 113) };
                tabItem2.Effect = null;
                closer.Source = GlobalMethod.GetImage("UI/Close1.png", UriType.Project);
                e.Handled = true;
            };
            tabItem2.MouseLeftButtonDown += (s, e) => {
                consoleWindow.Body = tabCanvas2;
                tabItem0.Effect = null;
                tabItem1.Effect = null;
                tabItem2.Effect = new MonoChrome() { FilterColor = Color.FromArgb(255, 190, 167, 113) };
                closer.Source = GlobalMethod.GetImage("UI/Close1.png", UriType.Project);
                e.Handled = true;
            };

            #region 场景部分

            tabCanvas0.Children.Add(button0); Canvas.SetLeft(button0, 10); Canvas.SetTop(button0, 6); Canvas.SetZIndex(button0, 3);
            button0.Click += (s, e) => {
                if (Application.Current.Host.Content.IsFullScreen) {
                    Application.Current.Host.Content.IsFullScreen = false;
                } else {
                    Application.Current.Host.Content.IsFullScreen = true;
                }
                Content_Resized(null, null);
            };
            tabCanvas0.Children.Add(button1); Canvas.SetLeft(button1, 70); Canvas.SetTop(button1, 6); Canvas.SetZIndex(button1, 3);
            button1.Click += (s, e) => {
                if (Application.Current.InstallState == InstallState.NotInstalled) {
                    Application.Current.Install();
                } else {
                    MessageBox.Show("本地已经安装!");
                }
            };

            tabCanvas0.Children.Add(textBlock30); Canvas.SetLeft(textBlock30, 140); Canvas.SetTop(textBlock30, 8); Canvas.SetZIndex(textBlock30, 3);
            tabCanvas0.Children.Add(comboBox26); Canvas.SetLeft(comboBox26, 190); Canvas.SetTop(comboBox26, 6); Canvas.SetZIndex(comboBox26, 3);
            comboBox26.Items.Add(new ComboBoxItem() { Tag = "0", Content = "基于像素(易错)" });
            comboBox26.Items.Add(new ComboBoxItem() { Tag = "1", Content = "基于范围(通用)", IsSelected = true });

            tabCanvas0.Children.Add(textBlock44); Canvas.SetLeft(textBlock44, 10); Canvas.SetTop(textBlock44, 34); Canvas.SetZIndex(textBlock44, 3);
            tabCanvas0.Children.Add(comboBox37); Canvas.SetLeft(comboBox37, 38); Canvas.SetTop(comboBox37, 32); Canvas.SetZIndex(comboBox37, 3);
            comboBox37.Items.Add(new ComboBoxItem() { Tag = "0", Content = "固态", IsSelected = true });
            comboBox37.Items.Add(new ComboBoxItem() { Tag = "1", Content = "动态" });
            comboBox37.SelectionChanged += (s, e) => {
                terrain.Refresh -= terrain_Refresh;
                switch (terrain.TerrainType = (TerrainTypes)Convert.ToInt32(((ComboBoxItem)comboBox37.SelectedItem).Tag)) {
                    case TerrainTypes.Fixed:
                        terrain.InitializeDynamicMatrix();
                        break;
                    case TerrainTypes.Dynamic:
                        terrain.Refresh += terrain_Refresh;
                        break;
                }
            };
            tabCanvas0.Children.Add(textBlock34); Canvas.SetLeft(textBlock34, 95); Canvas.SetTop(textBlock34, 34); Canvas.SetZIndex(textBlock34, 3);
            tabCanvas0.Children.Add(comboBox31); Canvas.SetLeft(comboBox31, 122); Canvas.SetTop(comboBox31, 32); Canvas.SetZIndex(comboBox31, 3);
            comboBox31.Items.Add(new ComboBoxItem() { Tag = "0", Content = "同步", IsSelected = true });
            comboBox31.Items.Add(new ComboBoxItem() { Tag = "1", Content = "缓动" });
            comboBox31.SelectionChanged += (s, e) => {
                space.EndEasingMapTo(leader.Position);
                space.ViewPortMoveMode = (ViewPortMoveModes)Convert.ToInt32(((ComboBoxItem)comboBox31.SelectedItem).Tag);
            };

            tabCanvas0.Children.Add(textBlock7); Canvas.SetLeft(textBlock7, 179); Canvas.SetTop(textBlock7, 34); Canvas.SetZIndex(textBlock7, 3);
            tabCanvas0.Children.Add(comboBox8); Canvas.SetLeft(comboBox8, 207); Canvas.SetTop(comboBox8, 32); Canvas.SetZIndex(comboBox8, 3);
            comboBox8.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无(最快)" });
            comboBox8.Items.Add(new ComboBoxItem() { Tag = "1", Content = "简单(快)", IsSelected = true });
            comboBox8.Items.Add(new ComboBoxItem() { Tag = "2", Content = "真实(慢)" });
            comboBox8.SelectionChanged += (s, e) => {
                space.ShadowType = (ShadowTypes)Convert.ToInt32(((ComboBoxItem)comboBox8.SelectedItem).Tag);
            };

            tabCanvas0.Children.Add(textBlock8); Canvas.SetLeft(textBlock8, 10); Canvas.SetTop(textBlock8, 60); Canvas.SetZIndex(textBlock8, 3);
            tabCanvas0.Children.Add(comboBox9); Canvas.SetLeft(comboBox9, 38); Canvas.SetTop(comboBox9, 58); Canvas.SetZIndex(comboBox9, 3);
            comboBox9.Items.Add(new ComboBoxItem() { Tag = "0", Content = "白天", IsSelected = true });
            comboBox9.Items.Add(new ComboBoxItem() { Tag = "1", Content = "黑夜" });
            comboBox9.Items.Add(new ComboBoxItem() { Tag = "2", Content = "回忆" });
            comboBox9.SelectionChanged += (s, e) => {
                switch (Convert.ToInt32(((ComboBoxItem)comboBox9.SelectedItem).Tag)) {
                    case 0:
                        space.ToNormal();
                        break;
                    case 1:
                        space.ToNight();
                        break;
                    case 2:
                        space.ToMemories();
                        break;
                }
            };
            tabCanvas0.Children.Add(comboBox10); Canvas.SetLeft(comboBox10, 92); Canvas.SetTop(comboBox10, 58); Canvas.SetZIndex(comboBox10, 3);
            comboBox10.Items.Add(new ComboBoxItem() { Tag = "0", Content = "简单" });
            comboBox10.Items.Add(new ComboBoxItem() { Tag = "1", Content = "仿真", IsSelected = true });
            comboBox10.SelectionChanged += (s, e) => {
                space.WeatherEffect = (WeatherEffects)Convert.ToInt32(((ComboBoxItem)comboBox10.SelectedItem).Tag);
            };
            tabCanvas0.Children.Add(comboBox11); Canvas.SetLeft(comboBox11, 146); Canvas.SetTop(comboBox11, 58); Canvas.SetZIndex(comboBox11, 3);
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无", IsSelected = true });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "1", Content = "下雨" });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "2", Content = "纷飞" });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "3", Content = "飘雪" });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "4", Content = "雷电" });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "5", Content = "云雾" });
            comboBox11.Items.Add(new ComboBoxItem() { Tag = "6", Content = "天惩" });
            comboBox11.SelectionChanged += (s, e) => {
                space.RunWeather((WeatherTypes)Convert.ToInt32(((ComboBoxItem)comboBox11.SelectedItem).Tag), slider1.Value);
            };
            tabCanvas0.Children.Add(textBlock9); Canvas.SetLeft(textBlock9, 204); Canvas.SetTop(textBlock9, 60); Canvas.SetZIndex(textBlock9, 3);
            tabCanvas0.Children.Add(textBlock10); Canvas.SetLeft(textBlock10, 229); Canvas.SetTop(textBlock10, 60); Canvas.SetZIndex(textBlock10, 3);
            tabCanvas0.Children.Add(textBlock11); Canvas.SetLeft(textBlock11, 296); Canvas.SetTop(textBlock11, 60); Canvas.SetZIndex(textBlock11, 3);
            tabCanvas0.Children.Add(slider1); Canvas.SetLeft(slider1, 235); Canvas.SetTop(slider1, 60); Canvas.SetZIndex(slider1, 3);
            slider1.ValueChanged += (s, e) => { space.RunWeather((WeatherTypes)Convert.ToInt32(((ComboBoxItem)comboBox11.SelectedItem).Tag), slider1.Value); };

            tabCanvas0.Children.Add(textBlock16); Canvas.SetLeft(textBlock16, 10); Canvas.SetTop(textBlock16, 86); Canvas.SetZIndex(textBlock16, 3);
            tabCanvas0.Children.Add(comboBox14); Canvas.SetLeft(comboBox14, 38); Canvas.SetTop(comboBox14, 84); Canvas.SetZIndex(comboBox14, 3);
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无", IsSelected = true });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "1", Content = "马赛克" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "2", Content = "径向模糊" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "3", Content = "盘状模糊" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "4", Content = "波纹" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "5", Content = "饱和" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "6", Content = "锐化" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "7", Content = "玻璃" });
            comboBox14.Items.Add(new ComboBoxItem() { Tag = "8", Content = "黑噬" });
            comboBox14.SelectionChanged += (s, e) => {
                switch (Convert.ToInt32(((ComboBoxItem)comboBox14.SelectedItem).Tag)) {
                    case 0:
                        space.Effect = null;
                        break;
                    case 1:
                        GlobalMethod.RunEffectAnimation(space, new Pixelate(), false, false, "Progress", 0, 100, TimeSpan.FromMilliseconds(2000), new ExponentialEase() { EasingMode = EasingMode.EaseIn }, true);
                        break;
                    case 2:
                        GlobalMethod.RunEffectAnimation(space, new RadialBlur(), false, false, "Progress", 0, 100, TimeSpan.FromMilliseconds(2000), new ExponentialEase() { EasingMode = EasingMode.EaseIn }, true);
                        break;
                    case 3:
                        GlobalMethod.RunEffectAnimation(space, new GrowablePoissonDisk(), true, false, "DiskRadius", 0, 10, TimeSpan.FromMilliseconds(1500), null, true);
                        break;
                    case 4:
                        GlobalMethod.RunEffectAnimation(space, new Ripple(), false, false, "Progress", 0, 100, TimeSpan.FromMilliseconds(2000), new ExponentialEase() { EasingMode = EasingMode.EaseIn }, true);
                        break;
                    case 5:
                        GlobalMethod.RunEffectAnimation(space, new Saturate(), true, false, "Progress", 0, 100, TimeSpan.FromMilliseconds(1500), null, true);
                        break;
                    case 6:
                        GlobalMethod.RunEffectAnimation(space, new Sharpen(), true, false, "Amount", 0, 2, TimeSpan.FromMilliseconds(2000), null, true);
                        break;
                    case 7:
                        GlobalMethod.RunEffectAnimation(space, new GlassTiles() { Tiles = 20 }, true, false, "BevelWidth", 0, 10, TimeSpan.FromMilliseconds(1500), null, true);
                        break;
                    case 8:
                        GlobalMethod.RunEffectAnimation(space, new Bands() { BandDensity = 30 }, true, false, "BandIntensity", 0, 1, TimeSpan.FromMilliseconds(2000), null, true);
                        break;
                }
            };

            tabCanvas0.Children.Add(textBlock58); Canvas.SetLeft(textBlock58, 10); Canvas.SetTop(textBlock58, 112); Canvas.SetZIndex(textBlock58, 3);
            tabCanvas0.Children.Add(comboBox40); Canvas.SetLeft(comboBox40, 122); Canvas.SetTop(comboBox40, 110); Canvas.SetZIndex(comboBox40, 3);
            comboBox40.Items.Add(new ComboBoxItem() { Tag = "0", Content = "连续", IsSelected = true });
            comboBox40.Items.Add(new ComboBoxItem() { Tag = "1", Content = "特效" });
            comboBox40.SelectionChanged += (s, e) => {
                space.ViewPortZoomMode = (ViewPortZoomModes)Convert.ToInt32(((ComboBoxItem)comboBox40.SelectedItem).Tag);
            };
            tabCanvas0.Children.Add(textBlock25); Canvas.SetLeft(textBlock25, 181); Canvas.SetTop(textBlock25, 112); Canvas.SetZIndex(textBlock25, 3);
            tabCanvas0.Children.Add(slider8); Canvas.SetLeft(slider8, 205); Canvas.SetTop(slider8, 110); Canvas.SetZIndex(slider8, 3);
            slider8.ValueChanged += (s, e) => {
                double value = Math.Round(slider8.Value, 2);
                //space.RunWeather((WeatherTypes)Convert.ToInt32(((ComboBoxItem)comboBox11.SelectedItem).Tag), slider8.Value);
                textBlock26.Text = value.ToString();
            };
            tabCanvas0.Children.Add(textBlock26); Canvas.SetLeft(textBlock26, 276); Canvas.SetTop(textBlock26, 112); Canvas.SetZIndex(textBlock26, 3);

            //分割线
            Image image0 = new Image() { Source = GlobalMethod.GetImage("UI/RoleManagement.png", UriType.Project) };
            tabCanvas0.Children.Add(image0); Canvas.SetLeft(image0, 0); Canvas.SetTop(image0, 135); Canvas.SetZIndex(image0, 3);
            tabCanvas0.Children.Add(textBlock6); Canvas.SetLeft(textBlock6, 10); Canvas.SetTop(textBlock6, 152); Canvas.SetZIndex(textBlock6, 3);
            tabCanvas0.Children.Add(textBlock35); Canvas.SetLeft(textBlock35, 130); Canvas.SetTop(textBlock35, 152); Canvas.SetZIndex(textBlock35, 3);
            tabCanvas0.Children.Add(textBlock36); Canvas.SetLeft(textBlock36, 273); Canvas.SetTop(textBlock36, 152); Canvas.SetZIndex(textBlock36, 3);
            tabCanvas0.Children.Add(textBlock37); Canvas.SetLeft(textBlock37, 10); Canvas.SetTop(textBlock37, 181); Canvas.SetZIndex(textBlock37, 3);
            tabCanvas0.Children.Add(slider0); Canvas.SetLeft(slider0, 36); Canvas.SetTop(slider0, 180); Canvas.SetZIndex(slider0, 3);
            slider0.ValueChanged += (s, e) => {
                textBlock5.Text = ((int)slider0.Value).ToString();
            };
            tabCanvas0.Children.Add(textBlock5); Canvas.SetLeft(textBlock5, 140); Canvas.SetTop(textBlock5, 180); Canvas.SetZIndex(textBlock5, 3);
            textBlock5.Text = slider0.Value.ToString();
            tabCanvas0.Children.Add(button5); Canvas.SetLeft(button5, 220); Canvas.SetTop(button5, 178); Canvas.SetZIndex(button5, 3);
            button5.Click += (s, e) => { AddRoles(null, new AddRolesEventArgs() { Num = (int)slider0.Value, Mode = 0 }); };
            tabCanvas0.Children.Add(button6); Canvas.SetLeft(button6, 264); Canvas.SetTop(button6, 178); Canvas.SetZIndex(button6, 3);
            button6.Click += (s, e) => {
                leader.Stop();
                leader.Target = null;
                space.ClearPlayer();
                textBlock6.Text = string.Format("[场景中共{0}个角色]", space.AllRoles().Count);
            };

            tabCanvas0.Children.Add(textBlock38); Canvas.SetLeft(textBlock38, 10); Canvas.SetTop(textBlock38, 207); Canvas.SetZIndex(textBlock38, 3);
            tabCanvas0.Children.Add(comboBox32); Canvas.SetLeft(comboBox32, 38); Canvas.SetTop(comboBox32, 204); Canvas.SetZIndex(comboBox32, 3);
            comboBox32.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机" });
            comboBox32.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无" });
            comboBox32.Items.Add(new ComboBoxItem() { Tag = "1", Content = "善良" });
            comboBox32.Items.Add(new ComboBoxItem() { Tag = "2", Content = "中立" });
            comboBox32.Items.Add(new ComboBoxItem() { Tag = "3", Content = "邪恶", IsSelected = true });
            tabCanvas0.Children.Add(textBlock39); Canvas.SetLeft(textBlock39, 95); Canvas.SetTop(textBlock39, 207); Canvas.SetZIndex(textBlock39, 3);
            tabCanvas0.Children.Add(comboBox33); Canvas.SetLeft(comboBox33, 123); Canvas.SetTop(comboBox33, 204); Canvas.SetZIndex(comboBox33, 3);
            comboBox33.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机", IsSelected = true });
            comboBox33.Items.Add(new ComboBoxItem() { Tag = "0", Content = "异使" });
            comboBox33.Items.Add(new ComboBoxItem() { Tag = "1", Content = "刺影" });
            comboBox33.Items.Add(new ComboBoxItem() { Tag = "2", Content = "甲士" });
            comboBox33.Items.Add(new ComboBoxItem() { Tag = "3", Content = "道法" });
            tabCanvas0.Children.Add(textBlock40); Canvas.SetLeft(textBlock40, 180); Canvas.SetTop(textBlock40, 207); Canvas.SetZIndex(textBlock40, 3);
            tabCanvas0.Children.Add(comboBox34); Canvas.SetLeft(comboBox34, 208); Canvas.SetTop(comboBox34, 204); Canvas.SetZIndex(comboBox34, 3);
            comboBox34.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机" });
            comboBox34.Items.Add(new ComboBoxItem() { Tag = "1", Content = "步行", IsSelected = true });
            comboBox34.Items.Add(new ComboBoxItem() { Tag = "2", Content = "骑乘" });
            tabCanvas0.Children.Add(textBlock41); Canvas.SetLeft(textBlock41, 10); Canvas.SetTop(textBlock41, 233); Canvas.SetZIndex(textBlock41, 3);
            tabCanvas0.Children.Add(comboBox29); Canvas.SetLeft(comboBox29, 38); Canvas.SetTop(comboBox29, 230); Canvas.SetZIndex(comboBox29, 3);
            comboBox29.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机" });
            comboBox29.Items.Add(new ComboBoxItem() { Tag = "0", Content = "地面", IsSelected = true });
            comboBox29.Items.Add(new ComboBoxItem() { Tag = "1", Content = "空中" });
            tabCanvas0.Children.Add(textBlock42); Canvas.SetLeft(textBlock42, 95); Canvas.SetTop(textBlock42, 233); Canvas.SetZIndex(textBlock42, 3);
            tabCanvas0.Children.Add(comboBox35); Canvas.SetLeft(comboBox35, 133); Canvas.SetTop(comboBox35, 230); Canvas.SetZIndex(comboBox35, 3);
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机", IsSelected = true });
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无(巡逻)" });
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "1", Content = "目标主角" });
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "2", Content = "自由战斗" });
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "3", Content = "小组作战" });
            comboBox35.Items.Add(new ComboBoxItem() { Tag = "4", Content = "门派对阵" });
            tabCanvas0.Children.Add(textBlock43); Canvas.SetLeft(textBlock43, 213); Canvas.SetTop(textBlock43, 233); Canvas.SetZIndex(textBlock43, 3);
            tabCanvas0.Children.Add(comboBox36); Canvas.SetLeft(comboBox36, 251); Canvas.SetTop(comboBox36, 230); Canvas.SetZIndex(comboBox36, 3);
            comboBox36.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "随机" });
            comboBox36.Items.Add(new ComboBoxItem() { Tag = "0", Content = "简单", IsSelected = true });
            comboBox36.Items.Add(new ComboBoxItem() { Tag = "1", Content = "机敏" });
            comboBox36.Items.Add(new ComboBoxItem() { Tag = "2", Content = "固执" });
            comboBox36.Items.Add(new ComboBoxItem() { Tag = "3", Content = "怯懦" });

            tabCanvas0.Children.Add(textBlock46); Canvas.SetLeft(textBlock46, 10); Canvas.SetTop(textBlock46, 259); Canvas.SetZIndex(textBlock46, 3);
            tabCanvas0.Children.Add(slider13); Canvas.SetLeft(slider13, 85); Canvas.SetTop(slider13, 259); Canvas.SetZIndex(slider13, 3);
            slider13.ValueChanged += (s, e) => {
                textBlock47.Text = string.Format("{0}%", (int)slider13.Value);
            };
            tabCanvas0.Children.Add(textBlock47); Canvas.SetLeft(textBlock47, 150); Canvas.SetTop(textBlock47, 259); Canvas.SetZIndex(textBlock47, 3);

            #endregion

            #region 主角部分

            tabCanvas1.Children.Add(textBlock1); Canvas.SetLeft(textBlock1, 10); Canvas.SetTop(textBlock1, 8); Canvas.SetZIndex(textBlock1, 3);
            tabCanvas1.Children.Add(comboBox1); Canvas.SetLeft(comboBox1, 38); Canvas.SetTop(comboBox1, 6); Canvas.SetZIndex(comboBox1, 3);
            comboBox1.Items.Add(new ComboBoxItem() { Tag = "0", Content = "异使" });
            comboBox1.Items.Add(new ComboBoxItem() { Tag = "1", Content = "刺影" });
            comboBox1.Items.Add(new ComboBoxItem() { Tag = "2", Content = "甲士", IsSelected = true });
            comboBox1.Items.Add(new ComboBoxItem() { Tag = "3", Content = "道法" });
            comboBox1.SelectionChanged += (s, e) => {
                leader.Profession = (Professions)Convert.ToInt32(((ComboBoxItem)comboBox1.SelectedItem).Tag);
                switch (leader.Profession) {
                    case Professions.Archer:
                        canvas0.Visibility = Visibility.Visible;
                        canvas1.Visibility = Visibility.Collapsed;
                        canvas2.Visibility = Visibility.Collapsed;
                        canvas3.Visibility = Visibility.Collapsed;
                        comboBox2.SelectedIndex = 1; leader.ArmorCode = 1;
                        comboBox3.SelectedIndex = 1; leader.WeaponCode = 1;
                        comboBox4.SelectedIndex = 0; leader.RideCode = 0;
                        break;
                    case Professions.Assassin:
                        canvas0.Visibility = Visibility.Collapsed;
                        canvas1.Visibility = Visibility.Visible;
                        canvas2.Visibility = Visibility.Collapsed;
                        canvas3.Visibility = Visibility.Collapsed;
                        comboBox5.SelectedIndex = 1; leader.ArmorCode = 5;
                        comboBox6.SelectedIndex = 1; leader.WeaponCode = 5;
                        comboBox7.SelectedIndex = 0; leader.RideCode = 0;
                        break;
                    case Professions.Warrior:
                        canvas0.Visibility = Visibility.Collapsed;
                        canvas1.Visibility = Visibility.Collapsed;
                        canvas2.Visibility = Visibility.Visible;
                        canvas3.Visibility = Visibility.Collapsed;
                        comboBox17.SelectedIndex = 1; leader.ArmorCode = 7;
                        comboBox18.SelectedIndex = 1; leader.WeaponCode = 7;
                        comboBox19.SelectedIndex = 0; leader.RideCode = 0;
                        break;
                    case Professions.Taoist:
                        canvas0.Visibility = Visibility.Collapsed;
                        canvas1.Visibility = Visibility.Collapsed;
                        canvas2.Visibility = Visibility.Collapsed;
                        canvas3.Visibility = Visibility.Visible;
                        comboBox23.SelectedIndex = 1; leader.ArmorCode = 9;
                        comboBox24.SelectedIndex = 1; leader.WeaponCode = 9;
                        comboBox25.SelectedIndex = 0; leader.RideCode = 0;
                        break;
                }
                comboBox0.SelectedIndex = 1;
            };
            tabCanvas1.Children.Add(textBlock0); Canvas.SetLeft(textBlock0, 98); Canvas.SetTop(textBlock0, 8); Canvas.SetZIndex(textBlock0, 3);
            tabCanvas1.Children.Add(comboBox0); Canvas.SetLeft(comboBox0, 126); Canvas.SetTop(comboBox0, 6); Canvas.SetZIndex(comboBox0, 3);
            comboBox0.Items.Add(new ComboBoxItem() { Tag = "0", Content = "打坐", IsSelected = true });
            comboBox0.Items.Add(new ComboBoxItem() { Tag = "1", Content = "步行" });
            comboBox0.Items.Add(new ComboBoxItem() { Tag = "2", Content = "骑乘" });
            comboBox0.SelectionChanged += (s, e) => {
                leader.State = (States)Convert.ToInt32(((ComboBoxItem)comboBox0.SelectedItem).Tag);
            };
            tabCanvas1.Children.Add(button2); Canvas.SetLeft(button2, 183); Canvas.SetTop(button2, 6); Canvas.SetZIndex(button2, 3);
            button2.Click += (s, e) => { leader.Attack(); };
            tabCanvas1.Children.Add(button3); Canvas.SetLeft(button3, 220); Canvas.SetTop(button3, 6); Canvas.SetZIndex(button3, 3);
            button3.Click += (s, e) => { leader.Injure(); };
            tabCanvas1.Children.Add(button4); Canvas.SetLeft(button4, 255); Canvas.SetTop(button4, 6); Canvas.SetZIndex(button4, 3);
            button4.Click += (s, e) => {

                //for (int i = 0; i < ObjectTracker.GetAllLiveTrackedObjects().Count(); i++) {
                //    //MessageBox.Show(ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i).GetType().ToString());
                //    if (ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is CreateRole ||
                //        ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is LanguageChoicer ||
                //        ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is Notice ||
                //        ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is SelectRole ||
                //        ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is UserLogin ||
                //         ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is LoginBackground ||
                //          ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is LoginManager ||
                //          ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is LoginTip ||
                //          ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is Loading ||
                //        ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i) is UserRegist) { MessageBox.Show(ObjectTracker.GetAllLiveTrackedObjects().ElementAt(i).GetType().ToString()); }
                //}
                //调试
                //MessageBox.Show(string.Format("{0}", ObjectTracker.GetAllLiveTrackedObjects().ElementAt(ObjectTracker.GetAllLiveTrackedObjects().Count() - 2).GetType().ToString()));
            };
            tabCanvas1.Children.Add(canvas0); Canvas.SetZIndex(canvas0, 4);
            tabCanvas1.Children.Add(textBlock2); Canvas.SetLeft(textBlock2, 10); Canvas.SetTop(textBlock2, 34); Canvas.SetZIndex(textBlock2, 3);
            canvas0.Children.Add(comboBox2); Canvas.SetLeft(comboBox2, 38); Canvas.SetTop(comboBox2, 32); Canvas.SetZIndex(comboBox2, 3);
            comboBox2.Items.Add(new ComboBoxItem() { Tag = "0", Content = "裸装" });
            comboBox2.Items.Add(new ComboBoxItem() { Tag = "1", Content = "誓珲", IsSelected = true });
            comboBox2.Items.Add(new ComboBoxItem() { Tag = "2", Content = "谟仙" });
            comboBox2.Items.Add(new ComboBoxItem() { Tag = "3", Content = "蓝凌" });
            comboBox2.Items.Add(new ComboBoxItem() { Tag = "4", Content = "释神" });
            comboBox2.SelectionChanged += (s, e) => {
                leader.ArmorCode = Convert.ToInt32(((ComboBoxItem)comboBox2.SelectedItem).Tag);
            };
            tabCanvas1.Children.Add(textBlock3); Canvas.SetLeft(textBlock3, 98); Canvas.SetTop(textBlock3, 34); Canvas.SetZIndex(textBlock3, 3);
            canvas0.Children.Add(comboBox3); Canvas.SetLeft(comboBox3, 126); Canvas.SetTop(comboBox3, 32); Canvas.SetZIndex(comboBox3, 3);
            comboBox3.Items.Add(new ComboBoxItem() { Tag = "0", Content = "空手" });
            comboBox3.Items.Add(new ComboBoxItem() { Tag = "1", Content = "火裂", IsSelected = true });
            comboBox3.Items.Add(new ComboBoxItem() { Tag = "2", Content = "妖月" });
            comboBox3.Items.Add(new ComboBoxItem() { Tag = "3", Content = "冰羽" });
            comboBox3.Items.Add(new ComboBoxItem() { Tag = "4", Content = "圣赤" });
            comboBox3.SelectionChanged += (s, e) => {
                leader.WeaponCode = Convert.ToInt32(((ComboBoxItem)comboBox3.SelectedItem).Tag);
            };
            tabCanvas1.Children.Add(textBlock4); Canvas.SetLeft(textBlock4, 185); Canvas.SetTop(textBlock4, 34); Canvas.SetZIndex(textBlock4, 3);
            canvas0.Children.Add(comboBox4); Canvas.SetLeft(comboBox4, 213); Canvas.SetTop(comboBox4, 32); Canvas.SetZIndex(comboBox4, 3);
            comboBox4.Items.Add(new ComboBoxItem() { Tag = "0", Content = "None" });
            comboBox4.Items.Add(new ComboBoxItem() { Tag = "1", Content = "翎翼", IsSelected = true });
            comboBox4.Items.Add(new ComboBoxItem() { Tag = "2", Content = "幻翼" });
            comboBox4.Items.Add(new ComboBoxItem() { Tag = "3", Content = "圣翼" });
            comboBox4.Items.Add(new ComboBoxItem() { Tag = "4", Content = "灵翼" });
            comboBox4.SelectionChanged += (s, e) => {
                leader.RideCode = Convert.ToInt32(((ComboBoxItem)comboBox4.SelectedItem).Tag);
                if (Convert.ToInt32(((ComboBoxItem)comboBox4.SelectedItem).Tag) == -1) {
                    comboBox0.SelectedIndex = 1;
                } else {
                    comboBox0.SelectedIndex = 2;
                }
            };

            tabCanvas1.Children.Add(canvas1); Canvas.SetZIndex(canvas1, 4);
            canvas1.Children.Add(comboBox5); Canvas.SetLeft(comboBox5, 38); Canvas.SetTop(comboBox5, 32); Canvas.SetZIndex(comboBox5, 3);
            comboBox5.Items.Add(new ComboBoxItem() { Tag = "0", Content = "裸装" });
            comboBox5.Items.Add(new ComboBoxItem() { Tag = "5", Content = "影侯", IsSelected = true });
            comboBox5.Items.Add(new ComboBoxItem() { Tag = "6", Content = "迷烩" });
            comboBox5.SelectionChanged += (s, e) => {
                leader.ArmorCode = Convert.ToInt32(((ComboBoxItem)comboBox5.SelectedItem).Tag);
            };
            canvas1.Children.Add(comboBox6); Canvas.SetLeft(comboBox6, 126); Canvas.SetTop(comboBox6, 32); Canvas.SetZIndex(comboBox6, 3);
            comboBox6.Items.Add(new ComboBoxItem() { Tag = "0", Content = "空手" });
            comboBox6.Items.Add(new ComboBoxItem() { Tag = "5", Content = "琅牙", IsSelected = true });
            comboBox6.Items.Add(new ComboBoxItem() { Tag = "6", Content = "穆灵" });
            comboBox6.SelectionChanged += (s, e) => {
                leader.WeaponCode = Convert.ToInt32(((ComboBoxItem)comboBox6.SelectedItem).Tag);
            };
            canvas1.Children.Add(comboBox7); Canvas.SetLeft(comboBox7, 213); Canvas.SetTop(comboBox7, 32); Canvas.SetZIndex(comboBox7, 3);
            comboBox7.Items.Add(new ComboBoxItem() { Tag = "0", Content = "None" });
            comboBox7.Items.Add(new ComboBoxItem() { Tag = "5", Content = "炯徒", IsSelected = true });
            comboBox7.Items.Add(new ComboBoxItem() { Tag = "6", Content = "釜邢" });
            comboBox7.SelectionChanged += (s, e) => {
                leader.RideCode = Convert.ToInt32(((ComboBoxItem)comboBox7.SelectedItem).Tag);
                if (Convert.ToInt32(((ComboBoxItem)comboBox7.SelectedItem).Tag) == -1) {
                    comboBox0.SelectedIndex = 1;
                } else {
                    comboBox0.SelectedIndex = 2;
                }
            };

            tabCanvas1.Children.Add(canvas2); Canvas.SetZIndex(canvas2, 4);
            canvas2.Children.Add(comboBox17); Canvas.SetLeft(comboBox17, 38); Canvas.SetTop(comboBox17, 32); Canvas.SetZIndex(comboBox17, 3);
            comboBox17.Items.Add(new ComboBoxItem() { Tag = "0", Content = "裸装" });
            comboBox17.Items.Add(new ComboBoxItem() { Tag = "7", Content = "圣甲", IsSelected = true });
            comboBox17.Items.Add(new ComboBoxItem() { Tag = "8", Content = "灭天" });
            comboBox17.SelectionChanged += (s, e) => {
                leader.ArmorCode = Convert.ToInt32(((ComboBoxItem)comboBox17.SelectedItem).Tag);
            };
            canvas2.Children.Add(comboBox18); Canvas.SetLeft(comboBox18, 126); Canvas.SetTop(comboBox18, 32); Canvas.SetZIndex(comboBox18, 3);
            comboBox18.Items.Add(new ComboBoxItem() { Tag = "0", Content = "空手" });
            comboBox18.Items.Add(new ComboBoxItem() { Tag = "7", Content = "雷霆", IsSelected = true });
            comboBox18.Items.Add(new ComboBoxItem() { Tag = "8", Content = "罗刹" });
            comboBox18.SelectionChanged += (s, e) => {
                leader.WeaponCode = Convert.ToInt32(((ComboBoxItem)comboBox18.SelectedItem).Tag);
            };
            canvas2.Children.Add(comboBox19); Canvas.SetLeft(comboBox19, 213); Canvas.SetTop(comboBox19, 32); Canvas.SetZIndex(comboBox19, 3);
            comboBox19.Items.Add(new ComboBoxItem() { Tag = "0", Content = "None" });
            comboBox19.Items.Add(new ComboBoxItem() { Tag = "7", Content = "绝影", IsSelected = true });
            comboBox19.Items.Add(new ComboBoxItem() { Tag = "8", Content = "飞电" });
            comboBox19.SelectionChanged += (s, e) => {
                leader.RideCode = Convert.ToInt32(((ComboBoxItem)comboBox19.SelectedItem).Tag);
                if (Convert.ToInt32(((ComboBoxItem)comboBox19.SelectedItem).Tag) == -1) {
                    comboBox0.SelectedIndex = 1;
                } else {
                    comboBox0.SelectedIndex = 2;
                }
            };

            tabCanvas1.Children.Add(canvas3); Canvas.SetZIndex(canvas3, 4);
            canvas3.Children.Add(comboBox23); Canvas.SetLeft(comboBox23, 38); Canvas.SetTop(comboBox23, 32); Canvas.SetZIndex(comboBox23, 3);
            comboBox23.Items.Add(new ComboBoxItem() { Tag = "0", Content = "裸装" });
            comboBox23.Items.Add(new ComboBoxItem() { Tag = "9", Content = "溢彩", IsSelected = true });
            comboBox23.Items.Add(new ComboBoxItem() { Tag = "10", Content = "焕彩" });
            comboBox23.SelectionChanged += (s, e) => {
                leader.ArmorCode = Convert.ToInt32(((ComboBoxItem)comboBox23.SelectedItem).Tag);
            };
            canvas3.Children.Add(comboBox24); Canvas.SetLeft(comboBox24, 126); Canvas.SetTop(comboBox24, 32); Canvas.SetZIndex(comboBox24, 3);
            comboBox24.Items.Add(new ComboBoxItem() { Tag = "0", Content = "空手" });
            comboBox24.Items.Add(new ComboBoxItem() { Tag = "9", Content = "法珠", IsSelected = true });
            comboBox24.Items.Add(new ComboBoxItem() { Tag = "10", Content = "道珠" });
            comboBox24.SelectionChanged += (s, e) => {
                leader.WeaponCode = Convert.ToInt32(((ComboBoxItem)comboBox24.SelectedItem).Tag);
            };
            canvas3.Children.Add(comboBox25); Canvas.SetLeft(comboBox25, 213); Canvas.SetTop(comboBox25, 32); Canvas.SetZIndex(comboBox25, 3);
            comboBox25.Items.Add(new ComboBoxItem() { Tag = "0", Content = "None" });
            comboBox25.Items.Add(new ComboBoxItem() { Tag = "9", Content = "水馨", IsSelected = true });
            comboBox25.Items.Add(new ComboBoxItem() { Tag = "10", Content = "妃饰" });
            comboBox25.SelectionChanged += (s, e) => {
                leader.RideCode = Convert.ToInt32(((ComboBoxItem)comboBox25.SelectedItem).Tag);
                if (Convert.ToInt32(((ComboBoxItem)comboBox25.SelectedItem).Tag) == -1) {
                    comboBox0.SelectedIndex = 1;
                } else {
                    comboBox0.SelectedIndex = 2;
                }
            };

            tabCanvas1.Children.Add(textBlock20); Canvas.SetLeft(textBlock20, 10); Canvas.SetTop(textBlock20, 60); Canvas.SetZIndex(textBlock20, 3);
            tabCanvas1.Children.Add(comboBox16); Canvas.SetLeft(comboBox16, 38); Canvas.SetTop(comboBox16, 58); Canvas.SetZIndex(comboBox16, 3);
            comboBox16.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "无", IsSelected = true });
            comboBox16.Items.Add(new ComboBoxItem() { Tag = "0", Content = "全身" });
            comboBox16.Items.Add(new ComboBoxItem() { Tag = "1", Content = "铠甲" });
            comboBox16.Items.Add(new ComboBoxItem() { Tag = "2", Content = "武器" });
            comboBox16.SelectionChanged += (s, e) => {
                leader.ActionTrigger -= role_ShowFlowLight;
                int code = Convert.ToInt32(((ComboBoxItem)comboBox16.SelectedItem).Tag);
                if (code == -1) {
                    leader.FlowLight = false;
                } else {
                    flowLightEquipType = (EquipTypes)code;
                    leader.ActionTrigger += role_ShowFlowLight;
                }
            };
            tabCanvas1.Children.Add(textBlock21); Canvas.SetLeft(textBlock21, 98); Canvas.SetTop(textBlock21, 60); Canvas.SetZIndex(textBlock21, 3);
            tabCanvas1.Children.Add(slider6); Canvas.SetLeft(slider6, 126); Canvas.SetTop(slider6, 60); Canvas.SetZIndex(slider6, 3);
            slider6.ValueChanged += (s, e) => {
                byte r, g, b;
                double value = slider6.Value / slider6.Maximum;
                if (value == 0) {
                    r = 255; g = 255; b = 255;
                } else if (value == 1) {
                    r = 0; g = 0; b = 0;
                } else if (value < 0.167) {
                    r = 255; g = 0; b = (byte)(value / 0.167 * 255.00);
                } else if (value >= 0.167 && value < 0.333) {
                    r = (byte)((value - 0.167) / 0.167 * 255.00); g = 0; b = 255;
                } else if (value >= 0.333 && value < 0.5) {
                    r = 255; g = (byte)((value - 0.333) / 0.167 * 255.00); b = 0;
                } else if (value >= 0.5 && value < 0.667) {
                    r = 0; g = 255; b = (byte)((value - 0.5) / 0.167 * 255.00);
                } else if (value >= 0.667 && value < 0.834) {
                    r = (byte)((value - 0.667) / 0.167 * 255.00); g = 255; b = 0;
                } else { r = 0; g = (byte)((value - 0.834) / 0.167 * 255.00); b = 255; }
                flowLightColor = Color.FromArgb(255, r, g, b);
            };
            tabCanvas1.Children.Add(textBlock22); Canvas.SetLeft(textBlock22, 200); Canvas.SetTop(textBlock22, 60); Canvas.SetZIndex(textBlock22, 3);
            tabCanvas1.Children.Add(slider7); Canvas.SetLeft(slider7, 228); Canvas.SetTop(slider7, 60); Canvas.SetZIndex(slider7, 3);
            slider7.ValueChanged += (s, e) => {
                flowLightCoefficient = slider7.Value;
            };

            tabCanvas1.Children.Add(textBlock17); Canvas.SetLeft(textBlock17, 10); Canvas.SetTop(textBlock17, 88); Canvas.SetZIndex(textBlock17, 3);
            tabCanvas1.Children.Add(comboBox15); Canvas.SetLeft(comboBox15, 38); Canvas.SetTop(comboBox15, 86); Canvas.SetZIndex(comboBox15, 3);
            comboBox15.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "无", IsSelected = true });
            comboBox15.Items.Add(new ComboBoxItem() { Tag = "0", Content = "全身" });
            comboBox15.Items.Add(new ComboBoxItem() { Tag = "1", Content = "铠甲" });
            comboBox15.Items.Add(new ComboBoxItem() { Tag = "2", Content = "武器" });
            comboBox15.SelectionChanged += (s, e) => {
                leader.ActionTrigger -= role_ShowChasingShadow;
                int code = Convert.ToInt32(((ComboBoxItem)comboBox15.SelectedItem).Tag);
                if (code != -1) {
                    chasingShadowEquipType = (EquipTypes)code;
                    leader.ActionTrigger += role_ShowChasingShadow;
                }
            };
            tabCanvas1.Children.Add(textBlock18); Canvas.SetLeft(textBlock18, 98); Canvas.SetTop(textBlock18, 88); Canvas.SetZIndex(textBlock18, 3);
            tabCanvas1.Children.Add(slider4); Canvas.SetLeft(slider4, 126); Canvas.SetTop(slider4, 88); Canvas.SetZIndex(slider4, 3);
            slider4.ValueChanged += (s, e) => {
                byte r, g, b;
                double value = slider4.Value / slider4.Maximum;
                if (value == 0) {
                    r = 255; g = 255; b = 255;
                } else if (value == 1) {
                    r = 0; g = 0; b = 0;
                } else if (value < 0.167) {
                    r = 255; g = 0; b = (byte)(value / 0.167 * 255.00);
                } else if (value >= 0.167 && value < 0.333) {
                    r = (byte)((value - 0.167) / 0.167 * 255.00); g = 0; b = 255;
                } else if (value >= 0.333 && value < 0.5) {
                    r = 255; g = (byte)((value - 0.333) / 0.167 * 255.00); b = 0;
                } else if (value >= 0.5 && value < 0.667) {
                    r = 0; g = 255; b = (byte)((value - 0.5) / 0.167 * 255.00);
                } else if (value >= 0.667 && value < 0.834) {
                    r = (byte)((value - 0.667) / 0.167 * 255.00); g = 255; b = 0;
                } else { r = 0; g = (byte)((value - 0.834) / 0.167 * 255.00); b = 255; }
                chasingShadowColor = Color.FromArgb(255, r, g, b);
            };
            tabCanvas1.Children.Add(textBlock19); Canvas.SetLeft(textBlock19, 200); Canvas.SetTop(textBlock19, 88); Canvas.SetZIndex(textBlock19, 3);
            tabCanvas1.Children.Add(slider5); Canvas.SetLeft(slider5, 228); Canvas.SetTop(slider5, 88); Canvas.SetZIndex(slider5, 3);
            slider5.ValueChanged += (s, e) => {
                chasingShadowCoefficient = slider5.Value;
            };

            tabCanvas1.Children.Add(textBlock31); Canvas.SetLeft(textBlock31, 10); Canvas.SetTop(textBlock31, 114); Canvas.SetZIndex(textBlock31, 3);
            tabCanvas1.Children.Add(comboBox28); Canvas.SetLeft(comboBox28, 38); Canvas.SetTop(comboBox28, 112); Canvas.SetZIndex(comboBox28, 3);
            comboBox28.Items.Add(new ComboBoxItem() { Tag = "0", Content = "全身" });
            comboBox28.Items.Add(new ComboBoxItem() { Tag = "1", Content = "铠甲" });
            comboBox28.Items.Add(new ComboBoxItem() { Tag = "2", Content = "武器", IsSelected = true });
            comboBox28.SelectionChanged += (s, e) => {
                windParticleEquipType = (EquipTypes)(Convert.ToInt32(((ComboBoxItem)comboBox28.SelectedItem).Tag));
                //测试副本用
                leader.DisplayWeaponParticle = (comboBox28.SelectedIndex == 2 && comboBox27.SelectedIndex == 2) ? true : false;
            };
            tabCanvas1.Children.Add(comboBox27); Canvas.SetLeft(comboBox27, 98); Canvas.SetTop(comboBox27, 112); Canvas.SetZIndex(comboBox27, 3);
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "无", IsSelected = true });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "0", Content = "标准" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "1", Content = "烟火" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "2", Content = "冰晶" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "3", Content = "花雾" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "4", Content = "星状" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "5", Content = "光状" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "6", Content = "球状" });
            comboBox27.Items.Add(new ComboBoxItem() { Tag = "7", Content = "闪光" });
            comboBox27.SelectionChanged += (s, e) => {
                leader.ActionTrigger -= role_ShowWindParticles;
                int code = Convert.ToInt32(((ComboBoxItem)comboBox27.SelectedItem).Tag);
                if (code != -1) {
                    windParticleType = (ParticleTypes)code;
                    leader.ActionTrigger += role_ShowWindParticles;
                }
                //测试副本用
                leader.DisplayWeaponParticle = (comboBox28.SelectedIndex == 2 && comboBox27.SelectedIndex == 2) ? true : false;
            };
            tabCanvas1.Children.Add(textBlock32); Canvas.SetLeft(textBlock32, 155); Canvas.SetTop(textBlock32, 114); Canvas.SetZIndex(textBlock32, 3);
            tabCanvas1.Children.Add(slider11); Canvas.SetLeft(slider11, 179); Canvas.SetTop(slider11, 114); Canvas.SetZIndex(slider11, 3);
            slider11.ValueChanged += (s, e) => {
                windParticleColor = slider11.Value;
            };
            tabCanvas1.Children.Add(textBlock33); Canvas.SetLeft(textBlock33, 233); Canvas.SetTop(textBlock33, 114); Canvas.SetZIndex(textBlock33, 3);
            tabCanvas1.Children.Add(slider12); Canvas.SetLeft(slider12, 247); Canvas.SetTop(slider12, 114); Canvas.SetZIndex(slider12, 3);
            slider12.ValueChanged += (s, e) => {
                windParticleCoefficient = slider12.Value;
            };

            tabCanvas1.Children.Add(textBlock12); Canvas.SetLeft(textBlock12, 10); Canvas.SetTop(textBlock12, 140); Canvas.SetZIndex(textBlock12, 3);
            tabCanvas1.Children.Add(comboBox12); Canvas.SetLeft(comboBox12, 58); Canvas.SetTop(comboBox12, 138); Canvas.SetZIndex(comboBox12, 3);
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "无", IsSelected = true });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "17", Content = "王者之盾" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "18", Content = "炎之魄" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "19", Content = "冰护身" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "20", Content = "道光法寰" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "21", Content = "星环" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "22", Content = "神之盾" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "23", Content = "宇宙之光" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "28", Content = "仙环石" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "46", Content = "金圆咒印" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "47", Content = "雷神护体" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "48", Content = "火之怒" });
            comboBox12.Items.Add(new ComboBoxItem() { Tag = "49", Content = "金龙修身" });
            comboBox12.SelectionChanged += (s, e) => {
                int code = Convert.ToInt32(((ComboBoxItem)comboBox12.SelectedItem).Tag);
                if (code == -1) {
                    leader.RemoveEffect(EffectTypes.Surround);
                } else {
                    EventHandler handler = null;
                    AnimationBase animation = new AnimationBase() {
                        Code = Convert.ToInt32(((ComboBoxItem)comboBox12.SelectedItem).Tag),
                        Position = leader.Center,
                        Loop = true,
                        Z = 999,
                    };
                    animation.Disposed += handler = (s0, e0) => {
                        animation.Disposed -= handler;
                        leader.RemoveEffect(EffectTypes.Surround);
                    };
                    leader.AddEffect(animation, EffectTypes.Surround);
                }
            };
            tabCanvas1.Children.Add(textBlock13); Canvas.SetLeft(textBlock13, 136); Canvas.SetTop(textBlock13, 140); Canvas.SetZIndex(textBlock13, 3);
            tabCanvas1.Children.Add(slider2); Canvas.SetLeft(slider2, 163); Canvas.SetTop(slider2, 140); Canvas.SetZIndex(slider2, 3);
            slider2.ValueChanged += (s, e) => {
                leader.ShiftEffectColor(EffectTypes.Surround, slider2.Value);
            };
            tabCanvas1.Children.Add(textBlock14); Canvas.SetLeft(textBlock14, 10); Canvas.SetTop(textBlock14, 166); Canvas.SetZIndex(textBlock14, 3);
            tabCanvas1.Children.Add(comboBox13); Canvas.SetLeft(comboBox13, 58); Canvas.SetTop(comboBox13, 164); Canvas.SetZIndex(comboBox13, 3);
            comboBox13.Items.Add(new ComboBoxItem() { Tag = "-1", Content = "无", IsSelected = true });
            comboBox13.Items.Add(new ComboBoxItem() { Tag = "24", Content = "佛光" });
            comboBox13.Items.Add(new ComboBoxItem() { Tag = "25", Content = "道光" });
            comboBox13.Items.Add(new ComboBoxItem() { Tag = "26", Content = "轮回" });
            comboBox13.Items.Add(new ComboBoxItem() { Tag = "45", Content = "蓝光" });
            comboBox13.SelectionChanged += (s, e) => {
                int code = Convert.ToInt32(((ComboBoxItem)comboBox13.SelectedItem).Tag);
                if (code == -1) {
                    leader.RemoveEffect(EffectTypes.Bottom);
                } else {
                    EventHandler handler = null;
                    AnimationBase animation = new AnimationBase() {
                        Code = Convert.ToInt32(((ComboBoxItem)comboBox13.SelectedItem).Tag),
                        Position = leader.Center,
                        Z = -1,
                        Loop = true
                    };
                    animation.Disposed += handler = (s0, e0) => {
                        animation.Disposed -= handler;
                        leader.RemoveEffect(EffectTypes.Bottom);
                    };
                    leader.AddEffect(animation, EffectTypes.Bottom);
                }
            };
            tabCanvas1.Children.Add(textBlock15); Canvas.SetLeft(textBlock15, 136); Canvas.SetTop(textBlock15, 166); Canvas.SetZIndex(textBlock15, 3);
            tabCanvas1.Children.Add(slider3); Canvas.SetLeft(slider3, 163); Canvas.SetTop(slider3, 166); Canvas.SetZIndex(slider3, 3);
            slider3.ValueChanged += (s, e) => {
                leader.ShiftEffectColor(EffectTypes.Bottom, slider3.Value);
            };

            tabCanvas1.Children.Add(textBlock23); Canvas.SetLeft(textBlock23, 10); Canvas.SetTop(textBlock23, 194); Canvas.SetZIndex(textBlock23, 3);
            tabCanvas1.Children.Add(comboBox20); Canvas.SetLeft(comboBox20, 38); Canvas.SetTop(comboBox20, 192); Canvas.SetZIndex(comboBox20, 3);
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "0", Content = "无", IsSelected = true });
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "1", Content = "幻降" });
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "2", Content = "影合" });
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "3", Content = "新生" });
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "4", Content = "残像" });
            comboBox20.Items.Add(new ComboBoxItem() { Tag = "5", Content = "波动" });
            comboBox20.SelectionChanged += (s, e) => {
                switch (Convert.ToInt32(((ComboBoxItem)comboBox20.SelectedItem).Tag)) {
                    case 0:
                        leader.EquipEntity(EquipTypes.Overall).Effect = null;
                        break;
                    case 1:
                        GlobalMethod.RunEffectAnimation(leader.EquipEntity(EquipTypes.Overall), new DirectionalBlur() { Angle = 90 }, false, false, "BlurAmount", -0.02, 0, TimeSpan.FromMilliseconds(400), null, true);
                        break;
                    case 2:
                        GlobalMethod.RunEffectAnimation(leader.EquipEntity(EquipTypes.Overall), new GrowablePoissonDisk() { InputSize = new Size(10, 50) }, false, false, "DiskRadius", -15, 0, TimeSpan.FromMilliseconds(500), new ExponentialEase() { EasingMode = EasingMode.EaseOut }, true);
                        break;
                    case 3:
                        GlobalMethod.RunEffectAnimation(leader.EquipEntity(EquipTypes.Overall), new CircleReveal() { FuzzyAmount = 0.1, CircleSize = 1, CenterPoint = new Point(0.5, 1), Texture2 = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/OpacityRect.png", UriType.Project) } }, false, false, "Progress", 30, 100, TimeSpan.FromMilliseconds(1500), null, true);
                        break;
                    case 4:
                        GlobalMethod.RunEffectAnimation(leader.EquipEntity(EquipTypes.Overall), new Blinds() { NumberOfBlinds = 30, Texture2 = new ImageBrush() { ImageSource = GlobalMethod.GetImage("UI/OpacityRect.png", UriType.Project) } }, false, false, "Progress", 0, 100, TimeSpan.FromMilliseconds(600), null, true);
                        break;
                    case 5:
                        GlobalMethod.RunEffectAnimation(leader.EquipEntity(EquipTypes.Overall), new Ripple(), false, false, "Progress", 180, 100, TimeSpan.FromMilliseconds(600), null, true);
                        break;
                }
            };

            tabCanvas1.Children.Add(textBlock27); Canvas.SetLeft(textBlock27, 98); Canvas.SetTop(textBlock27, 194); Canvas.SetZIndex(textBlock27, 3);
            tabCanvas1.Children.Add(slider9); Canvas.SetLeft(slider9, 126); Canvas.SetTop(slider9, 194); Canvas.SetZIndex(slider9, 3);
            slider9.ValueChanged += (s, e) => {
                //leader.ShiftEffectColor(EffectTypes.Bottom, slider9.Value);
                double value = Math.Round(slider9.Value, 2);
                textBlock28.Text = value.ToString();
                leader.Scale = slider9.Value;
                space.SetShadowScale(leader, value > 1 ? slider8.Value : 1);
            };
            tabCanvas1.Children.Add(textBlock28); Canvas.SetLeft(textBlock28, 200); Canvas.SetTop(textBlock28, 194); Canvas.SetZIndex(textBlock28, 3);
            tabCanvas1.Children.Add(comboBox22); Canvas.SetLeft(comboBox22, 240); Canvas.SetTop(comboBox22, 192); Canvas.SetZIndex(comboBox22, 3);
            comboBox22.Items.Add(new ComboBoxItem() { Tag = "0", Content = "地面", IsSelected = true });
            comboBox22.Items.Add(new ComboBoxItem() { Tag = "1", Content = "空中" });
            comboBox22.SelectionChanged += (s, e) => {
                switch (leader.SpaceLayer = (SpaceLayers)Convert.ToInt32(((ComboBoxItem)comboBox22.SelectedItem).Tag)) {
                    case SpaceLayers.Ground:
                        space.Scale = 1;
                        slider8.Value = 0.7;
                        slider9.Value = 1;
                        //space.RemoveCloudLayer();
                        break;
                    case SpaceLayers.Sky:
                        space.Scale = 0.4;
                        slider8.Value = 0.4;
                        slider9.Value = 2.4;
                        comboBox11.SelectedIndex = 5;
                        //space.AddCloudLayer(); //性能方面需要考量
                        break;
                }
                space.SetRoleVisibleTo(leader);
                space.SetAnimationVisibleTo(leader);
                space.SetMaskVisibleTo(leader);
                space.EndEasingMapTo(leader.Position);
            };

            tabCanvas1.Children.Add(textBlock45); Canvas.SetLeft(textBlock45, 10); Canvas.SetTop(textBlock45, 220); Canvas.SetZIndex(textBlock45, 3);
            tabCanvas1.Children.Add(comboBox38); Canvas.SetLeft(comboBox38, 60); Canvas.SetTop(comboBox38, 218); Canvas.SetZIndex(comboBox38, 3);
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "1", Content = "1级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "2", Content = "2级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "3", Content = "3级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "4", Content = "4级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "5", Content = "5级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "6", Content = "6级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "7", Content = "7级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "8", Content = "8级" });
            comboBox38.Items.Add(new ComboBoxItem() { Tag = "9", Content = "9级" });
            comboBox38.SelectionChanged += (s, e) => {
                leader.CurrentMagic.Level = Convert.ToInt32(((ComboBoxItem)comboBox38.SelectedItem).Tag);
            };

            tabCanvas1.Children.Add(comboBox39); Canvas.SetLeft(comboBox39, 112); Canvas.SetTop(comboBox39, 218); Canvas.SetZIndex(comboBox39, 3);
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "0", Content = "圆月斩(群体/圆环/弹开/麻痹)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "1", Content = "旋风斩(群体/持续伤害/颤栗)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "2", Content = "冰龙斩(单体/圆形/冰冻)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "3", Content = "地裂斩(群体/圆形/伤/燃烧)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "4", Content = "烈焰喷射(群体/直线波段/燃烧)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "5", Content = "冰魄轰炸(群体/多段圆环/冰冻)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "6", Content = "灭天雷(群体/圆形/麻痹)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "7", Content = "陨石坠落(群体/圆形/燃烧)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "8", Content = "幽冥夜火(群体/持续伤害/燃烧)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "9", Content = "连环闪电(单体+N次连环/电伤)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "10", Content = "火焰飞射(单体/灼烧)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "11", Content = "雷鸣箭(单体+N次连锁/麻痹)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "12", Content = "石封箭(群体/扇形/石化)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "13", Content = "冰咆哮(群体/波浪圆环/冰冻)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "14", Content = "毒雨箭(群体/扇形/毒化)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "15", Content = "轰雷斩(群体/圆形/麻痹)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "16", Content = "毒刃突刺(群体/圆环/毒化)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "17", Content = "电流辐射(单体+N次辐射/击退)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "18", Content = "魔神加护(单体/魔法加护)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "20", Content = "治愈之光(单体/魔法治愈)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "21", Content = "治愈之风(群体/魔法治愈)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "22", Content = "野蛮冲撞(群体/穿梭/多段击飞)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "23", Content = "召唤魔神(召唤辅助)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "24", Content = "召唤战神(召唤辅助)" });
            comboBox39.Items.Add(new ComboBoxItem() { Tag = "25", Content = "雷鸣斩(群体/圆环/弹开/麻痹)" });
            comboBox39.SelectionChanged += (s, e) => {
                leader.CurrentMagic.Code = Convert.ToInt32(((ComboBoxItem)comboBox39.SelectedItem).Tag);
            };

            tabCanvas1.Children.Add(button7); Canvas.SetLeft(button7, 10); Canvas.SetTop(button7, 244); Canvas.SetZIndex(button7, 3);
            button7.Click += delegate {
                if (instance != null) {
                    int x = (int)leader.Coordinate.X;
                    int y = (int)leader.Coordinate.Y;
                    if ((x >= 57 && x <= 61) && (y >= 58 && y <= 62) && leader.State == States.Riding && instance is HuntingSpiderKind) {
                        instance.TriggerOrgan[8] = true;
                    } else {
                        ShowTipText((instance is HuntingSpiderKind && ((HuntingSpiderKind)instance).Step == Components.Instance.HuntingSpiderKind.Steps.骑上马并移动到59_60附近开启封印) ? "开启条件不满足" : "当前场合无法使用");
                    }
                }
            };

            tabCanvas1.Children.Add(button8); Canvas.SetLeft(button8, 65); Canvas.SetTop(button8, 244); Canvas.SetZIndex(button8, 3);
            button8.Click += delegate {
                if (instance != null) {
                    int x = (int)leader.Coordinate.X;
                    int y = (int)leader.Coordinate.Y;
                    if (instance is GodFam && ((GodFam)instance).Step == Components.Instance.GodFam.Steps.于4个坐标处放置祭旗) {
                        if (x == 38 && y == 41) {
                            if (instance.TriggerOrgan[0]) {
                                ShowTipText("该坐标祭旗已放置,无需重复操作");
                            } else {
                                instance.TriggerOrgan[0] = true;
                                space.AddAnimation(new AnimationBase() {
                                    ID = 0,
                                    Code = 83,
                                    Position = new Point(-82, 1193),
                                    Z = 1193,
                                    Tip = "祭旗",
                                    Loop = true,
                                });
                            }
                        } else if (x == 47 && y == 41) {
                            if (instance.TriggerOrgan[1]) {
                                ShowTipText("该坐标祭旗已放置,无需重复操作");
                            } else {
                                instance.TriggerOrgan[1] = true;
                                space.AddAnimation(new AnimationBase() {
                                    ID = 0,
                                    Code = 83,
                                    Position = new Point(177, 1334),
                                    Z = 1334,
                                    Tip = "祭旗",
                                    Loop = true,
                                });
                            }
                        } else if (x == 47 && y == 31) {
                            if (instance.TriggerOrgan[2]) {
                                ShowTipText("该坐标祭旗已放置,无需重复操作");
                            } else {
                                instance.TriggerOrgan[2] = true;
                                space.AddAnimation(new AnimationBase() {
                                    ID = 0,
                                    Code = 83,
                                    Position = new Point(418, 1179),
                                    Z = 1179,
                                    Tip = "祭旗",
                                    Loop = true,
                                });
                            }
                        } else if (x == 36 && y == 31) {
                            if (instance.TriggerOrgan[3]) {
                                ShowTipText("该坐标祭旗已放置,无需重复操作");
                            } else {
                                instance.TriggerOrgan[3] = true;
                                space.AddAnimation(new AnimationBase() {
                                    ID = 0,
                                    Code = 83,
                                    Position = new Point(134, 1025),
                                    Z = 1025,
                                    Tip = "祭旗",
                                    Loop = true,
                                });
                            }
                        } else {
                            ShowTipText("放置位置不正确");
                        }
                    } else {
                        ShowTipText((instance is GodFam && ((GodFam)instance).Step == Components.Instance.GodFam.Steps.于4个坐标处放置祭旗) ? "位置不正确" : "当前场合无法使用");
                    }
                }
            };

            tabCanvas1.Children.Add(button9); Canvas.SetLeft(button9, 120); Canvas.SetTop(button9, 244); Canvas.SetZIndex(button9, 3);
            button9.Click += delegate {
                if (instance != null) {
                    int x = (int)leader.Coordinate.X;
                    int y = (int)leader.Coordinate.Y;
                    if ((x >= 41 && x <= 45) && (y >= 33 && y <= 37) && instance is GodFam && ((GodFam)instance).Step == Components.Instance.GodFam.Steps.召唤王者英灵) {
                        if (instance.TriggerOrgan[4]) {
                            ShowTipText("王者英灵已被成功召唤,无需重复操作");
                        } else {
                            instance.TriggerOrgan[4] = true;
                        }
                    } else {
                        ShowTipText((instance is GodFam && ((GodFam)instance).Step == Components.Instance.GodFam.Steps.召唤王者英灵) ? "召唤位置不正确" : "当前场合无法使用");
                    }
                }
            };

            #endregion

            #region 其他部分

            tabCanvas2.Children.Add(textBlock24); Canvas.SetLeft(textBlock24, 10); Canvas.SetTop(textBlock24, 6); Canvas.SetZIndex(textBlock24, 3);
            tabCanvas2.Children.Add(comboBox21); Canvas.SetLeft(comboBox21, 36); Canvas.SetTop(comboBox21, 4); Canvas.SetZIndex(comboBox21, 3);
            comboBox21.Items.Add(new ComboBoxItem() { Tag = "false", Content = "OFF" });
            comboBox21.Items.Add(new ComboBoxItem() { Tag = "true", Content = "ON", IsSelected = true });
            comboBox21.SelectionChanged += (s, e) => {
                space.MusicEnabled = Convert.ToBoolean(((ComboBoxItem)comboBox21.SelectedItem).Tag);
            };
            tabCanvas2.Children.Add(slider10); Canvas.SetLeft(slider10, 86); Canvas.SetTop(slider10, 6); Canvas.SetZIndex(slider10, 3);
            slider10.ValueChanged += (s, e) => {
                space.MusicVolume = slider10.Value;
                textBlock29.Text = Math.Round(slider10.Value, 2).ToString();
            };
            tabCanvas2.Children.Add(textBlock29); Canvas.SetLeft(textBlock29, 139); Canvas.SetTop(textBlock29, 6); Canvas.SetZIndex(textBlock29, 3);

            tabCanvas2.Children.Add(textBlock53); Canvas.SetLeft(textBlock53, 170); Canvas.SetTop(textBlock53, 6); Canvas.SetZIndex(textBlock53, 3);
            tabCanvas2.Children.Add(textBlock54); Canvas.SetLeft(textBlock54, 219); Canvas.SetTop(textBlock54, 6); Canvas.SetZIndex(textBlock54, 3);
            tabCanvas2.Children.Add(textBlock55); Canvas.SetLeft(textBlock55, 295); Canvas.SetTop(textBlock55, 6); Canvas.SetZIndex(textBlock55, 3);
            tabCanvas2.Children.Add(slider14); Canvas.SetLeft(slider14, 232); Canvas.SetTop(slider14, 6); Canvas.SetZIndex(slider14, 3);
            slider14.ValueChanged += (s, e) => {
                dramaDialogue.DialogSpeed = (int)slider14.Value;
            };

            tabCanvas2.Children.Add(textBlock56); Canvas.SetLeft(textBlock56, 10); Canvas.SetTop(textBlock56, 28); Canvas.SetZIndex(textBlock56, 3);
            tabCanvas2.Children.Add(textBlock57); Canvas.SetLeft(textBlock57, 242); Canvas.SetTop(textBlock57, 28); Canvas.SetZIndex(textBlock57, 3);
            tabCanvas2.Children.Add(slider15); Canvas.SetLeft(slider15, 140); Canvas.SetTop(slider15, 28); Canvas.SetZIndex(slider15, 3);
            slider15.ValueChanged += (s, e) => {
                ParallelDownloader.MaximumLimit = (int)slider15.Value;
                textBlock57.Text = ParallelDownloader.MaximumLimit.ToString();
            };

            //分割线
            Image image1 = new Image() { Source = GlobalMethod.GetImage("UI/CustomMagicPath.png", UriType.Project) };
            tabCanvas2.Children.Add(image1); Canvas.SetLeft(image1, 0); Canvas.SetTop(image1, 52); Canvas.SetZIndex(image1, 3);

            //绘制网格背景
            PathAnimationPainter[] pathAnimationPainter = new PathAnimationPainter[5];
            //切换卡
            ItemCard[] cards = new ItemCard[pathAnimationPainter.Count()];
            for (int i = 0; i < cards.Count(); i++) {
                pathAnimationPainter[i] = new PathAnimationPainter();
                tabCanvas2.Children.Add(pathAnimationPainter[i]);
                pathAnimationPainter[i].Position = new Point(10, 76);
                cards[i] = new ItemCard() { Text = (i + 1).ToString() };
                tabCanvas2.Children.Add(cards[i]);
                cards[i].Position = new Point(10 + i * 16, 66);
                cards[i].Z = 4;
                cards[i].MouseLeftButtonDown += (s,e)=> {
                    ItemCard card = s as ItemCard;
                    for (int j = 0; j < cards.Count(); j++) {
                        cards[j].IsSelected = pathAnimationPainter[j].IsSelected = cards[j] == card ? true : false;
                    }
                    e.Handled = true;
                };
            }
            cards[0].IsSelected = true;
            pathAnimationPainter[0].IsSelected = true;
            pathAnimationPainter[0].Color = Colors.White;
            pathAnimationPainter[1].Color = Colors.Yellow;
            pathAnimationPainter[2].Color = Colors.Red;
            pathAnimationPainter[3].Color = Colors.Cyan;
            pathAnimationPainter[4].Color = Colors.Orange;

            tabCanvas2.Children.Add(button10); Canvas.SetLeft(button10, 190); Canvas.SetTop(button10, 265); Canvas.SetZIndex(button10, 3);
            button10.Click += delegate {
                for (int i = 0; i < pathAnimationPainter.Count(); i++) {
                    pathAnimationPainter[i].Clear();
                }
            };
            tabCanvas2.Children.Add(button11); Canvas.SetLeft(button11, 246); Canvas.SetTop(button11, 265); Canvas.SetZIndex(button11, 3);
            button11.Click += delegate {
                for (int n = 0; n < pathAnimationPainter.Count(); n++) {
                    if (pathAnimationPainter[n].Path.Count> 1) {
                        Bullet bullet = new Bullet(new BulletDatas() { Code = pathAnimationPainter[n].AnimationCode, Loop = true, Type = BulletTypes.Animation }) { Z = 100 };
                        bullet.Center = bullet.Offset;
                        tabCanvas2.Children.Add(bullet);
                        Storyboard storyboard = new Storyboard();
                        PointAnimationUsingKeyFrames pointAnimationUsingKeyFrames = new PointAnimationUsingKeyFrames();
                        Storyboard.SetTarget(pointAnimationUsingKeyFrames, bullet);
                        Storyboard.SetTargetProperty(pointAnimationUsingKeyFrames, new PropertyPath("Position"));
                        DoubleAnimationUsingKeyFrames doubleAnimationUsingKeyFrames = new DoubleAnimationUsingKeyFrames();
                        Storyboard.SetTarget(doubleAnimationUsingKeyFrames, bullet);
                        Storyboard.SetTargetProperty(doubleAnimationUsingKeyFrames, new PropertyPath("Angle"));
                        double speed = pathAnimationPainter[n].Rate;
                        double a = 0.002; //加速系数
                        double timeSpanTemp = 0;
                        double durationTemp = 0;
                        double angleTemp = 0;
                        int circle = 0;
                        if (pathAnimationPainter[n].Easing == 2) {  //加速逆行即减速
                            for (int i = 0; i < pathAnimationPainter[n].Path.Count; i++)
                            { speed += a * i; }
                        }
                        for (int i = 0; i < pathAnimationPainter[n].Path.Count; i++) {
                            TimeSpan timeSpan = new TimeSpan();
                            Point lastPath = (i == 0 ? pathAnimationPainter[n].Path[0] : pathAnimationPainter[n].Path[i - 1]);
                            Point nowPath = pathAnimationPainter[n].Path[i];
                            Point nextPath = (i == pathAnimationPainter[n].Path.Count - 1 ? pathAnimationPainter[n].Path[pathAnimationPainter[n].Path.Count - 1] : pathAnimationPainter[n].Path[i + 1]);
                            switch (pathAnimationPainter[n].Easing) {
                                case 0:
                                    timeSpanTemp = GlobalMethod.GetDistance(lastPath, nowPath) / speed;
                                    durationTemp += timeSpanTemp;
                                    timeSpan = TimeSpan.FromMilliseconds(durationTemp);
                                    break;
                                case 1:
                                    speed += a * i;
                                    timeSpanTemp = GlobalMethod.GetDistance(lastPath, nowPath) / speed;
                                    durationTemp += timeSpanTemp;
                                    timeSpan = TimeSpan.FromMilliseconds(durationTemp);
                                    break;
                                case 2:
                                    speed -= a * (pathAnimationPainter[n].Path.Count - 1 - i);
                                    timeSpanTemp = GlobalMethod.GetDistance(lastPath, nowPath) / speed;
                                    durationTemp += timeSpanTemp;
                                    timeSpan = TimeSpan.FromMilliseconds(durationTemp);
                                    break;
                            }
                            pointAnimationUsingKeyFrames.KeyFrames.Add(
                                new LinearPointKeyFrame() {
                                    KeyTime = KeyTime.FromTimeSpan(timeSpan),
                                    Value = new Point() { X = nowPath.X * pathAnimationPainter[n].Proportion, Y = nowPath.Y * pathAnimationPainter[n].Proportion }
                                }
                            );
                            double angle = GlobalMethod.GetAngle(nowPath.Y - lastPath.Y, nowPath.X - lastPath.X) + 360 * circle;
                            //check大于0为顺时针个方向
                            double check = (nowPath.X - lastPath.X) * (nextPath.Y - nowPath.Y) - (nowPath.Y - lastPath.Y) * (nextPath.X - nowPath.X);
                            if (check > 0) {
                                if (angleTemp > 360 * circle && angle < 360 * circle) { angle += 360; } else if (angleTemp > 360 * circle + 180 && angle < angleTemp) { angle += 360; circle++; }
                            } else {
                                if (angleTemp < 360 * circle && angle > 360 * circle) { angle -= 360; } else if (angleTemp < 360 * circle - 180 && angle > angleTemp) { angle -= 360; circle--; }
                            }
                            angleTemp = angle; //用于旋转时的角度衔接
                            doubleAnimationUsingKeyFrames.KeyFrames.Add(
                                new LinearDoubleKeyFrame() {
                                    KeyTime = KeyTime.FromTimeSpan(timeSpan),
                                    Value = angle
                                }
                            );
                        }
                        pointAnimationUsingKeyFrames.Duration = new Duration(TimeSpan.FromMilliseconds(durationTemp));
                        storyboard.Children.Add(pointAnimationUsingKeyFrames);
                        if (pathAnimationPainter[n].Direction == 0) { storyboard.Children.Add(doubleAnimationUsingKeyFrames); }
                        EventHandler handler = null;
                        storyboard.Completed += handler = delegate {
                            storyboard.Completed -= handler;
                            tabCanvas2.Children.Remove(bullet);
                            bullet.Move_Completed(bullet, null);
                        };
                        storyboard.Begin();
                    }
                }
            };

            #endregion

            #region 子部分

            tabCanvas0.Children.Add(childCanvas0); Canvas.SetLeft(childCanvas0, 310); Canvas.SetTop(childCanvas0, 0); Canvas.SetZIndex(childCanvas0, 3);
            childCanvas0.Children.Add(textBlock48); Canvas.SetLeft(textBlock48, 6); Canvas.SetTop(textBlock48, 6); Canvas.SetZIndex(textBlock48, 3);
            childCanvas0.Children.Add(textBlock51); Canvas.SetLeft(textBlock51, 6); Canvas.SetTop(textBlock51, 26); Canvas.SetZIndex(textBlock51, 3);
            childCanvas0.Children.Add(textBlock52); Canvas.SetLeft(textBlock52, 6); Canvas.SetTop(textBlock52, 46); Canvas.SetZIndex(textBlock52, 3);
            childCanvas0.Children.Add(textBlock49); Canvas.SetLeft(textBlock49, 6); Canvas.SetTop(textBlock49, 66); Canvas.SetZIndex(textBlock49, 3);
            childCanvas0.Children.Add(rectangle0); Canvas.SetLeft(rectangle0, 60); Canvas.SetTop(rectangle0, 70); Canvas.SetZIndex(rectangle0, 3);
            childCanvas0.Children.Add(listBox0); Canvas.SetLeft(listBox0, 6); Canvas.SetTop(listBox0, 86); Canvas.SetZIndex(listBox0, 3);
            childCanvas0.Children.Add(textBlock50); Canvas.SetLeft(textBlock50, 6); Canvas.SetTop(textBlock50, 106); Canvas.SetZIndex(textBlock50, 3);
            childCanvas0.Children.Add(rectangle1); Canvas.SetLeft(rectangle1, 60); Canvas.SetTop(rectangle1, 110); Canvas.SetZIndex(rectangle1, 3);
            childCanvas0.Children.Add(listBox1); Canvas.SetLeft(listBox1, 6); Canvas.SetTop(listBox1, 126); Canvas.SetZIndex(listBox1, 3);

            #endregion
        }
Esempio n. 10
0
        public PointAnimationUsingKeyFramesExample()
        {
            Title = "PointAnimationUsingKeyFrames Example";
            Background = Brushes.White;
            Margin = new Thickness(20);

            // Create a NameScope for this page so that 
            // Storyboards can be used.
            NameScope.SetNameScope(this, new NameScope());

            // Create an EllipseGeometry.
            EllipseGeometry myAnimatedEllipseGeometry =
                new EllipseGeometry(new Point(200, 100), 15, 15);

            // Assign the EllipseGeometry a name so that 
            // it can be targeted by a Storyboard. 
            this.RegisterName(
                "MyAnimatedEllipseGeometry", myAnimatedEllipseGeometry);

            // Create a Path element to display the geometry.
            Path aPath = new Path();
            aPath.Fill = Brushes.Blue;
            aPath.Data = myAnimatedEllipseGeometry;

            // Create a Canvas to contain the path.
            Canvas containerCanvas = new Canvas();
            containerCanvas.Width = 500;
            containerCanvas.Height = 400;
            containerCanvas.Children.Add(aPath);

            // Create a PointAnimationUsingKeyFrames to 
            // animate the EllipseGeometry.
            PointAnimationUsingKeyFrames centerPointAnimation
                = new PointAnimationUsingKeyFrames();
            centerPointAnimation.Duration = TimeSpan.FromSeconds(5);

            // Animate from the starting position to (100,300) 
            // over the first half-second using linear 
            // interpolation.
            centerPointAnimation.KeyFrames.Add(
                new LinearPointKeyFrame(
                    new Point(100, 300), // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.5))) // KeyTime
                );

            // Animate from (100,300) (the value of the previous key frame)  
            // to (400,300) at 1 second using discrete interpolation. 
            // Because the interpolation is discrete, the ellipse will appear 
            // to "jump" to (400,300) at 1 second.
            centerPointAnimation.KeyFrames.Add(
                new DiscretePointKeyFrame(
                    new Point(400, 300), // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1))) // KeyTime
                );

            // Animate from (400,300) (the value of the previous key frame) to (200,100) 
            // over two seconds, starting at 1 second (the key time of the 
            // last key frame) and ending at 3 seconds.
            centerPointAnimation.KeyFrames.Add(
                new SplinePointKeyFrame(
                    new Point(200, 100), // Target value (KeyValue)
                    KeyTime.FromTimeSpan(TimeSpan.FromSeconds(3)), // KeyTime 
                    new KeySpline(0.6, 0.0, 0.9, 0.0) // KeySpline
                    )
                );

            // Set the animation to repeat forever. 
            centerPointAnimation.RepeatBehavior = RepeatBehavior.Forever;

            // Set the animation to target the Center property 
            // of the object named "MyAnimatedEllipseGeometry".
            Storyboard.SetTargetName(centerPointAnimation, "MyAnimatedEllipseGeometry");
            Storyboard.SetTargetProperty(
                centerPointAnimation, new PropertyPath(EllipseGeometry.CenterProperty));

            // Create a storyboard to apply the animation.
            Storyboard ellipseStoryboard = new Storyboard();
            ellipseStoryboard.Children.Add(centerPointAnimation);

            // Start the storyboard when the Path loads.
            aPath.Loaded += delegate(object sender, RoutedEventArgs e)
            {
                ellipseStoryboard.Begin(this);
            };

            Content = containerCanvas;
        }