} //END SetBlockViewToParent //--------------------------------------------// /// <summary> /// Sends a command to the Blocks contained within all BlockViews /// </summary> /// <param name="commandType">The command to send to all of the Blocks contained within the BlockViews</param> /// <param name="impactBlockTypes">OPTIONAL: The types of blocks you wish to call this command</param> /// <param name="excludeBlockViews">OPTIONAL: Skip over these BlockViews</param> public void SendCommand( Block.CommandType commandType, List<Block.BlockType> impactBlockTypes = null, List<BlockView> excludeBlockViews = null, List<BlockGroup> excludeBlockGroups = null, List<Block> excludeBlocks = null ) //--------------------------------------------// { //Send this command to all of the block views if( blockViews != null && blockViews.Count > 0 ) { foreach( BlockView blockView in blockViews ) { if( blockView != null ) { //If we aren't excluding anything, //or our list of exclusions does not contain this, send the command if( excludeBlockViews == null || ( excludeBlockViews != null && !excludeBlockViews.Contains( blockView ) ) ) { //Send along our info on what blockTypes to effect. //Don't inform linkedBlockViews of this command, //as they will already recieve it from this function blockView.SendCommand( commandType, impactBlockTypes, excludeBlockGroups, excludeBlocks, false ); } } } } } //END SendCommand
} //END RemoveBlock //--------------------------------------------// /// <summary> /// Sends a command to all of the Blocks contained within this BlockGroup /// </summary> /// <param name="commandType">The command to send</param> /// <param name="impactBlockTypes">OPTIONAL: The type of blocks to affect with this command</param> /// <param name="exclusions">OPTIONAL: Exclude any of these Blocks from this command</param> /// <param name="sendToNestedBlockGroups">OPTIONAL: Should we send this command to any nested BlockGroups also?</param> public void SendCommand( Block.CommandType commandType, List<Block.BlockType> impactBlockTypes = null, List<Block> exclusions = null, bool sendToNestedBlockGroups = false ) //--------------------------------------------// { //Send this command to every block if( blocks != null && blocks.Count > 0 ) { foreach( Block block in blocks ) { if( block != null ) { //If we aren't excluding anything, //or our list of exclusions does not contain this, continue to send the command if( exclusions == null || ( exclusions != null && !exclusions.Contains( block ) ) ) { //Check the list of impacted block types, if the list is not null, //and this block's type is not included, then don't send it the message if( impactBlockTypes != null && impactBlockTypes.Count() > 0 && impactBlockTypes.Contains( block.GetBlockType() ) ) { block.SendCommand( commandType ); } //If the list of impacted block types is null or empty, //then we don't care what BlockType this block is, just send the command else if( impactBlockTypes == null || ( impactBlockTypes != null && impactBlockTypes.Count() == 0 ) ) { block.SendCommand( commandType ); } } } } } //If we were told to, then tell our nested block groups to also perform the command if( sendToNestedBlockGroups && nestedBlockGroups != null ) { foreach( BlockGroup blockGroup in nestedBlockGroups ) { if( blockGroup != null ) { blockGroup.SendCommand( commandType, impactBlockTypes, exclusions, false ); } } } } //END SendCommand