示例#1
0
 private SVGPathElement(StrokeType type, bool rel)
 {
     StrokeType = type;
     Relative   = rel;
     if (type == StrokeType.Cubic)
     {
         points = new PointF[3];
     }
     else if (type == StrokeType.Quadratic)
     {
         points = new PointF[2];
     }
     else if (type == StrokeType.Arc)
     {
         points = new PointF[3];
     }
     else if (type == StrokeType.Z)
     {
         points = Array.Empty <PointF>();
     }
     else
     {
         points = new PointF[1];
     }
 }
        public static void GetStrokeStateInformation(Vector3 CenterPosition, float Distance, ConnectionDirection[] Connections, Vector3[] Directions, ModularStrokeSetData StrokeSet, System.Action <bool, StrokeType, int> Result)
        {
            if (Directions.Length > 0)                          // check if has any directions
            {
                float TotalAngles = 0f;                         // calculate total connection angles
                for (int i = 0; i < Directions.Length; i++)     // loop through all directions
                {
                    for (int x = 0; x < Directions.Length; x++) // loop through all directions
                    {
                        if (x != i)
                        {
                            TotalAngles += Vector3.Angle(Directions [i], Directions [x]);
                        }
                    }
                }                                                                                     // calculate angle and add to total angles

                StrokeType        Type     = (StrokeType)(int)(TotalAngles / Directions.Length);      // new stroke type
                IStrokeConnection SetPiece = StrokeSet.FindStrokePieceComponent(Type);

                if (SetPiece != null)
                {
                    int RotationY = CalculateMatchAngle(Connections, SetPiece.ConnectionDirections.ToArray());                     // calculate the angle to match
                    Result.Invoke(true, Type, RotationY);
                    return;
                }
            }
            Result.Invoke(false, StrokeType.Straight, 0);
        }
示例#3
0
 public void ConfigHeaders()
 {
     uiModel.currentMeta      = oneDollar.currentMeta;
     uiModel.strokeName       = uiModel.currentMeta.strokeName;
     uiModel.strokeLabel      = uiModel.currentMeta.strokeLabel;
     uiModel.descriptionIndex = uiModel.variantIndex = StrokeType.VariantNameToIndex(lastLoadedVariant);
     uiModel.variant          = uiModel.currentMeta.strokeVariants[uiModel.variantIndex];
     uiModel.description      = uiModel.currentMeta.description[uiModel.descriptionIndex];
 }
示例#4
0
        /// <summary>
        /// Stroke Property
        /// </summary>
        protected void GetChartElementStrokeTypeProperty()
        {
            propertyStrokeType = new ChartElementStrokeTypeProperty("Stroke Type");
            propertyStrokeType.ValuePresenter.Value = StrokeType.ToString();
            propertyStrokeType.SetChartElementPropertyValue
                += presenter =>
                {
                StrokeType = (LinePattern)System.Enum.Parse(typeof(LinePattern), presenter.Value.ToString()
#if SILVERLIGHT
                                                            , true
#endif
                                                            );
                SetStrokeType();
                };
        }
示例#5
0
        /// <summary>
        /// Compute a stroked open or closed path given a set of points and a <see cref="Pen"/>.
        /// </summary>
        /// <param name="pen">The pen to stroke the path with.</param>
        /// <param name="points">The points making up the ideal path.</param>
        /// <param name="lengths">The lengths of each point from the path start.</param>
        /// <param name="pathType">Whether the path is open or closed.</param>
        /// <param name="offset">The offset into the list of points that starts the path.</param>
        /// <param name="count">The number of points in the path.</param>
        public GraphicsPath(Pen pen, IList <CCVector2> points, IList <float> lengths, PathType pathType, int offset, int count)
            : this(pen)
        {
            _pointCount = count;
            _strokeType = StrokeType.Fill;

            switch (pathType)
            {
            case PathType.Open:
                CompileOpenPath(points, lengths, offset, count, null);
                break;

            case PathType.Closed:
                CompileClosedPath(points, lengths, offset, count, null);
                break;
            }
        }
