/// <summary> /// Triggered when a token is removed from the board. /// </summary> public void OnTokenRemoved( object sender, TokenArgs args) { // Check to see if the token above is burning Token token = args.Token; if (args.IsBurnt) { // Show the burning state with a new sprite (which we // remove when it is done). BurntSprite bt = new BurntSprite(GetTokenSprite(token)); sprites.Add(bt); } // Get the token sprite ContainerSprite ms = GetContainerSprite(token); // Remove the sprites from the list sprites.Remove(ms); // Redraw the entire screen QueueDraw(); log.Debug("TokenRemoved: {0} count {1}", args.Token, sprites.Count); }
public void Remove(Sprite spriteToRemove) { if (spriteToRemove.ListsBelongingTo.Contains(mSprites)) { mSprites.Remove(spriteToRemove); } else { mZBufferedSprites.Remove(spriteToRemove); } }
private void saveButtonClick(Window callingWindow) { // If a user thinks he's funny and selects AllNotJoint for BodySprites // and AllNotBodySprites for Joints, let the user know he has to // specify some criteria. if (this.bodySpriteSelectionMethod.Text == "All Not Joint" && this.jointSpriteSelectionMethod.Text == "All Not Body") { GuiManager.ShowMessageBox( "Cannot select All Not Body for Joint Selection when " + "All Not Joint is selected for Body Sprite Selection. " + "Change one of the criteria and try to save again.", "Selection Error"); return; } double error = 0; SpriteList possibleSprites = new SpriteList(); if (this.sceneOrGroup.Text == "Entire Scene") { possibleSprites = GameData.Scene.Sprites; } else if (GameData.EditorLogic.CurrentSprites.Count != 0) { ((Sprite)GameData.EditorLogic.CurrentSprites[0].TopParent).GetAllDescendantsOneWay(possibleSprites); } #region Get rid of the Axes from the possibleSprites if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.zAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.zAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xRot)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xRot); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yRot)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yRot); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xScale)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xScale); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yScale)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yScale); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.origin)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.origin); } #endregion if (this.bodySpriteSelectionMethod.Text == "Name Includes") { this.bodySprites = possibleSprites.FindSpritesWithNameContaining(this.bodyNameToInclude.Text); } else if (this.bodySpriteSelectionMethod.Text == "By Texture") { this.bodySprites = possibleSprites.FindSpritesWithTexture( FlatRedBallServices.Load<Texture2D>(this.bodyAvailableTextures.Text, GameData.SceneContentManager)); } else if (this.bodySpriteSelectionMethod.Text == "All") { this.bodySprites = possibleSprites; } if (this.jointSpriteSelectionMethod.Text == "Name Includes") { this.joints = possibleSprites.FindSpritesWithNameContaining(this.jointNameToInclude.Text); } else if (this.jointSpriteSelectionMethod.Text == "By Texture") { this.joints = possibleSprites.FindSpritesWithTexture( FlatRedBallServices.Load<Texture2D>(this.jointAvailableTextures.Text, GameData.SceneContentManager)); } else if (this.jointSpriteSelectionMethod.Text == "All") { this.joints = possibleSprites; } try { if (bodySpriteSelectionMethod == null) System.Windows.Forms.MessageBox.Show("a"); if (this.bodySpriteSelectionMethod.Text == "All Not Joint") { this.bodySprites = new SpriteList(); if (possibleSprites == null) System.Windows.Forms.MessageBox.Show("b"); foreach (Sprite s in possibleSprites) { if (this == null) System.Windows.Forms.MessageBox.Show("c"); if (this.joints == null) System.Windows.Forms.MessageBox.Show("d"); if (this.bodySprites == null) System.Windows.Forms.MessageBox.Show("e"); if (!this.joints.Contains(s)) { this.bodySprites.Add(s); } } } } catch { error = 3.3; } if (this.jointSpriteSelectionMethod.Text == "All Not Body") { this.joints = new SpriteList(); foreach (Sprite s in possibleSprites) { if (!this.bodySprites.Contains(s)) { this.joints.Add(s); } } } if (this.rootSpriteComboBox.Text != "<No Root>") { this.root = possibleSprites.FindByName(this.rootSpriteComboBox.Text); } else { this.root = null; } FileButtonWindow.spriteRigOptionsOK(this); this.Visible = false; }
private void saveButtonClick(Window callingWindow) { // If a user thinks he's funny and selects AllNotJoint for BodySprites // and AllNotBodySprites for Joints, let the user know he has to // specify some criteria. if (this.bodySpriteSelectionMethod.Text == "All Not Joint" && this.jointSpriteSelectionMethod.Text == "All Not Body") { GuiManager.ShowMessageBox( "Cannot select All Not Body for Joint Selection when " + "All Not Joint is selected for Body Sprite Selection. " + "Change one of the criteria and try to save again.", "Selection Error"); return; } double error = 0; SpriteList possibleSprites = new SpriteList(); if (this.sceneOrGroup.Text == "Entire Scene") { possibleSprites = GameData.Scene.Sprites; } else if (GameData.EditorLogic.CurrentSprites.Count != 0) { ((Sprite)GameData.EditorLogic.CurrentSprites[0].TopParent).GetAllDescendantsOneWay(possibleSprites); } #region Get rid of the Axes from the possibleSprites if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.zAxis)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.zAxis); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xRot)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xRot); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yRot)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yRot); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.xScale)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.xScale); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.yScale)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.yScale); } if (possibleSprites.Contains(GameData.EditorLogic.EditAxes.origin)) { possibleSprites.Remove(GameData.EditorLogic.EditAxes.origin); } #endregion if (this.bodySpriteSelectionMethod.Text == "Name Includes") { this.bodySprites = possibleSprites.FindSpritesWithNameContaining(this.bodyNameToInclude.Text); } else if (this.bodySpriteSelectionMethod.Text == "By Texture") { this.bodySprites = possibleSprites.FindSpritesWithTexture( FlatRedBallServices.Load <Texture2D>(this.bodyAvailableTextures.Text, GameData.SceneContentManager)); } else if (this.bodySpriteSelectionMethod.Text == "All") { this.bodySprites = possibleSprites; } if (this.jointSpriteSelectionMethod.Text == "Name Includes") { this.joints = possibleSprites.FindSpritesWithNameContaining(this.jointNameToInclude.Text); } else if (this.jointSpriteSelectionMethod.Text == "By Texture") { this.joints = possibleSprites.FindSpritesWithTexture( FlatRedBallServices.Load <Texture2D>(this.jointAvailableTextures.Text, GameData.SceneContentManager)); } else if (this.jointSpriteSelectionMethod.Text == "All") { this.joints = possibleSprites; } try { if (bodySpriteSelectionMethod == null) { System.Windows.Forms.MessageBox.Show("a"); } if (this.bodySpriteSelectionMethod.Text == "All Not Joint") { this.bodySprites = new SpriteList(); if (possibleSprites == null) { System.Windows.Forms.MessageBox.Show("b"); } foreach (Sprite s in possibleSprites) { if (this == null) { System.Windows.Forms.MessageBox.Show("c"); } if (this.joints == null) { System.Windows.Forms.MessageBox.Show("d"); } if (this.bodySprites == null) { System.Windows.Forms.MessageBox.Show("e"); } if (!this.joints.Contains(s)) { this.bodySprites.Add(s); } } } } catch { error = 3.3; } if (this.jointSpriteSelectionMethod.Text == "All Not Body") { this.joints = new SpriteList(); foreach (Sprite s in possibleSprites) { if (!this.bodySprites.Contains(s)) { this.joints.Add(s); } } } if (this.rootSpriteComboBox.Text != "<No Root>") { this.root = possibleSprites.FindByName(this.rootSpriteComboBox.Text); } else { this.root = null; } FileButtonWindow.spriteRigOptionsOK(this); this.Visible = false; }