Give access to the real-time state of the mouse
        private void DrawSurface_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            model.ScrollCount += Math.Sign(e.Delta);

            //Cap Zoom
            if (model.ScrollCount < model.ZoomMaxCap)
            {
                model.ScrollCount = model.ZoomMaxCap;
            }
            if (model.ScrollCount > model.ZoomMinCap)
            {
                model.ScrollCount = model.ZoomMinCap;
            }

            double oldZoom = model.Zoom;

            model.Zoom = (float)Math.Pow(1 + (model.ZoomSpeed / 100 * Math.Sign(model.ScrollCount)), Math.Abs(model.ScrollCount));

            double oldDelta = (Mouse.GetPosition().X - this._renderWindow.Position.X) - model.OffsetX;
            double newDelta = oldDelta * (model.Zoom / oldZoom);

            model.OffsetX += (float)(oldDelta - newDelta);

            UpdateWindow();
        }
Exemple #2
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (button != Mouse.Button.Left)
                return true;

            if (pressed && x == 0)
            {
                if (y == 0)
                {
                    Value -= Step;
                }
                else if (y == Height - 1)
                {
                    Value += Step;
                }
                else
                {
                    _dragging = true;
                }
            }

            if (!pressed)
                _dragging = false;

            return true;
        }
        private void DrawSurface_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            IsMouseDown = true;

            PrevMousePos   = new Vector2f(Mouse.GetPosition().X - _renderWindow.Position.X, Mouse.GetPosition().Y - _renderWindow.Position.Y);
            LastClickedPos = PrevMousePos;
        }
 public void HandleMouse(Mouse.Button key)
 {
     int x = Mouse.GetPosition(_screen).X;
     int y = Mouse.GetPosition(_screen).Y;
     if (x >= GameGUI[0].X && x <= GameGUI[0].X + 100 && y >= GameGUI[0].Y && y <= GameGUI[0].Y + 160)
         GameGUI[0].HandleMouse(key, x, y);
 }
 protected override void OnMouseDown(Mouse.Button button, int x, int y)
 {
     if (this.BoundingBox.Contains(x, y))// && button == Mouse.Button.Left)
     {
         buttonPressed.Invoke(null,null);
     }
 }
Exemple #6
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (button != Mouse.Button.Left || !pressed)
                return true;

            var xx = 0;
            foreach (var i in Items)
            {
                if (x >= xx && x < xx + i.Caption.Length + 2)
                {
                    i.Click();

                    if (i.Items.Count > 0)
                    {
                        _selected = i;
                        _drop.Show(xx, 1, i.Items);
                        _drop.Focus();
                        return true;
                    }
                }

                xx += i.Caption.Length + 2;
            }

            return true;
        }
Exemple #7
0
 protected bool isMouseButtonPressed(Mouse.Button button)
 {
     if (Mouse.IsButtonPressed(button))
         return true;
     else
         return false;
 }
		protected override void OnMouseDown(Mouse.Button button, int x, int y)
		{
			if (this.IsEntered)
			{
				mousedown = true;
				ChangeValue(x-(int)Position.X);
			}
		}
Exemple #9
0
 public bool IsButtonPressed(Mouse.Button button)
 {
     if (pressedButtons.Contains(button))
     {
         pressedButtons.Remove(button);
         return true;
     }
     return false;
 }
        private void UpdateWindow()
        {
            this.model.Debug_NoRefreshes += 1;  // Display Number of Refreshes for Debugging

            //      Process Events
            this._renderWindow.DispatchEvents();

            //      Clear Screen
            this._renderWindow.Clear(model.Theme.BackgroundColor);

            //      Draw Screen
            // SCROLL SCREEN
            if (KeyPressed_W)
            {
                model.OffsetY += model.ScrollSpeed;
            }
            if (KeyPressed_A)
            {
                model.OffsetX += model.ScrollSpeed;
            }
            if (KeyPressed_S)
            {
                model.OffsetY -= model.ScrollSpeed;
            }
            if (KeyPressed_D)
            {
                model.OffsetX -= model.ScrollSpeed;
            }

            // DRAW LINE
            model.DrawLine(this._renderWindow);

            // DRAW MARKERS
            model.DrawMarkers(this._renderWindow);

            // DRAW EVENTS
            model.DrawEvents(this._renderWindow);

            // PAN SCREEN
            if (IsMouseDown)
            {
                float CurrMouseX = Mouse.GetPosition().X - _renderWindow.Position.X;
                float CurrMouseY = Mouse.GetPosition().Y - _renderWindow.Position.Y;

                model.OffsetX -= PrevMousePos.X - CurrMouseX;
                model.OffsetY -= PrevMousePos.Y - CurrMouseY;

                PrevMousePos = new Vector2f(CurrMouseX, CurrMouseY);
            }

            // DRAW TITLE
            model.DrawTitle(this._renderWindow);


            //      Display Window
            this._renderWindow.Display();
        }
