private void AllFramesDirty(Animation ani) { if (ani != null) { ani.AllFramesDirty(); } }
private void LoadDirectory() { if (_currentPath != "") { Application.UseWaitCursor = true; toolStripStatusLabel1.Text = "Loading"; _characters.Clear(); try { Bitmap tmpBitmap; DirectoryInfo dir = new DirectoryInfo(_currentPath); foreach (FileInfo file in dir.GetFiles("*.png")) { string[] filenameparts = file.Name.Split(new char[] { '.' }); string[] elements = filenameparts[0].Split(new char[] { '_' }); if (elements.Length == 4) { Character character = _characters.FindByName(elements[0]); if (character == null) { character = new Character(elements[0]); _characters.Add(character); } Group group = character.Groups.FindByName(elements[1]); if (group == null) { group = new Group(elements[1]); character.Groups.Add(group); } Animation animation = group.Animations.FindByID(elements[2]); if (animation == null) { animation = new Animation(elements[2]); group.Animations.Add(animation); group.Animations.Sort(); } Frame frame = animation.Frames.FindByID(int.Parse(elements[3])); if (frame == null) { frame = new Frame(UInt16.Parse(elements[3])); frame.Path = file.FullName; animation.Frames.Add(frame); animation.Frames.Sort(); tmpBitmap = new Bitmap(_currentPath + "\\" + file.Name); frame.Width = (ushort)tmpBitmap.Width; frame.Height = (ushort)tmpBitmap.Height; } } else { // MessageBox.Show("Invalid Filename: " + file.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } LoadData(); Display(); SaveConfig(); } catch { MessageBox.Show("Error loading directory " + _currentPath, "Flipbook", MessageBoxButtons.OK, MessageBoxIcon.Error); } //finally //{ // //} Application.UseWaitCursor = false; toolStripStatusLabel1.Text = "Ready"; } }
private void DisplayAnimation(Animation ani) { timer1.Stop(); _currentAnimation = ani; _currentAnimation.AllFramesDirty(); ddbID.Text = _currentAnimation.ID.ToString(); txtAnimationFrames.Text = _currentAnimation.FrameCount.ToString(); // muss vor DisplayFrame gesetzt werden, sonst evtl Überlauf _updateSliderEventDisable = true; tbFramePosition.Value = 0; _updateSliderEventDisable = false; tbFramePosition.Maximum = _currentAnimation.FrameCount - 1; if (_currentAnimation.Frames.Count > 0) { if (_currentAnimation.LastSelectedFrame != null) { DisplayFrame(_currentAnimation.LastSelectedFrame); } else { DisplayFrame(_currentAnimation.Frames[0]); } } else { _currentFrame = null; } // muss nach DisplayFrame gesetzt werden, sonst mehrfaches BuildImage durch ValueChange-Ereignisse udAnimationPositionX.Value = _currentAnimation.PositionX; udAnimationPositionY.Value = _currentAnimation.PositionY; udAnimationDelay.Value = _currentAnimation.Delay; }
private void DisplayGroup(Group grp) { ddbGroup.Text = grp.Name; ddbID.DropDownItems.Clear(); ddbID.Text = ""; foreach (Animation ani in grp.Animations) { ToolStripMenuItem itm = new ToolStripMenuItem(); itm.DisplayStyle = ToolStripItemDisplayStyle.Text; itm.Text = ani.ID.ToString(); itm.Tag = ani; ddbID.DropDownItems.Add(itm); } if (grp.Animations.Count > 0) DisplayAnimation(grp.Animations[0]); else { _currentAnimation = null; ddbID.Text = "(none)"; } _currentGroup = grp; }
private void Display() { ddbCharacter.DropDownItems.Clear(); ddbCharacter.Text = "(none)"; ddbGroup.DropDownItems.Clear(); ddbGroup.Text = "(none)"; ddbID.DropDownItems.Clear(); ddbID.Text = "(none)"; _currentAnimation = null; _currentFrame = null; foreach (Character chr in _characters) { ToolStripMenuItem itm = new ToolStripMenuItem(); itm.DisplayStyle = ToolStripItemDisplayStyle.Text; itm.Text = chr.Name; itm.Tag = chr; ddbCharacter.DropDownItems.Add(itm); } if (_characters.Count > 0) DisplayCharacter(_characters[0]); else { ddbCharacter.Text = "(none)"; } }
public int IndexOf(Animation value) { return (base.IndexOf(value)); }
public int Add(Animation objItemToAdd) { return (base.Add(objItemToAdd)); }