// Use this for initialization
    void Awake()
    {
        Do_Character_Image_Generate_ = true;
        instantiate_character_ = GetComponent<Image> () ;
        animator_ = GetComponent<ImageAnimator>();

        //player番号を取得.
        var score_saver = GameObject.FindObjectOfType<ScoreSaver>();
        var result_refernce = GameObject.FindObjectOfType<ResultAnimationManager>();
        bool player_number = score_saver.Is1P;
        bool is_win = result_refernce.IsWin;
        bool is_draw = result_refernce.IsDraw;

        var audio_manager = AudioManager.Instance;

        //プレイヤー番号、勝敗をもとに表示する画像を設定
        if (player_number){

            //1P画像.(Lemon)
            if (is_win){
                Kudamon_Image_Type_ = Kudamon_Type_.Lemon_Win_;
                audio_manager.PlaySe(23);
                Debug.Log("1pwin");
            }
            else{
                Kudamon_Image_Type_ = Kudamon_Type_.Lemon_Lose_;
                audio_manager.PlaySe(21);
                Debug.Log("1plose");

            }

        }
        else {

            //2P画像.(apmon)
            if (is_win) {
                Kudamon_Image_Type_ = Kudamon_Type_.Appmon_Win_;
                audio_manager.PlaySe(19);
                Debug.Log("2pwin");

            }
            else
            {
                Kudamon_Image_Type_ = Kudamon_Type_.Appmon_Lose_;
                audio_manager.PlaySe(17);
                Debug.Log("2plose");

            }

        }
    }
Example #2
0
    // Use this for initialization
    void Awake()
    {
        //タイマーを初期化.
        time_counter_ = 0.0F;
        image_animator_ = GetComponent<ImageAnimator>();
        is_end_send_ = false;
        //桁番号参照用に、スコアジェネレータを初期化.
        //animationの遅延時間をスコア表示側から設定、
        //一桁ずつアニメーション時間をずらす.
        score_generator_refernce_ = GameObject.FindObjectOfType<ScoreGenerator>();
        sprite_animator_ = GetComponent<SpriteAnimator>();
        sprite_animator_.target_time_ = animation_end_target_time;
        sprite_animator_.delay_time_ = show_delay_time_
                                       + (score_generator_refernce_.DigitCounter * show_lag_);

        //スコアを参照.(1桁分のみ)
        GameObject score_refernce = GameObject.Find("ScoreGenerator(Clone)") as GameObject;
        number_ = score_refernce.GetComponent<ScoreGenerator>().Score;
        //Spriteを初期化.数字をランダムに取得.
        number_object_ = GetComponent<Image>();
        number_object_.sprite = Instantiate(Score_Number_[Random.Range(0,9)]) as Sprite;
    }
Example #3
0
 void ChangeSource()
 {
     Source         = _BitmapSources[_nCurrentFrame++];
     _nCurrentFrame = _nCurrentFrame % _BitmapSources.Length;
     ImageAnimator.UpdateFrames();
 }
Example #4
0
 public static void Stop()
 {
     bounds             = Rectangle.Empty;
     currentlyAnimating = false;
     ImageAnimator.StopAnimate(animatedImage, ImageEvent);
 }
Example #5
0
 internal void StopAnimate()
 {
     ImageAnimator.StopAnimate(this, OnFrameChanged);
     _isStart = false;
 }
Example #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            ImageAnimator.UpdateFrames();//초기 picturebox3에 뜨는 이미지
            Graphics g = pictureBox3.CreateGraphics();

            g.DrawImage(this.bit, new Point(15, 10));
            base.OnPaint(e);



            ImageAnimator.UpdateFrames();//초기 picturebox4에 뜨는 이미지
            Graphics t = pictureBox4.CreateGraphics();

            t.DrawImage(this.bit2, new Point(0, 0));
            base.OnPaint(e);



            Graphics y = pictureBox1.CreateGraphics();

            if (number == 0)//초기 picturebox1에 뜨는 이미지
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit3, new Point(-50, 0));
                base.OnPaint(e);
            }
            else if (number == 1)//피카츄 아이언테일 스킬 쓴 이 후 picturebox1 이미지
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit4, new Point(-50, 0));
                base.OnPaint(e);
            }
            else if (number == 2)//피카츄 전광석화 스킬 쓴 이 후 picturebox1 이미지
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit5, new Point(-70, 0));
                base.OnPaint(e);
            }
            else//피카츄 백만볼트 스킬 쓴 이 후 picturebox1 이미지
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit6, new Point(-70, 0));
                base.OnPaint(e);
            }

            Graphics h = pictureBox2.CreateGraphics();

            if (number == 0)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit1, new Point(0, 0));//윈디 1
                base.OnPaint(e);
            }
            else if (number == 1)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit7, new Point(0, 0));//불대문자
                base.OnPaint(e);
            }
            else if (number == 2)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit8, new Point(0, 0));//불꽃세례
                base.OnPaint(e);
            }
            else
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit9, new Point(0, 0));//돌진
                base.OnPaint(e);
            }
        }
