Skip to content

Commit aba53d5

Browse files
committed
hide details when dragging slot items
1 parent 6dc060c commit aba53d5

File tree

6 files changed

+28
-25
lines changed

6 files changed

+28
-25
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ public override void Update()
211211
var bagSlot = bagSlots[SlotIndex];
212212
var descriptor = bagSlot.Descriptor;
213213

214-
//TODO: dont show when is dragging
215-
_quantityLabel.IsVisibleInParent = descriptor.IsStackable && bagSlot.Quantity > 1;
214+
_quantityLabel.IsVisibleInParent = !IconImage.IsDragging && descriptor.IsStackable && bagSlot.Quantity > 1;
216215
if (_quantityLabel.IsVisibleInParent)
217216
{
218217
_quantityLabel.Text = Strings.FormatQuantityAbbreviated(bagSlot.Quantity);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
276276
var bankSlot = bankSlots[SlotIndex];
277277
var descriptor = bankSlot.Descriptor;
278278

279-
//TODO: dont show when is dragging
280-
_quantityLabel.IsVisibleInParent = descriptor.IsStackable && bankSlot.Quantity > 1;
279+
_quantityLabel.IsVisibleInParent = !IconImage.IsDragging && descriptor.IsStackable && bankSlot.Quantity > 1;
281280
if (_quantityLabel.IsVisibleInParent)
282281
{
283282
_quantityLabel.Text = Strings.FormatQuantityAbbreviated(bankSlot.Quantity);

Intersect.Client.Core/Interface/Game/Draggable.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ public partial class Draggable(Base parent, string name) : ImagePanel(parent, na
88
{
99
public bool DisableDragAndDrop { get; set; } = false;
1010

11+
public bool IsDragging => DragAndDrop.CurrentPackage?.DrawControl == this;
12+
1113
public override bool DragAndDrop_Draggable()
1214
{
1315
return true;

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

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
using Intersect.Client.Framework.Input;
1010
using Intersect.Client.General;
1111
using Intersect.Client.Interface.Game.DescriptionWindows;
12-
using Intersect.Client.Interface.Game.Inventory;
13-
using Intersect.Client.Interface.Game.Spells;
1412
using Intersect.Client.Items;
1513
using Intersect.Client.Localization;
1614
using Intersect.Client.Spells;
@@ -395,11 +393,25 @@ public void Update()
395393
}
396394
}
397395

396+
var isDragging = IconImage.IsDragging;
397+
if (isDragging)
398+
{
399+
_equipLabel.IsHidden = true;
400+
_quantityLabel.IsHidden = true;
401+
_cooldownLabel.IsHidden = true;
402+
}
403+
else
404+
{
405+
_equipLabel.IsHidden = !_isEquipped || _inventoryItemIndex < 0;
406+
_quantityLabel.IsHidden = _currentItem?.Stackable == false || _inventoryItemIndex < 0;
407+
_cooldownLabel.IsHidden = !_isFaded || _inventoryItemIndex < 0;
408+
}
409+
398410
if (updateDisplay) //Item on cd and fade is incorrect
399411
{
400412
if (_currentItem != null)
401413
{
402-
IconImage.Show();
414+
IconImage.IsVisibleInTree = !isDragging;
403415
IconImage.Texture = Globals.ContentManager.GetTexture(
404416
Framework.Content.TextureType.Item, _currentItem.Icon
405417
);
@@ -413,7 +425,7 @@ public void Update()
413425
_isFaded = Globals.Me.IsItemOnCooldown(_inventoryItemIndex);
414426
_isEquipped = Globals.Me.IsEquipped(_inventoryItemIndex);
415427

416-
if (_isFaded)
428+
if (_isFaded && !isDragging)
417429
{
418430
_cooldownLabel.IsHidden = false;
419431
_cooldownLabel.Text = TimeSpan
@@ -430,15 +442,11 @@ public void Update()
430442
_isFaded = true;
431443
}
432444

433-
_equipLabel.IsHidden = !_isEquipped || _inventoryItemIndex < 0;
434-
_quantityLabel.IsHidden = !_currentItem.Stackable || _inventoryItemIndex < 0;
435-
_cooldownLabel.IsHidden = !_isFaded || _inventoryItemIndex < 0;
436-
437445
_textureLoaded = true;
438446
}
439447
else if (_currentSpell != null)
440448
{
441-
IconImage.Show();
449+
IconImage.IsVisibleInTree = !isDragging;
442450
IconImage.Texture = Globals.ContentManager.GetTexture(
443451
Framework.Content.TextureType.Spell, _currentSpell.Icon
444452
);
@@ -450,7 +458,7 @@ public void Update()
450458
{
451459
var spellSlot = Globals.Me.FindHotbarSpell(slot);
452460
_isFaded = Globals.Me.IsSpellOnCooldown(spellSlot);
453-
if (_isFaded)
461+
if (_isFaded && !isDragging)
454462
{
455463
_cooldownLabel.IsHidden = false;
456464
var remaining = Globals.Me.GetSpellRemainingCooldown(spellSlot);

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using Intersect.Client.Core;
22
using Intersect.Client.Entities;
33
using Intersect.Client.Framework.File_Management;
4-
using Intersect.Client.Framework.GenericClasses;
54
using Intersect.Client.Framework.Gwen;
65
using Intersect.Client.Framework.Gwen.Control;
76
using Intersect.Client.Framework.Gwen.Control.EventArguments;
@@ -515,20 +514,17 @@ public override void Update()
515514
}
516515

517516
var equipped = Globals.Me.MyEquipment.Any(s => s == SlotIndex);
518-
//Todo: hide when dragging
519-
_equipImageBackground.IsVisibleInParent = equipped;
520-
//Todo: hide when dragging
521-
_equipLabel.IsVisibleInParent = equipped;
517+
var isDragging = IconImage.IsDragging;
518+
_equipImageBackground.IsVisibleInParent = !isDragging && equipped;
519+
_equipLabel.IsVisibleInParent = !isDragging && equipped;
522520

523-
//Todo: hide when dragging
524-
_quantityLabel.IsVisibleInParent = descriptor.IsStackable && inventorySlot.Quantity > 1;
521+
_quantityLabel.IsVisibleInParent = !isDragging && descriptor.IsStackable && inventorySlot.Quantity > 1;
525522
if (_quantityLabel.IsVisibleInParent)
526523
{
527524
_quantityLabel.Text = Strings.FormatQuantityAbbreviated(inventorySlot.Quantity);
528525
}
529526

530-
//Todo: hide when dragging
531-
_cooldownLabel.IsVisibleInParent = Globals.Me.IsItemOnCooldown(SlotIndex);
527+
_cooldownLabel.IsVisibleInParent = !isDragging && Globals.Me.IsItemOnCooldown(SlotIndex);
532528
if (_cooldownLabel.IsVisibleInParent)
533529
{
534530
var itemCooldownRemaining = Globals.Me.GetItemRemainingCooldown(SlotIndex);

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ public override void Update()
213213
return;
214214
}
215215

216-
//TODO: dont show when is dragging
217-
_cooldownLabel.IsVisibleInParent = Globals.Me.IsSpellOnCooldown(SlotIndex);
216+
_cooldownLabel.IsVisibleInParent = !IconImage.IsDragging && Globals.Me.IsSpellOnCooldown(SlotIndex);
218217
if (_cooldownLabel.IsVisibleInParent)
219218
{
220219
var itemCooldownRemaining = Globals.Me.GetSpellRemainingCooldown(SlotIndex);

0 commit comments

Comments
 (0)