private void stashWindow(int windowid) { GUI.Box(new Rect(5, 5, 200, 25), "Stash"); //Title if (GUI.Button(new Rect(210, 5, 30, 25), "X")) //Close Button { CloseStashWindow(); //return; } PageNum = GUI.SelectionGrid(new Rect(5, 35, 240, 25), PageNum, selStrings, 5); int cnt = 0 + (PageNum * 25); for (int x = 0; x < 5; x++) { for (int y = 0; y < 5; y++) { if (cnt <= player.Stash.Count - 1) { if (player.Stash[cnt] != null) { if (GUI.Button(new Rect(5 + (y * 45), 65 + (x * 45), 40, 40), new GUIContent(player.Stash[cnt].Icon, string.Format("Stash{0}", cnt) ), player.Stash[cnt].Rarity.ToString())) { if (Event.current.button == 1) { openedStash.MoveFromBankToPlayer(cnt); MyGUI._toolTip = ""; return; } } string stackInfo = player.Stash[cnt].MaxStacks > 1 ? player.Stash[cnt].CurStacks.ToString() : string.Empty; GUI.Box(new Rect(5 + (y * 45), 65 + (x * 45), 40, 40), stackInfo, "StackOverlay"); string moreInfo = player.Stash[cnt].ItemType == ItemEquipType.Weapon ? "+" + (player.Stash[cnt] as Weapon).Enchants : string.Empty; GUI.Box(new Rect(5 + (y * 45), 65 + (x * 45), 40, 40), moreInfo, "ItemInfoOverlay"); } } else { GUI.Box(new Rect(5 + (y * 45), 65 + (x * 45), 40, 40), ""); } cnt++; } } GUI.DragWindow(new Rect(0, 0, 10000, 20)); GUIHandler.SetToolTip(); GUI.BringWindowToFront(0); }
private void questTrackerWindow(int windowid) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); _questWindowPanel = GUILayout.Toolbar(_questWindowPanel, questWindowPanels, GUILayout.Height(20)); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); switch (_questWindowPanel) { case 0: DisplayQuestTracker(); break; case 1: DisplayAchievements(); break; } GUI.DragWindow(new Rect(0, 0, 10000, 20)); GUIHandler.SetToolTip(); }
public void characterWindow(int windowid) { _characterPanel = GUI.Toolbar(new Rect(5, _characterWindowRect.height - 25, _characterWindowRect.width - 10, 20), _characterPanel, _characterPanelNames); switch (_characterPanel) { case 0: //GUI.DrawTexture(new Rect(89,31,120,170),characterEquipped); break; case 1: DisplayAttributes(); break; case 2: DisplaySkills(); break; } DisplayEquipment(); GUIHandler.SetToolTip(); GUI.DragWindow(new Rect(0, 0, 10000, 20)); }
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(); }
void npcWindow(int windowid) { if (openedNPCDialog == null) { return; } /* WE USE 100 AS THE OPTION NUMBER FOR VENDOR IF NEEDED*/ /* WE USE 200 AS THE OPTION NUMBER FOR CRAFTING IF NEEDED*/ //int optionNum = openedNPCDialog.OptionNumber; if (openedNPCDialog.textNum + 1 != openedNPCDialog.npcText.Length) { openedNPCDialog.buttonTextNum = 0; } else { openedNPCDialog.buttonTextNum = 1; } //GUI.Box (new Rect((0,0,400,400),""); //BG if (openedNPCDialog.OptionNumber == 0 || openedNPCDialog.OptionNumber == 1) { GUI.Box(new Rect(5, 5, 355, 30), openedNPCDialog.Title); //Title if (GUI.Button(new Rect(365, 5, 30, 30), "X")) //Close Button { openedNPCDialog.CloseDialog(); return; } } //Dialogue Options: Conversation, Quests, Vendor if (openedNPCDialog.OptionNumber == 0) //displaying options { if (GUI.Button(new Rect(5, 40, 390, 20), "Conversation")) //Converse { openedNPCDialog.OptionNumber = 1; } for (int i = 0; i < openedNPCDialog.quests.Count; i++) { string questInfo = openedNPCDialog.quests[i].QuestName; if (openedNPCDialog.quests[i].isAccepted) { questInfo += " [In Progress]"; } if (!openedNPCDialog.quests[i].isAccepted) { questInfo = ToolTipStyle.Yellow + questInfo + ToolTipStyle.EndColor; } else if (openedNPCDialog.quests[i].isAccepted) { questInfo = ToolTipStyle.Orange + questInfo + ToolTipStyle.EndColor; } else if (openedNPCDialog.quests[i].isComplete) { questInfo = ToolTipStyle.Green + questInfo + ToolTipStyle.EndColor; } if (GUI.Button(new Rect(5, 65 + (i * 25), 390, 20), questInfo)) { openedNPCDialog.OptionNumber = 2 + i; } } if (openedNPCDialog.isVendor) { string vendorInfo = ToolTipStyle.Blue + "*Vendor*" + ToolTipStyle.EndColor; if (GUI.Button(new Rect(5, 65 + (openedNPCDialog.quests.Count * 25), 390, 20), vendorInfo)) { openedNPCDialog.OptionNumber = 100; } } if (openedNPCDialog.isBlacksmith) { int isVendorSpace = openedNPCDialog.isVendor ? 25 : 0; string blackSmithInfo = ToolTipStyle.Blue + "*Crafting*" + ToolTipStyle.EndColor; if (GUI.Button(new Rect(5, 65 + isVendorSpace + (openedNPCDialog.quests.Count * 25), 390, 20), blackSmithInfo)) { openedNPCDialog.OptionNumber = 200; } } } //Conversation Option else if (openedNPCDialog.OptionNumber == 1) { GUI.Box(new Rect(5, 40, 390, 330), openedNPCDialog.npcText[openedNPCDialog.textNum], "NPCDialog"); //Dialog if (GUI.Button(new Rect(5, 375, 385, 20), openedNPCDialog.buttonText[openedNPCDialog.buttonTextNum])) //Button { if (openedNPCDialog.textNum + 1 != openedNPCDialog.npcText.Length) //Go to next conversation text if we're not on the last one { openedNPCDialog.textNum += 1; } else { if (openedNPCDialog.npcText != openedNPCDialog.npcTextOrig) //if convo is for quest { foreach (NPCQuest nq in _pc.QuestsInProgress) { if (openedNPCDialog.NpcName.Contains(nq.nameOfNPCtoTalkTo)) { nq.talkDone = true; } } } openedNPCDialog.OptionNumber = 0; openedNPCDialog.EnterDialog(); } } } //Vendor Option /*NOTE: arrayNum 0-15 = Vendor, 16-19 = BuyBack for the tooltips*/ else if (openedNPCDialog.OptionNumber == 100) { GUI.Box(new Rect(5, 5, 390, 30), "Vendor"); //Title if (GUI.Button(new Rect(365, 5, 30, 30), "X")) //Close Button { openedNPCDialog.CloseDialog(); } int vendorCnt = 0; for (int m = 0; m < 4; m++) { for (int n = 0; n < 4; n++) { if (vendorCnt <= openedNPCDialog.vendor.vendorItems.Count - 1) { if (openedNPCDialog.vendor.vendorItems[vendorCnt] != null) { if (GUI.Button(new Rect(5 + (n * 45), 40 + (m * 45), 40, 40), new GUIContent(openedNPCDialog.vendor.vendorItems[vendorCnt].Icon, string.Format("Vendor{0}", vendorCnt) ), openedNPCDialog.vendor.vendorItems[vendorCnt].Rarity.ToString())) { if (Event.current.button == 1) { openedNPCDialog.vendor.PlayerBuyItem(vendorCnt); return; } } string stackInfo = openedNPCDialog.vendor.vendorItems[vendorCnt].MaxStacks > 1 ? openedNPCDialog.vendor.vendorItems[vendorCnt].CurStacks.ToString() : string.Empty; GUI.Box(new Rect(5 + (n * 45), 40 + (m * 45), 40, 40), stackInfo, "StackOverlay"); string moreInfo = openedNPCDialog.vendor.vendorItems[vendorCnt].ItemType == ItemEquipType.Weapon ? "+" + (openedNPCDialog.vendor.vendorItems[vendorCnt] as Weapon).Enchants : string.Empty; GUI.Box(new Rect(5 + (n * 45), 40 + (m * 45), 40, 40), moreInfo, "ItemInfoOverlay"); } } else { GUI.Box(new Rect(5 + (n * 45), 40 + (m * 45), 40, 40), ""); } vendorCnt++; } } GUI.Box(new Rect(5, 220, 390, 30), "BuyBack"); //BuyBack Title for (int b = 0; b < 4; b++) { if (b <= openedNPCDialog.vendor.buyBackItems.Count - 1) { if (openedNPCDialog.vendor.buyBackItems[b] != null) { if (GUI.Button(new Rect(5 + (b * 45), 255, 40, 40), new GUIContent(openedNPCDialog.vendor.buyBackItems[b].Icon, string.Format("Vendor{0}", 16 + b) ), openedNPCDialog.vendor.buyBackItems[b].Rarity.ToString())) { if (Event.current.button == 1) { openedNPCDialog.vendor.PlayerBuyBack(b); } } string stackInfo = openedNPCDialog.vendor.buyBackItems[b].MaxStacks > 1 ? openedNPCDialog.vendor.buyBackItems[b].CurStacks.ToString() : string.Empty; GUI.Box(new Rect(5 + (b * 45), 255, 40, 40), stackInfo, "StackOverlay"); string moreInfo = openedNPCDialog.vendor.buyBackItems[b].ItemType == ItemEquipType.Weapon ? "+" + (openedNPCDialog.vendor.buyBackItems[b] as Weapon).Enchants : string.Empty; GUI.Box(new Rect(5 + (b * 45), 255, 40, 40), moreInfo, "ItemInfoOverlay"); } } else { GUI.Box(new Rect(5 + (b * 45), 255, 40, 40), ""); } } } //Blacksmith Option else if (openedNPCDialog.OptionNumber == 200) { blackSmith = openedNPCDialog.GetComponent <NPCBlacksmith>(); GUI.Box(new Rect(5, 5, 390, 30), "Crafting"); //Title if (GUI.Button(new Rect(365, 5, 30, 30), "X")) //Close Button { openedNPCDialog.CloseDialog(); } for (int i = 0; i < CraftedItemsClasses.AllCraftableItems.Count; i++) { GUI.Box(new Rect(5, 40 + (i * 55), 390, 50), ""); //craftitem bg if (GUI.Button(new Rect(10, 45 + (i * 55), 40, 40), new GUIContent(CraftedItemsClasses.AllCraftableItems[i].Icon, string.Format("Craft{0}", i) ))) { selectedItem = CraftedItemsClasses.AllCraftableItems[i]; } string infoString = string.Format("Level {0} {1}", CraftedItemsClasses.AllCraftableItems[i].RequiredLevel, CraftedItemsClasses.AllCraftableItems[i].Name); //infoString = check if have all items if (GUI.Button(new Rect(55, 45 + (i * 55), 335, 40), infoString)) { selectedItem = CraftedItemsClasses.AllCraftableItems[i]; } } GUI.Box(new Rect(5, 270, 390, 15), ""); //Seperator if (selectedItem != null) { GUI.Box(new Rect(5, _npcWindowRect.height - 105, 390, 100), ""); blackSmith.GetMatsInfo(selectedItem); for (int m = 0; m < blackSmith.itemsNeeded.Count; m++) { GUI.Box(new Rect(10 + (m * 45), _npcWindowRect.height - 100, 40, 40), new GUIContent(blackSmith.itemsNeeded[m].Icon, string.Format("CraftMat{0}", m) )); GUI.Box(new Rect(17 + (m * 45), _npcWindowRect.height - 62, 20, 20), blackSmith.itemsNeeded[m].CurStacks.ToString(), "Invisible"); } GUI.Box(new Rect(_npcWindowRect.width - 130, _npcWindowRect.height - 100, 120, 30), selectedItem.Name); if (GUI.Button(new Rect(10, _npcWindowRect.height - 40, 380, 30), "Craft Item")) { blackSmith.CraftItem(selectedItem); } } else { GUI.Box(new Rect(5, _npcWindowRect.height - 105, 390, 100), "Choose an Item to Craft"); } } //Quest Option else { if (!openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].isFinished) { //display for quest optionNum GUI.Box(new Rect(5, 5, 390, 30), openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestName); //Title if (GUI.Button(new Rect(365, 5, 30, 30), "X")) //Close Button { openedNPCDialog.CloseDialog(); } GUI.Box(new Rect(5, 40, 390, 230), openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestText, "NPCDialog"); //Dialog GUI.Box(new Rect(5, 275, 390, 20), "Rewards", "NPCDialog"); //Rewards string rewardText = "Exp: " + openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestExpReward + " " + "Gold: " + openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestGoldReward; GUI.Box(new Rect(5, 300, 390, 20), rewardText, "NPCDialog"); //Exp/Gold Reward for (int i = 0; i < openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestReward.Count; i++) { string stackInfo = openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestReward[i].MaxStacks > 1 ? openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestReward[i].CurStacks.ToString() : string.Empty; //Quest Item Reward GUI.Box(new Rect(5 + (45 * i), 325, 40, 40), new GUIContent(openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestReward[i].Icon, string.Format("NPCQuest{0}_{1}", openedNPCDialog.OptionNumber - 2, i)), openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestReward[i].Rarity.ToString()); GUI.Box(new Rect(5 + (45 * i), 325, 40, 40), stackInfo, "StackOverlay"); } if (openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].requirementStatus == RequirementsStatus.All) { if (!openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].isAccepted) { if (GUI.Button(new Rect(5, 375, 190, 20), "Accept Quest")) //Button { Debug.Log("Quest Accepted"); openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].isAccepted = true; _pc.QuestsInProgress.Add(openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2]); if (openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].qego != null) { openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].qego.EnableGameObjects(); } openedNPCDialog.OptionNumber = 0; } } else { if (openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].isComplete) { if (GUI.Button(new Rect(5, 375, 190, 20), "Complete Quest")) //Button { Debug.Log("Quest Complete"); openedNPCDialog.CompleteQuest(openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2]); openedNPCDialog.OptionNumber = 0; } } else { GUI.Button(new Rect(5, 375, 190, 20), "In Progress"); } } } else { if (openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].requirementStatus == RequirementsStatus.Quests) { string info = string.Format("Requires: Level {0}", openedNPCDialog.quests[openedNPCDialog.OptionNumber - 2].QuestLevelReq); GUI.Button(new Rect(5, 375, 190, 20), info); } } if (GUI.Button(new Rect(200, 375, 190, 20), "Close")) //Button { openedNPCDialog.CloseDialog(); } } } GUI.DragWindow(new Rect(0, 0, 10000, 20)); GUIHandler.SetToolTip(); GUI.BringWindowToFront(0); }