Example #7
0
 //获得当前gif动画的下一步需要渲染的帧,当下一步任何对当前gif动画的操作都是对该帧进行操作)
 private void UpdateImage()
 {
     ImageAnimator.UpdateFrames(FGifImage);
 }
Example #8
0
        private void DrawGeneral(Graphics g, LiveSplitState state, float width, float height, LayoutMode mode)
        {
            if (NeedUpdateAll)
            {
                UpdateAll(state);
            }

            if (Settings.BackgroundGradient == ExtendedGradientType.Alternating)
            {
                g.FillRectangle(new SolidBrush(
                                    state.Run.IndexOf(Split) % 2 + (Settings.ShowColumnLabels ? 1 : 0) == 1
                    ? Settings.BackgroundColor2
                    : Settings.BackgroundColor
                                    ), 0, 0, width, height);
            }

            MeasureTimeLabel.Text  = TimeFormatter.Format(new TimeSpan(24, 0, 0));
            MeasureDeltaLabel.Text = DeltaTimeFormatter.Format(new TimeSpan(0, 9, 0, 0));

            MeasureTimeLabel.Font          = state.LayoutSettings.TimesFont;
            MeasureTimeLabel.IsMonospaced  = true;
            MeasureDeltaLabel.Font         = state.LayoutSettings.TimesFont;
            MeasureDeltaLabel.IsMonospaced = true;

            MeasureTimeLabel.SetActualWidth(g);
            MeasureDeltaLabel.SetActualWidth(g);

            NameLabel.ShadowColor = state.LayoutSettings.ShadowsColor;
            foreach (var label in LabelsList)
            {
                label.SetActualWidth(g);
                label.ShadowColor = state.LayoutSettings.ShadowsColor;
            }
            MinimumWidth  = CalculateLabelsWidth() + IconWidth + 10;
            MinimumHeight = 0.85f * (g.MeasureString("A", state.LayoutSettings.TimesFont).Height + g.MeasureString("A", state.LayoutSettings.TextFont).Height);

            if (Settings.SplitTimesAccuracy != CurrentAccuracy)
            {
                TimeFormatter   = new RegularSplitTimeFormatter(Settings.SplitTimesAccuracy);
                CurrentAccuracy = Settings.SplitTimesAccuracy;
            }
            if (Settings.DeltasAccuracy != CurrentDeltaAccuracy || Settings.DropDecimals != CurrentDropDecimals)
            {
                DeltaTimeFormatter   = new DeltaSplitTimeFormatter(Settings.DeltasAccuracy, Settings.DropDecimals);
                CurrentDeltaAccuracy = Settings.DeltasAccuracy;
                CurrentDropDecimals  = Settings.DropDecimals;
            }

            if (Split != null)
            {
                if (mode == LayoutMode.Vertical)
                {
                    NameLabel.VerticalAlignment = StringAlignment.Center;
                    NameLabel.Y      = 0;
                    NameLabel.Height = height;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Center;
                        label.Y      = 0;
                        label.Height = height;
                    }
                }
                else
                {
                    NameLabel.VerticalAlignment = StringAlignment.Near;
                    NameLabel.Y      = 0;
                    NameLabel.Height = 50;
                    foreach (var label in LabelsList)
                    {
                        label.VerticalAlignment = StringAlignment.Far;
                        label.Y      = height - 50;
                        label.Height = 50;
                    }
                }

                if (IsActive)
                {
                    var currentSplitBrush = new LinearGradientBrush(
                        new PointF(0, 0),
                        Settings.CurrentSplitGradient == GradientType.Horizontal
                        ? new PointF(width, 0)
                        : new PointF(0, height),
                        Settings.CurrentSplitTopColor,
                        Settings.CurrentSplitGradient == GradientType.Plain
                        ? Settings.CurrentSplitTopColor
                        : Settings.CurrentSplitBottomColor);
                    g.FillRectangle(currentSplitBrush, 0, 0, width, height);
                }

                if (DisplayIcon)
                {
                    var icon   = Split.Icon ?? NoIconImage;
                    var shadow = (Split.Icon != null) ? ShadowImage : NoIconShadow;

                    /*if (DateTime.Now.Date.Month == 4 && DateTime.Now.Date.Day == 1)
                     * {
                     *  icon = LiveSplit.Web.Share.TwitchEmoteResolver.Resolve("Kappa", true, false, false);
                     *  shadow = null;
                     * }*/

                    if (OldImage != icon)
                    {
                        ImageAnimator.Animate(icon, (s, o) => { });
                        ImageAnimator.Animate(shadow, (s, o) => { });
                        OldImage = icon;
                    }

                    var drawWidth    = Settings.IconSize;
                    var drawHeight   = Settings.IconSize;
                    var shadowWidth  = Settings.IconSize * (5 / 4f);
                    var shadowHeight = Settings.IconSize * (5 / 4f);
                    if (icon.Width > icon.Height)
                    {
                        var ratio = icon.Height / (float)icon.Width;
                        drawHeight   *= ratio;
                        shadowHeight *= ratio;
                    }
                    else
                    {
                        var ratio = icon.Width / (float)icon.Height;
                        drawWidth   *= ratio;
                        shadowWidth *= ratio;
                    }

                    ImageAnimator.UpdateFrames(shadow);
                    if (Settings.IconShadows && shadow != null)
                    {
                        g.DrawImage(
                            shadow,
                            7 + (Settings.IconSize * (5 / 4f) - shadowWidth) / 2 - 0.7f,
                            (height - Settings.IconSize) / 2.0f + (Settings.IconSize * (5 / 4f) - shadowHeight) / 2 - 0.7f,
                            shadowWidth,
                            shadowHeight);
                    }

                    ImageAnimator.UpdateFrames(icon);

                    g.DrawImage(
                        icon,
                        7 + (Settings.IconSize - drawWidth) / 2,
                        (height - Settings.IconSize) / 2.0f + (Settings.IconSize - drawHeight) / 2,
                        drawWidth,
                        drawHeight);
                }

                NameLabel.Font      = state.LayoutSettings.TextFont;
                NameLabel.X         = 5 + IconWidth;
                NameLabel.HasShadow = state.LayoutSettings.DropShadows;

                if (ColumnsList.Count() == LabelsList.Count)
                {
                    var curX  = width - 7;
                    var nameX = width - 7;
                    foreach (var label in LabelsList.Reverse())
                    {
                        var column = ColumnsList.ElementAt(LabelsList.IndexOf(label));

                        var labelWidth = 0f;
                        if (column.Type == ColumnType.DeltaorSplitTime || column.Type == ColumnType.SegmentDeltaorSegmentTime)
                        {
                            labelWidth = Math.Max(MeasureDeltaLabel.ActualWidth, MeasureTimeLabel.ActualWidth);
                        }
                        else if (column.Type == ColumnType.Delta || column.Type == ColumnType.SegmentDelta)
                        {
                            labelWidth = MeasureDeltaLabel.ActualWidth;
                        }
                        else
                        {
                            labelWidth = MeasureTimeLabel.ActualWidth;
                        }
                        label.Width = labelWidth + 20;
                        curX       -= labelWidth + 5;
                        label.X     = curX - 15;

                        label.Font         = state.LayoutSettings.TimesFont;
                        label.HasShadow    = state.LayoutSettings.DropShadows;
                        label.IsMonospaced = true;
                        label.Draw(g);

                        if (!String.IsNullOrEmpty(label.Text))
                        {
                            nameX = curX + labelWidth + 5 - label.ActualWidth;
                        }
                    }
                    NameLabel.Width = (mode == LayoutMode.Horizontal ? width - 10 : nameX) - IconWidth;
                    NameLabel.Draw(g);
                }
            }
            else
            {
                DisplayIcon = Settings.DisplayIcons;
            }
        }
