Added controls for gamepad, changed input & UI
This commit is contained in:
@@ -94,46 +94,7 @@ namespace Assets.Scripts
|
||||
inventory.itemDisplay.transform.localScale = new Vector3(0,0,0);
|
||||
}
|
||||
|
||||
public void OnMouseDrag()
|
||||
{
|
||||
inventory.setDrag(gameObject);
|
||||
Item toMove;
|
||||
if (place == ItemPlace.BAG)
|
||||
{
|
||||
toMove = items[currentBag];
|
||||
}
|
||||
else
|
||||
{
|
||||
toMove = equip;
|
||||
}
|
||||
if (toMove != null)
|
||||
{
|
||||
inventory.dragImage.GetComponent<RawImage>().color = toMove.rarityColor;
|
||||
inventory.dragImage.GetComponent<RawImage>().texture = toMove.image;
|
||||
inventory.dragImage.transform.position = new Vector3(Input.mousePosition.x + 50, Input.mousePosition.y - 50, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnMouseUp()
|
||||
{
|
||||
inventory.dragImage.GetComponent<RawImage>().color = new Color(0,0,0,0);
|
||||
inventory.dragImage.GetComponent<RawImage>().texture = null;
|
||||
inventory.dragImage.transform.position = new Vector3(0,0,0);
|
||||
InventorySlot startDrag = inventory.getDrag().GetComponent<InventorySlot>();
|
||||
Item item;
|
||||
if (startDrag.place == ItemPlace.BAG)
|
||||
{
|
||||
item = startDrag.getItem(startDrag.currentBag);
|
||||
}
|
||||
else
|
||||
{
|
||||
item = startDrag.getEquip();
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
item.move(startDrag, inventory, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Equipment getEquip()
|
||||
{
|
||||
@@ -235,5 +196,29 @@ namespace Assets.Scripts
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void showSlotOptions(){
|
||||
GameObject current = EventSystem.current.currentSelectedGameObject;
|
||||
GameObject.Find("Inventory").GetComponent<Inventory>().currentSlot = current;
|
||||
GameObject.Find("btnEquip").transform.Find("Text").GetComponent<Text>().text = "Equip";
|
||||
GameObject.Find("btnEquip").GetComponent<Button>().interactable = true;
|
||||
if(equip != null || items[currentBag] != null){
|
||||
if(equip != null){
|
||||
GameObject.Find("btnEquip").transform.Find("Text").GetComponent<Text>().text = "Unequip";
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnEquip"));
|
||||
}
|
||||
if(items[currentBag] != null){
|
||||
if(items[currentBag] is Equipment){
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnEquip"));
|
||||
}
|
||||
else{
|
||||
GameObject.Find("btnEquip").GetComponent<Button>().interactable = false;
|
||||
EventSystem.current.SetSelectedGameObject(GameObject.Find("btnTrash"));
|
||||
}
|
||||
}
|
||||
GameObject.Find("pnlInventoryActions").transform.position = new Vector3(current.transform.position.x + 125, current.transform.position.y, 0);
|
||||
GameObject.Find("pnlInventoryActions").transform.localScale = new Vector3(1,1,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user