コード例 #1
0
        protected override void OnLeftMouseClick(object sender, World3DClickEventArgs e)
        {
            base.OnLeftMouseClick(sender, e);
            if (this.GroundSpawnsService != null)
            {
                Point3D p = new Point3D(e.PointInWorld.X, e.PointInWorld.Y, e.PointInWorld.Z);
                if (Transform3D != null)
                {
                    Transform3D.TryTransform(p, out p);
                }

                if (Keyboard.IsKeyDown(Key.LeftAlt) && SelectedGroundSpawn != null)
                {
                    SelectedGroundSpawn.CenterPositionAt(new Point3D(p.X, p.Y, p.Z + ZAdjustment));
                    return;
                }

                if (e.CheckSelection != null)
                {
                    var selections = GroundSpawnsService.ZoneGroundSpawns.GroundSpawns.Where(x =>
                    {
                        var pt3d = new Point3D(x.MidPoint.X, x.MidPoint.Y, x.MaxZ);
                        pt3d = Transform3D.Transform(pt3d);
                        return e.CheckSelection(pt3d, 0);
                    });
                    if (selections.Count() > 0)
                    {
                        SelectedGroundSpawn = selections.ElementAt(0);

                        if (selections.Count() > 1)
                        {
                            SelectedGroundSpawns = selections;
                        }
                        else
                        {
                            SelectedGroundSpawns = null;
                        }
                        return;
                    }
                }

                var spawn = GroundSpawnsService.GetClosestGroundSpawn(p);
                if (spawn != null)
                {
                    SelectedGroundSpawn = spawn;
                    SelectedGroundSpawns = null;
                }
            }
        }
コード例 #2
0
        protected override void OnLeftMouseClick(object sender, World3DClickEventArgs e)
        {
            base.OnLeftMouseClick(sender, e);
            EQEmu.Grids.Waypoint waypoint = null;

            if (this.GridsService != null && SelectedGrid != null)
            {
                Point3D p = new Point3D(e.PointInWorld.X, e.PointInWorld.Y, e.PointInWorld.Z);
                if (Transform3D != null)
                {
                    Transform3D.TryTransform(p, out p);
                }

                //add a new waypoint
                if (Keyboard.IsKeyDown(Key.LeftShift) && SelectedGrid != null)
                {
                    waypoint = SelectedGrid.GetNewWaypoint();

                    waypoint.X = p.X; waypoint.Y = p.Y; waypoint.Z = p.Z + ZAdjustment;
                    SelectedGrid.AddWaypoint(waypoint);

                    //TODO 3d displayer needs to handle this, hack to update display
                    SelectedGrid = SelectedGrid;
                    SelectedWaypoint = waypoint;

                    return;
                }
                //adjust waypoint heading
                if (Keyboard.IsKeyDown(Key.LeftCtrl) && SelectedWaypoint != null)
                {
                    SelectedWaypoint.LookAt(p);

                    //TODO 3d displayer needs to handle this, hack to update display
                    waypoint = SelectedWaypoint;
                    SelectedGrid = SelectedGrid;
                    SelectedWaypoint = waypoint;

                    return;
                }

                if (Keyboard.IsKeyDown(Key.LeftAlt) && SelectedWaypoint != null)
                {
                    SelectedWaypoint.X = p.X; SelectedWaypoint.Y = p.Y; SelectedWaypoint.Z = p.Z + ZAdjustment;

                    //TODO more update hacks
                    waypoint = SelectedWaypoint;
                    SelectedGrid = SelectedGrid;
                    SelectedWaypoint = waypoint;
                }

                List<Waypoint> selectedWaypoints = new List<Waypoint>();
                foreach (var wp in SelectedGrid.Waypoints.Where(
                    x =>
                    {
                        var checkPt = new Point3D(x.X, x.Y, x.Z);
                        Transform3D.TryTransform(checkPt, out checkPt);
                        double dist = 5.0;
                        return e.CheckSelection(checkPt, dist);
                    }))
                {
                    selectedWaypoints.Add(wp);
                }

                if (selectedWaypoints.Count > 0)
                {
                    SelectedWaypoint = selectedWaypoints.ElementAt(0);
                    SelectedWaypoints = selectedWaypoints;
                }
                else
                {
                    waypoint = SelectedGrid.GetNearestWaypoint(p);
                    if (waypoint != null)
                    {
                        SelectedWaypoint = waypoint;
                        SelectedWaypoints = null;
                    }
                }
            }
        }