Example #9
0
        public static Boolean SaveThumbSingle(String filename, String suffix, ThumbInfo x)
        {
            try {
                using (Image img = Image.FromFile(filename)) {
                    String destPath = Img.GetThumbPath(filename, suffix);
                    if (file.Exists(destPath))
                    {
                        file.Delete(destPath);
                    }

                    if (img.Size.Width <= x.Width && img.Size.Height <= x.Height)
                    {
                        File.Copy(filename, destPath);
                    }
                    else if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif) && ImageAnimator.CanAnimate(img))
                    {
                        File.Copy(filename, destPath);
                    }
                    else
                    {
                        Img.SaveThumbnail(filename, destPath, x.Width, x.Height, x.Mode);
                    }
                }

                return(true);
            }
            catch (OutOfMemoryException ex) {
                logger.Error("file format error: " + filename);
                return(false);
            }
        }
Example #10
0
 /// <summary>
 /// Stop animation
 /// </summary>
 public void StopAnimate()
 {
     ImageAnimator.StopAnimate(this.gifBitmap, this.OnFrameChanged);
 }
Example #11
0
        //关闭显示动画,该方法可以在winform关闭时,或者某个按钮的触发事件中进行调用,以停止渲染当前gif动画。

        private void StopAnimate()
        {
            //FGifImage = null;
            ImageAnimator.StopAnimate(FGifImage, evtHandler);
        }
