Exemplo n.º 1
0
        public override void MouseClick(object sender, MouseButtonEventArgs args)
        {
            String itemName = GetItemName(args);

            if (itemName == NewGameButton.ButtonName)
            {

                UnsetEvents();
                /*GameWindow GameWin = new GameWindow(Screen);
                GameWin.SetEvents();*/

                NewGameWindow NewGameWin = new NewGameWindow(Screen);
                NewGameWin.SetEvents();

            }
            else if (itemName == MapEditorButton.ButtonName)
            {
                UnsetEvents();

                EditorWindow MapEditWin = new EditorWindow(Screen);
                MapEditWin.SetEvents();

            }
            else if (itemName == QuitButton.ButtonName)
            {
                Events.QuitApplication();
            }
        }
Exemplo n.º 2
0
 public void MouseClick(object sender, MouseButtonEventArgs args)
 {
     foreach (ListItem item in Items)
     {
         if (item.GetRect(GetPoint()).Contains(args.Position))
         {
             SelectedIndex = item.Index;
         }
     }
 }
Exemplo n.º 3
0
        public void MouseClick(object sender, MouseButtonEventArgs args)
        {
            Drag = false;

            if (bOk.GetRect(GetPoint()).Contains(args.Position))
            {
                UnsetEvents();
                Garbage.Add(this);
            }
        }
Exemplo n.º 4
0
        public override void MouseClick(object sender, MouseButtonEventArgs args)
        {
            String TextureName = hasFocus(args.Position);

            if (TextureName != "None")
            {
                TileSelected.Texture = TextureName;
            }

            UnsetEvents();
            Garbage.Add(this);
        }
