LoadText() публичный Метод

public LoadText ( string text, bool skipZero = true ) : void
text string
skipZero bool
Результат void
Пример #1
0
    virtual protected FNode createTilemap(XMLNode node)
    {
        XMLNode csvData    = new XMLNode();
        XMLNode properties = new XMLNode();

        foreach (XMLNode child in node.children)
        {
            if (child.tagName == "data")
            {
                csvData = child;
            }
            else if (child.tagName == "properties")
            {
                properties = child;
            }
        }

        // make sure encoding is set to csv
        if (csvData.attributes["encoding"] != "csv")
        {
            Debug.Log("FTiledScene: Could not render layer data, encoding set to: " + csvData.attributes["encoding"]);
            return(null);
        }

        // remember name
        _layerNames.Add(node.attributes["name"]);

        // skipZero, if this is true all filled tiles will be drawn without clipping
        bool skipZero = false;

        // do stuff with properties
        foreach (XMLNode property in properties.children)
        {
            // check each property
            if (property.attributes["name"] == "skipZero")
            {
                skipZero = bool.Parse(property.attributes["value"]);
            }
        }

        // get text for csv data
        string csvText    = csvData.value;
        string firstFrame = csvText.Substring(0, csvText.IndexOf(','));
        int    firstID    = RemoveFrameFlags(uint.Parse(firstFrame));

        // find name of tileset being used, assumes all tiles are from the same tileset
        string baseName = this.getTilesetNameForID(firstID);

        // create tilemap
        FTilemap tilemap = new FTilemap(baseName);

        if (!skipZero)
        {
            tilemap.clipToScreen = true;
            tilemap.clipNode     = _clipNode;
        }
        tilemap.LoadText(csvText, skipZero);

        return(tilemap);
    }
    protected virtual FNode createTilemap(XMLNode node)
    {
        XMLNode csvData = new XMLNode();
        XMLNode properties = new XMLNode();
        foreach (XMLNode child in node.children) {
            if (child.tagName == "data") {
                csvData = child;
            } else if (child.tagName == "properties") {
                properties = child;
            }
        }

        // make sure encoding is set to csv
        if (csvData.attributes["encoding"] != "csv") {
            Debug.Log ("FTiledScene: Could not render layer data, encoding set to: " + csvData.attributes["encoding"]);
            return null;
        }

        // remember name
        _layerNames.Add (node.attributes["name"]);

        // skipZero, if this is true all filled tiles will be drawn without clipping
        bool skipZero = false;

        // do stuff with properties
        foreach (XMLNode property in properties.children) {
            // check each property
            if (property.attributes["name"] == "skipZero") {
                skipZero = bool.Parse(property.attributes["value"]);
            }
        }

        // get text for csv data
        string csvText = csvData.value;
        string firstFrame = csvText.Substring( 0, csvText.IndexOf(',') );
        int firstID = RemoveFrameFlags(uint.Parse(firstFrame));

        // find name of tileset being used, assumes all tiles are from the same tileset
        string baseName = this.getTilesetNameForID(firstID);

        // create tilemap
        FTilemap tilemap = new FTilemap(baseName);
        if (!skipZero) {
            tilemap.clipToScreen = true;
            tilemap.clipNode = _clipNode;
        }
        tilemap.LoadText(csvText, skipZero);

        return tilemap;
    }