void DropSelectedSlot(WindowUI window, bool controlKeyPressed) { if (m_selectedSlot != null) { int index = m_selectedSlot.GetSlotIndex(); int amount = m_selectedSlot.GetSlotAmount(controlKeyPressed); int windowId = m_selectedSlot.GetWindow().GetWindowId(); WindowType windowType = m_selectedSlot.GetWindow().GetWindowType(); if (window == null) { if (windowType.Equals(WindowType.InventoryWindow)) { m_gameManager.SendDrop(index, amount); } else if (windowType.Equals(WindowType.CharacterWindow)) { m_gameManager.SendUse(index); } else if (IsCombineWindow(windowType)) { m_gameManager.SendDropFromWindow(windowId, index, amount); } } else { WindowType newWindowType = window.GetWindowType(); if (newWindowType.Equals(WindowType.CharacterWindow)) { if (windowType.Equals(WindowType.InventoryWindow)) { m_gameManager.SendUse(index); } else if (windowType.Equals(WindowType.CharacterWindow)) { m_gameManager.SendUse(index); } } else if (newWindowType.Equals(WindowType.DiscardButton)) { if (windowType.Equals(WindowType.InventoryWindow) || windowType.Equals(WindowType.CharacterWindow)) { m_gameManager.SendDiscardItem(index); } else if (windowType.Equals(WindowType.SpellsWindow)) { m_gameManager.SendDiscardSpell(index); } } } } }
public void CopySlot(SlotUI slot, bool copyAsReference = false, bool swapSlots = false) { if (slot != null) { if (copyAsReference) { swapSlots = false; } int index = slot.GetSlotIndex(); int referenceIndex = slot.GetReferenceIndex(); int amount = slot.GetSlotAmount(true); int slotId = slot.GetSlotId(); int soundId = slot.GetSoundId(); int graphicId = slot.GetSlotGraphicId(); Color color = slot.GetSlotColor(); WindowUI window = slot.GetWindow(); WindowUI referenceWindow = slot.GetReferenceWindow(); SlotType slotType = slot.GetSlotType(); string slotName = slot.GetSlotName(); string spellTarget = slot.GetSpellTarget(); bool enabled = slot.GetSlotEnabled(); if (swapSlots) { slot.CopySlot(this); slot.SetSlotIndex(index); } SetSlotAmount(amount); SetSlotId(slotId); SetSoundId(soundId); SetSlotType(slotType); UpdateSlotGraphic(graphicId, color); SetSlotName(slotName); SetSpellTarget(spellTarget); if (copyAsReference) { SetReferenceIndex(index); SetReferenceWindow(window); } else { SetReferenceIndex(referenceIndex); SetReferenceWindow(referenceWindow); SetSlotEnabled(enabled); if (!swapSlots) { SetSlotIndex(index); } } } }