示例#6
0
        /// <summary>
        /// Compute a stroked open or closed path given a set of points and a path and outline <see cref="Pen"/>.
        /// </summary>
        /// <param name="pen">The pen to stroke the path with.</param>
        /// <param name="outlinePen">The pen to stroke the outline of the path with.</param>
        /// <param name="points">The points making up the ideal path.</param>
        /// <param name="pathType">Whether the path is open or closed.</param>
        /// <param name="offset">The offset into the list of points that starts the path.</param>
        /// <param name="count">The number of points in the path.</param>
        /// <param name="strokeType">Whether to stroke just the path, the outline, or both.</param>
        public GraphicsPath(Pen pen, Pen outlinePen, IList <CCVector2> points, PathType pathType, int offset, int count, StrokeType strokeType)
            : this(pen)
        {
            _pointCount = count;
            _strokeType = strokeType;

            switch (pathType)
            {
            case PathType.Open:
                CompileOpenPath(points, null, offset, count, outlinePen);
                break;

            case PathType.Closed:
                CompileClosedPath(points, null, offset, count, outlinePen);
                break;
            }
        }
示例#7
0
    private UIVertex[] _polys = null;                 //四边形数组

    public void InitData(Vector2[] nodeList, float width, int smooth, bool isClose = false)
    {
        _polys = new UIVertex[4];
        if (nodeList == null || nodeList.Length < 1)
        {
            Debug.LogError("No node in nodeList.");
            return;
        }
        _nodeList = nodeList;
        if (_nodeList.Length == 1)
        {
            _strokeType = StrokeType.Point;
        }
        else if (_nodeList.Length == 2)
        {
            _strokeType = StrokeType.Line;
        }
        else
        {
            _strokeType = StrokeType.Curve;
        }
        _width = width;
        if (_strokeType == StrokeType.Line)
        {
            _smooth = 1;
        }
        else
        {
            _smooth = smooth;
        }
        _isClose = isClose;
        CalculateCurve();
        CalTangent();
        InitVT();
        if (_isClose && _verticesCurve != null && _verticesCurve.Length > 1)
        {
            _verticesCloseRingLast2 = new Vector3[]
            {
                _verticesCurve[_verticesCurve.Length - 2],
                _verticesCurve[_verticesCurve.Length - 1]
            };
            HandelClosedRing();
        }
        SetAllDirty();
    }
示例#8
0
    void getStroke()
    {
        //Clear stroke and strokes
        if (screenTouches.Count != 1)
        {
            stroke.getStrokePoints().Clear();
            strokes.Clear();
            strokeType = StrokeType.None;
            return;
        }
        //If it is the same frame, do not save the point
        if (lastFrame == screenTouches [0].getFrame())
        {
            return;
        }
        lastFrame = screenTouches [0].getFrame();


        //Set the start time
        if (stroke.getStrokePoints().Count == 0)
        {
            stroke.setStartTime(Time.time);
        }

        //Add touch point to the active stroke
        stroke.getStrokePoints().Add(screenTouches [0]);

        //If there are too few touch points
        if (stroke.getStrokePoints().Count < 5)
        {
            return;
        }

        //Check if the stroke reverse
        if (CheckReverse() == true)
        {
            //Set the end time
            stroke.setEndTime(Time.time);
//			print (stroke.getEndTime()-stroke.getStartTime());
            strokes.Add(stroke);
            stroke = new Stroke();
            stroke.setStartTime(Time.time);
            stroke.getStrokePoints().Add(screenTouches [0]);
        }
    }
