Example #1
0
        void SetControlData(int index)
        {
            if (index != -1)
            {
                TileLayerDeffination layer = tileMap.GetByOrder(index);

                txtCols.Text  = layer.Columns + "";
                txtRows.Text  = layer.Rows + "";
                txtSizeX.Text = layer.TileSize.X + "";
                txtSizeY.Text = layer.TileSize.Y + "";

                if (layer.Tiles != null)
                {
                    txtTilesX.Text = layer.Tiles[0].Length + "";
                    txtTilesY.Text = layer.Tiles.Count + "";
                }
                else
                {
                    txtTilesX.Text = "1";
                    txtTilesY.Text = "1";
                }

                grid.Columns = layer.Columns;
                grid.Rows    = layer.Rows;

                if (layer.NormalMapFilepath != "")
                {
                    grid.NormalMapFilepath = layer.NormalMapFilepath;
                }
                else
                {
                    grid.NormalMapFilepath = "null";
                }

                if (layer.TileSheetFilepath != "")
                {
                    grid.TileSheetFilepath = layer.TileSheetFilepath;
                }
                else
                {
                    grid.TileSheetFilepath = "null";
                }

                grid.SetSourceIndex(0);
            }
            else
            {
                txtCols.Text = "1";
                txtRows.Text = "1";

                txtSizeX.Text = "128";
                txtSizeY.Text = "128";

                txtTilesX.Text = "1";
                txtTilesY.Text = "1";

                grid.Columns = 1;
                grid.Rows    = 1;

                grid.TileSheetFilepath = "null";
                grid.NormalMapFilepath = "null";

                grid.SetSourceIndex(0);
            }
        }