Example #12
0
        public void HandleAnimatedTwitchEmote(LazyLoadedImage emote)
        {
            if (emote.Image != null)
            {
                var img = (Image)emote.Image;

                var animated = ImageAnimator.CanAnimate(img);

                if (animated)
                {
                    try
                    {
                        var dimension          = new FrameDimension(img.FrameDimensionsList[0]);
                        var frameCount         = img.GetFrameCount(dimension);
                        var frameDuration      = new int[frameCount];
                        var currentFrame       = 0;
                        var currentFrameOffset = 0;

                        var times = img.GetPropertyItem(0x5100).Value;
                        var frame = 0;
                        for (var i = 0; i < frameCount; i++)
                        {
                            var num = BitConverter.ToInt32(times, 4 * frame);

                            if (num == 0)
                            {
                                frameDuration[i] = 4;
                            }
                            else
                            {
                                frameDuration[i] = num;
                            }
                        }
                        emote.IsAnimated = true;

                        Console.WriteLine("new gif emote " + emote.Name);

                        App.GifEmoteFramesUpdating += (s, e) =>
                        {
                            currentFrameOffset += 3;

                            var oldCurrentFrame = currentFrame;

                            while (true)
                            {
                                if (currentFrameOffset > frameDuration[currentFrame])
                                {
                                    currentFrameOffset -= frameDuration[currentFrame];
                                    currentFrame        = (currentFrame + 1) % frameCount;
                                }
                                else
                                {
                                    break;
                                }
                            }

                            if (oldCurrentFrame != currentFrame)
                            {
                                lock (img)
                                {
                                    img.SelectActiveFrame(dimension, currentFrame);
                                }
                            }
                        };
                    }
                    catch { }
                }
                App.TriggerEmoteLoaded();
            }
        }
Example #13
0
 public help1()
 {
     InitializeComponent();
     ImageAnimator.Animate(pictureBox1.BackgroundImage, OnFrameChanged);
 }
Example #14
0
        /// <summary>
        /// 关闭显示动画,该方法可以在winform关闭时,或者某个按钮的触发事件中进行调用,以停止渲染当前gif动画。
        /// </summary>
        private void StopAnimate()
        {
            m_Image = null;

            ImageAnimator.StopAnimate(m_Image, evtHandler);
        }
Example #15
0
        public static Boolean saveAvatarPrivate(int x, int y, String srcPath, ThumbnailType ttype)
        {
            String thumbPath = Img.GetThumbPath(srcPath, ttype);

            try {
                using (Image img = Image.FromFile(srcPath)) {
                    if (img.Size.Width <= x && img.Size.Height <= y)
                    {
                        File.Copy(srcPath, thumbPath);
                    }
                    else if (img.RawFormat.Equals(System.Drawing.Imaging.ImageFormat.Gif) && ImageAnimator.CanAnimate(img))
                    {
                        File.Copy(srcPath, thumbPath);
                    }
                    else
                    {
                        logger.Info("save thumbnail..." + ttype.ToString() + ": " + srcPath + "=>" + thumbPath);
                        Img.SaveThumbnail(srcPath, thumbPath, x, y, SaveThumbnailMode.Cut);
                    }
                    return(true);
                }
            }
            catch (OutOfMemoryException ex) {
                logger.Error("file format error: " + srcPath);
                return(false);
            }
        }
