diff --git a/DotNetCTFDumper/GUI/MainForm.cs b/DotNetCTFDumper/GUI/MainForm.cs index 634d575..b35e725 100644 --- a/DotNetCTFDumper/GUI/MainForm.cs +++ b/DotNetCTFDumper/GUI/MainForm.cs @@ -650,22 +650,35 @@ namespace DotNetCTFDumper.GUI } } } + + private bool breakAnim; + private bool isAnimRunning; private void advancedPlayAnimation_Click(object sender, EventArgs e) { if (((ChunkNode) advancedTreeView.SelectedNode).loader is Animation anim) { - var animThread = new Thread(PlayAnimation); - List frames = new List(); - foreach (var dir in anim.DirectionDict) + if (isAnimRunning) + { + breakAnim = true; + } + else { - foreach (var frame in dir.Value.Frames) + isAnimRunning = true; + var animThread = new Thread(PlayAnimation); + List frames = new List(); + foreach (var dir in anim.DirectionDict) { - frames.Add(Exe.Instance.GameData.GameChunks.GetChunk().Images[frame].Bitmap); + foreach (var frame in dir.Value.Frames) + { + frames.Add(Exe.Instance.GameData.GameChunks.GetChunk().Images[frame].Bitmap); + } + animThread.Start(new Tuple,AnimationDirection>(frames,dir.Value)); } - animThread.Start(new Tuple,AnimationDirection>(frames,dir.Value)); } + + } } @@ -674,13 +687,43 @@ namespace DotNetCTFDumper.GUI var (frames,anim) = (Tuple,AnimationDirection>) o; var fps = (float)anim.MaxSpeed; float delay = 1f/fps; - Console.WriteLine((int) (delay*1200)); - foreach (Bitmap frame in frames) + int i = 0; + if (anim.Repeat > 0) + { + foreach (Bitmap frame in frames) + { + advancedPictureBox.Image = frame; + advancedInfoLabel.Text = $"Current frame: {frames.IndexOf(frame)}\nAnimation Speed: {fps}"; + Thread.Sleep((int) (delay*1500)); + } + isAnimRunning = false; + Thread.CurrentThread.Abort(); + } + else { - advancedPictureBox.Image = frame; - advancedInfoLabel.Text = $"Current frame: {frames.IndexOf(frame)}\nAnimation Speed: {fps}"; - Thread.Sleep((int) (delay*1500)); + while (true) + { + var frame = frames[i]; + advancedPictureBox.Image = frame; + advancedInfoLabel.Text = $"Current frame: {i.ToString()}\nAnimation Speed: {fps}"; + Thread.Sleep((int) (delay*1500)); + i++; + if (i == frames.Count) i = 0; + if (breakAnim) + { + isAnimRunning = false; + breakAnim = false; + Thread.CurrentThread.Abort(); + break; + + } + + + } } + + //Limited + } diff --git a/DotNetCTFDumper/Settings.cs b/DotNetCTFDumper/Settings.cs index d8dc35b..e3da443 100644 --- a/DotNetCTFDumper/Settings.cs +++ b/DotNetCTFDumper/Settings.cs @@ -1,5 +1,4 @@ using System.IO; -using DotNetCTFDumper.Utils; namespace DotNetCTFDumper { @@ -32,12 +31,6 @@ namespace DotNetCTFDumper public static bool DoMFA; public static bool UseGUI; - public static string DumperVersion = "CTFAN 0.1.1-c Debug"; - - public static byte[] EncryptionKey=>Decryption.DecryptionKey; - - - - + public static string DumperVersion = "CTFAN 0.1.5-a Debug"; } } \ No newline at end of file