private void inventoryWindow(int windowid) { bool controlIsDown = false; bool shiftIsDown = false; int cnt = 0; for (int y = 0; y < _inventoryRows; y++) { if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) { controlIsDown = true; } if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) { shiftIsDown = true; } for (int x = 0; x < _inventoryCols; x++) { if (cnt < _pc.Inventory.Count) { buttonRects[cnt] = new Rect(5 + (itemWidth * x), 20 + y * itemHeight, itemWidth, itemHeight); //Item Button if (GUI.Button(buttonRects[cnt], new GUIContent(_pc.Inventory[cnt].Icon, string.Format("Inventory{0}", cnt)), _pc.Inventory[cnt].Rarity.ToString())) { //Left Click To Pick Up Item/Split Stack if (!showSplit) { if (Event.current.button == 0) { if (shiftIsDown && _pc.Inventory[cnt].CurStacks > 1) { showSplit = true; MyGUI.inventoryArrayToSplit = cnt; } else if (!MyGUI.itemIsPickedUp) { MyGUI.itemIsPickedUp = true; MyGUI.SetPickedUpItem(_pc.Inventory[cnt].Icon, string.Format("Inventory{0}", cnt)); } else { if (!MyGUI.itemIsForUse) { GUIHandler.SwapItems(string.Format("Inventory{0}", cnt)); } else { GUIHandler.UseSocket(cnt); } } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { if (_pc.playerState == PlayerState.Stash) { _pc.AddToBank(cnt); } else if (_pc.playerState != PlayerState.NPCDialog) { InventoryDo("UseItem", cnt); } else if (controlIsDown && NPCDialogGUI.openedNPCDialog.OptionNumber == 100) //if in vendor and holding control { NPCDialogGUI.openedNPCDialog.vendor.PlayerSellItem(cnt); } MyGUI._toolTip = ""; return; } } } string stackInfo = _pc.Inventory[cnt].MaxStacks > 1 ? _pc.Inventory[cnt].CurStacks.ToString() : string.Empty; GUI.Box(buttonRects[cnt], stackInfo, "StackOverlay"); string moreInfo = _pc.Inventory[cnt].ItemType == ItemEquipType.Weapon ? "+" + (_pc.Inventory[cnt] as Weapon).Enchants : string.Empty; if (_pc.Inventory[cnt].ItemType == ItemEquipType.QuestItem) { moreInfo = "Q"; } GUI.Box(buttonRects[cnt], moreInfo, "ItemInfoOverlay"); } else { GUI.Box(new Rect(5 + (itemWidth * x), 20 + y * itemHeight, itemWidth, itemHeight), "", "inventorySlot"); } cnt++; } } if (GUI.Button(new Rect(5, _inventoryWindowRect.height - 25, 20, 20), new GUIContent("", "Deletes items from your inventory."), "Invisible")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.TrashIconDropItem(); } } } GUI.Label(new Rect(27, _inventoryWindowRect.height - 27, _inventoryWindowRect.width - 54, 20), _pc.Gold.ToString("N0").Replace(".", ","), "Gold"); GUI.DragWindow(new Rect(0, 0, 10000, 20)); GUIHandler.SetToolTip(); }
private void DisplayEquipment() { //Debug.Log ("DISPLAYING EQUIPS"); //Equipped Weapon if (_pc.EquipedWeapon == null) { if (GUI.Button(new Rect(130, 221, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedWeapon"); } } } } else { if (GUI.Button(new Rect(130, 221, 40, 40), new GUIContent(_pc.EquipedWeapon.Icon, "EquipedWeapon"), _pc.EquipedWeapon.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedWeapon"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedWeapon", 0); } } string moreInfo = "+" + (_pc.EquipedWeapon as Weapon).Enchants.ToString(); GUI.Box(new Rect(130, 221, 40, 40), moreInfo, "ItemInfoOverlay"); } //Equipped Head if (_pc.EquipedArmorHead == null) { if (GUI.Button(new Rect(24, 21, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorHead"); } } } } else { if (GUI.Button(new Rect(24, 21, 40, 40), new GUIContent(_pc.EquipedArmorHead.Icon, "EquipedArmorHead"), _pc.EquipedArmorHead.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorHead"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorHead", 0); } } } //Equipped Chest Armour if (_pc.EquipedArmorChest == null) { if (GUI.Button(new Rect(24, 68, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorChest"); } } } } else { if (GUI.Button(new Rect(24, 68, 40, 40), new GUIContent(_pc.EquipedArmorChest.Icon, "EquipedArmorChest"), _pc.EquipedArmorChest.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorChest"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorChest", 0); } } } //Equipped Gloves if (_pc.EquipedArmorGloves == null) { if (GUI.Button(new Rect(238, 68, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorGloves"); } } } } else { if (GUI.Button(new Rect(238, 68, 40, 40), new GUIContent(_pc.EquipedArmorGloves.Icon, "EquipedArmorGloves"), _pc.EquipedArmorGloves.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorGloves"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorGloves", 0); } } } //Equipped Legs if (_pc.EquipedArmorLegs == null) { if (GUI.Button(new Rect(24, 116, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorLegs"); } } } } else { if (GUI.Button(new Rect(24, 116, 40, 40), new GUIContent(_pc.EquipedArmorLegs.Icon, "EquipedArmorLegs"), _pc.EquipedArmorLegs.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorLegs"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorLegs", 0); } } } //Equipped Feet if (_pc.EquipedArmorFeet == null) { if (GUI.Button(new Rect(238, 115, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorFeet"); } } } } else { if (GUI.Button(new Rect(238, 115, 40, 40), new GUIContent(_pc.EquipedArmorFeet.Icon, "EquipedArmorFeet"), _pc.EquipedArmorFeet.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorFeet"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorFeet", 0); } } } //Equipped Back if (_pc.EquipedArmorBack == null) { if (GUI.Button(new Rect(238, 21, 40, 40), "", "Box")) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorBack"); } } } } else { if (GUI.Button(new Rect(238, 21, 40, 40), new GUIContent(_pc.EquipedArmorBack.Icon, "EquipedArmorBack"), _pc.EquipedArmorBack.Rarity.ToString())) { if (Event.current.button == 0) { if (MyGUI.itemIsPickedUp) { GUIHandler.SwapItems("EquipedArmorBack"); } } //Right Click To Use Item if (Event.current.button == 1 && !MyGUI.itemIsPickedUp) { inventoryWindowGUI.InventoryDo("ReturnEquippedArmorBack", 0); } } } }