Example #16
0
 protected override void OnPaint(PaintEventArgs e)
 {
     ImageAnimator.UpdateFrames();
 }
Example #17
0
 private void onAnimate(object o, EventArgs e)
 {
     ImageAnimator.UpdateFrames();
 }
Example #18
0
 private void button2_Click(object sender, EventArgs e)
 {
     // Останавливаем анимацию
     ImageAnimator.StopAnimate(animatedImage,
                               new EventHandler(this.OnFrameChanged));
 }
Example #19
0
        protected override void OnCellPainting(DataGridViewCellPaintingEventArgs e)
        {
            base.OnCellPainting(e);

            if (e.ColumnIndex < 0 || e.RowIndex < 0)
            {
                return;
            }

            NodeIdWrapper NodeIdWrapper = new NodeIdWrapper(e.RowIndex);
            Bitmap        icon          = null;
            Rectangle     rect          = e.CellBounds;

            if (e.ColumnIndex == 0)
            {
                // Check if we have to draw a busy indicator.
                int type;
                Model.get_field(NodeIdWrapper, 0, out type);
                if ((MessageType)type == MessageType.BusyMsg)
                {
                    icon = (e.RowIndex % 2 == 1) ? Resources.busy_indicator_lightblue : Resources.busy_indicator_white;
                    ImageAnimator.UpdateFrames();
                    rect.X   += (rect.Width - icon.Width) / 2;
                    rect.Y   += (rect.Height - icon.Height) / 2;
                    rect.Size = icon.Size;
                }
            }

            if (icon == null)
            {
                int iconId = Model.get_field_icon(NodeIdWrapper, e.ColumnIndex, IconSize.Icon16);
                icon = IconManagerWrapper.get_instance().get_icon(iconId);
                if (icon != null)
                {
                    rect.Size = icon.Size;

                    // Horizontal alignment.
                    switch (e.CellStyle.Alignment)
                    {
                    case DataGridViewContentAlignment.TopRight:
                    case DataGridViewContentAlignment.MiddleRight:
                    case DataGridViewContentAlignment.BottomRight:
                        rect.X += e.CellBounds.Width - rect.Width;
                        rect.X -= 1; // cell border width (required only for right alignment)
                        break;

                    case DataGridViewContentAlignment.TopCenter:
                    case DataGridViewContentAlignment.MiddleCenter:
                    case DataGridViewContentAlignment.BottomCenter:
                        rect.X += (e.CellBounds.Width - rect.Width) / 2;
                        break;
                    }

                    // Vertical alignment.
                    switch (e.CellStyle.Alignment)
                    {
                    case DataGridViewContentAlignment.MiddleLeft:
                    case DataGridViewContentAlignment.MiddleCenter:
                    case DataGridViewContentAlignment.MiddleRight:
                        rect.Y += (e.CellBounds.Height - rect.Height) / 2;
                        break;

                    case DataGridViewContentAlignment.BottomLeft:
                    case DataGridViewContentAlignment.BottomCenter:
                    case DataGridViewContentAlignment.BottomRight:
                        rect.Y += e.CellBounds.Height - rect.Height;
                        break;
                    }
                }
            }

            if (icon != null)
            {
                e.PaintBackground(e.CellBounds, true);
                e.Graphics.DrawImageUnscaledAndClipped(icon, rect);
                e.Handled = true;
            }
        }
Example #20
0
 /// <summary>
 /// Returns a value indicating whether the given image is animated.
 /// </summary>
 /// <param name="image">
 /// The <see cref="System.Drawing.Image"/> to test.
 /// </param>
 /// <returns>
 /// The true if the image is animated; otherwise, false.
 /// </returns>
 public static bool IsAnimated(Image image)
 {
     return(ImageAnimator.CanAnimate(image));
 }
Example #21
0
 /// <summary>
 /// Start animation
 /// </summary>
 public void StartAnimate()
 {
     ImageAnimator.Animate(Bitmap, OnFrameChanged);
 }