Exemplo n.º 5
0
        void OnMouseButtonUp(object sender, SdlDotNet.Input.MouseButtonEventArgs e)
        {
            if (!rectangle.Contains(e.Position))
            {
                return;
            }
            Vector2D position = new Vector2D(e.X, e.Y);

            Vector2D.Transform(ref toWorld, ref position, out position);
            if (mouseUp != null)
            {
                mouseUp(this, new ViewportMouseButtonEventArgs(position, e.ButtonPressed, e.Button));
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// If the mouse click hits a sprite, 
 /// then the sprite will be marked as 'being dragged'
 /// </summary>
 /// <param name="args"></param>
 public override void Update(MouseButtonEventArgs args)
 {
     if (args == null)
     {
         throw new ArgumentNullException("args");
     }
     if (this.IntersectsWith(new Point(args.X, args.Y)))
     {
         // If we are being held down, pick up the marble
         if (args.ButtonPressed)
         {
             if (args.Button == MouseButton.PrimaryButton)
             {
                 if (this.FirstClick)
                 {
                     this.BeingDragged = true;
                     this.FirstClick = false;
                     //TODO: Make Bounding Box controls appear!
                 }
                 else
                 {
                     this.FirstClick = true;
                     this.BeingDragged = false;
                     //TODO: Make Bounding Box controls dis-appear!
                 }
             }
             else
             {
                 this.BeingDragged = false;
                 //TODO: Make Bounding Box controls dis-appear!
             }
         }
         else
         {
             this.BeingDragged = false;
             //TODO: Make Bounding Box controls dis-appear!
         }
     }
 }
Exemplo n.º 7
0
 /// <summary>
 /// If the mouse click hits a sprite, 
 /// then the sprite will be marked as 'being dragged'
 /// </summary>
 /// <param name="args"></param>
 public override void Update(MouseButtonEventArgs args)
 {
     if (args == null)
     {
         throw new ArgumentNullException("args");
     }
     if (this.IntersectsWith(new Point(args.X, args.Y)))
     {
         if (args.ButtonPressed)
         {
             if (args.Button == MouseButton.PrimaryButton)
             {
                 this.BackgroundColor = Color.Red;
                 this.BeingDragged = true;
                 OnTextButtonSpriteSelect(new TextButtonSpriteEventArgs(this, this.Text));
             }
         }
         else
         {
             this.BackgroundColor = Color.Violet;
             this.BeingDragged = false;
         }
     }
 }
Exemplo n.º 8
0
 private void MouseButtonDown(object sender, MouseButtonEventArgs e)
 {
 }
Exemplo n.º 9
0
 void btnOK_Click(object sender, MouseButtonEventArgs e)
 {
     lbl1.Visible = false;
     lbl2.Visible = false;
     lbl3.Visible = false;
     lbl4.Visible = false;
     lblMode.Visible = false;
     txt1.Visible = false;
     txt2.Visible = false;
     txt3.Visible = false;
     hsb1.Visible = false;
     hsb2.Visible = false;
     hsb3.Visible = false;
     picSprite.Visible = false;
     picSprite2.Visible = false;
     lstSound.Visible = false;
     chkTake.Visible = false;
     chkHidden.Visible = false;
     optAllow.Visible = false;
     optBlock.Visible = false;
     nudStoryLevel.Visible = false;
     CloseOptionsPanel();
 }
Exemplo n.º 10
0
 void btnMapProperties_Click(object sender, MouseButtonEventArgs e)
 {
     if (SdlDotNet.Widgets.WindowManager.Windows.Contains("winProperties") == false) {
         SdlDotNet.Widgets.WindowManager.AddWindow(new Editors.MapEditor.winProperties());
     } else {
         SdlDotNet.Widgets.WindowManager.BringWindowToFront(SdlDotNet.Widgets.WindowManager.FindWindow("winProperties"));
     }
     // TODO: Map Properties [Map Editor] (and uncomment all of it)
 }
Exemplo n.º 11
0
 void btnHouseProperties_Click(object sender, MouseButtonEventArgs e)
 {
     if (SdlDotNet.Widgets.WindowManager.Windows.Contains("winHouseProperties") == false) {
         SdlDotNet.Widgets.WindowManager.AddWindow(new Editors.MapEditor.winHouseProperties());
     } else {
         SdlDotNet.Widgets.WindowManager.BringWindowToFront(SdlDotNet.Widgets.WindowManager.FindWindow("winHouseProperties"));
     }
 }
Exemplo n.º 12
0
		public void HandleMouseButtonUp (MouseButtonEventArgs args)
		{
			if (dialog != null)
				dialog.HandleMouseButtonUp (args);
			else
				MouseButtonUp (args);
		}
Exemplo n.º 13
0
 /// <summary>
 /// If the mouse click hits a sprite, 
 /// then the sprite will be marked as 'being dragged'
 /// </summary>
 /// <param name="args"></param>
 public override void Update(MouseButtonEventArgs args)
 {
     if (args == null)
     {
         throw new ArgumentNullException("args");
     }
     if (this.IntersectsWith(new Point(args.X, args.Y)))
     {
         // If we are being held down, pick up the marble
         if (args.ButtonPressed)
         {
             if (args.Button == MouseButton.PrimaryButton)
             {
                 this.BeingDragged = true;
                 this.Animate = false;
             }
             else
             {
                 this.Kill();
             }
         }
         else
         {
             this.BeingDragged = false;
             this.Animate = true;
         }
     }
 }
Exemplo n.º 14
0
        private void MouseButtonDown(object sender, MouseButtonEventArgs e)
        {
            // Toogle the emitter off and on.
            emit.Emitting = !emit.Emitting;

            CreateExplosion();
        }
Exemplo n.º 15
0
		public override void MouseButtonUp (MouseButtonEventArgs args)
		{
			if (PointInside (args.X, args.Y))
				OnActivate ();
		}
Exemplo n.º 16
0
        public override void MouseClick(object sender, MouseButtonEventArgs args)
        {
            String Type = hasFocus(args.Position);

            if (Type == "CreepStart")
            {
                TileSelected.Type = TileType.CreepStart;
            }
            else if (Type == "CreepEnd")
            {
                TileSelected.Type = TileType.CreepEnd;
            }
            else if (Type == "CreepPath")
            {
                TileSelected.Type = TileType.CreepPath;
            }
            else if (Type == "Normal")
            {
                TileSelected.Type = TileType.Normal;
            }
            else if (Type == "Obstacle")
            {
                TileSelected.Type = TileType.Obstacle;
            }

            UnsetEvents();
            Garbage.Add(this);
        }
Exemplo n.º 17
0
		void MouseButtonUp (object o, MouseButtonEventArgs args)
		{
			cached_cursor_x = args.X;
			cached_cursor_y = args.Y;
			
			if (cursor != null)
				cursor.SetPosition (cached_cursor_x, cached_cursor_y);

			if (currentScreen != null)
				currentScreen.HandleMouseButtonUp (args);
		}
Exemplo n.º 18
0
		public override void MouseButtonUp (MouseButtonEventArgs args)
		{
			HideDropdown ();
		}
Exemplo n.º 19
0
		public override void MouseButtonDown (MouseButtonEventArgs args)
		{
			ShowDropdown();
		}
Exemplo n.º 20
0
 public virtual void OnMouseButtonDown(CGameEngine game, MouseButtonEventArgs e)
 {
 }
Exemplo n.º 21
0
 private void MouseButtonUp(object sender, MouseButtonEventArgs e)
 {
     switch (e.Button)
      {
     case MouseButton.PrimaryButton:
        WorldHelper.ClientToServerProvider.PlaceOrRemoveCubeNotification(_Client.Connection, true, Player.Location, Player.RotationLeft, Player.RotationUp, Player.SelectedMaterial);
        break;
     case MouseButton.SecondaryButton:
        WorldHelper.ClientToServerProvider.PlaceOrRemoveCubeNotification(_Client.Connection, false, Player.Location, Player.RotationLeft, Player.RotationUp, Player.SelectedMaterial);
        break;
     case MouseButton.WheelDown:
        NextMaterial(false);
        break;
     case MouseButton.WheelUp:
        NextMaterial(true);
        break;
      }
 }
Exemplo n.º 22
0
 private void MouseButtonUpEvent(object sender, SdlDotNet.Input.MouseButtonEventArgs mouse)
 {
     playState.Clicked = -1;
 }
Exemplo n.º 23
0
        private void MouseButtonDownEvent(object sender, SdlDotNet.Input.MouseButtonEventArgs mouse)
        {
            if (mouse.Button != MouseButton.PrimaryButton)
            {
                return;
            }

            if (gameInfo.HighScores)
            {
                if (gEngine.exitButton.IntersectsWith(new Point(mouse.X, mouse.Y)))
                {
                    if (isChangingName)
                    {
                        userName = userName.Remove(userName.Length - 1);
                        gameInfo.TopTenNames[gameInfo.Place] = userName;
                        isChangingName = false;
                        gameInfo.Place = -1;
                    }
                    gameInfo.HighScores = false;
                    return;
                }
                return;
            }

            if (gEngine.highScores.IntersectsWith(new Point(mouse.X, mouse.Y)))
            {
                gameInfo.HighScores = true;
                return;
            }

            if (gEngine.newGame.IntersectsWith(new Point(mouse.X, mouse.Y)))
            {
                NewGame();
                return;
            }

            if (gEngine.quitGame.IntersectsWith(new Point(mouse.X, mouse.Y)))
            {
                RetireGame(true);
                return;
            }

            if (gEngine.switchMode.IntersectsWith(new Point(mouse.X, mouse.Y)))
            {
                SwitchMode();
                return;
            }

            if (gEngine.SoundImage.IntersectsWith(new Point(mouse.X, mouse.Y)) ||
                gEngine.SoundOffImage.IntersectsWith(new Point(mouse.X, mouse.Y)))
            {
                if (gameInfo.Sound)
                {
                    gameInfo.Sound     = false;
                    match.Volume       = 0;
                    levelChange.Volume = 0;
                    applause.Volume    = 0;
                }
                else
                {
                    gameInfo.Sound     = true;
                    match.Volume       = 128;
                    levelChange.Volume = 20;
                    applause.Volume    = 50;
                }
                return;
            }

            if (mouse.X < 235)
            {
                return;
            }

            if (!isClickable)
            {
                return;
            }

            int x = (mouse.X - 235) / 75;
            int y = mouse.Y / 75;

            gameInfo.Hint = 0;
            if (!board.clicked)
            {
                board.clicked = true;
                board.sel_x   = x;
                board.sel_y   = y;
            }
            else
            {
                if ((x == (board.sel_x + 1) && (y == board.sel_y)) ||
                    (x == (board.sel_x - 1) && (y == board.sel_y)) ||
                    (y == (board.sel_y + 1) && (x == board.sel_x)) ||
                    (y == (board.sel_y - 1) && (x == board.sel_x)))
                {
                    board.clicked = false;
                    board.SwapPieces(x, y, board.sel_x, board.sel_y);
                    swapHelper.x1 = x; swapHelper.y1 = y; swapHelper.x2 = board.sel_x; swapHelper.y2 = board.sel_y;
                    isSwapping    = true;
                }
                board.clicked = false;
            }
        }
Exemplo n.º 24
0
        public void MouseDown(object sender, MouseButtonEventArgs args)
        {
            Rectangle wBar = new Rectangle(new Point(X, Y), new Size(WinBar.Width, WinBar.Height));

            if (wBar.Contains(args.Position))
            {
                Drag = true;
            }
        }
Exemplo n.º 25
0
 private void OnMouseButtonDown(object sender, MouseButtonEventArgs e)
 {
     ((CGameState)states.Peek()).OnMouseButtonDown(this, e);
 }
Exemplo n.º 26
0
        private void MouseButtonDownEvent(object sender, SdlDotNet.Input.MouseButtonEventArgs mouse)
        {
            if (isPassing)
            {
                if (gEngine.GetPassButtonIntersects(mouse.X, mouse.Y))
                {
                    PassCards();
                    isPlaying = true;
                }

                bool found       = false;
                int  cardClicked = gEngine.GetCardIntersects(mouse.X, mouse.Y);
                if (cardClicked == -1)
                {
                    return;
                }
                for (int i = 0; i < 3; i++)
                {
                    if (found)
                    {
                        passing[i - 1] = passing[i];
                    }
                    if (passing[i] == cardClicked)
                    {
                        found = true;
                    }
                }
                if (found)
                {
                    passing[2] = -1;
                    numberOfClicked--;
                }
                if (numberOfClicked < 3 && !found)
                {
                    passing[numberOfClicked] = cardClicked;
                    numberOfClicked++;
                }
                gEngine.ClearHand();
                gEngine.UpdateHand(userHand.Cards.Count, passing);
            }
            else if (isPlaying)
            {
                if (playState.Turn == 0)
                {
                    if (playState.Trick.Count == 4)
                    {
                        CalculateTrick();
                        return;
                    }
                    int cardClicked = gEngine.GetCardIntersects(mouse.X, mouse.Y);

                    if (cardClicked == -1)
                    {
                        return;
                    }

                    if (playState.Trick.Count > 0)
                    {
                        if (UserHasSuit(playState.Lead.CardSuit))
                        {
                            if (userHand.Cards[cardClicked].CardSuit == playState.Lead.CardSuit)
                            {
                                UserPlayCard(userHand.Cards[cardClicked]);
                            }
                            else
                            {
                                playState.Clicked = cardClicked;
                                return;
                            }
                        }
                        else if ((userHand.Cards[cardClicked].CardSuit == Suit.Hearts ||
                                  (userHand.Cards[cardClicked].CardSuit == Suit.Spades &&
                                   userHand.Cards[cardClicked].CardValue == FaceValue.Queen)) &&
                                 (playState.Lead.CardSuit == Suit.Clubs && playState.Lead.CardValue == FaceValue.Two))
                        {
                            playState.Clicked = cardClicked;
                            return;
                        }
                        else
                        {
                            UserPlayCard(userHand.Cards[cardClicked]);
                        }
                    }
                    else
                    {
                        if (userHand.Contains(Suit.Clubs, FaceValue.Two) &&
                            !(userHand.Cards[cardClicked].CardSuit == Suit.Clubs &&
                              userHand.Cards[cardClicked].CardValue == FaceValue.Two))
                        {
                            playState.Clicked = cardClicked;
                            return;
                        }
                        else if (!playState.IsBroken && userHand.Cards[cardClicked].CardSuit == Suit.Hearts)
                        {
                            playState.Clicked = cardClicked;

                            if (UserHasSuit(Suit.Clubs) || UserHasSuit(Suit.Diamonds) || UserHasSuit(Suit.Spades))
                            {
                                return;
                            }
                        }
                        playState.Lead = userHand.Cards[cardClicked];
                        UserPlayCard(userHand.Cards[cardClicked]);
                    }
                    if (userHand.Cards.Count == 12 && (playState.Lead.CardSuit != Suit.Clubs || playState.Lead.CardValue != FaceValue.Two))
                    {
                        throw new InvalidOperationException("ENGINE - FIRST CARD WASN'T TWO OF CLUBS!");
                    }

                    playState.Turn++;
                    pauseForXTicks(050);
                }
            }
        }
Exemplo n.º 27
0
		public override void MouseButtonDown (MouseButtonEventArgs args)
		{
		}
Exemplo n.º 28
0
		public virtual void MouseButtonUp (MouseButtonEventArgs args)
		{
			if (args.Button != MouseButton.PrimaryButton &&
			    args.Button != MouseButton.WheelUp &&
			    args.Button != MouseButton.WheelDown)
				return;

			if (mouseDownElement != null) {
				if (args.Button == MouseButton.PrimaryButton)
					mouseDownElement.MouseButtonUp (args);

				mouseDownElement = null;
			}
		}
Exemplo n.º 29
0
 public void MouseClick(object sender,MouseButtonEventArgs args)
 {
     if(bContinue.GetRect(GetPoint()).Contains(args.Position))
     {
         Garbage.Add(this);
         UnsetEvents();
         GameObj.NewGame(GameDifficulty.Hard);
     }
     else if(bQuit.GetRect(GetPoint()).Contains(args.Position))
     {
         Events.QuitApplication();
     }
 }
Exemplo n.º 30
0
 static void OnMouseButtonDown(MouseButtonEventArgs e)
 {
     if (MouseButtonDown != null)
     {
         MouseButtonDown(instance, e);
     }
 }
Exemplo n.º 31
0
        public void MouseClick(object sender, MouseButtonEventArgs args)
        {
            Drag = false;
            String ItemName = GetButtonName(args.Position);

            if (ItemName == "Cancel")
            {
                UnsetEvents();
                Garbage.Add(this);
            }
            else if (ItemName == "Soldier")
            {
                ChoosenClass = UnitClasses.Soldier;
                UnsetEvents();
                Garbage.Add(this);
            }
            else if (ItemName == "Paladin")
            {
                ChoosenClass = UnitClasses.Paladin;
                UnsetEvents();
                Garbage.Add(this);
            }
            else if (ItemName == "Mage")
            {
                ChoosenClass = UnitClasses.Mage;
                UnsetEvents();
                Garbage.Add(this);
            }
            else if (ItemName == "Archer")
            {
                ChoosenClass = UnitClasses.Archer;
                UnsetEvents();
                Garbage.Add(this);
            }
            else if (ItemName == "Thieft")
            {
                ChoosenClass = UnitClasses.Thieft;
                UnsetEvents();
                Garbage.Add(this);
            }
        }
Exemplo n.º 32
0
 static void OnMouseButtonUp(MouseButtonEventArgs e)
 {
     if (MouseButtonUp != null)
     {
         MouseButtonUp(instance, e);
     }
 }
Exemplo n.º 33
0
 /// <summary>
 /// Processes a mouse button. This event is trigger by the SDL
 /// system. 
 /// </summary>
 /// <param name="args">Event args</param>
 public virtual void Update(MouseButtonEventArgs args)
 {
 }
Exemplo n.º 34
0
 void btnEyeDropper_Click(object sender, MouseButtonEventArgs e)
 {
     if (limiter == Enums.MapEditorLimitTypes.Full) {
         if (ActiveTool == MappingTool.EyeDropper) {
             SetActiveTool(MappingTool.Editor);
             btnEyeDropper.Selected = false;
         } else {
             SetActiveTool(MappingTool.EyeDropper);
             btnEyeDropper.Selected = true;
         }
     }
 }