예제 #1
0
    /**
     * 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--;
                }
            }
        }
    }
예제 #2
0
    protected static ResourcesUni createResources(AdventureData adventureData, string type)
    {
        ResourcesUni resources  = new ResourcesUni();
        bool         introduced = false;

        for (int i = 0; i < adventureData.getArrows().Count; i++)
        {
            CustomArrow customArrow = adventureData.getArrows()[i];
            if (customArrow.getType().Equals(type))
            {
                resources.addAsset(type, customArrow.getPath());
                introduced = true;
                break;
            }
        }

        if (!introduced)
        {
            resources.addAsset(type, null);
        }

        return(resources);
    }