Example #22
0
 /// <summary>
 /// Returns a value indicating whether the given image is animated.
 /// </summary>
 /// <param name="image">
 /// The <see cref="System.Drawing.Image"/> to test.
 /// </param>
 /// <returns>
 /// The true if the image is animated; otherwise, false.
 /// </returns>
 public static bool IsAnimated(Image image) => ImageAnimator.CanAnimate(image);
Example #23
0
        public override void render(Graphics g)
        {
            if (WINNER != null)
            {
                g.DrawString(WINNER + "\nwon!", new Font("Arial", 100), new SolidBrush(Color.Red), stringdx++, 50);
            }

            for (int i = 0; i < DeathParticles.Count; i++)
            {
                try
                {
                    DeathParticles[i].AnimateBlood();
                    ImageAnimator.UpdateFrames();
                    g.DrawImage(DeathParticles[i].particle, DeathParticles[i].deathPos.X - this.width * 2,
                                DeathParticles[i].deathPos.Y - this.height);
                }
                catch (Exception e) { Console.WriteLine(e.StackTrace.ToString()); }
            }

            #region p1
            if (this.id == ObjectID.Player)
            {
                if (god)
                {
                    g.DrawEllipse(new Pen(new SolidBrush(Color.Red), 7), x, y, 35, 50);
                }

                if (this.gravity == 0.375f)
                {
                    g.DrawEllipse(new Pen(new SolidBrush(Color.Blue), 7), x, y, 35, 50);
                }

                if (dx != 0)
                {
                    if (facing == 1)
                    {
                        playerWalk.drawAnimation(g, (int)x, (int)y, 32, 44);
                    }

                    else
                    {
                        playerWalkLeft.drawAnimation(g, (int)x, (int)y, 32, 44);
                    }
                }
                else
                {
                    g.DrawImage(tex.player[0], (int)x, (int)y, 32, 44);
                }

                if (debugDrawings)
                {
                    g.DrawRectangle(new Pen(Color.Gray), (int)x, (int)y, 32, 44);
                    g.DrawRectangle(new Pen(Color.AliceBlue), getBounds());
                    g.DrawRectangle(new Pen(Color.DarkGreen), getBoundsTop());
                    g.DrawRectangle(new Pen(Color.Red), getBoundsRight());
                    g.DrawRectangle(new Pen(Color.Silver), getBoundsLeft());
                }
                g.DrawString(playerName, font, brush, new PointF(x - 5, y - 15));
            }
            #endregion
            else if (this.id == ObjectID.Player2)
            {
                if (debugDrawings)
                {
                    g.DrawRectangle(new Pen(Color.Gray), (int)x, (int)y, 48, 48);
                    g.DrawRectangle(new Pen(Color.AliceBlue), getBounds());
                    g.DrawRectangle(new Pen(Color.DarkGreen), getBoundsTop());
                    g.DrawRectangle(new Pen(Color.Red), getBoundsRight());
                    g.DrawRectangle(new Pen(Color.Silver), getBoundsLeft());
                }
                if (dx != 0)
                {
                    if (facing == 1)
                    {
                        p2Walk.drawAnimation(g, (int)x, (int)y, 48, 48);
                    }

                    else if (facing == -1)
                    {
                        p2WalkLeft.drawAnimation(g, (int)x, (int)y, 48, 48);
                    }
                }
                else
                {
                    g.DrawImage(tex.player2[0], (int)x, (int)y, 48, 44);
                }

                g.DrawString(player2Name, font, brush, new PointF(x - 5, y - 15));
            }
        }
Example #24
0
 /// <summary>
 /// Stop animation
 /// </summary>
 public void StopAnimate()
 {
     ImageAnimator.StopAnimate(this.gifBitmap, this.OnFrameChanged);
     this.Visibility = Visibility.Collapsed;
 }
 /// <summary>
 /// Stop animation
 /// </summary>
 public void StopAnimate()
 {
     ImageAnimator.StopAnimate(_bitmap, OnFrameChanged);
 }
Example #26
0
 protected override void OnLoad(EventArgs e)
 {
     bit = new Bitmap("loading_002.gif");
     ImageAnimator.Animate(bit, new EventHandler(this.OnFrameChanged));
     base.OnLoad(e);
 }
