Пример #1
0
 protected bool DoConvertBackgroundRepeat(StyleBase onStyle, object value, out PatternRepeat result)
 {
     if (null == value)
     {
         result = PatternRepeat.RepeatBoth;
         return(false);
     }
     else if (CSSBackgroundRepeatParser.TryGetRepeatEnum(value.ToString(), out result))
     {
         return(true);
     }
     else
     {
         result = PatternRepeat.RepeatBoth;
         return(false);
     }
 }
Пример #2
0
    private PatternRepeat InitPatternTimeStamp(int i)
    {
        if (i >= owner.parts.Count && i < 0)
        {
            return(new PatternRepeat());
        }

        PatternRepeat repeat = new PatternRepeat();

        repeat.fireRoot       = owner.parts[i];
        repeat.count          = 10;
        repeat.delay          = 0.2f;
        repeat.target         = PlayerScript.player;
        repeat.bulletPrefab   = bulletPrefab;
        repeat.bulletSpeed    = 10f;
        repeat.deltaDirection = 90f;

        return(repeat);
    }
Пример #3
0
        protected static PDFBrush Create(FillStyle fill)
        {
            if (fill == null)
            {
                throw new ArgumentNullException("fill");
            }

            Drawing.FillType fillstyle;
            bool             fillstyledefined;
            string           imgsrc;
            double           opacity;
            PDFColor         color;

            if (fill.TryGetValue(StyleKeys.FillStyleKey, out fillstyle))
            {
                if (fillstyle == Drawing.FillType.None)
                {
                    return(null);
                }
                fillstyledefined = true;
            }
            else
            {
                fillstyledefined = false;
            }

            //If we have an image source and we are set to use an image fill style (or it has not been specified)
            if (fill.TryGetValue(StyleKeys.FillImgSrcKey, out imgsrc) && !string.IsNullOrEmpty(imgsrc) && (fillstyle == Drawing.FillType.Image || fillstyledefined == false))
            {
                PDFImageBrush img    = new PDFImageBrush(imgsrc);
                PatternRepeat repeat = fill.PatternRepeat;

                if (repeat == PatternRepeat.RepeatX || repeat == PatternRepeat.RepeatBoth)
                {
                    img.XStep = fill.PatternXStep;
                }
                else
                {
                    img.XStep = NoXRepeatStepSize;
                }

                if (repeat == PatternRepeat.RepeatY || repeat == PatternRepeat.RepeatBoth)
                {
                    img.YStep = fill.PatternYStep;
                }
                else
                {
                    img.YStep = NoYRepeatStepSize;
                }

                img.XPostion = fill.PatternXPosition;
                img.YPostion = fill.PatternYPosition;

                PDFUnit x, y;

                if (fill.TryGetValue(StyleKeys.FillXSizeKey, out x))
                {
                    img.XSize = x;
                }

                if (fill.TryGetValue(StyleKeys.FillYSizeKey, out y))
                {
                    img.YSize = y;
                }

                if (fill.TryGetValue(StyleKeys.FillOpacityKey, out opacity))
                {
                    img.Opacity = opacity;
                }

                return(img);
            }

            //if we have a colour and a solid style (or no style)
            else if (fill.TryGetValue(StyleKeys.FillColorKey, out color) && (fill.Style == Drawing.FillType.Solid || fillstyledefined == false))
            {
                PDFSolidBrush solid = new PDFSolidBrush(fill.Color);

                //if we have an opacity set it.
                if (fill.TryGetValue(StyleKeys.FillOpacityKey, out opacity))
                {
                    solid.Opacity = opacity;
                }

                return(solid);
            }
            else
            {
                return(null);
            }
        }