• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# UnitPoint类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnitPoint的典型用法代码示例。如果您正苦于以下问题:C# UnitPoint类的具体用法?C# UnitPoint怎么用?C# UnitPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UnitPoint类属于命名空间,在下文中一共展示了UnitPoint类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: onKillUnit

 public static void onKillUnit(UnitPoint info)
 {
     if (EventControl.killUnit != null)
     {
         EventControl.killUnit (info);
     }
 }
开发者ID:Beugeny,项目名称:scripts,代码行数:7,代码来源:EventControl.cs


示例2: Line

 public Line(UnitPoint point, UnitPoint endpoint, float width, Color color)
 {
     P1 = point;
     P2 = endpoint;
     Width = width;
     Color = color;
     Selected = false;
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:8,代码来源:LineTool.cs


示例3: init

 public void init(int unitId, int team, Transform moveFinalTarget)
 {
     this.moveFinalTarget = moveFinalTarget;
     unitPoint = new UnitPoint();
     unitPoint.team = team;
     unitPoint.id = unitId;
     unitPoint.currentLife = unitPoint.info().life;
 }
开发者ID:Beugeny,项目名称:scripts,代码行数:8,代码来源:UnitController.cs


示例4: SetPosition

 public void SetPosition(UnitPoint pos)
 {
     if (Control.ModifierKeys == Keys.Control)
         pos = HitUtil.OrthoPointD(OtherPoint(m_pointId), pos, 45);
     if (m_angleLocked || Control.ModifierKeys == (Keys)(Keys.Control | Keys.Shift))
         pos = HitUtil.NearestPointOnLine(m_owner.P1, m_owner.P2, pos, true);
     SetPoint(m_pointId, pos, m_clone);
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:8,代码来源:LineTool.cs


示例5: SnapPointBase

 public SnapPointBase(ICanvas canvas, IDrawObject owner, UnitPoint snappoint)
 {
     m_owner = owner;
     m_snappoint = snappoint;
     float size = (float)canvas.ToUnit(14);
     m_boundingRect.X = (float)(snappoint.X - size / 2);
     m_boundingRect.Y = (float)(snappoint.Y - size / 2);
     m_boundingRect.Width = size;
     m_boundingRect.Height = size;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:10,代码来源:SnapPoints.cs


示例6: DrawNode

 static public void DrawNode(ICanvas canvas, UnitPoint nodepoint)
 {
     RectangleF r = new RectangleF(canvas.ToScreen(nodepoint), new SizeF(0, 0));
     r.Inflate(3, 3);
     if (r.Right < 0 || r.Left > canvas.ClientRectangle.Width)
         return;
     if (r.Top < 0 || r.Bottom > canvas.ClientRectangle.Height)
         return;
     canvas.Graphics.FillRectangle(Brushes.White, r);
     r.Inflate(1, 1);
     canvas.Graphics.DrawRectangle(Pens.Black, ScreenUtils.ConvertRect(r));
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:12,代码来源:DrawToolsUtils.cs


示例7: SetNewPoints

 public void SetNewPoints(DrawTools.Line l, UnitPoint hitpoint, UnitPoint intersectpoint)
 {
     SetLine(l);
     double hitToVp1 = HitUtil.Distance(hitpoint, l.P1); // hit point to vertex point
     double ispToVp1 = HitUtil.Distance(intersectpoint, l.P1); // intersect point to vertex point
     // if hit is closer than intersect point, then keep this point and adjust the other
     if (hitToVp1 <= ispToVp1)
         m_p2 = intersectpoint;
     else
         m_p1 = intersectpoint;
     ResetLine();
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:12,代码来源:LinesMeetEditTool.cs


示例8: DrawTriangleNode

        static public void DrawTriangleNode(ICanvas canvas, UnitPoint nodepoint)
        {
            PointF screenpoint = canvas.ToScreen(nodepoint);
            float size = 4;
            PointF[] p = new PointF[] 
			{
				new PointF(screenpoint.X - size, screenpoint.Y),
				new PointF(screenpoint.X, screenpoint.Y + size),
				new PointF(screenpoint.X + size, screenpoint.Y),
				new PointF(screenpoint.X, screenpoint.Y - size),
			};
            canvas.Graphics.FillPolygon(Brushes.White, p);
        }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:13,代码来源:DrawToolsUtils.cs


示例9: OnMouseMove

 public override void OnMouseMove(ICanvas canvas, UnitPoint point)
 {
     if (m_perSnap != null)
     {
         MouseMovePerpendicular(canvas, point);
         return;
     }
     if (m_tanSnap != null)
     {
         MouseMoveTangent(canvas, point);
         return;
     }
     base.OnMouseMove(canvas, point);
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:14,代码来源:LineTool.cs


示例10: GetObjectData

        /*
        public void GetObjectData(XmlWriter wr)
        {
            wr.WriteStartElement("line");
            XmlUtil.WriteProperties(this, wr);
            wr.WriteEndElement();
        }
        public void AfterSerializedIn()
        {
        }
         * */
        #endregion

        public void ExtendLineToPoint(UnitPoint newpoint)
        {
            UnitPoint newlinepoint = HitUtil.NearestPointOnLine(P1, P2, newpoint, true);
            if (HitUtil.Distance(newlinepoint, P1) < HitUtil.Distance(newlinepoint, P2))
                P1 = newlinepoint;
            else
                P2 = newlinepoint;
        }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:21,代码来源:LineTool.cs


示例11: InitializeFromModel

 public override void InitializeFromModel(UnitPoint point, DrawingLayer layer, ISnapPoint snap)
 {
     base.InitializeFromModel(point, layer, snap);
     m_perSnap = snap as PerpendicularSnapPoint;
     m_tanSnap = snap as TangentSnapPoint;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:6,代码来源:LineTool.cs


示例12: SnapPoint

        public ISnapPoint SnapPoint(ICanvas canvas, UnitPoint point, List<IDrawObject> otherobjs, Type[] runningsnaptypes, Type usersnaptype)
        {
            float thWidth = ThresholdWidth(canvas, Width);
            if (runningsnaptypes != null)
            {
                foreach (Type snaptype in runningsnaptypes)
                {
                    if (snaptype == typeof(VertextSnapPoint))
                    {
                        if (HitUtil.CircleHitPoint(m_p1, thWidth, point))
                            return new VertextSnapPoint(canvas, this, m_p1);
                        if (HitUtil.CircleHitPoint(m_p2, thWidth, point))
                            return new VertextSnapPoint(canvas, this, m_p2);
                    }
                    if (snaptype == typeof(MidpointSnapPoint))
                    {
                        UnitPoint p = MidPoint(canvas, m_p1, m_p2, point);
                        if (p != UnitPoint.Empty)
                            return new MidpointSnapPoint(canvas, this, p);
                    }
                    if (snaptype == typeof(IntersectSnapPoint))
                    {
                        Line otherline = Utils.FindObjectTypeInList(this, otherobjs, typeof(Line)) as Line;
                        if (otherline == null)
                            continue;
                        UnitPoint p = HitUtil.LinesIntersectPoint(m_p1, m_p2, otherline.m_p1, otherline.m_p2);
                        if (p != UnitPoint.Empty)
                            return new IntersectSnapPoint(canvas, this, p);
                    }
                }
                return null;
            }

            if (usersnaptype == typeof(MidpointSnapPoint))
                return new MidpointSnapPoint(canvas, this, HitUtil.LineMidpoint(m_p1, m_p2));
            if (usersnaptype == typeof(IntersectSnapPoint))
            {
                Line otherline = Utils.FindObjectTypeInList(this, otherobjs, typeof(Line)) as Line;
                if (otherline == null)
                    return null;
                UnitPoint p = HitUtil.LinesIntersectPoint(m_p1, m_p2, otherline.m_p1, otherline.m_p2);
                if (p != UnitPoint.Empty)
                    return new IntersectSnapPoint(canvas, this, p);
            }
            if (usersnaptype == typeof(VertextSnapPoint))
            {
                double d1 = HitUtil.Distance(point, m_p1);
                double d2 = HitUtil.Distance(point, m_p2);
                if (d1 <= d2)
                    return new VertextSnapPoint(canvas, this, m_p1);
                return new VertextSnapPoint(canvas, this, m_p2);
            }
            if (usersnaptype == typeof(NearestSnapPoint))
            {
                UnitPoint p = HitUtil.NearestPointOnLine(m_p1, m_p2, point);
                if (p != UnitPoint.Empty)
                    return new NearestSnapPoint(canvas, this, p);
            }
            if (usersnaptype == typeof(PerpendicularSnapPoint))
            {
                UnitPoint p = HitUtil.NearestPointOnLine(m_p1, m_p2, point);
                if (p != UnitPoint.Empty)
                    return new PerpendicularSnapPoint(canvas, this, p);
            }
            return null;
        }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:66,代码来源:LineTool.cs


示例13: Move

 public void Move(UnitPoint offset)
 {
     m_p1.X += offset.X;
     m_p1.Y += offset.Y;
     m_p2.X += offset.X;
     m_p2.Y += offset.Y;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:7,代码来源:LineTool.cs


示例14: SetPoint

 protected void SetPoint(ePoint pointid, UnitPoint point, Line line)
 {
     if (pointid == ePoint.P1)
         line.P1 = point;
     if (pointid == ePoint.P2)
         line.P2 = point;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:7,代码来源:LineTool.cs


示例15: OnMouseDown

 public virtual eDrawObjectMouseDown OnMouseDown(ICanvas canvas, UnitPoint point, ISnapPoint snappoint)
 {
     Selected = false;
     if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Line)
     {
         Line src = snappoint.Owner as Line;
         m_p2 = HitUtil.NearestPointOnLine(src.P1, src.P2, m_p1, true);
         return eDrawObjectMouseDown.DoneRepeat;
     }
     /*
     if (snappoint is PerpendicularSnapPoint && snappoint.Owner is Arc)
     {
         Arc src = snappoint.Owner as Arc;
         m_p2 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, m_p1, 0);
         return eDrawObjectMouseDown.DoneRepeat;
     }
      * */
     if (Control.ModifierKeys == Keys.Control)
         point = HitUtil.OrthoPointD(m_p1, point, 45);
     m_p2 = point;
     return eDrawObjectMouseDown.DoneRepeat;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:22,代码来源:LineTool.cs


示例16: MouseMoveTangent

 protected virtual void MouseMoveTangent(ICanvas canvas, UnitPoint point)
 {
     /*
     if (m_tanSnap.Owner is IArc)
     {
         IArc src = m_tanSnap.Owner as IArc;
         m_p1 = HitUtil.TangentPointOnCircle(src.Center, src.Radius, point, m_tanReverse);
         m_p2 = point;
         if (m_p1 == UnitPoint.Empty)
             m_p2 = m_p1 = src.Center;
     }
      * */
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:13,代码来源:LineTool.cs


示例17: PointInObject

 public bool PointInObject(ICanvas canvas, UnitPoint point)
 {
     float thWidth = ThresholdWidth(canvas, Width);
     return HitUtil.IsPointInLine(m_p1, m_p2, point, thWidth);
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:5,代码来源:LineTool.cs


示例18: MidPoint

 UnitPoint MidPoint(ICanvas canvas, UnitPoint p1, UnitPoint p2, UnitPoint hitpoint)
 {
     UnitPoint mid = HitUtil.LineMidpoint(p1, p2);
     float thWidth = ThresholdWidth(canvas, Width);
     if (HitUtil.CircleHitPoint(mid, thWidth, hitpoint))
         return mid;
     return UnitPoint.Empty;
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:8,代码来源:LineTool.cs


示例19: InitializeFromModel

 abstract public void InitializeFromModel(UnitPoint point, DrawingLayer layer, ISnapPoint snap);
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:1,代码来源:DrawToolsUtils.cs


示例20: MouseMovePerpendicular

 protected virtual void MouseMovePerpendicular(ICanvas canvas, UnitPoint point)
 {
     if (m_perSnap.Owner is Line)
     {
         Line src = m_perSnap.Owner as Line;
         m_p1 = HitUtil.NearestPointOnLine(src.P1, src.P2, point, true);
         m_p2 = point;
     }
     /*
     if (m_perSnap.Owner is IArc)
     {
         IArc src = m_perSnap.Owner as IArc;
         m_p1 = HitUtil.NearestPointOnCircle(src.Center, src.Radius, point, 0);
         m_p2 = point;
     }
      * */
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:17,代码来源:LineTool.cs



注:本文中的UnitPoint类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnitSelectionDelegate类代码示例发布时间:2022-05-24
下一篇:
C# UnitOfWorkScope类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap