/// <summary> /// Removes all event handlers from the window, use this method when the windows is removed or hidden /// </summary> /// <param name="window"></param> public void UnregisterInventoryWindow(InventoryWindow window) { // remove all event handlers if (window is CharacterInventory) { var charInventory = window as CharacterInventory; //charInventory.EquipmentSlotClicked -= InventoryUiSlotClicked; } //window.InventorySlotClicked -= InventoryUiSlotClicked; window.CellMouseEnter -= InventoryUiCellMouseEnter; window.CellMouseLeave -= InventoryUiCellMouseLeave; window.CellMouseUp -= charInventory_CellMouseUp; window.CellMouseDown -= charInventory_CellMouseDown; }
/// <summary> /// Allows the inventory window to perform inventory transfers (chest - player inventory, chest - chest etc) /// </summary> /// <param name="window"></param> public void RegisterInventoryWindow(InventoryWindow window) { // listen character window events if (window is CharacterInventory) { var charInventory = window as CharacterInventory; //charInventory.EquipmentSlotClicked += InventoryUiSlotClicked; } // listen standart inventory events //window.InventorySlotClicked += InventoryUiSlotClicked; window.CellMouseEnter += InventoryUiCellMouseEnter; window.CellMouseLeave += InventoryUiCellMouseLeave; window.CellMouseUp += charInventory_CellMouseUp; window.CellMouseDown += charInventory_CellMouseDown; }