示例#9
0
        private CanvasStrokeStyle StrokeStyle(StrokeType s)
        {
            var ss = _strokeStyle;

            if (s != Core.StrokeType.Filled)
            {
                var sc = s & Core.StrokeType.SC_Triangle;
                var dc = s & Core.StrokeType.DC_Triangle;
                var ec = s & Core.StrokeType.EC_Triangle;
                var ds = s & Core.StrokeType.Filled;

                ss.EndCap    = ec == Core.StrokeType.EC_Round ? CanvasCapStyle.Round : ec == Core.StrokeType.EC_Square ? CanvasCapStyle.Square : ec == Core.StrokeType.EC_Triangle ? CanvasCapStyle.Triangle : CanvasCapStyle.Flat;
                ss.DashCap   = dc == Core.StrokeType.DC_Round ? CanvasCapStyle.Round : dc == Core.StrokeType.DC_Square ? CanvasCapStyle.Square : dc == Core.StrokeType.DC_Triangle ? CanvasCapStyle.Triangle : CanvasCapStyle.Flat;
                ss.StartCap  = sc == Core.StrokeType.SC_Round ? CanvasCapStyle.Round : sc == Core.StrokeType.SC_Square ? CanvasCapStyle.Square : sc == Core.StrokeType.SC_Triangle ? CanvasCapStyle.Triangle : CanvasCapStyle.Flat;
                ss.DashStyle = ds == Core.StrokeType.Dotted ? CanvasDashStyle.Dot : ds == Core.StrokeType.Dashed ? CanvasDashStyle.Dash : CanvasDashStyle.Solid;
                ss.LineJoin  = CanvasLineJoin.Round;
            }
            return(ss);
        }
示例#10
0
    void checkCycloGesture()
    {
        //Fit the first stroke to ecclipse
        if (lastStrokesCount == 0 && strokes.Count == 1)
        {
            float eccentricity = FitStroke2Ellipse(strokes [0]);

            //Wait for the second reverse to activate cycloZoom
            if (eccentricity < 0.8 && eccentricity > 0)
            {
                strokeType = StrokeType.WaitZoom;
            }
            //Start the cyclopan
            if (eccentricity > 0.8 || eccentricity == 0)
            {
                strokeType = StrokeType.Pan;
            }
        }

        if (strokeType == StrokeType.Pan)
        {
            cycloPan();
        }

        //Activate the cyclozoom
        if (lastStrokesCount == 1 && strokes.Count == 2 && strokeType == StrokeType.WaitZoom)
        {
            strokeType = StrokeType.Zoom;
            FitStroke2Circle(strokes [0], strokes [1]);
        }

        //Fit the two last strokes to a circle, so the circle can be refreshed half a period
        if (strokeType == StrokeType.Zoom && strokes.Count >= 2 && lastStrokesCount != strokes.Count)
        {
            FitStroke2Circle(strokes [strokes.Count - 2], strokes [strokes.Count - 1]);
        }

        //Use the cyclozoom to change the scale
        if (strokeType == StrokeType.Zoom && strokes.Count >= 2 && stroke.getStrokePoints().Count >= 2)
        {
            cycloZoom();
        }
    }
示例#11
0
        DashStyle Translate(StrokeType st)
        {
            switch (st)
            {
            case (StrokeType.solid): return(DashStyle.Solid);

            case (StrokeType.custom): return(DashStyle.Custom);

            case (StrokeType.dash): return(DashStyle.Dash);

            case (StrokeType.dashdot): return(DashStyle.DashDot);

            case (StrokeType.dashdotdot): return(DashStyle.DashDotDot);

            case (StrokeType.dot): return(DashStyle.Dot);

            default: return(DashStyle.Solid);
            }
        }
示例#12
0
        public void SetType(StrokeType strokeType)
        {
            if (image == null)
            {
                return;
            }
            switch (strokeType)
            {
            case StrokeType.None:
                image.enabled = false;
                break;

            case StrokeType.Clean:
                image.enabled = true;
                image.sprite  = Utilities.FindSpriteCached("RoundRectSmallStroke");
                break;

            case StrokeType.Regular:
                image.enabled = true;
                image.sprite  = Utilities.FindSpriteCached("RoundRectBigStroke");
                break;
            }
        }
示例#13
0
        public void SetType(StrokeType strokeType)
        {
            if (image == null)
            {
                return;
            }
            switch (strokeType)
            {
            case StrokeType.None:
                image.enabled = false;
                break;

            case StrokeType.Clean:
                image.enabled = true;
                image.sprite  = Resources.FindObjectsOfTypeAll <Sprite>().Last(x => x.name == "RoundRectSmallStroke");
                break;

            case StrokeType.Regular:
                image.enabled = true;
                image.sprite  = Resources.FindObjectsOfTypeAll <Sprite>().Last(x => x.name == "RoundRectBigStroke");
                break;
            }
        }
