Beispiel #1
0
        private static int GetColor(Shape.Types objType)
        {
            switch (objType)
            {
            case Shape.Types.I:
                return(1);

            case Shape.Types.J:
                return(2);

            case Shape.Types.L:
                return(3);

            case Shape.Types.NULL:
                return(0);

            case Shape.Types.S:
                return(4);

            case Shape.Types.SQUARE:
                return(1);

            case Shape.Types.T:
                return(5);

            case Shape.Types.Z:
                return(6);
            }

            return(0);
        }
        public static Shape DeserializeShape(BufferStream Buffer)
        {
            Shape.Types type = (Shape.Types)Buffer.ReadInt32();

            switch (type)
            {
            case Shape.Types.Circle:
                return(DeserializeCircleShape(Buffer));

            case Shape.Types.Polygon:
                return(DeserializePolygonShape(Buffer));
            }

            throw new Exception("Unknow shape type");
        }