private void DropToBoxinventoryFromCharacterInventory(DragAndDropParam dragAndDropParam) { ItemCell itemCellInventory = dragAndDropParam.dragCell as ItemCell; ItemCell itemCellBox = dragAndDropParam.dropCell as ItemCell; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>(); if (itemCellInventory != null) { Debug.Log("Drop to stuck"); } else { ItemInventory itemInventory = panelBoxInventory.sceneObject.GetItemInventory(); for (int i = 0; i < itemCellBox.count; i++) { if (!itemInventory.AddItem(itemCellBox.item)) { break; } CharacterParam.itemInventory.RemoveItem(itemCellBox.item); } } // Update Box Inventory Panel panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject); // Update All Panels UIBuilder.UpdateAllPanels(); }
private void EquipItemFromIBoxInventory(DragAndDropParam dragAndDropParam) { EquipCell equipCell = dragAndDropParam.dragCell as EquipCell; ItemCell itemCell = dragAndDropParam.dropCell as ItemCell; equipCell.item = itemCell.item; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragFromPanel.GetComponent <PanelBoxInventory>(); panelBoxInventory.sceneObject.GetItemInventory().RemoveItem(itemCell.item); // Update Character Param CharacterParam.UpadateParam(itemCell.item); // Update Box Inventory Panel panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject); // Update All Panels UIBuilder.UpdateAllPanels(); }
private void UnEquipItemToBoxInventory(DragAndDropParam dragAndDropParam) { EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dropCell as ItemCell; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>(); if (itemCell != null) { Debug.Log("Drop to stuck"); } else { panelBoxInventory.sceneObject.GetItemInventory().AddItem(equipCell.item); // Update Character Param CharacterParam.UpadateParam(equipCell.item); equipCell.item = null; } // Update Box Inventory Panel panelBoxInventory.UpdatePanel(panelBoxInventory.sceneObject); // Update All Panels UIBuilder.UpdateAllPanels(); }
private void ActionCellDrop(DragAndDropParam dragAndDropParam) { // Stop Prev Action StopAllCoroutines(); /// Hot Bar if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelHotBar") { // Drop Cell if (dragAndDropParam.dropCell == null) { return; } // Create Action StartCoroutine(StartAction(0, dragAndDropParam, this.DropCellToHotBar)); } /// Equip from Character Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacter" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory") { if (dragAndDropParam.dropCell is EquipCell) { // Drop Cell if (dragAndDropParam.dropCell == null || dragAndDropParam.dropCell.baseCell != null) { return; } EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Cell Not Empty if (equipCell.equipType != itemCell.item.itemType || equipCell.item != null) { return; } // Create Action StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromICharacterInventory)); } } /// Equip from Box Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacter" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory") { if (dragAndDropParam.dropCell is EquipCell) { // Drop Cell if (dragAndDropParam.dropCell == null || dragAndDropParam.dropCell.baseCell != null) { return; } EquipCell equipCell = dragAndDropParam.dropCell as EquipCell; ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Cell Not Empty if (equipCell.equipType != itemCell.item.itemType || equipCell.item != null) { return; } // Create Action StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.EquipItemFromIBoxInventory)); } } /// UnEquip to Character Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacter") { EquipCell equipCell = dragAndDropParam.dragCell as EquipCell; // Full Inventory if (!CharacterParam.itemInventory.IsAdd(equipCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToCharacterInventory)); } /// UnEquip to Box Inventory if (dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory" && dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacter") { EquipCell equipCell = dragAndDropParam.dragCell as EquipCell; PanelBoxInventory panelBoxInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>(); // Full Inventory if (!panelBoxInventory.sceneObject.GetItemInventory().IsAdd(equipCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.UnEquipItemToBoxInventory)); } /// Drop from Box Inventory to Character Inventory if (dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelBoxInventory" && dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelCharacterInventory") { ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Full Inventory if (!CharacterParam.itemInventory.IsAdd(itemCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToCharacterInventoryFromBoxInventory)); } /// Drop from Character Inventory to Box Inventory if (dragAndDropParam.dragFromPanel != null && dragAndDropParam.dragFromPanel.panelName == "PanelCharacterInventory" && dragAndDropParam.dragToPanel != null && dragAndDropParam.dragToPanel.panelName == "PanelBoxInventory") { ItemInventory itemInventory = dragAndDropParam.dragToPanel.GetComponent <PanelBoxInventory>().sceneObject.GetItemInventory(); ItemCell itemCell = dragAndDropParam.dragCell as ItemCell; // Full Inventory if (!itemInventory.IsAdd(itemCell.item)) { return; } StartCoroutine(StartAction(GameParams.equipTime, dragAndDropParam, this.DropToBoxinventoryFromCharacterInventory)); } }