示例#14
0
        /// <summary>
        /// Compute a stroked open or closed path given a set of points and a path and outline <see cref="Pen"/>.
        /// </summary>
        /// <param name="pen">The pen to stroke the path with.</param>
        /// <param name="outlinePen">The pen to stroke the outline of the path with.</param>
        /// <param name="points">The points making up the ideal path.</param>
        /// <param name="pathType">Whether the path is open or closed.</param>
        /// <param name="offset">The offset into the list of points that starts the path.</param>
        /// <param name="count">The number of points in the path.</param>
        /// <param name="strokeType">Whether to stroke just the path, the outline, or both.</param>
        public GraphicsPath (Pen pen, Pen outlinePen, IList<Vector2> points, PathType pathType, int offset, int count, StrokeType strokeType)
            : this(pen)
        {
            _pointCount = count;
            _strokeType = strokeType;

            switch (pathType) {
                case PathType.Open:
                    CompileOpenPath(points, null, offset, count, outlinePen);
                    break;

                case PathType.Closed:
                    CompileClosedPath(points, null, offset, count, outlinePen);
                    break;
            }
        }
示例#15
0
 public static Texture2D CreateStrokeSpriteFont(SpriteFont spriteFont, string text, Color textColor, Vector2 scale, int strokeSize, Color strokeColor, GraphicsDevice graphics, StrokeType strokeType = StrokeType.OutlineAndTexture)
 {
     using (var textTexture2D = DrawSpriteFontToTexture2D(spriteFont, text, textColor, scale, graphics))
     {
         return(CreateStroke(textTexture2D, strokeSize, strokeColor, graphics, strokeType));
     }
 }
示例#16
0
 /// <summary>
 /// Compute a stroked open or closed path given a set of points and a path and outline <see cref="Pen"/>.
 /// </summary>
 /// <param name="pen">The pen to stroke the path with.</param>
 /// <param name="outlinePen">The pen to stroke the outline of the path with.</param>
 /// <param name="points">The points making up the ideal path.</param>
 /// <param name="pathType">Whether the path is open or closed.</param>
 /// <param name="strokeType">Whether to stroke just the path, the outline, or both.</param>
 public GraphicsPath(Pen pen, Pen outlinePen, IList <CCVector2> points, PathType pathType, StrokeType strokeType)
     : this(pen, outlinePen, points, pathType, 0, points.Count, strokeType)
 {
 }
        private ModularPlacableObject PlaceObjectAt(Vector3 Position, Quaternion Rotation, StrokeType Type)
        {
            ModularPlacableObject Placable = ModularInstanceGetter.Invoke(Type); // get placable

            Placable.transform.rotation = Rotation;                              // set rotation
            Placable.Position           = Position;                              // set position
            return(Placable);
        }
