Esempio n. 1
0
        public void DrawWidgets(NRenderPrimitiveDrawInterface PDI)
        {
            if (m_command == EditorCommand.TerrainMode)
            {
                TerrainEd.DrawWidgets(PDI);
            }
            else if (m_command == EditorCommand.NavigateMapMode)
            {
                if (NavigateMapEd != null)
                {
                    NavigateMapEd.DrawWidgets(PDI);
                }
            }

            ActorEd.DrawWidgets(PDI);
        }
 public void UnselectActor( ActorEd actor )
 {
     actor.IsSelected = false;
     _selectedActors.Remove( actor );
     Global.Properties.UnselectObject( actor.Properties );
     OnActorSelectionChanged( );
 }
        private ActorMode GetActorMode( ActorEd actor, float X, float Y )
        {
            int width = Consts.Viewport.ACTOR_SELECTION_EDGE_WIDTH;
            Vector2 pos = Helper.ScreenToWorldPosition( Camera, X, Y );
            if( actor != null )
            {
                RectangleF bounds = actor.Bounds;
                if( ( pos.X <= bounds.X + width && pos.Y <= bounds.Y + width ) ||         //Top-Left corner
                    ( pos.X <= bounds.X + width && pos.Y >= bounds.Bottom - width ) ||    //Bottom-Left corner
                    ( pos.X >= bounds.Right - width && pos.Y <= bounds.Y + width ) ||     //Top-Right corner
                    ( pos.X >= bounds.Right - width && pos.Y >= bounds.Bottom - width ) ) //Bottom-Right corner
                {
                    return ActorMode.Rotate;
                }

                if( pos.X <= bounds.X + width )
                    return ActorMode.ScaleLeft;
                else if( pos.Y <= bounds.Y + width )
                    return ActorMode.ScaleTop;
                else if( pos.X >= bounds.Right - width )
                    return ActorMode.ScaleRight;
                else if( pos.Y >= bounds.Bottom - width )
                    return ActorMode.ScaleBottom;
            }

            return ActorMode.Move;
        }
        public void SelectActor( ActorEd actor, bool addToSelection )
        {
            actor.IsSelected = true;
            if( !addToSelection )
            {
                UnselectAllActors( );
                Global.Properties.SelectObject( actor.Properties );
            }
            else
                Global.Properties.AddObjectToSelection( actor.Properties );

            _selectedActors.Add( actor );

            OnActorSelectionChanged( );
        }