Exemple #11
0
 public static bool isMouseButtonTap(Mouse.Button key)
 {
     if (!isActive)
         return false;
     if (PressedMouseButtons.Contains(key.ToString()) &&
         !OldPressedMouseButtons.Contains(key.ToString()))
         return true;
     return false;
 }
Exemple #12
0
 public void MouseDown(Mouse.Button button, int x, int y)
 {
     foreach (Element ele in Elements)
     {
         if (ele != null)
             ele.MouseDown(button, x, y);
     }
     OnMouseDown(button, x, y);
 }
Exemple #13
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (pressed && x >= 0 && x <= Width - 2 && y >= 0 && y < _lines.Count)
            {
                var line = _lines[y];
                if (line.Clickable && Clicked != null)
                    Clicked(line.Address, button);
            }

            _scrollbar.MousePressed(x - _scrollbar.Left, y - _scrollbar.Top, button, pressed);
            return true;
        }
Exemple #14
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (!pressed)
                return true;

            Checked = !Checked;

            if (Changed != null)
                Changed();

            return true;
        }
 protected override void OnMouseDown(Mouse.Button button, int x, int y)
 {
     if (BoundingBox.Contains(x, y))
     {
         Input.Color = Color.Red;
         Focus = true;
     }
     else
     {
         Input.Color = Color.White;
         Focus = false;
     }
 }
Exemple #16
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (SelectEnabled && pressed && (x > 0 && y > 0 && x < Width - 1 && y < Height - 1))
            {
                var index = (int)_scrollbar.Value + (y - 1);

                if (index < Items.Count)
                {
                    Selected = index;

                    if (Changed != null)
                        Changed();
                }

                return true;
            }

            _scrollbar.MousePressed(x - _scrollbar.Left, y - _scrollbar.Top, button, pressed);
            return true;
        }
        private void DrawSurface_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            bool closeSideColumn = true;

            foreach (EventViewModel eventViewModel in model.ListOfEvents)
            {
                if (eventViewModel.IsMouseOver(_renderWindow) && eventViewModel != model.EditingEvent)
                {
                    CloseSideColumn();
                    OpenSideColumn(eventViewModel);

                    closeSideColumn = false;
                }
            }

            // Close side column if the cursor wasn't dragged
            if (closeSideColumn && LastClickedPos == new Vector2f(Mouse.GetPosition().X - _renderWindow.Position.X, Mouse.GetPosition().Y - _renderWindow.Position.Y))
            {
                CloseSideColumn();
            }
        }
Exemple #18
0
        public override bool MousePressed(int x, int y, Mouse.Button button, bool pressed)
        {
            if (button != Mouse.Button.Left)
                return true;

            if (pressed)
            {
                _holding = true;
            }
            else
            {
                if (x >= 0 && y >= 0 && x < Width && y < Height)
                {
                    if (_holding && Clicked != null)
                        Clicked();
                }

                _holding = false;
            }

            return true;
        }
Exemple #19
0
 public override void MouseRelease(Mouse.Button button, int x, int y)
 {
 }