Example #27
0
        //关闭显示动画,该方法可以在winform关闭时,或者某个按钮的触发事件中进行调用,以停止渲染当前gif动画。

        private void StopAnimate()
        {
            ImageAnimator.StopAnimate(FGifImage, evtHandler);
        }
Example #28
0
        public override EffectLayer Render(IGameState gamestate)
        {
            EffectLayer image_layer = new EffectLayer();

            if (!String.IsNullOrWhiteSpace(Properties.ImagePath))
            {
                if (!_loaded_image_path.Equals(Properties.ImagePath))
                {
                    //Not loaded, load it!
                    if (!File.Exists(Properties.ImagePath))
                    {
                        throw new FileNotFoundException("Could not find file specified for layer: " + Properties.ImagePath);
                    }

                    _loaded_image      = new Bitmap(Properties.ImagePath);
                    _loaded_image_path = Properties.ImagePath;

                    if (Properties.ImagePath.EndsWith(".gif") && ImageAnimator.CanAnimate(_loaded_image))
                    {
                        ImageAnimator.Animate(_loaded_image, null);
                    }
                }

                if (Properties.ImagePath.EndsWith(".gif") && ImageAnimator.CanAnimate(_loaded_image))
                {
                    ImageAnimator.UpdateFrames(_loaded_image);
                }

                temp_layer = new EffectLayer("Temp Image Render");

                if (Properties.Sequence.type == KeySequenceType.Sequence)
                {
                    using (Graphics g = temp_layer.GetGraphics())
                    {
                        g.DrawImage(_loaded_image, new RectangleF(0, 0, Effects.canvas_width, Effects.canvas_height), new RectangleF(0, 0, _loaded_image.Width, _loaded_image.Height), GraphicsUnit.Pixel);
                    }

                    foreach (var key in Properties.Sequence.keys)
                    {
                        image_layer.Set(key, Utils.ColorUtils.AddColors(image_layer.Get(key), temp_layer.Get(key)));
                    }
                }
                else
                {
                    float x_pos  = (float)Math.Round((Properties.Sequence.freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width);
                    float y_pos  = (float)Math.Round((Properties.Sequence.freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height);
                    float width  = (float)Math.Round((double)(Properties.Sequence.freeform.Width * Effects.editor_to_canvas_width));
                    float height = (float)Math.Round((double)(Properties.Sequence.freeform.Height * Effects.editor_to_canvas_height));

                    if (width < 3)
                    {
                        width = 3;
                    }
                    if (height < 3)
                    {
                        height = 3;
                    }

                    Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height);

                    using (Graphics g = temp_layer.GetGraphics())
                    {
                        g.DrawImage(_loaded_image, rect, new RectangleF(0, 0, _loaded_image.Width, _loaded_image.Height), GraphicsUnit.Pixel);
                    }

                    using (Graphics g = image_layer.GetGraphics())
                    {
                        PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f));

                        Matrix myMatrix = new Matrix();
                        myMatrix.RotateAt(Properties.Sequence.freeform.Angle, rotatePoint, MatrixOrder.Append);

                        g.Transform = myMatrix;
                        g.DrawImage(temp_layer.GetBitmap(), rect, rect, GraphicsUnit.Pixel);
                    }
                }
            }

            return(image_layer);
        }
Example #29
0
 private static void Animate()
 {
     ImageAnimator.UpdateFrames();
 }
Example #30
0
 internal void StartAnimate()
 {
     ImageAnimator.Animate(this, OnFrameChanged);
     _isStart = true;
 }
