FTilemap.LoadCSV C# (CSharp) Method

LoadCSV() public method

public LoadCSV ( string textFile, bool skipZero = true ) : void
textFile string
skipZero bool
return void
    public void LoadCSV(string textFile, bool skipZero=true)
    {
        TextAsset dataAsset = (TextAsset) Resources.Load (textFile, typeof(TextAsset));
        if(!dataAsset) {
            Debug.Log ("FTilemap: Couldn't load the atlas data from: " + textFile);
        }
        string fileContents = dataAsset.ToString();
        Resources.UnloadAsset(dataAsset);

        this.LoadText(fileContents, skipZero);
    }

Usage Example

    // Use this for initialization
    void Start()
    {
        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(480.0f, 2.0f, 1.0f, "");
        fparams.origin          = new Vector2(0.5f, 0.5f);
        fparams.backgroundColor = new Color(0.15f, 0.15f, 0.3f);
        Futile.instance.Init(fparams);

        // load image atlas (within Resources/Atlases folder)
        Futile.atlasManager.LoadAtlas("Atlases/Burglar");

        // Add tilemap
        FTilemap room1 = new FTilemap("Burglar Walls");

        room1.LoadCSV("CSVs/Room1Map");         // load comma separated text file (within Resources/CSVs folder)
        room1.x  = -room1.width / 2;
        room1.y -= 4;
        Futile.stage.AddChild(room1);

        // create burglar
        burglar   = new FAnimatedSprite("Burglar");
        burglar.y = -24;
        int[] frames = { 1, 1, 2, 1, 1, 1, 10, 1, 11, 1 }; // idle anim
        burglar.addAnimation(new FAnimation("idle", frames, 400, true));
        int[] frames2 = { 3, 4, 5, 6, 4, 7 };              // run anim
        burglar.addAnimation(new FAnimation("run", frames2, 180, true));
        Futile.stage.AddChild(burglar);                    // add burglar to stage

        // load font atlas
        Futile.atlasManager.LoadAtlas("Atlases/Fonts");

        // Add large font text
        Futile.atlasManager.LoadFont("Large", "Large Font", "Atlases/Large Font", 0, 0);
        FLabel label1 = new FLabel("Large", "LARGE FONT");

        label1.y = 26;
        Futile.stage.AddChild(label1);

        // Add small font text
        Futile.atlasManager.LoadFont("Small", "Small Font", "Atlases/Small Font", 0, 0);
        FLabel label2 = new FLabel("Small", "Small Font");

        label2.y = 12;
        Futile.stage.AddChild(label2);

        // Add tiny font text
        Futile.atlasManager.LoadFont("Tiny", "Tiny Font", "Atlases/Tiny Font", 0, 0);
        FLabel label3 = new FLabel("Tiny", "Tiny Font");

        label3.y = 3;
        Futile.stage.AddChild(label3);
    }
All Usage Examples Of FTilemap::LoadCSV