FromReducedLayer() static private method

static private FromReducedLayer ( TMXGlueLib reducedLayerInfo, LayeredTileMap owner, TMXGlueLib rtmi, string contentManagerName ) : MapDrawableBatch
reducedLayerInfo TMXGlueLib
owner LayeredTileMap
rtmi TMXGlueLib
contentManagerName string
return MapDrawableBatch
        public static LayeredTileMap FromReducedTileMapInfo(TMXGlueLib.DataTypes.ReducedTileMapInfo rtmi, string contentManagerName, string tilbToLoad)
        {
            var toReturn = new LayeredTileMap();

            string oldRelativeDirectory = FileManager.RelativeDirectory;

            FileManager.RelativeDirectory = FileManager.GetDirectory(tilbToLoad);

            MapDrawableBatch mdb;


            for (int i = 0; i < rtmi.Layers.Count; i++)
            {
                var reducedLayer = rtmi.Layers[i];

                mdb = MapDrawableBatch.FromReducedLayer(reducedLayer, contentManagerName, rtmi.CellWidthInPixels, rtmi.CellHeightInPixels, rtmi.QuadWidth, rtmi.QuadHeight);

                mdb.AttachTo(toReturn, false);
                mdb.RelativeZ = reducedLayer.Z;
                toReturn.mMapLists.Add(mdb);
            }
            FileManager.RelativeDirectory = oldRelativeDirectory;

            return(toReturn);
        }
Beispiel #2
0
        public static LayeredTileMap FromReducedTileMapInfo(TMXGlueLib.DataTypes.ReducedTileMapInfo rtmi, string contentManagerName, string tilbToLoad)
        {
            var toReturn = new LayeredTileMap();

            string oldRelativeDirectory = FileManager.RelativeDirectory;

            FileManager.RelativeDirectory = FileManager.GetDirectory(tilbToLoad);

            MapDrawableBatch mdb;

            if (rtmi.NumberCellsWide != 0)
            {
                toReturn.mNumberTilesWide = rtmi.NumberCellsWide;
            }

            if (rtmi.NumberCellsTall != 0)
            {
                toReturn.mNumberTilesTall = rtmi.NumberCellsTall;
            }

            toReturn.mWidthPerTile  = rtmi.QuadWidth;
            toReturn.mHeightPerTile = rtmi.QuadHeight;

            for (int i = 0; i < rtmi.Layers.Count; i++)
            {
                var reducedLayer = rtmi.Layers[i];

                mdb = MapDrawableBatch.FromReducedLayer(reducedLayer, rtmi, contentManagerName);

                mdb.AttachTo(toReturn, false);
                mdb.RelativeZ = reducedLayer.Z;
                toReturn.mMapLists.Add(mdb);
            }
            FileManager.RelativeDirectory = oldRelativeDirectory;

            return(toReturn);
        }