public void Update(int number, EClip clip, PIGFile piggyFile) { isLocked = true; eclipID = number; this.clip = clip; this.piggyFile = piggyFile; //vclip specific data txtEffectFrameSpeed.Text = clip.Clip.FrameTime.ToString(); txtEffectTotalTime.Text = clip.Clip.PlayTime.ToString(); txtEffectLight.Text = clip.Clip.LightValue.ToString(); txtEffectFrameCount.Text = clip.Clip.NumFrames.ToString(); //eclip stuff cbEClipBreakEClip.SelectedIndex = clip.ExplosionEClip + 1; cbEClipBreakVClip.SelectedIndex = clip.ExplosionVClip + 1; txtEffectExplodeSize.Text = clip.ExplosionSize.ToString(); txtEffectBrokenID.Text = clip.DestroyedBitmapNum.ToString(); cbEClipBreakSound.SelectedIndex = clip.SoundNum + 1; cbEClipMineCritical.SelectedIndex = clip.CriticalClip + 1; FrameSpinner.Value = 0; UpdateEffectFrame(0); isLocked = false; }
public void UpdateEClipPanel(int num) { eclipPanel.Stop(); EClip clip = datafile.EClips[num]; eclipPanel.Update(num, clip, datafile.piggyFile); txtElemName.Text = datafile.EClipNames[num]; }
public EClip Clone() { EClip clip = (EClip)MemberwiseClone(); clip.Clip = clip.Clip.Clone(); return(clip); }
private void TMAPInfoEClip_SelectedIndexChanged(object sender, EventArgs e) { if (isLocked || transactionManager.TransactionInProgress) { return; } isLocked = true; int eclipNum = cbTexEClip.SelectedIndex - 1; EClip clip = datafile.GetEClip(eclipNum); TMAPInfo tmapInfo = datafile.TMapInfo[textureID]; TMapInfoEClipTransaction transaction = null; if (clip == null) { transaction = new TMapInfoEClipTransaction("TMapInfo EClip change", textureID, 0, datafile, piggyFile, textureID, -1); } else { int clipCurrentID = clip.ChangingWallTexture; if (clipCurrentID != -1 && clipCurrentID != textureID) { if (MessageBox.Show("This EClip is already assigned to another wall texture, do you want to change it?", "EClip in use", MessageBoxButtons.YesNo) == DialogResult.Yes) { transaction = new TMapInfoEClipTransaction("TMapInfo EClip change", textureID, 0, datafile, piggyFile, textureID, eclipNum); } else { cbTexEClip.SelectedIndex = tmapInfo.EClipNum + 1; isLocked = false; return; } } //this was commented out and I have no idea if there was a good reason for it else { transaction = new TMapInfoEClipTransaction("TMapInfo EClip change", textureID, 0, datafile, piggyFile, textureID, eclipNum); } } if (transaction != null) { transactionManager.ApplyTransaction(transaction); } isLocked = false; }
public override bool Apply() { lastTexture = datafile.Textures[deleteNum]; lastValue = datafile.TMapInfo[deleteNum]; datafile.Textures.RemoveAt(deleteNum); datafile.TMapInfo.RemoveAt(deleteNum); references.Clear(); if (datafile.Textures.Count != 0) { //Change every reference to the deleted element for (int i = 0; i < datafile.EClips.Count(); i++) { EClip temp = datafile.EClips[i].Clone(); //Change references that exactly reference the object to -1 if (datafile.EClips[i].ChangingObjectTexture == deleteNum) { datafile.EClips[i].ChangingWallTexture = -1; references.Add(new ChangedHAMReference(temp, datafile.EClips, i)); } //Change references to further elements by subtracting one else if (datafile.EClips[i].ChangingObjectTexture > deleteNum) { datafile.EClips[i].ChangingWallTexture--; references.Add(new ChangedHAMReference(temp, datafile.EClips, i)); } } for (int i = 0; i < datafile.TMapInfo.Count(); i++) { TMAPInfo temp = datafile.TMapInfo[i].Clone(); //Change references that exactly reference the object to -1 if (datafile.TMapInfo[i].DestroyedID == deleteNum) { datafile.TMapInfo[i].DestroyedID = -1; references.Add(new ChangedHAMReference(temp, datafile.TMapInfo, i)); } //Change references to further elements by subtracting one else if (datafile.TMapInfo[i].DestroyedID > deleteNum) { datafile.TMapInfo[i].DestroyedID--; references.Add(new ChangedHAMReference(temp, datafile.TMapInfo, i)); } } for (int i = 0; i < datafile.WClips.Count(); i++) { WClip temp = datafile.WClips[i].Clone(); bool change = false; //Change references that exactly reference the object to -1 for (int j = 0; j < datafile.WClips[i].NumFrames; j++) { if (datafile.WClips[i].Frames[j] == deleteNum) { datafile.WClips[i].Frames[j] = 0; change = true; } //Change references to further elements by subtracting one else if (datafile.WClips[i].Frames[j] > deleteNum) { datafile.WClips[i].Frames[j]--; change = true; } } if (change) { references.Add(new ChangedHAMReference(temp, datafile.WClips, i)); } } } return(true); }