public void SetItem(int i, Item item) { Action <Point2D> itemTakeHandler = (p) => ItemTake.Raise(i, p); Action <Point2D> itemTransferHandler = (p) => ItemTransfer.Raise(i, p); Action <Point2D> itemActHandler = (p) => ItemAct.Raise(i, p); Action <KeyModifiers> itemInteractHandler = (mods) => ItemInteract.Raise(i); if (items[i] != null) { items[i].Take -= itemTakeHandler; items[i].Transfer -= itemTransferHandler; items[i].Act -= itemActHandler; items[i].Interact -= itemInteractHandler; items[i].Remove(); items[i].Dispose(); } if (item != null) { items[i] = new ItemWidget(this, null); items[i].Item = item; items[i].Move(slotPositions[i].X, slotPositions[i].Y); items[i].Take += itemTakeHandler; items[i].Transfer += itemTransferHandler; items[i].Act += itemActHandler; items[i].Interact += itemInteractHandler; } }
void Start() { interact = GameObject.Find("pickuprange").GetComponent <ItemInteract> (); canvas = GameObject.Find("MainCanvas"); inv = GameObject.Find("Inventory").GetComponent <Inventory> (); title = inv.GetComponent <Title> (); }
bool IItemDropTarget.Interact(Point2D p, Point2D ul, KeyModifiers mods) { if (Session == null) { return(false); } var sc = ToAbsolute(p); var mc = Geometry.ScreenToMap(sc); var gob = Session.Scene.GetObjectAt(sc); ItemInteract.Raise(new MapClickEvent(0, mods, mc, p, gob)); return(true); }
//Picks up a pickupable item public override void Pickup(Pickupable item) { //Get itemInteract script ItemInteract itemInteract = GetComponent <ItemInteract>(); //Remove the item from the list of possible interactables if (itemInteract.possibleInteractables.Contains(item)) { itemInteract.possibleInteractables.Remove(item); } //Call character pickup function base.Pickup(item); }
private void CheckInteraction() { if (Physics.Raycast(cam.transform.position, cam.transform.forward, out var hit, maxDistanceInteractable, layerInteractable) && hit.collider.transform.CompareTag("Item")) { ItemInteract i = hit.collider.transform.GetComponent <ItemInteract>(); if (i != null) { if (Input.GetButtonDown("Interact")) { i.Interact(); } else { i.DisplayHelp(); return; } } } GameManager.Instance.UiManager.HudManager.HelpInteract(false); GameManager.Instance.UiManager.HudManager.HelpInteract(false); }
//Get item interact component from character void Start() { itemInteract = transform.parent.parent.GetComponent <ItemInteract>(); }
public PacketHandlers() { setPacketSizes(); PacketHandler temp; temp = new ActionButton(); handlers.Add(PacketId.CLOSE, temp); //Close handlers.Add(PacketId.ACTIONBUTTON, temp); //Actionbutton #1 handlers.Add(PacketId.ACTIONBUTTON2, temp); //Actionbutton #2 handlers.Add(PacketId.ACTIONBUTTON3, temp); //Actionbutton #3 temp = new ClientAction(); handlers.Add(PacketId.IDLE, temp); //Idle handlers.Add(PacketId.MOVE_CAMERA, temp); //Move camera handlers.Add(PacketId.PING, temp); //Ping handlers.Add(PacketId.FOCUS, temp); //Window focus handlers.Add(PacketId.CLICK_MOUSE, temp); //Mouse handlers.Add(PacketId.WINDOW_TYPE, temp); //Window type handlers.Add(PacketId.SOUND_SETTINGS, temp); //Toggle sound (sounds) temp = new Command(); handlers.Add(PacketId.COMMAND, temp); //Commands temp = new Communication(); handlers.Add(PacketId.ADD_FRIEND, temp); //Add friend handlers.Add(PacketId.DELETE_FRIEND, temp); //Delete friend handlers.Add(PacketId.ADD_IGNORE, temp); //Add ignore handlers.Add(PacketId.DELETE_IGNORE, temp); //Delete ignore handlers.Add(PacketId.SEND_PM, temp); //Send PM handlers.Add(PacketId.CLAN_RANKS, temp); //Set clan ranks handlers.Add(PacketId.CLAN_CHAT, temp); //Join clan chat handlers.Add(PacketId.PUBLIC, temp); //Public chat handlers.Add(PacketId.CLAN_KICK, temp); //Clan chat kick handlers.Add(PacketId.PRIVACY_SETTINGS, temp); //public/private/trade chat settings temp = new Walk(); handlers.Add(PacketId.WALK_1, temp); //Walk handlers.Add(PacketId.WALK_2, temp); //Walk handlers.Add(PacketId.WALK_3, temp); //Walk temp = new PlayerInteract(); handlers.Add(PacketId.ATTACK_PLAYER, temp); //Attack handlers.Add(PacketId.FOLLOW, temp); //Follow handlers.Add(PacketId.TRADE, temp); //Trade handlers.Add(PacketId.MAGIC_ON_PLAYER, temp); //Magic on player temp = new NPCInteract(); handlers.Add(PacketId.NPC_FIRST_CLICK, temp); //Attack handlers.Add(PacketId.NPC_SECOND_CLICK, temp); //Second click handlers.Add(PacketId.NPC_THIRD_CLICK, temp); //Third click handlers.Add(PacketId.NPC_FOURTH_CLICK, temp); //Fourth click handlers.Add(PacketId.NPC_FIFTH_CLICK, temp); //Fifth click handlers.Add(PacketId.NPC_EXAMINE, temp); //Examine Npc handlers.Add(PacketId.MAGIC_ON_NPC, temp); //Magic on NPC handlers.Add(PacketId.ITEM_ON_NPC, temp); //Item on NPC temp = new ObjectInteract(); handlers.Add(PacketId.OBJECT_FIRST_CLICK, temp); //First click handlers.Add(PacketId.OBJECT_SECOND_CLICK, temp); //Second click handlers.Add(PacketId.OBJECT_THIRD_CLICK, temp); //Third click handlers.Add(PacketId.OBJECT_FOURTH_CLICK, temp); //Fourth click handlers.Add(PacketId.OBJECT_FIFTH_CLICK, temp); //Fifth click handlers.Add(PacketId.OBJECT_EXAMINE, temp); //object examine temp = new ItemInteract(); handlers.Add(PacketId.EQUIP, temp); //Equip item handlers.Add(PacketId.ITEM_ON_ITEM, temp); //Item used on item handlers.Add(PacketId.INV_CLICK, temp); //Inventory click item handlers.Add(PacketId.ITEM_ON_OBJECT, temp); //Item used on object handlers.Add(PacketId.ITEM_ON_GROUND_ITEM, temp); //Item used on ground item. handlers.Add(PacketId.INV_OPERATE, temp); //Operate option handlers.Add(PacketId.INV_DROP, temp); //Drop item handlers.Add(PacketId.PICKUP, temp); //Pick up item handlers.Add(PacketId.INV_SWAP_SLOT, temp); //Swap item slot 1 handlers.Add(PacketId.INV_SWAP_SLOT2, temp); //Swap item slot 2 handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION1, temp); //Right click option 1 handlers.Add(PacketId.INV_RIGHT_CLICK_OPTION2, temp); //Right click option 2 handlers.Add(PacketId.INV_EXAMINE_ITEM, temp); //Inventory item examine handlers.Add(PacketId.INV_EXAMINE_ITEM_GE, temp); //Inventory item examine in GE_SELL_ITEM temp = new InterfaceOptions(); handlers.Add(PacketId.ENTER_AMOUNT, temp); //Enter amount handlers.Add(PacketId.ENTER_TEXT, temp); // Enter text handlers.Add(PacketId.INTERFACE_CLICK_1, temp); //Option 1 handlers.Add(PacketId.INTERFACE_CLICK_2, temp); //Option 2 handlers.Add(PacketId.INTERFACE_CLICK_3, temp); //Option 3 handlers.Add(PacketId.INTERFACE_CLICK_4, temp); //Option 4 handlers.Add(PacketId.INTERFACE_CLICK_5, temp); //Option 5 handlers.Add(PacketId.INTERFACE_CLICK_6, temp); //Option 6 handlers.Add(PacketId.INTERFACE_CLICK_7, temp); //Option 7 handlers.Add(PacketId.INTERFACE_CLICK_8, temp); //Option 8 handlers.Add(PacketId.INTERFACE_CLICK_9, temp); //Option 9 handlers.Add(PacketId.INTERFACE_CLICK_10, temp); //Option 9 handlers.Add(PacketId.GE_SEARCH, temp); //Grand exchange search temp = new Unused(); handlers.Add(PacketId.REIGON_LOADING, temp); //Region loading, varied size handlers.Add(PacketId.PACKET_COUNT, temp); //Sent after any click which increases 'count' in getPackets handlers.Add(PacketId.CLIENT_VARIABLE_30, temp); //Sent if a client variable is 30..unknown handlers.Add(PacketId.DODGY_PACKET, temp); //Caused by a dodgy packet Console.WriteLine("Binded packetHandlers"); }
bool IItemDropTarget.Interact(Point2D p, Point2D ul, KeyModifiers mods) { ItemInteract.Raise(); return(true); }