Skip to content

Commit 6dc060c

Browse files
committed
dont let player do some actions when is dragging
1 parent 01a76a2 commit 6dc060c

File tree

6 files changed

+63
-10
lines changed

6 files changed

+63
-10
lines changed

Intersect.Client.Core/Core/Input.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Intersect.Client.Entities;
33
using Intersect.Client.Framework.GenericClasses;
44
using Intersect.Client.Framework.Graphics;
5+
using Intersect.Client.Framework.Gwen.DragDrop;
56
using Intersect.Client.Framework.Gwen.Input;
67
using Intersect.Client.Framework.Input;
78
using Intersect.Client.General;
@@ -138,6 +139,11 @@ public static void OnKeyPressed(Keys modifier, Keys key)
138139
return;
139140
}
140141

142+
if (DragAndDrop.IsDragging)
143+
{
144+
return;
145+
}
146+
141147
var gameUi = Interface.Interface.GameUi;
142148

143149
// First try and unfocus chat then close all UI elements, then untarget our target.. and THEN open the escape menu.
@@ -196,7 +202,7 @@ public static void OnKeyPressed(Keys modifier, Keys key)
196202
break;
197203

198204
case Control.ToggleGui:
199-
if (currentGameState == GameStates.InGame)
205+
if (currentGameState == GameStates.InGame && !DragAndDrop.IsDragging)
200206
{
201207
Interface.Interface.HideUi = !Interface.Interface.HideUi;
202208
}

Intersect.Client.Core/Interface/Game/Bag/BagWindow.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Intersect.Client.Framework.GenericClasses;
44
using Intersect.Client.Framework.Gwen;
55
using Intersect.Client.Framework.Gwen.Control;
6+
using Intersect.Client.Framework.Gwen.DragDrop;
67
using Intersect.Client.General;
78
using Intersect.Client.Localization;
89
using Intersect.Client.Utilities;
@@ -65,12 +66,6 @@ private void InitItemContainer()
6566
PopulateSlotContainer.Populate(_slotContainer, Items);
6667
}
6768

68-
public override void Hide()
69-
{
70-
_contextMenu?.Close();
71-
base.Hide();
72-
}
73-
7469
public void Update()
7570
{
7671
if (IsVisibleInTree == false)
@@ -86,4 +81,17 @@ public void Update()
8681
}
8782
}
8883
}
84+
85+
public override void Hide()
86+
{
87+
_contextMenu?.Close();
88+
89+
// dont hide window if we are dragging something
90+
if (Items.Any(c => c.IconImage == DragAndDrop.CurrentPackage?.DrawControl))
91+
{
92+
return;
93+
}
94+
95+
base.Hide();
96+
}
8997
}

Intersect.Client.Core/Interface/Game/Bank/BankWindow.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Intersect.Client.Core;
22
using Intersect.Client.Framework.File_Management;
3-
using Intersect.Client.Framework.GenericClasses;
43
using Intersect.Client.Framework.Gwen;
54
using Intersect.Client.Framework.Gwen.Control;
5+
using Intersect.Client.Framework.Gwen.DragDrop;
66
using Intersect.Client.General;
77
using Intersect.Client.Localization;
88
using Intersect.Client.Utilities;
@@ -89,4 +89,17 @@ public void Update()
8989
}
9090
}
9191
}
92+
93+
public override void Hide()
94+
{
95+
_contextMenu?.Close();
96+
97+
// dont hide window if we are dragging something
98+
if (Items.Any(c => c.IconImage == DragAndDrop.CurrentPackage?.DrawControl))
99+
{
100+
return;
101+
}
102+
103+
base.Hide();
104+
}
92105
}

Intersect.Client.Core/Interface/Game/Hotbar/HotBarWindow.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Intersect.Client.Framework.GenericClasses;
44
using Intersect.Client.Framework.Gwen;
55
using Intersect.Client.Framework.Gwen.Control;
6+
using Intersect.Client.Framework.Gwen.DragDrop;
67
using Intersect.Client.General;
78

89
namespace Intersect.Client.Interface.Game.Hotbar;
@@ -49,4 +50,15 @@ public void Update()
4950
slot.Update();
5051
}
5152
}
53+
54+
public override void Hide()
55+
{
56+
// dont hide window if we are dragging something
57+
if (Items.Any(c => c.IconImage == DragAndDrop.CurrentPackage?.DrawControl))
58+
{
59+
return;
60+
}
61+
62+
base.Hide();
63+
}
5264
}

Intersect.Client.Core/Interface/Game/Inventory/InventoryWindow.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Intersect.Client.Core;
22
using Intersect.Client.Framework.File_Management;
3-
using Intersect.Client.Framework.GenericClasses;
43
using Intersect.Client.Framework.Gwen;
54
using Intersect.Client.Framework.Gwen.Control;
5+
using Intersect.Client.Framework.Gwen.DragDrop;
66
using Intersect.Client.General;
77
using Intersect.Client.Localization;
88
using Intersect.Client.Utilities;
@@ -97,6 +97,13 @@ public override void Hide()
9797
}
9898

9999
_contextMenu?.Close();
100+
101+
// dont hide window if we are dragging something
102+
if (Items.Any(c => c.IconImage == DragAndDrop.CurrentPackage?.DrawControl))
103+
{
104+
return;
105+
}
106+
100107
base.Hide();
101108
}
102109
}

Intersect.Client.Core/Interface/Game/Spells/SpellsWindow.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using Intersect.Client.Core;
22
using Intersect.Client.Framework.File_Management;
3-
using Intersect.Client.Framework.GenericClasses;
43
using Intersect.Client.Framework.Gwen;
54
using Intersect.Client.Framework.Gwen.Control;
5+
using Intersect.Client.Framework.Gwen.DragDrop;
66
using Intersect.Client.Localization;
77
using Intersect.Client.Utilities;
88

@@ -74,6 +74,13 @@ private void InitItemContainer()
7474
public override void Hide()
7575
{
7676
_contextMenu?.Close();
77+
78+
// dont hide window if we are dragging something
79+
if (Items.Any(c => c.IconImage == DragAndDrop.CurrentPackage?.DrawControl))
80+
{
81+
return;
82+
}
83+
7784
base.Hide();
7885
}
7986
}

0 commit comments

Comments
 (0)