Esempio n. 1
0
        public Tux(int top, int left)
            : base()
        {
            Top = top;
            Left = left;

            imgNormal = new AnimateImage(Files.tux_normal, 200, GameDirection.Left, GameDirection.Right);
            imgSmall = new AnimateImage(Files.tux_small, 200, GameDirection.Left, GameDirection.Right);

            Width = imgNormal.CurImage(direction).Width;
            Height = imgNormal.CurImage(direction).Height;

            curimg = imgNormal;
            direction = GameDirection.Right;

            firePressed = false;
            mode = MainGameObjectMode.Normal;

            immortializeEnd = DateTime.Now;
            immortialize = false;

            GamePhysics.JumpData jumping = new GamePhysics.JumpData();
            jumping.direction = GameDirection.None;
            jumping.distance = 0;
            this.jumping = jumping;

            wantNext = new Queue<WantNext>();
        }
Esempio n. 2
0
        public void Play()
        {
            if (AnimateImage != null)
            {
                image = new AnimateImage(AnimateImage);
                image.OnFrameChanged += new EventHandler <EventArgs>((o, ex) => { Invalidate(); });
                SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);

                var   owner    = this;
                Image newImg   = image.Image;
                var   scWidth  = owner.Width * 1.0f / image.Image.Width;
                var   scHeight = owner.Height * 1.0f / image.Image.Height;
                var   minScale = Math.Min(scWidth, scHeight);
                if (minScale < 1.0f)
                {
                    newImg = new Bitmap(image.Image, new Size((int)(minScale * image.Image.Width), (int)(minScale * image.Image.Height)));
                }
                if (scWidth < scHeight)
                {
                    owner.Height = newImg.Height;
                }
                else if (scWidth > scHeight)
                {
                    owner.Width = newImg.Width;
                }
                image.Play();
            }
        }
Esempio n. 3
0
        public ImgForm(string imgPath)
        {
            InitializeComponent();
            //this._imageTag= InitImageTag();
            if (File.Exists(imgPath))
            {
                imgType = Common.CheckImageType(imgPath);
                switch (imgType)
                {
                case ImageType.GIF:
                    try
                    {
                        SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
                        this.img    = Image.FromFile(imgPath);
                        imgAnimator = new AnimateImage(this.img);
                        imgAnimator.OnFrameChanged += ImgAnimator_OnFrameChanged;
                        if (this.img.Width >= this.minWidth || this.img.Height >= this.minHeight)
                        {
                            this.Size = img.Size;
                        }
                        else
                        {
                            this.Size = new Size(minWidth, minHeight);
                        }
                    }
                    catch (Exception ex)
                    {
                    }
                    break;

                case ImageType.None:
                    break;

                default:
                    try
                    {
                        this.img = Image.FromFile(imgPath);
                        if (this.img.Width >= this.minWidth || this.img.Height >= this.minHeight)
                        {
                            this.Size = img.Size;
                        }
                        else
                        {
                            this.Size = new Size(minWidth, minHeight);
                        }
                    }
                    catch (Exception ex)
                    {
                        this.Close();
                    }
                    break;
                }
            }
        }
Esempio n. 4
0
        public frmAndonEventCancel_30()
        {
            InitializeComponent();

            image = new AnimateImage(Properties.Resources.ReadIDCard);
            image.OnFrameChanged += new EventHandler <EventArgs>(image_OnFrameChanged);
            SetStyle(
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint,
                true);

            switch (IRAPUser.Instance.CommunityID)
            {
            case 60006:
                if (Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2) == "en")
                {
                    lblGetIDNo.Text = "Please swipe your card or enter a number " +
                                      "to obtain the events that you called";
                }
                else
                {
                    lblGetIDNo.Text = "    请刷卡或输入工号,获取您呼叫的安灯事件:";
                }
                edtIDCardNo.Properties.UseSystemPasswordChar = false;
                break;

            default:
                if (Thread.CurrentThread.CurrentUICulture.Name.Substring(0, 2) == "en")
                {
                    lblGetIDNo.Text = "Please swipe your card to obtain " +
                                      "the events that you called";
                }
                else
                {
                    lblGetIDNo.Text = "请刷卡,获取您呼叫的安灯事件:";
                }
                edtIDCardNo.Properties.UseSystemPasswordChar = true;
                break;
            }
        }