protected override bool OnMouseDown(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseDown(button);

            if (button == EMouseButtons.Left)
            {
                if (GetPositionByCursor(out startPosition))
                    pathTest = true;
            }

            if (button == EMouseButtons.Right)
            {
                MapObject mapObject = GetMapObjectByCursor();
                if (mapObject != null)
                {
                    UnitAttack(mapObject);
                }
                else
                {
                    Vec3 position;
                    if (GetPositionByCursor(out position))
                        UnitMove(position);
                }
            }

            return base.OnMouseDown(button);
        }
        protected override bool OnMouseDown( EMouseButtons button )
        {
            if( button == EMouseButtons.Left )
                ToggleEntity();

            return base.OnMouseDown( button );
        }
        protected override bool OnMouseUp(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseUp(button);

            return base.OnMouseUp(button);
        }
Esempio n. 4
0
 protected override bool OnMouseDown( EMouseButtons button )
 {
     if( button == EMouseButtons.Left || button == EMouseButtons.Right )
     {
         Destroy( true );
         return true;
     }
     return base.OnMouseDown( button );
 }
		protected override bool OnMouseDown( EMouseButtons button )
		{
			if( button == EMouseButtons.Left )
			{
				if( GetPositionByCursor( out startPosition ) )
					pathTest = true;
			}
			return base.OnMouseDown( button );
		}
Esempio n. 6
0
        protected override bool OnMouseDown(EMouseButtons button)
        {
            //If you click out side the inventory box, and have selected an item, drop that item
            if (GetPlayerUnit().Inventory.CurrentHoldItem != String.Empty)
            {
                Vec2i windowSize = EngineApp.Instance.VideoMode.Size;

                float ix = hudControl.Controls["Inventory"].Position.Value.X * windowSize.X;
                float iy = hudControl.Controls["Inventory"].Position.Value.Y * windowSize.Y;

                float mx = MousePosition.X * windowSize.X;
                float my = MousePosition.Y * windowSize.Y;

                float iw = hudControl.Controls["Inventory"].Size.Value.X;
                float ih = hudControl.Controls["Inventory"].Size.Value.Y;

                if (!(ix < mx && mx < ix + iw &&
                      iy < my && my < iy + ih))
                {
                    //Show item
                    GetPlayerUnit().Inventory.dropItem(GetPlayerUnit(), hudControl);

                    //Make selected icon to mouse
                    ScreenControlManager.Instance.DefaultCursor = @"Cursors\default.png";
                }
            }

            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseDown(button);

            //currentAttachedGuiObject
            if (currentAttachedGuiObject != null)
            {
                currentAttachedGuiObject.ControlManager.DoMouseDown(button);
                return true;
            }

            //GameControlsManager
            if (EntitySystemWorld.Instance.Simulation)
            {
                if (GetRealCameraType() != CameraType.Free && !IsCutSceneEnabled())
                {
                    if (GameControlsManager.Instance.DoMouseDown(button))
                        return true;
                }
            }

            return base.OnMouseDown(button);
        }
 public SystemKeyboardMouseValue(SystemKeyboardMouseValue source)
 {
     type = source.Type;
     key = source.Key;
     mouseButton = source.MouseButton;
     scrollDirection = source.scrollDirection;
     strength = source.strength;
     _parent = source.Parent;
 }
        /// <summary>
        /// Sends the notice on pressing a mouse button.
        /// </summary>
        /// <param name="button">A value indicating which button was clicked.</param>
        /// <returns><b>true</b> if such system key is used; otherwise, <b>false</b>.</returns>
        public bool DoMouseDown(EMouseButtons button)
        {
            bool handled = false;

            GameControlsManager.SystemKeyboardMouseValue key;
            if (GameControlsManager.Instance.IsAlreadyBinded(button, out key))
            {
                if (GameControlsEvent != null)
                    GameControlsEvent(new GameControlsKeyDownEventData(key.Parent.ControlKey, 1));
                handled = true;
            }

            return handled;
        }