示例#18
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);


            imgPixel = new Texture2D(GraphicsDevice, 1, 1);
            Color[] _Color = new Color[1];
            _Color[0] = Color.White;
            imgPixel.SetData(_Color);

            arialSpriteFont       = Content.Load <SpriteFont>("Arial");
            cooperBlackSpriteFont = Content.Load <SpriteFont>("CooperBlack");

            imgCheckBox        = Content.Load <Texture2D>("CheckBox");
            imgCheckBoxChecked = Content.Load <Texture2D>("CheckBox_Checked");

            imgCameraOriginal    = Content.Load <Texture2D>("camera");
            imgGlobeOriginal     = Content.Load <Texture2D>("globe");
            imgHeartOriginal     = Content.Load <Texture2D>("heart");
            imgImagePlusOriginal = Content.Load <Texture2D>("picture-plus");
            imgSurgeOriginal     = Content.Load <Texture2D>("surge");

            var pos = new Vector2(50, 50);

            imgObjTextType = CreateAndAddImageObject(new Drawables.Image(imgPixel, pos));
            pos.X         += 100;
            imgObjTextOutlineWithTextureCheckbox         = CreateAndAddImageObject(new Drawables.Image(imgPixel, pos));
            imgObjTextOutlineWithTextureCheckbox.OnClick = () =>
            {
                strokeType = StrokeType.OutlineAndTexture;
                UpdateTextureOutlines();
            };
            imgObjTextOutlineWithTexture = CreateAndAddImageObject(new Drawables.Image(imgPixel, pos + new Vector2(38, 0)));

            pos.Y += 40;
            imgObjTextOutlineWithoutTextureCheckbox         = CreateAndAddImageObject(new Drawables.Image(imgPixel, pos));
            imgObjTextOutlineWithoutTextureCheckbox.OnClick = () =>
            {
                strokeType = StrokeType.OutlineWithoutTexture;
                UpdateTextureOutlines();
            };
            imgObjTextOutlineWithoutTexture = CreateAndAddImageObject(new Drawables.Image(imgPixel, pos + new Vector2(38, 0)));

            pos = new Vector2(600, 15);

            CreateAndAddImageObject(new Drawables.Image(imgPixel, new Rectangle((int)pos.X - 30, (int)pos.Y, 2, 180)))
            .color = Color.Yellow;

            imgObjTextSize = new Drawables.Image(imgPixel, pos);
            drawList.Add(imgObjTextSize);
            pos.X += 80;
            var imgBtnMinus = Content.Load <Texture2D>("btnMinus");

            CreateAndAddImageObject(new Drawables.Image(imgBtnMinus, pos))
            .OnClick = () =>
            {
                strokeSize = Math.Max(strokeSize - 1, 0);
                UpdateTextureOutlines();
            };
            pos.X += 45;
            imgObjTextSizeNumber = new Drawables.Image(imgPixel, pos);
            drawList.Add(imgObjTextSizeNumber);
            pos.X += 40;
            var imgBtnPlus = Content.Load <Texture2D>("btnPlus");

            CreateAndAddImageObject(new Drawables.Image(imgBtnPlus, pos))
            .OnClick = () =>
            {
                strokeSize++;
                UpdateTextureOutlines();
            };

            pos = new Vector2(600, 80);

            imgObjTextColor = new Drawables.Image(imgPixel, pos);
            drawList.Add(imgObjTextColor);

            var posLeftColor = pos.X + 100;

            pos = new Vector2(posLeftColor, pos.Y);
            CreateSquareColor(pos, Color.White, true);
            pos.X += 45;
            CreateSquareColor(pos, Color.Yellow);
            pos.X += 45;
            CreateSquareColor(pos, Color.Black);
            pos.X += 45;
            CreateSquareColor(pos, Color.Red);
            pos.X += 45;
            CreateSquareColor(pos, Color.Blue);
            pos.X += 45;
            CreateSquareColor(pos, Color.Green);
            pos.X += 45;
            CreateSquareColor(pos, Color.Pink);
            pos.X  = posLeftColor;
            pos.Y += 45;
            CreateSquareColor(pos, Color.LightGray);
            pos.X += 45;
            CreateSquareColor(pos, Color.Gray);
            pos.X += 45;
            CreateSquareColor(pos, Color.DarkGray);
            pos.X += 45;
            CreateSquareColor(pos, Color.Olive);
            pos.X += 45;
            CreateSquareColor(pos, Color.Cyan);
            pos.X += 45;
            CreateSquareColor(pos, Color.Orange);
            pos.X += 45;
            CreateSquareColor(pos, Color.Purple);

            CreateAndAddImageObject(new Drawables.Image(imgPixel, new Rectangle(15, 195, 1000, 2)))
            .color = Color.Yellow;

            imgObjTextSprintFontStroke = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(25, 210)));
            imgObjTextSmall            = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(25, 260)));
            imgObjTextBigText          = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(25, 280)));

            CreateAndAddImageObject(new Drawables.Image(imgPixel, new Rectangle(15, 195, 1000, 2)))
            .color = Color.Yellow;

            CreateAndAddImageObject(new Drawables.Image(imgSurgeOriginal, new Vector2(850, 250)));
            imgObjSurge = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(900, 250)));

            var posY = 370;

            CreateAndAddImageObject(new Drawables.Image(imgHeartOriginal, new Vector2(50, posY)));
            imgObjHeart = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(100, posY)));

            CreateAndAddImageObject(new Drawables.Image(imgCameraOriginal, new Vector2(200, posY)));
            imgObjCamera = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(275, posY)));

            CreateAndAddImageObject(new Drawables.Image(imgImagePlusOriginal, new Vector2(50, posY + 75)));
            imgObjImagePlus = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(200, posY + 75)));

            CreateAndAddImageObject(new Drawables.Image(imgGlobeOriginal, new Vector2(440, posY)));
            imgObjGlobe = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(700, posY)));

            CreateAndAddImageObject(new Drawables.Image(imgPixel, new Rectangle(15, 630, 1000, 2)))
            .color = Color.Yellow;

            imgObjMultipleText = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(25, 640)));

            imgObjFpsText = CreateAndAddImageObject(new Drawables.Image(imgPixel, new Vector2(600, 660)));

            UpdateTextureOutlines();
        }
        public static Texture2D CreateStroke(Texture2D src, int size, Color color, GraphicsDevice graphics, StrokeType strokeType = StrokeType.OutlineAndTexture)
        {
#if ANDROID
            if (!MainThread.IsMainThread)
            {
                throw new Exception("To create a stroke effect, it must be running in the main thread");
            }
#endif

            lock (graphics)
            {
                var effect = GetEffectStroke(graphics);

                // create a render target with margins
                using (var renderTargetResize = new RenderTarget2D(graphics, src.Width + size * 2, src.Height + size * 2))
                {
                    graphics.SetRenderTarget(renderTargetResize);
                    graphics.Clear(Color.Transparent);

                    var spriteBatch = GetSpriteBatch(graphics);
                    // Create a new texture with the new size
                    spriteBatch.Begin();

                    // draw the texture with the margin
                    spriteBatch.Draw(src, new Vector2(size), Color.White);

                    spriteBatch.End();

                    var renderTarget = new RenderTarget2D(graphics, renderTargetResize.Width, renderTargetResize.Height);

                    // Apply my effect
                    effect.Parameters["textureSize"].SetValue(new Vector2(renderTargetResize.Width, renderTargetResize.Height));
                    effect.Parameters["outlineWidth"].SetValue(size);
                    effect.Parameters["outlineColor"].SetValue(color.ToVector4());
                    effect.Parameters["typeId"].SetValue((int)strokeType);

                    // Draw the img with the effect
                    graphics.SetRenderTarget(renderTarget);
                    graphics.Clear(Color.Transparent);

                    spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, effect);
                    spriteBatch.Draw(renderTargetResize, new Vector2(0, 0), Color.White);
                    spriteBatch.End();
                    graphics.SetRenderTarget(null);

                    return(renderTarget);
                }
            }
        }
