コード例 #1
0
    public override bool doTool()
    {
        //  if( resources.getAssetPath( type ).Equals( "NULL" ) ) {
        if (resources.getAssetPath(type) == null)
        {
            removed = false;
        }
        else
        {
            for (int i = 0; i < adventureData.getArrows().Count; i++)
            {
                CustomArrow arrow = adventureData.getArrows()[i];
                if (arrow.getType().Equals(type))
                {
                    adventureData.getArrows().Remove(arrow);
                    break;
                }
            }
            removed = true;
        }
        bool done = base.doTool();

        if (!done)
        {
            return(false);
        }
        else
        {
            setArrow(type, resources.getAssetPath(type));
            return(true);
        }
    }
コード例 #2
0
 public override bool redoTool()
 {
     arrowDeleted = adventureData.getArrows()[index];
     adventureData.getArrows().RemoveAt(index);
     Controller.getInstance().updatePanel();
     return(true);
 }
コード例 #3
0
    public object Clone()
    {
        CustomArrow ca = (CustomArrow)this.MemberwiseClone();

        ca.path = (path != null ? path : null);
        ca.type = (type != null ? type : null);
        return(ca);
    }
コード例 #4
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--;
                }
            }
        }
    }
コード例 #5
0
    public override bool Equals(System.Object o)
    {
        if (o == null || !(o is CustomArrow))
        {
            return(false);
        }
        CustomArrow arrow = (CustomArrow)o;

        if (arrow.type.Equals(type))
        {
            return(true);
        }
        return(false);
    }
コード例 #6
0
    public void setArrow(string type, string path)
    {
        CustomArrow arrow = new CustomArrow(type, path);
        CustomArrow temp  = null;

        foreach (CustomArrow cb in adventureData.getArrows())
        {
            if (cb.Equals(arrow))
            {
                temp = cb;
            }
        }
        if (temp != null)
        {
            adventureData.getArrows().Remove(temp);
        }
        adventureData.addArrow(arrow);
    }
コード例 #7
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);
    }
コード例 #8
0
 public override bool doTool()
 {
     arrowDeleted = adventureData.getArrows()[index];
     adventureData.getArrows().RemoveAt(index);
     return(true);
 }
コード例 #9
0
    public void addArrow(string type, string path)
    {
        CustomArrow ca = new CustomArrow(type, path);

        arrows.Add(ca);
    }
コード例 #10
0
 public void addArrow(CustomArrow arrow)
 {
     arrows.Add(arrow);
 }
コード例 #11
0
 public void addArrow(string type, string path)
 {
     CustomArrow ca = new CustomArrow(type, path);
     arrows.Add(ca);
 }
コード例 #12
0
 public void addArrow(CustomArrow arrow)
 {
     arrows.Add(arrow);
 }