//================================================ // Clear Frame Button //================================================ private void Clear_Frame_Button_Click(object sender, EventArgs e) { m_AnimationFrameInfoList.RemoveAt(m_iCurrentFrameIndex); m_AnimationFrameInfoList.Insert(m_iCurrentFrameIndex, new AnimatedFrameInfo()); m_iCurrentlySelectedTextureID = -1; AnimationPanel.Invalidate(); }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { OpenFileDialog.FileName = ""; OpenFileDialog.Filter = "XML Files (*.xml)|*.xml"; if (OpenFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (ResetEverything()) { // Read XML m_oClassXML.ReadFromXML(OpenFileDialog.FileName); // Convert XML Animation To Editor Version m_AnimationFrameInfoList = ConvertListValuesBetweenGameandEditor(m_oClassXML.GetAnimFrameInfoList(), false); // Add In the Animation Frames to the List for (; AnimationFrames_Listview.Items.Count < m_AnimationFrameInfoList.Count;) { AnimationFrames_Listview.Items.Add("Frame" + (AnimationFrames_Listview.Items.Count + 1 < 10 ? "0" : "") + (AnimationFrames_Listview.Items.Count + 1).ToString()); } // Set Current Frame to Select and deselect Sprites m_iCurrentFrameIndex = 0; m_iCurrentlySelectedTextureID = -1; // Check Boxes As Appropriate Relative_to_Screen_Checkbox.Checked = m_oClassXML.GetRelativeToScreen(); // Update Panel AnimationPanel.Invalidate(); } } }
//================================================ // AnimationFrames_Listview ~ Changed Selection //================================================ private void AnimationFrames_Listview_SelectedIndexChanged(object sender, EventArgs e) { if (AnimationFrames_Listview.SelectedIndices.Count > 0) { // Set CurrentFrame Selected and Current Sprite Selection m_iCurrentFrameIndex = AnimationFrames_Listview.SelectedIndices[0]; m_iCurrentlySelectedTextureID = -1; // Modify the Main Controls display to current chosen options if (m_AnimationFrameInfoList.Count > m_iCurrentFrameIndex) { Tint_screen_Checkbox.Checked = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_bTintScreen; TintScreenRed_numericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintScreenRed; TintScreenGreen_numericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintScreenGreen; TintScreenBlue_numericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintScreenBlue; TintScreenAlpha_numericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintScreenAlpha; TintCharacter_CheckBox.Checked = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_bTintCharacter; TintCharacterRed_NumericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintCharacterRed; TintCharacterGreen_NumericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintCharacterGreen; TintCharacterBlue_NumericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintCharacterBlue; Sounds_ComboBox.Text = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_sSoundFilename; Sounds_ComboBox.Text = Sounds_ComboBox.Text != "" ? Sounds_ComboBox.Text : "(No Sound)"; WaitTime_NumericUpDown.Value = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iWaitTimeTillNextFrame; Animation_Partially_Completed_CheckBox.Checked = m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_bAnimationPartiallyCompleted; } // Update Panel AnimationPanel.Invalidate(); } }
//================================================ // Paste Frame Button //================================================ private void Paste_Frame_Button_Click(object sender, EventArgs e) { m_AnimationFrameInfoList.RemoveAt(m_iCurrentFrameIndex); m_AnimationFrameInfoList.Insert(m_iCurrentFrameIndex, CopyAnimFrameInfo(m_AnimFrameInfo_ClipboardCopy)); m_iCurrentlySelectedTextureID = -1; AnimationPanel.Invalidate(); }
//================================================ // Tint Screen Alpha ~ NumericUpDown //================================================ private void TintScreenAlpha_numericUpDown_ValueChanged(object sender, EventArgs e) { m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iTintScreenAlpha = (int)TintScreenAlpha_numericUpDown.Value; if (Tint_screen_Checkbox.Checked) { AnimationPanel.Invalidate(); } }
//================================================ // Texture Height ~ NumericUpDown //================================================ private void TextureHeight_NumericUpDown_ValueChanged(object sender, EventArgs e) { if (m_iCurrentlySelectedTextureID >= 0) { m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).H = (int)TextureHeight_NumericUpDown.Value; AnimationPanel.Invalidate(); } }
//==================================== // Move Sprite //==================================== private void MouseMoveSprite(int Mouse_X, int Mouse_Y) { int XPos = Mouse_X - (int)((m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).W *m_iZoom) * 0.5); int YPos = Mouse_Y - (int)((m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).H *m_iZoom) * 0.5); m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).X = XPos; m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).Y = YPos; AnimationPanel.Invalidate(); }
//================================================ // Remove Sprite Button //================================================ private void Remove_Sprite_Button_Click(object sender, EventArgs e) { if (m_iSpriteAddRemoveStatePlaceHolder == (uint)SpriteAddRemoveState.AddSpriteMode) { m_iSpriteAddRemoveStatePlaceHolder = (uint)SpriteAddRemoveState.RemoveSpriteMode; m_iCurrentlySelectedTextureID = -1; AnimationPanel.Invalidate(); } }
//================================================ // Remove Frame Button //================================================ private void Remove_Frame_Button_Click(object sender, EventArgs e) { AnimationFrames_Listview.Items.RemoveAt(AnimationFrames_Listview.Items.Count - 1); m_AnimationFrameInfoList.RemoveAt(m_iCurrentFrameIndex); if (m_iCurrentFrameIndex >= AnimationFrames_Listview.Items.Count) { m_iCurrentFrameIndex = AnimationFrames_Listview.Items.Count - 1; } m_iCurrentlySelectedTextureID = -1; AnimationPanel.Invalidate(); }
//================================================ // Swap Sprite Button //================================================ private void SwapSprite_Button_Click(object sender, EventArgs e) { if (m_iCurrentlySelectedTextureID >= 0) { string TextureName = GetImageNameByState(); Image Texture = GetImageFromList(TextureName); m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).TextureName = TextureName; m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).Texture = Texture; m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.ElementAt(m_iCurrentlySelectedTextureID).BlitRect = GetAnimationSpriteFullBlitRect(Texture); AnimationPanel.Invalidate(); } }
//==================================== // Add New Sprite //==================================== private void RemoveSpriteFromAnimationPanel(int iSelectedTexture) { if (iSelectedTexture >= 0) { m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList.RemoveAt(iSelectedTexture); foreach (SpriteInfo SprInfo in m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_SpriteInfoList) { if (SprInfo.ID > iSelectedTexture) { SprInfo.ID--; } } m_iCurrentlySelectedTextureID = -1; AnimationPanel.Invalidate(); } }
//==================================== // Play Complete Animation //==================================== private void PlayCompleteAnimation() { int iTempCurrentFrameIndexHolder = m_iCurrentFrameIndex; // Start at First Element m_iCurrentFrameIndex = 0; // Play Entire Animation while (m_iCurrentFrameIndex < m_AnimationFrameInfoList.Count) { AnimationPanel.Invalidate(); AnimationPanel.Update(); PlaySelectedSound(true); System.Threading.Thread.Sleep(m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_iWaitTimeTillNextFrame); m_iCurrentFrameIndex++; } // Go Back to Previously Selected Frame m_iCurrentFrameIndex = iTempCurrentFrameIndexHolder; AnimationPanel.Invalidate(); }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { ResetEverything(); AnimationPanel.Invalidate(); }
//================================================ // Tint Character ~ Checkbox //================================================ private void TintCharacter_CheckBox_CheckedChanged(object sender, EventArgs e) { m_AnimationFrameInfoList.ElementAt(m_iCurrentFrameIndex).m_bTintCharacter = TintCharacter_CheckBox.Checked; AnimationPanel.Invalidate(); }
//================================================ // Zoom ~ NumericUpDown //================================================ private void Zoom_NumericUpDown1_ValueChanged(object sender, EventArgs e) { m_iZoom = (int)Zoom_NumericUpDown1.Value; AnimationPanel.Invalidate(); }