public ReceiveItemDropPacket ( |
||
itemPacket | ||
return | void |
/*--------------------------------------------------------------------------------------- * -- FUNCTION: OkDropButtonOnClick * -- DATE: 10/03/2016 * -- REVISIONS: * -- DESIGNER: Joseph Tam-Huang * -- PROGRAMMER: Joseph Tam-Huang * -- INTERFACE: public void OkDropButtonOnClick() * -- RETURNS: void * -- NOTES: * -- Checks that the amount trying to be dropped is allowed. If yes, send a DropItem * -- network message, otherwise update the error message. * ----------------------------------------------------------------------------------------*/ public void OkDropButtonOnClick() { Debug.Log("ok drop clicked"); _drop_amt = int.Parse(_amt_input_field.GetComponent <InputField>().text); if (_drop_amt > 0 && _drop_amt <= _amt) { // Send Network message List <Pair <string, string> > msg = _world_item_manager.CreateDropItemNetworkMessage(_item.id, _drop_amt, _inv_pos); NetworkingManager.send_next_packet(DataType.Item, (int)ItemUpdate.Drop, msg, Protocol.TCP); // Pretend that a drop message was received if (Application.platform != RuntimePlatform.LinuxPlayer) { _world_item_manager.ReceiveItemDropPacket(_world_item_manager.ConvertListToJSONClass(msg)); } GameData.MouseBlocked = false; Deactivate(); } else { _error_text.text = "Invalid amount"; } }
/*----------------------------------------------------------------------------------- * -- FUNCTION: DropItemOnClick * -- DATE: 05/03/2016 * -- REVISIONS: * -- DESIGNER: Joseph Tam-Huang * -- PROGRAMMER: Joseph Tam-Huang * -- INTERFACE: public void DropItemOnClick() * -- RETURNS: void * -- NOTES: * -- Sends an ItemDrop network message if there is only one item or activates the * -- AmountPanel if there are more that 1 item stack. * -- Deactivates the ItemMenu * ----------------------------------------------------------------------------------*/ public void DropItemOnClick() { if (_amt > 1 && _item.stackable) { _amount_panel.Activate(_item, _amt, _inv_pos); } else { // Send Network message List <Pair <string, string> > msg = _world_item_manager.CreateDropItemNetworkMessage(_item.id, _amt, _inv_pos); NetworkingManager.send_next_packet(DataType.Item, (int)ItemUpdate.Drop, msg, Protocol.TCP); // Pretend that a drop message was received for local testing if (Application.platform != RuntimePlatform.LinuxPlayer) { _world_item_manager.ReceiveItemDropPacket(_world_item_manager.ConvertListToJSONClass(msg)); } } GameData.MouseBlocked = false; Deactivate(); }