示例#20
0
    void cycloPan()
    {
        Stroke  firstStroke = strokes [0];
        Vector2 startPoint  = firstStroke.getStrokePoints() [0].getTouchPosition();
        Vector2 endPoint    = firstStroke.getStrokePoints() [firstStroke.getStrokePoints().Count - 1].getTouchPosition();

        float dragDis   = Vector2.Distance(startPoint, endPoint);
        float dragSpeed = dragDis / (firstStroke.getEndTime() - firstStroke.getStartTime());

        //If the speed is not high enough, do not trigger the cyclopan
        if (dragSpeed < 50)
        {
            strokes.Clear();
            stroke.getStrokePoints().Clear();
            stroke     = new Stroke();
            strokeType = StrokeType.None;
        }
        else
        {
            //Get the average frequence of the last three strokes
            float frequenceAve = 0;
            int   strokeCount  = 0;
            for (int i = strokes.Count - 1; i >= 0; --i)
            {
                strokeCount++;
                float Te        = strokes [i].getEndTime() - strokes [i].getStartTime();
                float frequence = 0.5f / Te;

                if (strokeCount > 3)
                {
                    break;
                }
                frequenceAve += frequence;
            }
            frequenceAve /= strokeCount;


            //Get the gain
            float k    = 1.0f;
            float gain = Mathf.Max(1, k * frequenceAve);

            Vector2 lastPoint = lastScreenTouches [0].getTouchPosition();
            Vector2 point     = screenTouches [0].getTouchPosition();
            float   dis       = Vector2.Distance(lastPoint, point);

            //If the break time is bigger than the threshold value, cancel the cyclopan
            if (dis < 2)
            {
                breakTime += Time.time - lastTime;
                if (breakTime > 0.1)
                {
                    strokes.Clear();
                    stroke.getStrokePoints().Clear();
                    stroke     = new Stroke();
                    strokeType = StrokeType.None;
                }
            }
            else
            {
                breakTime = 0;

                float dragRange = gain * dis;

                Vector2 dragDirection = endPoint - startPoint;
                dragDirection.Normalize();

                GameObject cube = GameObject.Find("Cube");
                cube.transform.Translate(new Vector3(dragDirection.x * dragRange, 0, dragDirection.y * dragRange));
            }
        }
    }
