/// <summary> /// use this for client UI mangling attepts /// </summary> public static bool TryUpdateSlot(UISlotObject slotInfo) { if (!CanPutItemToSlot(slotInfo)) { return(false); } InventoryInteractMessage.Send(slotInfo.SlotUUID, slotInfo.FromSlotUUID, slotInfo.SlotContents, true); return(true); }
/// Drop an item from a slot. use forceSlotUpdate=false when doing clientside prediction, /// otherwise client will forcefully receive update slot messages public void DropItem(string hand, bool forceClientInform = true) { if (CustomNetworkManager.Instance._isServer) { ValidateDropItem(hand, forceClientInform); } else { InventoryInteractMessage.Send(hand, null, forceClientInform); } }
// public static InventoryInteractMessage Send(string hand, bool forceSlotUpdate/* = false*/) // { // return Send(hand, null, forceSlotUpdate); // } /// <summary> /// A serverside inventory request, for updating UI slots etc. /// You can give a position to dropWorldPos when dropping an item /// or else use Vector3.zero when not placing or dropping to ignore it. /// (The world pos is converted to local position automatically) /// </summary> public static InventoryInteractMessage Send(string hand, GameObject subject /* = null*/, bool forceSlotUpdate /* = false*/) { InventoryInteractMessage msg = new InventoryInteractMessage { Subject = subject ? subject.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid, Slot = encodeSlot(hand), ForceSlotUpdate = forceSlotUpdate }; msg.Send(); return(msg); }
public static InventoryInteractMessage Send(string slotUUID, string fromSlotUUID, GameObject subject, bool forceSlotUpdate) { InventoryInteractMessage msg = new InventoryInteractMessage { Subject = subject ? subject.GetComponent <NetworkIdentity>().netId : NetworkInstanceId.Invalid, SlotUUID = slotUUID, FromSlotUUID = fromSlotUUID, ForceSlotUpdate = forceSlotUpdate }; msg.Send(); return(msg); }
public bool TrySetItem(GameObject item) { if (!IsFull && item != null && CheckItemFit(item)) { // Debug.LogErrorFormat("TrySetItem TRUE for {0}", item.GetComponent<ItemAttributes>().hierarchy); InventoryInteractMessage.Send(item, eventName); //predictions(?): // SetItem(item); return(true); } // Debug.LogErrorFormat("TrySetItem FALSE for {0}", item.GetComponent<ItemAttributes>().hierarchy); return(false); }
/// Drop an item from a slot. use forceSlotUpdate=false when doing clientside prediction, /// otherwise client will forcefully receive update slot messages public void RequestDropItem(string handUUID, bool forceClientInform = true) { InventoryInteractMessage.Send("", handUUID, InventoryManager.GetSlotFromUUID(handUUID, isServer).Item, forceClientInform); }
/// Drop an item from a slot. use forceSlotUpdate=false when doing clientside prediction, /// otherwise client will forcefully receive update slot messages public void RequestDropItem(string hand, Vector3 dropWorldPos, bool forceClientInform = true) { InventoryInteractMessage.Send(hand, null, forceClientInform, dropWorldPos); }
/// Drop an item from a slot. use forceSlotUpdate=false when doing clientside prediction, /// otherwise client will forcefully receive update slot messages public void RequestDropItem(string hand, bool forceClientInform = true) { InventoryInteractMessage.Send(hand, null, forceClientInform); }