Ejemplo n.º 1
0
 public override void Update(GameTime gameTime, Window Updater)
 {
     if (this.ContainsMouse)
     {
         SceneObject s = ReturnMouseOver(Updater);
         if (s != null)
         {
             if (MouseManager.MouseClicked)
             {
                 s.LeftClick(gameTime);
                 MouseManager.SetDraggedObject(s);
             }
             if (MouseManager.RMouseClicked)
             {
                 s.RightClick(gameTime);
             }
         }
     }
     base.Update(gameTime, Updater);
 }
        public static void Update(GameTime gameTime)
        {
#if WINDOWS
            if (Game1.self.IsActive)
            {
                MouseManager.Update(gameTime);
                KeyboardManager.Update(gameTime);
            }
#endif
            bool Loading = Level.LoadLevels();

#if EDITOR
#if !XBOX
            EditorManager.Update(gameTime);
#endif
#if XBOX
            RecieverManager.Update(gameTime);
#endif
#endif

#if !EDITOR
            GameManager.Update(gameTime);
#endif
        }
 public override Vector2 RightStickReset()
 {
     MouseManager.ResetMouse();
     return(MouseManager.MouseMovement / MouseDivide);
 }
        public override void Update(GameTime gameTime, Window Updater)
        {
            RelativeMouse = Updater.RelativeMousePoint;
            base.Update(gameTime, Updater);
            if (ContainsMouse)
            {
                GameObject MouseObject = ReturnMouseOver(Updater);
                HighlightedObject = MouseObject;

                if (MouseManager.MouseClicked)
                {
                    if (MouseObject != null)
                    {
                        bool ShouldSelect = !MouseObject.HierarchyDragRectangle.Contains(Updater.RelativeMousePoint);

                        if (KeyboardManager.ControlPressed())
                        {
                            if (MouseObject.EditorSelected)
                            {
                                ParentScene.RemoveSelected(MouseObject);
                            }
                            else
                            {
                                ParentScene.AddSelected(MouseObject);
                                MouseObject.LeftClick(gameTime);
                            }
                        }
                        else if (KeyboardManager.ShiftPressed())
                        {
                            ShiftSelect(MouseObject);
                            MouseObject.LeftClick(gameTime);
                        }
                        else
                        {
                            if (ShouldSelect)
                            {
                                ParentScene.ClearSelected();
                                ParentScene.AddSelected(MouseObject);
                                MouseObject.LeftClick(gameTime);
                            }
                            MouseManager.SetDraggedObject(MouseObject);
                        }

                        WorldViewer.self.NeedsToRedraw      = true;
                        ObjectProperties.self.NeedsToRedraw = true;
                    }
                }

                if (MouseManager.DraggedObject == null && MouseManager.PreviousDraggedObject != null && MouseManager.PreviousDraggedObject.GetType().IsSubclassOf(typeof(GameObject)))
                {
                    if (MouseObject != null && Updater.RelativeMousePoint.X < MouseObject.HierarchyBox.X + MouseObject.HierarchyBoxOutline.Width + 2)
                    {
                        MouseObject.HierarchyExpanded = !MouseObject.HierarchyExpanded;
                        MouseObject.ModifyCollection();
                    }
                    else if (MouseObject != null && MouseManager.PreviousDraggedObject != MouseObject)
                    {
                        GameObject g = MouseManager.PreviousDraggedObject as GameObject;
                        if (!g.HierarchyObjectIschild(MouseObject))
                        {
                            MouseObject.HierarchyExpanded = true;
                            MouseObject.AddHierarchyObject(g);
                        }
                    }
                }

                if (MouseManager.mouseState.RightButton == ButtonState.Pressed && MouseManager.mouseStatePrevious.RightButton == ButtonState.Released)
                {
                    if (MouseObject != null)
                    {
                        ParentScene.ClearSelected();
                        ParentScene.AddSelected(MouseObject);
                        MouseObject.RightClick(gameTime);

                        WorldViewer.self.NeedsToRedraw      = true;
                        ObjectProperties.self.NeedsToRedraw = true;
                        HierarchyViewer.self.NeedsToRedraw  = true;
                    }
                }
            }
            else
            {
                HighlightedObject = null;
            }
        }