private void removeSequence(CoronaSpriteSetSequence sequence) { this.stopAnimCurrentSequence(); if (sequence != null) { this.stopAnimCurrentSequence(); if (this.sequenceFrameListView.LargeImageList != null) { this.sequenceFrameListView.LargeImageList.Dispose(); } this.sequenceFrameListView.LargeImageList = null; this.sequenceFrameListView.BeginUpdate(); this.sequenceFrameListView.Items.Clear(); this.set.SequenceSelected = null; this.set.Sequences.Remove(sequence); this.refreshSpriteSetFramesListView(); this.sequenceFrameListView.EndUpdate(); } }
private void addSequenceBt_Click(object sender, EventArgs e) { if (this.set != null) { if (this.framesSetListView.SelectedIndices.Count > 0) { bool canCreate = true; int indexDepart = this.framesSetListView.SelectedIndices[0]; for (int i = 0; i < this.framesSetListView.SelectedIndices.Count; i++) { if (i != 0) { int indexPrevious = this.framesSetListView.SelectedIndices[i - 1]; int index = this.framesSetListView.SelectedIndices[i]; if (index - indexPrevious != 1) { canCreate = false; break; } } } if (canCreate == true) { this.stopAnimCurrentSequence(); CoronaSpriteSetSequence sequence = new CoronaSpriteSetSequence("sequence" + set.Sequences.Count, indexDepart + 1, this.framesSetListView.SelectedIndices.Count, 1000, 0); this.set.Sequences.Add(sequence); this.sequencesCmbBx.Items.Clear(); for (int i = 0; i < set.Sequences.Count; i++) { this.sequencesCmbBx.Items.Add(set.Sequences[i]); } this.sequencesCmbBx.SelectedIndex = set.Sequences.Count - 1; } else { MessageBox.Show("Can not create sequences with non-consecutive frames!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Please select Sprite set frame to create a new sequence!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void playAnimCurrentSequence() { stopAnimCurrentSequence(); if (this.set != null) { if (this.sequencesCmbBx.SelectedItem != null) { CoronaSpriteSetSequence sequence = (CoronaSpriteSetSequence)this.sequencesCmbBx.SelectedItem; this.set.SequenceSelected = sequence; this.set.playAnimation(this.animPictBx); } } }
private void sequencesCmbBx_SelectedIndexChanged(object sender, EventArgs e) { this.stopAnimCurrentSequence(); if (this.sequenceFrameListView.LargeImageList != null) { this.sequenceFrameListView.LargeImageList.Dispose(); } this.sequenceFrameListView.LargeImageList = null; this.sequenceFrameListView.BeginUpdate(); this.sequenceFrameListView.Items.Clear(); if (this.set != null) { if (this.sequencesCmbBx.SelectedItem != null) { CoronaSpriteSetSequence sequence = (CoronaSpriteSetSequence)this.sequencesCmbBx.SelectedItem; if (sequence != null) { ImageList sequenceFrames = new ImageList(); sequenceFrames.ImageSize = new Size(32, 32); this.sequenceFrameListView.LargeImageList = sequenceFrames; if (sequence.FrameDepart - 1 + sequence.FrameCount - 1 < set.Frames.Count) { for (int i = sequence.FrameDepart - 1; i < sequence.FrameDepart - 1 + sequence.FrameCount; i++) { SpriteFrame obj = set.Frames[i]; if (obj.Image != null) { sequenceFrames.Images.Add(obj.Image); ListViewItem item = new ListViewItem((i + 1).ToString(), sequenceFrames.Images.Count - 1); this.sequenceFrameListView.Items.Add(item); } } } SequencePropertyConverter seqProp = new SequencePropertyConverter(sequence); this.sequencePropGrid.SelectedObject = seqProp; this.set.SequenceSelected = sequence; } } } this.sequenceFrameListView.EndUpdate(); this.playAnimCurrentSequence(); }
private void removeSequence(CoronaSpriteSetSequence sequence) { this.stopAnimCurrentSequence(); if (sequence != null) { this.stopAnimCurrentSequence(); this.set.SequenceSelected = null; this.set.Sequences.Remove(sequence); this.refreshSpriteSetFramesListView(); } }
private void removeFrameBt_Click(object sender, EventArgs e) { if (this.set != null) { this.stopAnimCurrentSequence(); for (int i = 0; i < this.framesSetListView.SelectedItems.Count; i++) { SpriteFrame frame = (SpriteFrame)this.framesSetListView.SelectedItems[i].Tag; this.removeFrame(frame); List <CoronaSpriteSetSequence> sequencesToDelete = this.set.checkSequencesIntegrity(); if (sequencesToDelete != null) { for (int j = 0; j < sequencesToDelete.Count; j++) { CoronaSpriteSetSequence sequenceToDelete = sequencesToDelete[j]; this.removeSequence(sequenceToDelete); MessageBox.Show("The sequence named \"" + sequenceToDelete.Name + "\" has been automatically removed because it used a frame index that does not exist anymore!", "Sequence Integrity Corrupted", MessageBoxButtons.OK, MessageBoxIcon.Information); sequenceToDelete = null; } sequencesToDelete = null; } } this.refreshSpriteSetFramesListView(); //----- //DialogResult res = MessageBox.Show("Warning: All sequences of that sprite set need to be removed before be allowed to remove a frame!\n Continue?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question); //if (res == DialogResult.Yes) //{ // this.stopAnimCurrentSequence(); // this.set.Sequences.Clear(); // for (int i = 0; i < this.framesSetListView.SelectedItems.Count; i++) // { // SpriteFrame frame = (SpriteFrame)this.framesSetListView.SelectedItems[i].Tag; // this.removeFrame(frame); // } // this.refreshSpriteSetFramesListView(); //} } }
public SpriteSequencePropertyEditor(CoronaObject obj, IWindowsFormsEditorService editorServiceParam) { editorService = editorServiceParam; InitializeComponent(); // Add all groups from the scene List <CoronaSpriteSetSequence> sequences = obj.DisplayObject.SpriteSet.Sequences; this.Items.Add("DEFAULT"); for (int i = 0; i < sequences.Count; i++) { CoronaSpriteSetSequence sequence = sequences[i]; this.Items.Add(sequence.Name); } this.Refresh(); }
private void sequencesCmbBx_SelectedIndexChanged(object sender, EventArgs e) { this.stopAnimCurrentSequence(); if (this.set != null) { if (this.sequencesCmbBx.SelectedItem != null) { CoronaSpriteSetSequence sequence = (CoronaSpriteSetSequence)this.sequencesCmbBx.SelectedItem; if (sequence != null) { SequencePropertyConverter seqProp = new SequencePropertyConverter(sequence); this.sequencePropGrid.SelectedObject = seqProp; this.set.SequenceSelected = sequence; } } } this.playAnimCurrentSequence(); }
public SequencePropertyConverter(CoronaSpriteSetSequence seq) { this.seq = seq; }
public void removeFrame(int index) { if (this.sheet != null && this.mainForm.CurrentAssetProject != null) { AssetsToSerialize assetProject = this.mainForm.CurrentAssetProject; SpriteFrame frame = this.sheet.Frames[index]; this.sheet.Frames.Remove(frame); //Chercher toutes lespsriteSet utilisant cette frame for (int i = 0; i < assetProject.SpriteSets.Count; i++) { CoronaSpriteSet set = assetProject.SpriteSets[i]; List <SpriteFrame> framesToDelete = set.checkFramesIntegrity(); if (framesToDelete != null) { for (int j = 0; j < framesToDelete.Count; j++) { set.Frames.Remove(framesToDelete[j]); } framesToDelete = null; List <CoronaSpriteSetSequence> sequencesToDelete = set.checkSequencesIntegrity(); if (sequencesToDelete != null) { for (int j = 0; j < sequencesToDelete.Count; j++) { CoronaSpriteSetSequence sequenceToDelete = sequencesToDelete[j]; set.Sequences.Remove(sequenceToDelete); MessageBox.Show("The sequence named \"" + sequenceToDelete.Name + "\", located in the sprite set named \"" + set.Name + "\", has been automatically removed because it used a frame index that does not exist anymore!", "Sequence Integrity Corrupted", MessageBoxButtons.OK, MessageBoxIcon.Information); sequenceToDelete = null; } sequencesToDelete = null; } } } frame.Image.Dispose(); frame = null; //Chercher toutes lespsriteSet utilisant cette frame //for (int i = 0; i < assetProject.SpriteSets.Count; i++) //{ // bool hasFound = false; // CoronaSpriteSet set = assetProject.SpriteSets[i]; // for (int j = 0; j < set.Frames.Count; j++) // { // if (set.Frames[j] == frame) // { // hasFound = true; // break; // } // } // if (hasFound == true) // { // this.mainForm.removeSpriteSet(set); // } //} //frame.Image.Dispose(); //this.sheet.Frames.Remove(frame); //frame = null; } }