本文整理汇总了C#中UnitPoint类的典型用法代码示例。如果您正苦于以下问题:C# UnitPoint类的具体用法?C# UnitPoint怎么用?C# UnitPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnitPoint类属于命名空间,在下文中一共展示了UnitPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onKillUnit
public static void onKillUnit(UnitPoint info)
{
if (EventControl.killUnit != null)
{
EventControl.killUnit (info);
}
}
示例2: Line
public Line(UnitPoint point, UnitPoint endpoint, float width, Color color)
{
P1 = point;
P2 = endpoint;
Width = width;
Color = color;
Selected = false;
}
示例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;
}
示例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);
}
示例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;
}
示例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));
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}