Exuippment - fix equip
This commit is contained in:
parent
db8589c61a
commit
7e8b5ca6e2
@ -55,19 +55,38 @@ public class EquipmentPanelController : DraggablePanelController
|
||||
// 2. Set up panel additn items to it
|
||||
|
||||
//public void SetUp - in parent
|
||||
|
||||
/// <summary>
|
||||
/// elements: List<
|
||||
/// IndexValuePair<
|
||||
/// int: dropped slot number,
|
||||
/// EquippableItem: dragged item
|
||||
/// >
|
||||
/// >
|
||||
/// </summary>
|
||||
/// <param name="elements"></param>
|
||||
public override void BuildPanelContent(List<IndexValuePair<int, EquippableItem>> elements)
|
||||
{
|
||||
|
||||
base.BuildPanelContent(elements);
|
||||
|
||||
/* Debug.Log("Build content"); */
|
||||
foreach (IndexValuePair<int, EquippableItem> element in elements)
|
||||
{
|
||||
/* Debug.Log($"key: {element.Key} - value: {element.Value}"); */
|
||||
//Debug.Log($"key: {element.Key} - {(EquipmentPanelSlotsTypeEnum)element.Key}");
|
||||
|
||||
if(element.Value != null)
|
||||
ChildBoxList.Where(slot => ((EquipmentSlot)slot).type == (EquipmentPanelSlotsTypeEnum)element.Key).ToList().ForEach(slot => slot.SetItem((EquippableItem)element.Value));
|
||||
if (element.Value != null)
|
||||
{
|
||||
|
||||
// slot type != element.key
|
||||
// element.Key IS DROPPED SLOT number
|
||||
// ChildBoxList order IS CONSTANT
|
||||
// elements HAVE mixed order
|
||||
|
||||
|
||||
// there is error - ChildBoxList.Where(slot => ((EquipmentSlot)slot).type == (EquipmentPanelSlotsTypeEnum)element.Key).ToList().ForEach(slot => slot.SetItem((EquippableItem)element.Value));
|
||||
|
||||
// FIX
|
||||
ChildBoxList[element.Key].SetItem((EquippableItem)element.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +103,6 @@ public class EquipmentPanelController : DraggablePanelController
|
||||
|
||||
public override void EndDrag(ItemSlot itemSlot)
|
||||
{
|
||||
Debug.Log("End Drag");
|
||||
if (!DraggedSlotController.Instance.IsDragged()) // if there was nothing dragged - ignore event
|
||||
return;
|
||||
|
||||
@ -104,7 +122,7 @@ public class EquipmentPanelController : DraggablePanelController
|
||||
{
|
||||
if (slot.Value != null)
|
||||
{
|
||||
Debug.Log($"Slot nr: {slot.Key} with item: {slot.Value}");
|
||||
// Debug.Log($"Slot nr: {slot.Key} with item: {slot.Value}");
|
||||
UiManager.Add(new IndexValuePair<int, EquippableItem>(slot.Key, slot.Value));
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user