示例#21
0
 /// <summary>
 /// Compute a stroked open or closed path given a set of points and a path and outline <see cref="Pen"/>.
 /// </summary>
 /// <param name="pen">The pen to stroke the path with.</param>
 /// <param name="outlinePen">The pen to stroke the outline of the path with.</param>
 /// <param name="points">The points making up the ideal path.</param>
 /// <param name="pathType">Whether the path is open or closed.</param>
 /// <param name="strokeType">Whether to stroke just the path, the outline, or both.</param>
 public GraphicsPath (Pen pen, Pen outlinePen, IList<Vector2> points, PathType pathType, StrokeType strokeType)
     : this(pen, outlinePen, points, pathType, 0, points.Count, strokeType)
 { }
示例#22
0
        /// <summary>
        /// Compute a stroked open or closed path given a set of points and a <see cref="Pen"/>.
        /// </summary>
        /// <param name="pen">The pen to stroke the path with.</param>
        /// <param name="points">The points making up the ideal path.</param>
        /// <param name="lengths">The lengths of each point from the path start.</param>
        /// <param name="pathType">Whether the path is open or closed.</param>
        /// <param name="offset">The offset into the list of points that starts the path.</param>
        /// <param name="count">The number of points in the path.</param>
        public GraphicsPath (Pen pen, IList<Vector2> points, IList<float> lengths, PathType pathType, int offset, int count)
            : this(pen)
        {
            _pointCount = count;
            _strokeType = StrokeType.Fill;

            switch (pathType) {
                case PathType.Open:
                    CompileOpenPath(points, lengths, offset, count, null);
                    break;

                case PathType.Closed:
                    CompileClosedPath(points, lengths, offset, count, null);
                    break;
            }
        }
示例#23
0
 public Keystroke(StrokeType type, AltoKey key)
 {
     Type = type;
     Key  = key;
 }
示例#24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StrokeInterval"/> struct.
 /// </summary>
 /// <param name="startIndex">The index of the firs element</param>
 /// <param name="endIndex">The index of the last element</param>
 /// <param name="strokeType">Type of the stroke.</param>
 public StrokeInterval(int startIndex, int endIndex, StrokeType strokeType)
 {
     this.StartIndex = startIndex;
     this.EndIndex   = endIndex;
     this.StrokeType = strokeType;
 }
 /// <summary>
 /// Set StrokeType field</summary>
 /// <param name="strokeType_">Nullable field value to be set</param>
 public void SetStrokeType(StrokeType? strokeType_)
 {
     SetFieldValue(49, 0, strokeType_, Fit.SubfieldIndexMainField);
 }
示例#26
0
 public StrokeDto GetStroke(int userId, StrokeType strokeType = StrokeType.Forehand, StrokeAngle strokeAngle = StrokeAngle.Front)
 {
     //todo:get from azure
     return(new StrokeDto());
 }
示例#27
0
 public StrokeDto GetStroke(int userId, StrokeType strokeType = StrokeType.Forehand, StrokeAngle strokeAngle = StrokeAngle.Front)
 {
     //todo:get from azure
     return new StrokeDto();
 }