Esempio n. 9
0
        protected override bool OnMouseDown( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDown( button );

            switch( button )
            {
            case EMouseButtons.Left:
                {
                    tryingToMovePiece = GetPieceByCursor();
                    if( tryingToMovePiece != null )
                    {
                        if( EntitySystemWorld.Instance.IsServer() )
                        {
                            //server
                            GameNetworkServer server = GameNetworkServer.Instance;
                            tryingToMovePiece.Server_MoveBegin( server.UserManagementService.ServerUser );
                        }
                        else if( EntitySystemWorld.Instance.IsClientOnly() )
                        {
                            //client
                            tryingToMovePiece.Client_MoveTryToBegin();
                        }
                        else
                        {
                            //single mode
                            tryingToMovePiece.Single_MoveBegin();
                        }

                        Vec2 cursorPosition;
                        GetGameAreaCursorPosition( out cursorPosition );
                        tryingToMovePieceOffset = tryingToMovePiece.Position.ToVec2() - cursorPosition;
                        return true;
                    }
                }
                break;
            }

            return base.OnMouseDown( button );
        }
Esempio n. 10
0
 public bool IsButtonDown(EMouseButtons mb)
 {
     return(IsMouseButtonState(mb, ButtonState.Pressed, mCurrentMouseState));
 }
Esempio n. 11
0
 protected virtual bool OnMouseDoubleClick(Viewport viewport, EMouseButtons button)
 {
     return(false);
 }
        protected override bool OnMouseUp( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseUp( button );

            //currentAttachedGuiObject
            if( currentAttachedGuiObject != null )
                currentAttachedGuiObject.ControlManager.DoMouseUp( button );

            //GameControlsManager
            GameControlsManager.Instance.DoMouseUp( button );

            return base.OnMouseUp( button );
        }
Esempio n. 13
0
 public InputMessageMouseButtonUp(EMouseButtons button)
     : base(button)
 {
 }
Esempio n. 14
0
 protected virtual bool OnMouseUp(Viewport viewport, EMouseButtons button)
 {
     return(false);
 }
Esempio n. 15
0
 protected InputMessageMouseButton(EMouseButtons button)
 {
     this.button = button;
 }
Esempio n. 16
0
 public InputMessageMouseDoubleClick(EMouseButtons button)
     : base(button)
 {
 }
Esempio n. 17
0
 public bool IsButtonUp(EMouseButtons mb)
 {
     return(IsMouseButtonState(mb, ButtonState.Released, mCurrentMouseState));
 }
Esempio n. 18
0
        protected override bool OnMouseDown( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDown( button );

            if( base.OnMouseDown( button ) )
                return true;

            //free camera rotating
            if( FreeCameraEnabled )
            {
                if( button == EMouseButtons.Right )
                {
                    freeCameraMouseRotating = true;
                    freeCameraRotatingStartPos = EngineApp.Instance.MousePosition;
                }
            }

            return true;
        }
Esempio n. 19
0
        protected override bool OnMouseUp( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseUp( button );

            //do tasks
            if( ( button == EMouseButtons.Right || button == EMouseButtons.Left ) &&
                ( !FreeCameraMouseRotating || !EngineApp.Instance.MouseRelativeMode ) )
            {
                bool pickingSuccess = false;
                Vec3 mouseMapPos = Vec3.Zero;
                Unit mouseOnObject = null;

                //pick on active area
                if( IsMouseInActiveArea() )
                {
                    //get pick information
                    Ray ray = RendererWorld.Instance.DefaultCamera.GetCameraToViewportRay(
                        EngineApp.Instance.MousePosition );
                    if( !float.IsNaN( ray.Direction.X ) )
                    {
                        RayCastResult result = PhysicsWorld.Instance.RayCast( ray,
                            (int)ContactGroup.CastOnlyContact );
                        if( result.Shape != null )
                        {
                            pickingSuccess = true;
                            mouseOnObject = MapSystemWorld.GetMapObjectByBody( result.Shape.Body ) as Unit;
                            mouseMapPos = result.Position;
                        }
                    }
                }

                //pick on minimap
                if( minimapControl.GetScreenRectangle().IsContainsPoint( MousePosition ) )
                {
                    pickingSuccess = true;
                    Vec2 pos = GetMapPositionByMouseOnMinimap();
                    mouseMapPos = new Vec3( pos.X, pos.Y, GridPathFindSystem.Instance.GetMotionMapHeight( pos ) );
                }

                if( pickingSuccess )
                {
                    //do tasks
                    if( TaskTargetChooseIndex != -1 )
                    {
                        if( button == EMouseButtons.Left )
                            DoTaskTargetChooseTasks( mouseMapPos, mouseOnObject );
                        if( button == EMouseButtons.Right )
                            TaskTargetChooseIndex = -1;
                    }
                    else
                    {
                        if( button == EMouseButtons.Right )
                            DoRightClickTasks( mouseMapPos, mouseOnObject );
                    }
                }
            }

            //select mode
            if( selectMode && button == EMouseButtons.Left )
                DoEndSelectMode();

            //minimap mouse change camera position
            if( minimapChangeCameraPosition )
                minimapChangeCameraPosition = false;

            return base.OnMouseUp( button );
        }
        protected override bool OnMouseDoubleClick( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDoubleClick( button );

            //currentAttachedGuiObject
            if( currentAttachedGuiObject != null )
            {
                currentAttachedGuiObject.ControlManager.DoMouseDoubleClick( button );
                return true;
            }

            return base.OnMouseDoubleClick( button );
        }
