/** * Deletes a given asset from the script, removing all occurrences. * * @param assetPath * Path of the asset (relative to the ZIP), without suffix in * case of an animation or set of slides */ public void deleteAssetReferences(string assetPath) { if (assetPath != null) { // Firstly iterate arrows for (int i = 0; i < arrows.Count; i++) { CustomArrow arrow = arrows[i]; if (arrow.getPath() != null && arrow.getPath().Equals(assetPath)) { arrow.setPath(null); } if (arrow.getSoundPath() != null && arrow.getSoundPath().Equals(assetPath)) { arrow.setSoundPath(null); } if (arrow.getPath() == null && arrow.getSoundPath() == null) { arrows.RemoveAt(i); i--; } } // Secondly iterate buttons for (int i = 0; i < buttons.Count; i++) { CustomButton button = buttons[i]; if (button.getPath() != null && button.getPath().Equals(assetPath)) { button.setPath(null); } if (button.getSoundPath() != null && button.getSoundPath().Equals(assetPath)) { button.setSoundPath(null); } if (button.getPath() == null && button.getSoundPath() == null) { arrows.RemoveAt(i); i--; } } // Finally iterate cursors for (int i = 0; i < cursors.Count; i++) { CustomCursor cursor = cursors[i]; if (cursor.getPath() != null && cursor.getPath().Equals(assetPath)) { cursors.RemoveAt(i); i--; } } } }