Ejemplo n.º 1
0
        private static void SerializeMapCellState(BinaryWriter Writer, MapCellState CellState)
        {
            if (CellState == null)
            {
                return;
            }

            MapWallState northWall = CellState.GetWall(MapDirection.North);
            MapWallState southWall = CellState.GetWall(MapDirection.South);
            MapWallState westWall  = CellState.GetWall(MapDirection.West);
            MapWallState eastWall  = CellState.GetWall(MapDirection.East);

            SerializeMapPlaceState(Writer, CellState.Place);

            if (northWall != null)
            {
                SerializeMapWallState(Writer, northWall);
            }
            if (southWall != null)
            {
                SerializeMapWallState(Writer, southWall);
            }
            if (westWall != null)
            {
                SerializeMapWallState(Writer, westWall);
            }
            if (eastWall != null)
            {
                SerializeMapWallState(Writer, eastWall);
            }
        }
        private List <FrameworkElement> RenderCell(MapCellState cell, Rect cellArea)
        {
            List <FrameworkElement> result = new List <FrameworkElement>();

            if (cell == null)
            {
                return(result);
            }

            result.Add(RenderPlace(cell.Place, cellArea));
            result.Add(RenderWall(cell.GetWall(MapDirection.South), cellArea));
            result.Add(RenderWall(cell.GetWall(MapDirection.West), cellArea));
            result.Add(RenderWall(cell.GetWall(MapDirection.North), cellArea));
            result.Add(RenderWall(cell.GetWall(MapDirection.East), cellArea));
            result.Add(RenderWallCorner(cell.GetWall(MapDirection.North), cell.GetWall(MapDirection.West), cellArea));
            result.Add(RenderWallCorner(cell.GetWall(MapDirection.North), cell.GetWall(MapDirection.East), cellArea));
            result.Add(RenderWallCorner(cell.GetWall(MapDirection.South), cell.GetWall(MapDirection.West), cellArea));
            result.Add(RenderWallCorner(cell.GetWall(MapDirection.South), cell.GetWall(MapDirection.East), cellArea));

            while (result.Remove(null))
            {
                ;
            }

            return(result);
        }
        private static void SerializeMapCellState(BinaryWriter Writer, MapCellState CellState)
        {
            if (CellState == null) return;

            MapWallState northWall = CellState.GetWall(MapDirection.North);
            MapWallState southWall = CellState.GetWall(MapDirection.South);
            MapWallState westWall = CellState.GetWall(MapDirection.West);
            MapWallState eastWall = CellState.GetWall(MapDirection.East);

            SerializeMapPlaceState(Writer, CellState.Place);

            if (northWall != null) SerializeMapWallState(Writer, northWall);
            if (southWall != null) SerializeMapWallState(Writer, southWall);
            if (westWall != null) SerializeMapWallState(Writer, westWall);
            if (eastWall != null) SerializeMapWallState(Writer, eastWall);
        }