Esempio n. 21
0
        protected override bool OnMouseDown( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDown( button );

            if( !FreeCameraEnabled && button == EMouseButtons.Left )
            {
                if( IsCursorOverCatapult() )
                {
                    catapultFiring = true;
                    catapultFiringMouseStartPosition = MousePosition;
                    return true;
                }
            }

            if( button == EMouseButtons.Right )
            {
                //remove all CatapultBullet

                List<Entity> list = new List<Entity>();
                foreach( Entity entity in Map.Instance.Children )
                {
                    if( entity.Type.Name == "CatapultGame_CatapultBullet" )
                        list.Add( entity );
                }

                foreach( Entity entity in list )
                    entity.SetForDeletion( true );

            }

            return base.OnMouseDown( button );
        }
        protected override bool OnMouseUp(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseUp(button);

            //GameControlsManager
            GameControlsManager.Instance.DoMouseUp(button);

            return base.OnMouseUp(button);
        }
Esempio n. 23
0
 public virtual bool OnMouseDoubleClick(EMouseButtons button)
 {
     return(false);
 }
Esempio n. 24
0
        protected override bool OnMouseDown(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
            {
                return(base.OnMouseDown(button));
            }

            if (IsMouseInControlArea())
            {
                if (button == EMouseButtons.Left)
                {
                    if (hudControl.selectedUnit != null)
                    {
                        Dynamic   curObj    = GetObject();
                        RTSUnitAI intellect = hudControl.selectedUnit.Intellect as RTSUnitAI;

                        switch (CursorState)
                        {
                        case State.Target:
                            if (curObj != null)
                            {
                                CursorState = State.HUDDefault;
                                intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Attack, curObj), false);
                            }
                            break;

                        case State.Use:
                            if (curObj as Unit == null)
                            {
                                //inventory item?
                                intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Use, curObj), false);



                                /*
                                 *  //PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Loot);
                                 *  intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Stop), false);
                                 * else if (curObj as VBItem != null)
                                 *  intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.PickUp, curObj), false);
                                 * else
                                 *  intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Stop), false);
                                 *  //PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Interact);
                                 */
                            }
                            break;

                        case State.HUDDefault:
                            if (curObj != null)
                            {
                                /*PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Interact);
                                 * RTSCharacter ch = curObj as RTSCharacter;
                                 * if (ch != null)
                                 * {
                                 *  string msg = "{0} has {1} hit points and is armed with {2}";
                                 *  Log.Info(msg + ".", ch.GetName(), (int)ch.Life, ch.ActiveHeldItem.Type.Name);
                                 * }
                                 */
                            }
                            break;

                        case State.Walk:
                            intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Move, MapPos()), false);
                            //PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Move);
                            break;

                        default:
                            if (curObj != null /*&& curObj != PlayerIntellect.Instance.ControlledObject*/)
                            {
                                VBCharacter tmpEnt = curObj as VBCharacter;
                                if (tmpEnt != null)
                                {
                                    intellect.DoTask(new RTSUnitAI.Task(RTSUnitAI.Task.Types.Talk, tmpEnt), false);

                                    /*
                                     * switch (tmpEnt.ConvType)
                                     * {
                                     *  case RTSCharacter.ConversationType.BubbleChat:
                                     *      tmpEnt.BubbleChat("I NEVER HAD MY ONE CHILD!");
                                     *      break;
                                     *  case RTSCharacter.ConversationType.Conversation:
                                     *      PlayerIntellect.Instance.SetTask(tmpEnt, PlayerIntellect.TaskType.Chat);
                                     *      break;
                                     *
                                     *  default:
                                     *      break;
                                     * }*/
                                }
                            }
                            break;
                        }
                    }
                    else
                    {
                        Dynamic obj = GetObject();
                        if (obj != null && obj as VBCharacter != null)
                        {
                            hudControl.selectedUnit = obj as VBCharacter;
                        }
                    }
                }
                else
                if (button == EMouseButtons.Right)
                {
                    Dynamic obj = GetObject();
                    if (obj != null && cursorState > State.Walk)
                    {
                        hudControl.Controls.Add(new ObjectMenu(obj));
                    }
                    else
                    {
                        ToggleCursor();
                    }
                }
            }

            return(base.OnMouseDown(button));
        }