Example #31
0
        protected override void OnPaint(PaintEventArgs e)
        {
            ImageAnimator.UpdateFrames();
            Graphics g = pictureBox3.CreateGraphics();

            g.DrawImage(this.bit, new Point(15, 10));//chu 13, 초기 picturebox3에 뜨는 gif
            base.OnPaint(e);



            ImageAnimator.UpdateFrames();
            Graphics t = pictureBox4.CreateGraphics();

            t.DrawImage(this.bit2, new Point(0, 0));//앤테이 1, 초기 picturebox4에 뜨는 gif
            base.OnPaint(e);



            Graphics y = pictureBox1.CreateGraphics();

            if (number == 0)
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit3, new Point(-50, 0));//chu 1, 초기 picturebox1에 뜨는 gif
                base.OnPaint(e);
            }
            else if (number == 1)
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit4, new Point(-50, 0));//chu 5, 피카츄 아이언테일 사용 시 picturebox1에 뜨는 gif
                base.OnPaint(e);
            }
            else if (number == 2)
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit5, new Point(-70, 0));//chu 3, 피카츄 전광석화 사용 시 picturebox에 뜨는 gif
                base.OnPaint(e);
            }
            else
            {
                ImageAnimator.UpdateFrames();
                y.DrawImage(this.bit6, new Point(-70, 0));//chu 4, 피카츄 백만볼트 사용 시 picturebox에 뜨는 gif
                base.OnPaint(e);
            }

            Graphics h = pictureBox2.CreateGraphics();

            if (number == 0)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit1, new Point(0, 0));//앤테이, 초기 picturebox2에 뜨는 gif
                base.OnPaint(e);
            }
            else if (number == 1)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit7, new Point(0, 0));//성스러운불꽃, 피카츄 아이언테일 사용 시 picturebox2에 뜨는 gif
                base.OnPaint(e);
            }
            else if (number == 2)
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit8, new Point(0, 0));//분연, 피카츄 전광석화 사용 시 picturebox2에 뜨는 gif
                base.OnPaint(e);
            }
            else
            {
                ImageAnimator.UpdateFrames();
                h.DrawImage(this.bit9, new Point(0, 0));//파괴광선1, 피카츄 백만볼트 사용 시 picturebox2에 뜨는 gif
                base.OnPaint(e);
            }
        }
Example #32
0
        private void LoadImage()
        {
            if (PreventLoadImage)
            {
                return;
            }

            ibMain.Text = "";

            if (!File.Exists(imagePath.FullName))
            {
                ibMain.Image = null;
                ImageShown   = false;
                OnImageUnload();
                Invalidate();
                //MessageBox.Show("invalid image");

                /*MessageBox.Show(this,
                 *  InternalSettings.Item_Does_Not_Exist_Message,
                 *  InternalSettings.Item_Does_Not_Exist_Title,
                 *  MessageBoxButtons.OK);
                 *
                 * Program.mainForm.CloseCurrentTabPage();
                 *
                 * // need to call this here to display the image
                 * // of the tab that gets selected after CloseCurrentTabPage
                 * if (Program.mainForm.CurrentPage != null)
                 *  Program.mainForm.CurrentPage.LoadImageSafe();
                 */
                ibMain.Text = "The Path: \n" + imagePath.FullName + "\nDoes Not Exists";
                return;
            }

            if (changingImagePath)
            {
                BitmapChangeTracker?.Clear();
            }

            if (BitmapChangeTracker.CurrentBitmap == null)
            {
                BitmapChangeTracker.CurrentBitmap = ImageHelper.LoadImage(ImagePath.FullName); //ImageHelper.LoadImageAsBitmap(imagePath.FullName);
                if (BitmapChangeTracker.CurrentBitmap == null || BitmapChangeTracker.CurrentBitmap.Image == null)
                {
                    ibMain.Image = null;
                    ImageShown   = false;
                    ibMain.Text  = "The Path: \n" + imagePath.FullName + "\nCould Not Be Loaded, The Image Is Invalid / Unsupported";
                    OnImageUnload();
                    Invalidate();
                }
            }

            if (InternalSettings.Show_Default_Transparent_Colors)
            {
                ibMain.GridColor          = InternalSettings.Default_Transparent_Grid_Color;
                ibMain.GridColorAlternate = InternalSettings.Default_Transparent_Grid_Color_Alternate;
            }
            else
            {
                ibMain.GridColor          = InternalSettings.Current_Transparent_Grid_Color;
                ibMain.GridColorAlternate = InternalSettings.Current_Transparent_Grid_Color_Alternate;
            }

            if (ImageAnimator.CanAnimate(BitmapChangeTracker.CurrentBitmap.Image))
            {
                int curFrame = 0;

                if (GifDecoder != null)
                {
                    curFrame = GifDecoder.ActiveFrameIndex;
                }

                GifDecoder = new GifDecoder(BitmapChangeTracker.CurrentBitmap as Gif);

                if (curFrame != 0)
                {
                    GifDecoder.SetFrame(curFrame);
                }
            }
            else
            {
                GifDecoder = null;
            }

            ibMain.Image = BitmapChangeTracker.CurrentBitmap;
            ImageShown   = true;

            OnImageLoad();
            Invalidate();
        }