private static PathGeometry CreateArc(MiningModuleIntegrityBar a) { ArcSegment arc = new ArcSegment(); Point point = new Point(a.Radius, 0); a.CenterOfArc = new Point(0, 0); PathFigure figure = new PathFigure(); figure.StartPoint = point; arc = new ArcSegment(); arc.SweepDirection = SweepDirection.Clockwise; arc.IsLargeArc = true; arc.Size = new Size(a.Radius, a.Radius); arc.Point = a.ComputePointOnCircle(Math.PI * 2); a.SetArc(arc); figure.Segments.Add(arc); PathGeometry geom = new PathGeometry(); geom.Figures.Add(figure); geom.Transform = new TranslateTransform(a.Radius, a.Radius); return(geom); }
public static DrawingGroup CreateArcSegments(MiningModuleIntegrityBar arc) { DrawingGroup d = null; arc.SceneMgr.Invoke(new Action(() => { d = new DrawingGroup(); d.Children.Add(new GeometryDrawing(Brushes.Transparent, new Pen(new SolidColorBrush(arc.Color), 2), CreateArc(arc))); TransformGroup tg = new TransformGroup(); tg.Children.Add(new TranslateTransform(arc.Position.X, arc.Position.Y)); d.Transform = tg; })); return(d); }
public static MiningModuleIntegrityBar CreateMiningModuleIntegrityBar(SceneMgr mgr, MiningModule module, Player owner) { MiningModuleIntegrityBar arc = new MiningModuleIntegrityBar(mgr, IdMgr.GetNewId(mgr.GetCurrentPlayer().GetId())); arc.Color = owner.Data.SpecialColor; arc.Radius = module.Radius + 5; CenterCloneControl pControl = new CenterCloneControl(module); arc.AddControl(pControl); HpBarControl hControl = new HpBarControl(arc); module.AddControl(hControl); arc.SetGeometry(SceneGeometryFactory.CreateArcSegments(arc)); return(arc); }