Esempio n. 25
0
 public bool WasButtonPressed(EMouseButtons mb)
 {
     return(IsButtonUp(mb) && IsMouseButtonState(mb, ButtonState.Pressed, mPreviousMouseState));
 }
Esempio n. 26
0
 public SystemKeyboardMouseValue( EMouseButtons mouseButton )
 {
     type = Types.MouseButton;
     this.mouseButton = mouseButton;
 }
Esempio n. 27
0
        protected override bool OnMouseUp(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
            {
                return(base.OnMouseUp(button));
            }

            //GameControlsManager
            GameControlsManager.Instance.DoMouseUp(button);

            if (IsMouseInControlArea() && button == EMouseButtons.Left)
            {
                Dynamic curObj = GetObject();

                switch (CursorState)
                {
                case State.Target:
                    if (curObj != null)
                    {
                        CursorState = State.HUDDefault;
                        //PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.InteractWithItem);
                    }
                    break;

                case State.Use:
                    if (curObj as Unit == null)
                    {
                        /*
                         * if (curObj as InventoryObject != null)
                         *  PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Loot);
                         * else if (curObj as Item != null)
                         *  PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Take);
                         * else
                         *  PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Interact);
                         * */
                    }
                    break;

                case State.HUDDefault:
                    if (curObj != null)
                    {
                        /*PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Interact);
                         * RTSCharacter ch = curObj as RTSCharacter;
                         * if (ch != null)
                         * {
                         *  string msg = "{0} has {1} hit points and is armed with {2}";
                         *  Log.Info(msg + ".", ch.GetName(), (int)ch.Life, ch.ActiveHeldItem.Type.Name);
                         * }
                         */
                    }
                    break;

                case State.Walk:
                    //PlayerIntellect.Instance.SetTask(curObj, PlayerIntellect.TaskType.Move);
                    break;

                default:
                    if (curObj != null && curObj != hudControl.selectedUnit)
                    {
                        VBCharacter tmpEnt = curObj as VBCharacter;
                        if (tmpEnt != null)
                        {
                            /*
                             * switch (tmpEnt.ConvType)
                             * {
                             *  case RTSCharacter.ConversationType.BubbleChat:
                             *      tmpEnt.BubbleChat("I NEVER HAD MY ONE CHILD!");
                             *      break;
                             *  case RTSCharacter.ConversationType.Conversation:
                             *      PlayerIntellect.Instance.SetTask(tmpEnt, PlayerIntellect.TaskType.Chat);
                             *      break;
                             *
                             *  default:
                             *      break;
                             * }*/
                        }
                    }
                    break;
                }
            }

            return(base.OnMouseUp(button));
        }
Esempio n. 28
0
 private void List_ItemMouseDoubleClick(UIControl sender, EMouseButtons button, int index, ref bool handled)
 {
     ButtonLoad_Click(null);
 }
Esempio n. 29
0
 protected override void Viewport_MouseUp(Viewport viewport, EMouseButtons button, ref bool handled)
 {
     preview.PerformMouseUp(button, ref handled);
 }
        /// <summary>
        /// Check if the Given Input is Binded. Return the currently binded control to the input
        /// </summary>
        public bool IsAlreadyBinded(EMouseButtons button, float strength, out SystemKeyboardMouseValue control)
        {
            control = null;
            foreach (GameControlItem item in Items)
            {
                if (item.BindedKeyboardMouseValues.Count <= 0)
                    continue;

                foreach (SystemKeyboardMouseValue value in item.BindedKeyboardMouseValues)
                {
                    if (value.Type == SystemKeyboardMouseValue.Types.MouseButton &&
                        value.MouseButton == button && value.Strength == strength)
                    {
                        control = value;
                        return true;
                    }
                }
            }

            return false;
        }
 protected virtual void Viewport_MouseDoubleClick(Viewport viewport, EMouseButtons button, ref bool handled)
 {
 }
 public SystemKeyboardMouseValue(EMouseButtons mouseButton, float strength)
 {
     type = Types.MouseButton;
     this.mouseButton = mouseButton;
     this.strength = strength;
 }
