Example #1
0
        void ReleaseDesignerOutlets()
        {
            if (AccuracyLabel != null)
            {
                AccuracyLabel.Dispose();
                AccuracyLabel = null;
            }

            if (AnimationImage != null)
            {
                AnimationImage.Dispose();
                AnimationImage = null;
            }

            if (DistanceLabel != null)
            {
                DistanceLabel.Dispose();
                DistanceLabel = null;
            }

            if (OpenMapButton != null)
            {
                OpenMapButton.Dispose();
                OpenMapButton = null;
            }

            if (TaskDescLabel != null)
            {
                TaskDescLabel.Dispose();
                TaskDescLabel = null;
            }
        }
Example #2
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (NowPic >= Animation.Images.Count)
            {
                repeat++;
                NowPic = 0;
                if (repeat >= RepeatTime)
                {
                    Timer.Stop();
                    if (removeLast)
                    {
                        ParentCanvas.Children.Remove(_image);
                    }
                    else
                    {
                        NowPic = Animation.Images.Count - 1;
                    }
                    if (callback != null)
                    {
                        callback();
                    }
                }
            }
            AnimationImage img = Animation.Images[NowPic];

            if (anchor)
            {
                _image.Width  = img.W;
                _image.Height = img.H;
                Canvas.SetLeft(_image, basex - img.AnchorX);
                Canvas.SetTop(_image, basey - img.AnchorY);
            }
            _image.Source = img.Image;
            NowPic++;
        }
Example #3
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            if (Status == SpiritStatus.Standing) //站立的时候4个回调切换一次,否则像抽风
            {
                if (standSwitchIndex != 0)
                {
                    standSwitchIndex++;
                    if (standSwitchIndex > 2)
                    {
                        standSwitchIndex = 0;
                    }
                    return;
                }
                standSwitchIndex++;
            }

            List <AnimationImage> images = null;
            string statusStr             = StatusMap[(int)Status];

            if (!AnimationImages.ContainsKey(statusStr))
            {
                images = AnimationImages["stand"];
            }
            else
            {
                images = AnimationImages[statusStr];
            }
            if (images == null)
            {
                MessageBox.Show(string.Format("error, animation {0}/stand not exist", Role.Animation));
            }
            if (picCurrent >= images.Count)
            {
                picCurrent = 0;
                if (Status == SpiritStatus.Attacking)
                {
                    Status = SpiritStatus.Standing;
                }
            }
            AnimationImage currentImage = images[picCurrent];

            Body.Source = currentImage.Image;
            Body.Height = currentImage.H * CommonSettings.SpiritScaleRate;
            Body.Width  = currentImage.W * CommonSettings.SpiritScaleRate;

            if (FaceRight)
            {
                Canvas.SetLeft(Body, this.ActualWidth / 2 - currentImage.AnchorX * CommonSettings.SpiritScaleRate);
            }
            else
            {
                Canvas.SetLeft(Body, this.ActualWidth / 2 - (Body.Width - currentImage.AnchorX * CommonSettings.SpiritScaleRate));
            }
            Canvas.SetTop(Body, this.ActualHeight - currentImage.AnchorY * CommonSettings.SpiritScaleRate);

            picCurrent++;
        }
Example #4
0
        private void ChangeAnimationType_Select(object sender, EventArgs e)
        {
            var selectedType = cmbAnimationType.SelectedItem?.ToString();

            gpAnimationDrawing.Visible     = false;
            gpAnimationImage.Visible       = false;
            gpAnimationActionMoveX.Visible = false;
            if (!populatingForm)
            {
                IAnimationItem newAnimation = null;
                if (selectedType == "Drawing")
                {
                    newAnimation = new AnimationDrawing
                    {
                        Name       = _animation.Name,
                        Type       = AnimationItemTypeEnum.Drawing,
                        FillColor  = Color.White,
                        FillMethod = FillTypeEnum.Solid,
                        OffsetX    = 50,
                        OffsetY    = 50,
                        Triggers   = _animation.Triggers
                    };
                }
                if (selectedType == "Image")
                {
                    newAnimation = new AnimationImage
                    {
                        Name      = _animation.Name,
                        Type      = AnimationItemTypeEnum.Image,
                        ImagePath = "",
                        Triggers  = _animation.Triggers
                    };
                    pbAnimationImage.BackgroundImage?.Dispose();
                    pbAnimationImage.BackgroundImage = new Bitmap(1, 1);
                    pbAnimationImage.Image?.Dispose();
                    pbAnimationImage.Image = new Bitmap(1, 1);
                }
                _animation = newAnimation;
                PopulateTab(0);
            }
            //if (_animation.Type == AnimationItemTypeEnum.Image)
            //{
            //    gpAnimationImage.Visible = true;
            //}
            //if(_animation.Type == AnimationItemTypeEnum.Drawing)
            //{
            //    gpAnimationDrawing.Visible = true;
            //}
        }
Example #5
0
        public Bakuda(Point startPoint, int tileSize)
        {
            MoveSpeed      = 75.0f;
            HitPoints      = 0;
            DirectionState = DirectionState.Left;
            HitPoints      = 1;

            this.tileSize = tileSize;

            CollisionRectangle = new Rectangle(startPoint.X, startPoint.Y, tileSize, tileSize);

            Image imageTemp = new Image("Play/Bakuda3x", new Rectangle(0, 0, tileSize, tileSize), new Vector2(startPoint.X, startPoint.Y));

            Image            = new AnimationImage(imageTemp, new List <int>(new int[] { 0, 1 }));
            Image.SwitchTime = 100;
        }