Exemple #20
0
 public override void MouseClick(Mouse.Button button, int x, int y)
 {
 }
        public void HandleMouse(Mouse.Button but, int x, int y)
        {
            if (x >= X + 158 && x <= X + 178 && y >= Y && y <= Y + 20)
            {
                MyButton[16].Picked();
            }

            if (x >= X + 0 && x <= X + 158 && y >= Y && y <= Y + 20)
            {
                MyButton[17].Picked();
            }

            if (x >= X + 155 && x <= X + 172 && y >= Y + 29 && y <= Y + 46)
            {
                MyButton[18].Picked();
            }

            if (x >= X + 155 && x <= X + 172 && y >= Y + 121 && y <= Y + 138)
            {
                MyButton[19].Picked();
            }

            if (x >= X + 155 && x <= X + 172 && y >= Y + 158 && y <= Y + 175)
            {
                MyButton[20].Picked();
            }

            for (int r = 0; r < 4; r++)
            {
                for (int c = 0; c < 4; c++)
                {
                    if (x >= X + (c * 38) + 6 && x <= X + 38 * (c + 1) && y >= Y + 26 + (r * 38) && y <= Y + (r + 1) * 38 + 26)
                    {
                        MyButton[r * 4 + c].Picked();
                        break;
                    }
                }
            }
        }
Exemple #22
0
 public bool IsButtonReleased(Mouse.Button button)
 {
     return WasButtonDown(button) && IsButtonUp(button);
 }
Exemple #23
0
 public bool IsButtonPressed(Mouse.Button button)
 {
     return IsButtonDown(button) && WasButtonUp(button);
 }
Exemple #24
0
 public bool WasButtonUp(Mouse.Button button)
 {
     return !WasButtonDown(button);
 }
Exemple #25
0
 public bool WasButtonDown(Mouse.Button button)
 {
     return PreviousMouseState[button];
 }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            UpdateWindow();

            RefreshScreenStopwatch.Start();

            Thread backgroundThread = new Thread(() =>
            {
                while (_renderWindow.IsOpen)
                {
                    System.Windows.Application.Current?.Dispatcher.Invoke(DispatcherPriority.Loaded, new Action(() =>
                    {
                        // Update Year At Mouse
                        model.YearAtMouse = (int)Math.Round(
                            (Mouse.GetPosition().X - _renderWindow.Position.X - model.OffsetX) / (model.IntervalLengthPx * model.Zoom));

                        bool Update;

                        if (RefreshScreenStopwatch.ElapsedMilliseconds > RefreshRateInSeconds * 1000)
                        {
                            Update = true;
                            RefreshScreenStopwatch.Restart();
                        }
                        else
                        {
                            Update =
                                IsMouseDown ||
                                KeyPressed_W || KeyPressed_A || KeyPressed_S || KeyPressed_D;
                        }


                        // Check if a note needs to be drawn

                        bool DrawNote = false;
                        foreach (EventViewModel n in model.ListOfEvents)
                        {
                            if (n.IsMouseOver(_renderWindow))
                            {
                                // Update window so the background color changes
                                Update = true;

                                // Check if Note needs to be drawn
                                if (n.Note != null)
                                {
                                    DrawNote = true;

                                    if (!DisplayEventNoteStopwatch.IsRunning)
                                    {
                                        DisplayEventNoteStopwatch.Start();
                                    }

                                    if (DisplayEventNoteStopwatch.Elapsed.TotalSeconds > model.DisplayNoteDelayInSeconds)
                                    {
                                        model.EventToDrawNote = n;
                                    }
                                }
                            }
                        }

                        if (!DrawNote)
                        {
                            DisplayEventNoteStopwatch.Stop();
                            DisplayEventNoteStopwatch.Reset();

                            model.EventToDrawNote = null;
                        }

                        if (Update)
                        {
                            UpdateWindow();
                        }
                    }
                                                                                                                ));
                }
            });

            backgroundThread.Start();

            DrawSurface.Focus();
        }
Exemple #27
0
 public override void MouseRelease(Mouse.Button button, int x, int y)
 {
     myclient.GameMode.MouseRelease(button, x, y);
 }
Exemple #28
0
 public void HandleMouseDown(Vector2i mousePosition, Mouse.Button button)
 {
     IsPressed = true;
 }
        public void HandleMouse(Mouse.Button but, int x, int y)
        {
            if (x >= X + 150 && x <= X + 170 && y >= Y && y <= Y + 20)
            {
                MyButton[0].Picked();
            }

            else if (x >= X + 0 && x <= X + 150 && y >= Y && y <= Y + 20)
            {
                MyButton[1].Picked();
            }

            else if (x >= X + 144 && x <= X + 161 && y >= Y + 130 && y <= Y + 147)
            {
                MyButton[2].Picked();
            }
        }