Esempio n. 33
0
 public SystemKeyboardMouseValue(EMouseButtons mouseButton)
 {
     type             = Types.MouseButton;
     this.mouseButton = mouseButton;
 }
        protected override bool OnMouseDown(EMouseButtons button)
        {
            if (demoMode)
            {
                Vec2 viewportSize = RendererWorld.Instance.DefaultViewport.DimensionsInPixels.Size.ToVec2();
                Vec2 offset = 3.0f / viewportSize;
                if (Math.Abs(MousePosition.X - screenTextLastMousePosition.X) > offset.X ||
                    Math.Abs(MousePosition.Y - screenTextLastMousePosition.Y) > offset.Y)
                {
                    lastTimeOfKeyDownOrMouseMove = EngineApp.Instance.Time;
                    screenTextLastMousePosition = MousePosition;
                }
            }

            return base.OnMouseDown(button);
        }
Esempio n. 35
0
 public DefaultKeyboardMouseValueAttribute(EMouseButtons mouseButton)
 {
     value = new GameControlsManager.SystemKeyboardMouseValue(mouseButton);
 }
		protected override bool OnMouseUp( EMouseButtons button )
		{
			if( button == EMouseButtons.Left && pathTest )
				pathTest = false;
			return base.OnMouseUp( button );
		}
            protected override bool OnMouseDown(Viewport viewport, EMouseButtons button)
            {
                if (button == EMouseButtons.Left)
                {
                    bool overStartPoint = !heightStage && lastStartPointRectangle.HasValue && lastStartPointRectangle.Value.Contains(viewport.MousePosition);

                    if (heightStage)
                    {
                        Finish(false);
                        return(true);
                    }
                    else if (overStartPoint)
                    {
                        HeightStageStart(viewport);
                        return(true);
                    }
                    else
                    {
                        var points = MeshGeometry.GetPoints();

                        if (!viewport.MouseRelativeMode)
                        {
                            if (points.Length >= 3)
                            {
                                var plane = MeshGeometry.GetPolygonPlaneByPoints();
                                var ray   = viewport.CameraSettings.GetRayByScreenCoordinates(viewport.MousePosition);

                                if (plane.Intersects(ray, out double scale))
                                {
                                    var position = ray.GetPointOnRay(scale);

                                    var point = MeshGeometry.CreateComponent <Component_MeshGeometry_PolygonBasedPolyhedron_Point>(enabled: false);
                                    point.Name      = MeshGeometry.Components.GetUniqueName("Point", false, 1);
                                    point.Transform = new Transform(position, Quaternion.Identity);
                                    point.Enabled   = true;

                                    return(true);
                                }
                            }
                            else
                            {
                                if (CalculatePointPosition(viewport, out var position, out var collidedWith))
                                {
                                    var point = MeshGeometry.CreateComponent <Component_MeshGeometry_PolygonBasedPolyhedron_Point>(enabled: false);
                                    point.Name      = MeshGeometry.Components.GetUniqueName("Point", false, 1);
                                    point.Transform = new Transform(position, Quaternion.Identity);
                                    point.Enabled   = true;

                                    //detect Clockwise
                                    var points2 = MeshGeometry.GetPointPositions();
                                    if (points2.Length == 3)
                                    {
                                        var normal = Plane.FromPoints(points2[0], points2[1], points2[2]).Normal;

                                        var d1 = (points2[0] - viewport.CameraSettings.Position).Length();
                                        var d2 = ((points2[0] + normal) - viewport.CameraSettings.Position).Length();

                                        if (d1 < d2)
                                        {
                                            MeshGeometry.Clockwise = true;
                                        }
                                    }

                                    return(true);
                                }
                            }
                        }
                    }
                }

                return(false);
            }
