public abstract void Refresh(MapView m);
protected void DoDraw(MapView m, Graphics graphics, IEnumerable<Prop> props, IEnumerable<Server.Objects.Object> objects) { if (m.DisplayProps) foreach (Prop p in props) graphics.DrawEllipse(Pens.Purple, m.WorldToScreenX(p.position.X - p.MotionObject.Radius), m.WorldToScreenY(p.position.Y - p.MotionObject.Radius), m.SizeToScreenX(p.MotionObject.Radius * 2), m.SizeToScreenY(p.MotionObject.Radius * 2)); if (m.DisplayApparentSize) foreach (Server.Objects.Object v in objects) if (!v.IsDeleted) graphics.DrawEllipse(Pens.Orange, m.WorldToScreenX(v.Position.X - v.ObjectClass.VisibilityRange), m.WorldToScreenY(v.Position.Y - v.ObjectClass.VisibilityRange), m.SizeToScreenX(v.ObjectClass.VisibilityRange * 2), m.SizeToScreenY(v.ObjectClass.VisibilityRange * 2)); if (m.DisplaySightRange) foreach (Server.Objects.Object v in objects) if (!v.IsDeleted) graphics.DrawEllipse(Pens.Blue, m.WorldToScreenX(v.Position.X - v.ObjectClass.SightRange), m.WorldToScreenY(v.Position.Y - v.ObjectClass.SightRange), m.SizeToScreenX(v.ObjectClass.SightRange * 2), m.SizeToScreenY(v.ObjectClass.SightRange * 2)); foreach (Server.Objects.Object v in objects) if (!v.IsDeleted) { Brush p = new SolidBrush(Common.Int2Color.Conv(v.Team)); graphics.FillEllipse(p, m.WorldToScreenX(v.Position.X - v.ObjectClass.CollisionRadius), m.WorldToScreenY(v.Position.Y - v.ObjectClass.CollisionRadius), m.SizeToScreenX(v.ObjectClass.CollisionRadius * 2), m.SizeToScreenY(v.ObjectClass.CollisionRadius * 2)); } Pen arrowp = new Pen(Color.Black, 1); arrowp.StartCap = System.Drawing.Drawing2D.LineCap.Flat; arrowp.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; foreach (Server.Objects.Object v in objects) if (!v.IsDeleted) { arrowp.Color = Common.Int2Color.Conv(v.Team); if (v is Server.Objects.Unit && ((Server.Objects.Unit)v).Target != null) graphics.DrawLine(arrowp, m.WorldToScreenX(v.Position.X), m.WorldToScreenY(v.Position.Y), m.WorldToScreenX(((Server.Objects.Unit)v).Target.Position.X), m.WorldToScreenY(((Server.Objects.Unit)v).Target.Position.Y)); } foreach (Server.Objects.Object v in objects) if (!v.IsDeleted) { graphics.DrawLine(Pens.Black, m.WorldToScreenX(v.Position.X), m.WorldToScreenY(v.Position.Y), m.WorldToScreenX(v.Position.X + (float)Math.Cos(v.MotionObject.Orientation) * v.ObjectClass.CollisionRadius), m.WorldToScreenY(v.Position.Y + (float)Math.Sin(v.MotionObject.Orientation) * v.ObjectClass.CollisionRadius)); } }
public abstract void Draw(MapView m, Graphics graphics);
public override void Refresh(MapView m) { }
public override void Draw(MapView m, Graphics graphics) { DoDraw(m, graphics, MainWindow.Server.Props, MainWindow.Server.Objects.Values); }
public override void Refresh(MapView m) { List<Server.Objects.Object> os = new List<Server.Objects.Object>(); List<Prop> ps = new List<Prop>(); os.AddRange(MainWindow.Server.VicinityManager.InVisibleRange(Following)); os.Add(Following); ps.AddRange(MainWindow.Server.Props); m.objects = os; props = ps; m.Invalidate(); }
public override void Draw(MapView m, Graphics graphics) { DoDraw(m, graphics, props, m.objects); }