Exemple #30
0
 public MouseButtonInputArgs(Mouse.Button button, bool pressed, int x, int y)
 {
     Button = button;
     Pressed = pressed;
     screenPosition = new Vector2i(x, y);
 }
Exemple #31
0
 private bool CheckButton(Mouse.Button button)
 {
     return Mouse.IsButtonPressed(button);
 }
 public void HandleMouseUp(Vector2i mousePosition, Mouse.Button button)
 {
 }
Exemple #33
0
 public bool IsButtonDown(Mouse.Button button)
 {
     return MouseState[button];
 }
Exemple #34
0
 public void HandleMouseUp(Vector2i mousePosition, Mouse.Button button)
 {
     if (IsPressed && IsHovered)
     {
         if (OnClick != null)
             OnClick(this, EventArgs.Empty);
     }
     IsPressed = false;
 }
        public void HandleMouse(Mouse.Button key)
        {
            Map m = Logic.CurrentParty.MainParty.MyParty[0].CurMap;
            int x = Mouse.GetPosition(_screen).X;
            int y = Mouse.GetPosition(_screen).Y;
            if (x >= GameGUI[0].X && x <= GameGUI[0].X + 369 && y >= GameGUI[0].Y && y <= GameGUI[0].Y + 25 && GameGUI[0].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[0].HandleMouse(key, x, y);
            }
            else if (x >= GameGUI[1].X && x <= GameGUI[1].X + 178 && y >= GameGUI[1].Y && y <= GameGUI[1].Y + 178 && GameGUI[1].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[1].HandleMouse(key, x, y);
            }
            else if (x >= GameGUI[2].X && x <= GameGUI[2].X + 140 && y >= GameGUI[2].Y && y <= GameGUI[2].Y + 200 && GameGUI[2].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[2].HandleMouse(key, x, y);
            }
            //if (x >= GameGUI[3].X && x <= GameGUI[3].X + 140 && y >= GameGUI[3].Y && y <= GameGUI[3].Y + 200)
            //{
            //    GameGUI[3].HandleMouse(key, x, y);
            //}
            else if (x >= GameGUI[4].X && x <= GameGUI[4].X + 250 && y >= GameGUI[4].Y && y <= GameGUI[4].Y + 130)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[4].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[5].X && x <= GameGUI[5].X + 178 && y >= GameGUI[5].Y && y <= GameGUI[5].Y + 140 && GameGUI[5].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[5].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[7].X && x <= GameGUI[7].X + 132 && y >= GameGUI[7].Y && y <= GameGUI[7].Y + 89 && GameGUI[7].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[7].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[8].X && x <= GameGUI[8].X + 170 && y >= GameGUI[8].Y && y <= GameGUI[8].Y + 210 && GameGUI[8].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[8].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[9].X && x <= GameGUI[9].X + 170 && y >= GameGUI[9].Y && y <= GameGUI[9].Y + 150 && GameGUI[9].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[9].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[10].X && x <= GameGUI[10].X + 170 && y >= GameGUI[10].Y && y <= GameGUI[10].Y + 210 && GameGUI[10].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[10].HandleMouse(key, x, y);
            }

            else if (x >= GameGUI[11].X && x <= GameGUI[11].X + 200 && y >= GameGUI[11].Y && y <= GameGUI[11].Y + 200 && GameGUI[11].Visibility)
            {
                if (GameGUI[6] != null)
                    GameGUI[6].Visibility = false;
                GameGUI[11].HandleMouse(key, x, y);
            }

            else
            {
                if (key == Mouse.Button.Right)
                {
                    if (ClickState > -1)
                    {
                        ClickState = -1;
                        return;
                    }

                    GameGUI[6] = new RightClickGUI(_screen, Mouse.GetPosition(_screen).X, Mouse.GetPosition(_screen).Y, (int)(Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - _screen.Size.X / 2 / 16 - 1), (int)((Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - _screen.Size.Y / 2 / 16 - 1));
                    GameGUI[6].HandleMouse(key, x, y);

                    if (Mouse.IsButtonPressed(Mouse.Button.Right) && Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX] > -1 && Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX]] is SpawnBuildable)
                    {
                        SpawnBuildable b = (SpawnBuildable)Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX]];
                        if (!b.Builded)
                        {
                            Logic.CurrentParty.MainParty.MyParty[0].TargetX = (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1;
                            Logic.CurrentParty.MainParty.MyParty[0].TargetY = (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1;
                            Logic.CurrentParty.MainParty.MyParty[0].CurrentAction = 2;
                            Logic.DoPathFinding(Logic.CurrentParty.MainParty.MyParty[0]);
                            Logic.CurrentParty.MainParty.MyParty[0].ActionDir = Logic.CurrentParty.MainParty.MyParty[0].PathfindingPath[0];
                            Logic.CurrentParty.MainParty.MyParty[0].PathfindingPath.RemoveAt(0);
                            GameGUI[6].Visibility = false;

                        }

                        else
                        {
                            //if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX] > -1 && Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX]] is SpawnBuildableFire)
                            //{
                            //    SpawnBuildableFire bfire = (SpawnBuildableFire)Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[(int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY][(int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX]];
                                GameGUI[6] = new RightClickGUI(_screen, Mouse.GetPosition(_screen).X, Mouse.GetPosition(_screen).Y, (int)(Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - _screen.Size.X / 2 / 16 - 1), (int)((Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - _screen.Size.Y / 2 / 16 - 1));
                                GameGUI[6].HandleMouse(key, x, y);
                            //}
                        }
                    }

                }
                else
                {
                    switch (ClickState)
                    {
                        case 0:
                            GameGUI[9].Visibility = false;
                            Logic.BuildStuff((int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinX, (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1 + Logic.CurrentParty.MainParty.MyParty[0].CurMap.MinY, CurrentObjectIndex, _screen, m);
                            ClickState = -1;
                            break;
                        default:
                            if (GameGUI[6].Visibility)
                            {
                                GameGUI[6].HandleMouse(key, x, y);
                                GameGUI[6].Visibility = false;
                                if(Logic.CurrentParty.MainParty.MyParty[0].CurrentAction == 4)
                                {
                                }
                                return;
                            }
                            else if (Mouse.IsButtonPressed(Mouse.Button.Left))
                            {
                                Logic.CurrentParty.MainParty.MyParty[0].CurrentAction = 0;
                                Logic.CurrentParty.MainParty.MyParty[0].TargetX = (int)Mouse.GetPosition(_screen).X / 16 + Logic.CurrentParty.MainParty.MyParty[0].X - (int)_screen.Size.X / 2 / 16 - 1;
                                Logic.CurrentParty.MainParty.MyParty[0].TargetY = (int)(Mouse.GetPosition(_screen).Y + 8) / 16 + Logic.CurrentParty.MainParty.MyParty[0].Y - (int)_screen.Size.Y / 2 / 16 - 1;
                                Logic.Pathfinder = Logic.CurrentParty.MainParty.MyParty[0];
                                Logic.DoPathFinding(Logic.CurrentParty.MainParty.MyParty[0]);
                                ConstructionGUI gc = (ConstructionGUI)GameGUI[9];
                                bool noitem = true;
                                SpawnBuildable sb = null;
                                if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[gc.LocY][gc.LocX] > -1)
                                {
                                    if (Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[gc.LocY][gc.LocX]] is SpawnBuildable)
                                        sb = (SpawnBuildable)Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[gc.LocY][gc.LocX]];
                                }
                                if (sb != null)
                                {
                                    for (int bs = 0; bs < sb.Required.Count; bs++)
                                    {
                                        if (sb.Required.ElementAt(bs).Value.Count > 0 || sb.Builded)
                                            noitem = false;
                                    }

                                    if (noitem)
                                    {
                                        Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnable[Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[gc.LocY][gc.LocX]] = null;
                                        Logic.CurrentParty.MainParty.MyParty[0].CurMap.SpawnedSpawnableLocation[gc.LocY][gc.LocX] = -1;
                                    }
                                }
                                GameGUI[9].Visibility = false;
                                return;
                            }
                            break;
                    }

                }
            }
        }