Esempio n. 38
0
        protected override bool OnMouseUp(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseUp(button);

            //currentAttachedGuiObject
            if (currentAttachedGuiObject != null)
                currentAttachedGuiObject.ControlManager.DoMouseUp(button);

            //Check and do item pick up action
            if(button == EMouseButtons.Right && ShiftKeyPressed )
            {
                Ray lookRay = RendererWorld.Instance.DefaultCamera.GetCameraToViewportRay(
                new Vec2(.5f, .5f));

                Vec3 lookFrom = lookRay.Origin;
                Vec3 lookDir = Vec3.Normalize(lookRay.Direction);

                //VHFOS How far an item can be pick up
                float distance = 20.0f;

                Unit playerUnit = GetPlayerUnit();

                RayCastResult[] piercingResult = PhysicsWorld.Instance.RayCastPiercing(
                    new Ray(lookFrom, lookDir * distance), (int)ContactGroup.CastOnlyContact);

                foreach (RayCastResult result in piercingResult)
                {
                    MapObject obj = MapSystemWorld.GetMapObjectByBody(result.Shape.Body);

                    if (obj != null)
                        if (obj.Type != null)
                            if (obj.Type.Name.ToString().EndsWith("Item"))
                            {
                                Item pickItem = obj as Item;
                                if (playerUnit.Inventory.AddItem(pickItem))
                                {
                                    pickItem.Take(playerUnit as Unit);
                                    pickItem.Visible = false;
                                    pickItem.Position = new Vec3(0.0f, 0.0f, 10000.0f);
                                }
                            }
                }
            }

            //GameControlsManager
            GameControlsManager.Instance.DoMouseUp(button);

            return base.OnMouseUp(button);
        }
Esempio n. 39
0
        /////////////////////////////////////////

        protected virtual bool OnItemMouseDoubleClick(EMouseButtons button, int index)
        {
            return(false);
        }
Esempio n. 40
0
        protected override bool OnMouseUp( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseUp( button );

            //free camera rotating
            if( button == EMouseButtons.Right && freeCameraMouseRotating )
            {
                EngineApp.Instance.MouseRelativeMode = false;
                freeCameraMouseRotating = false;
            }

            return base.OnMouseUp( button );
        }
Esempio n. 41
0
        //!!!!
        //public bool IsKeyLocked( EKeys key )
        //{
        //	if( key != EKeys.Insert && key != EKeys.NumLock && key != EKeys.Capital && key != EKeys.Scroll )
        //		Log.Fatal( "Viewport: IsKeyLocked: Invalid key value. Next keys can be checked by this method: EKeys.Insert, EKeys.NumLock, EKeys.Capital, EKeys.Scroll." );
        //	return EngineApp.platform.IsKeyLocked( key );
        //}

        public bool IsMouseButtonPressed(EMouseButtons button)
        {
            //lock( lockerKeysMouse )
            return(mouseButtons[(int)button]);
        }
        protected override bool OnMouseDown( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDown( button );

            //currentAttachedGuiObject
            if( currentAttachedGuiObject != null )
            {
                currentAttachedGuiObject.ControlManager.DoMouseDown( button );
                return true;
            }

            //GameControlsManager
            if( EntitySystemWorld.Instance.Simulation )
            {
                if( GetRealCameraType() != CameraType.Free && !IsCutSceneEnabled() )
                {
                    if( GameControlsManager.Instance.DoMouseDown( button ) )
                        return true;
                }
            }

            return base.OnMouseDown( button );
        }
Esempio n. 43
0
 protected override bool OnMouseUp(EMouseButtons button)
 {
     SetShouldDetach();
     return(base.OnMouseUp(button));
 }
Esempio n. 44
0
 protected override bool OnMouseDoubleClick(EMouseButtons button)
 {
     if (controlManager != null && !IsScreenFadingOut())
         if (controlManager.DoMouseDoubleClick(button))
             return true;
     return base.OnMouseDoubleClick(button);
 }
Esempio n. 45
0
 static bool IsSupportedMouseButton(EMouseButtons button)
 {
     return(button == EMouseButtons.Left ||
            button == EMouseButtons.Middle ||
            button == EMouseButtons.Right);
 }
        protected override bool OnMouseDown(EMouseButtons button)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnMouseDown(button);

            //GameControlsManager
            if (EntitySystemWorld.Instance.Simulation)
            {
                if (!FreeCameraEnabled && !IsCutSceneEnabled())
                {
                    if (GameControlsManager.Instance.DoMouseDown(button))
                        return true;
                }
            }

            return base.OnMouseDown(button);
        }
