// // ITEM EVENT HANDLERS // private void itemPanel_Click(object sender, EventArgs e, Item item) { if (item != null) { PlayerThinking(item.Description); ucItemClicked itemControl = new ucItemClicked(item, User, ActiveRoom, this); this.roomPanel.Controls.Add(itemControl); ItemClick = itemControl; itemControl.Show(); itemControl.BringToFront(); } }
private void picturebox_Click(object sender, EventArgs e, Item item) { if (item != null) { MainForm.PlayerThinking(item.Description); // // GIVING ITEM TO CHARACTER // if (IsCharacterOpen) { this.Hide(); ucGiveItem giveItemControl = new ucGiveItem(User, item, MotherCharacter, MainForm, this); MainForm.Controls.Add(giveItemControl); giveItemControl.Show(); giveItemControl.BringToFront(); } // // USING ON OTHER ITEM // else if (IsItemOpen) { if (MotherItem.UsableItemPair.Name == item.Name) { this.Hide(); ucUseItemOnItem useItemOnItemControl = new ucUseItemOnItem(User, ActiveRoom, item, MotherItem, MainForm, this); MainForm.Controls.Add(useItemOnItemControl); useItemOnItemControl.Show(); useItemOnItemControl.BringToFront(); } else { MainForm.HideThoughts(); MainForm.PlayerThinking("Cant use " + item.Name.ToLower() + " on " + MotherItem.Name.ToLower() + "."); } } // // UNLOCK DOOR // else if (IsDoorOpen) { if (item is Key && item.ID == ClickedDoor.ID) { ClickedDoor.IsLocked = false; MainForm.OpenRoom(ClickedDoor.ToRoom); MainForm.HideThoughts(); MainForm.PlayerThinking("Love is the master key that opens the gates of happiness."); this.Hide(); } else if (item is Key && item.ID != ClickedDoor.ID) { MainForm.HideThoughts(); MainForm.PlayerThinking("This key goes somewhere else"); } else if (item is Key == false) { MainForm.HideThoughts(); MainForm.PlayerThinking("This is not even a key"); } } // // STANDARD ITEM CLICK // // else { ucItemClicked itemControl = new ucItemClicked(item, User, OpenContainerItem.ItemSlots, ActiveRoom, MainForm, this, OpenContainerItem); this.Hide(); MainForm.Controls.Add(itemControl); itemControl.Show(); itemControl.BringToFront(); } } }