Esempio n. 47
0
 internal void PerformMouseUp(EMouseButtons button, ref bool handled)
 {
     OnMouseUp(button, ref handled);
 }
Esempio n. 48
0
        protected override bool OnMouseUp( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseUp( button );

            switch( button )
            {
            case EMouseButtons.Left:
                if( tryingToMovePiece != null )
                {
                    UpdateShouldSendMovingPiecePositionToServer( true );

                    if( EntitySystemWorld.Instance.IsServer() || EntitySystemWorld.Instance.IsSingle() )
                        tryingToMovePiece.ServerOrSingle_MoveFinish();
                    else
                        tryingToMovePiece.Client_MoveTryToFinish();

                    tryingToMovePiece = null;

                    return true;
                }
                break;
            }

            return base.OnMouseUp( button );
        }
Esempio n. 49
0
 protected virtual void OnMouseDoubleClick(EMouseButtons button, ref bool handled)
 {
     owner.PerformBaseViewportMouseDoubleClick(button, ref handled);
 }
Esempio n. 50
0
        protected override bool OnMouseDown( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseDown( button );

            if( button == EMouseButtons.Left && IsMouseInActiveArea() && TaskTargetChooseIndex == -1 )
            {
                selectMode = true;
                selectDraggedMouse = false;
                selectStartPos = EngineApp.Instance.MousePosition;
                return true;
            }

            //minimap mouse change camera position
            if( button == EMouseButtons.Left && taskTargetChooseIndex == -1 )
            {
                if( minimapControl.GetScreenRectangle().IsContainsPoint( MousePosition ) )
                {
                    minimapChangeCameraPosition = true;
                    cameraPosition = GetMapPositionByMouseOnMinimap();
                    return true;
                }
            }

            return base.OnMouseDown( button );
        }
Esempio n. 51
0
 internal void PerformMouseDoubleClick(EMouseButtons button, ref bool handled)
 {
     OnMouseDoubleClick(button, ref handled);
 }
Esempio n. 52
0
 /// <summary>
 /// Sends the notice on releasing a mouse button.
 /// </summary>
 /// <param name="button">A value indicating which button was clicked.</param>
 /// <returns><b>true</b> if such system key is used; otherwise, <b>false</b>.</returns>
 public bool DoMouseUp( EMouseButtons button )
 {
     bool handled = false;
     //!!!!!slowly
     foreach( GameControlItem item in items )
     {
         //!!!!!need use binded values here
         foreach( SystemKeyboardMouseValue value in item.DefaultKeyboardMouseValues )
         {
             if( value.Type == SystemKeyboardMouseValue.Types.MouseButton &&
                 value.MouseButton == button )
             {
                 if( GameControlsEvent != null )
                     GameControlsEvent( new GameControlsKeyUpEventData( item.ControlKey ) );
                 handled = true;
             }
         }
     }
     return handled;
 }
Esempio n. 53
0
 public void PerformBaseViewportMouseUp(EMouseButtons button, ref bool handled)
 {
     base.Viewport_MouseUp(Viewport, button, ref handled);
 }
Esempio n. 54
0
 public DefaultKeyboardMouseValueAttribute( EMouseButtons mouseButton )
 {
     value = new GameControlsManager.SystemKeyboardMouseValue( mouseButton );
 }
Esempio n. 55
0
 protected override void Viewport_MouseDoubleClick(Viewport viewport, EMouseButtons button, ref bool handled)
 {
     editor.PerformMouseDoubleClick(button, ref handled);
 }
Esempio n. 56
0
        protected override bool OnMouseUp( EMouseButtons button )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnMouseUp( button );

            if( catapultFiring && button == EMouseButtons.Left )
            {
                Fire();
                catapultFiring = false;
                return true;
            }

            return base.OnMouseUp( button );
        }
Esempio n. 57
0
 public bool WasMouseButtonPressed(EMouseButtons mb)
 {
     return(IsMouseButtonDown(mb) && IsMouseButtonState(mb, ButtonState.Released, mPreviousMouseState));
 }