private void SendItemMoveCommand(Item item, ServerCommands.ItemMoveLocation to = ServerCommands.ItemMoveLocation.UnitBody, int toIndex = -1) { // send command. // first off, determine move source. ServerCommands.ItemMoveLocation from; int fromIndex = -1; if (item.Parent == LogicHuman.ItemsBody) { from = ServerCommands.ItemMoveLocation.UnitBody; fromIndex = item.Class.Option.Slot; } else if (item.Parent == LogicHuman.ItemsPack) { from = ServerCommands.ItemMoveLocation.UnitPack; fromIndex = item.Index; } else { from = ServerCommands.ItemMoveLocation.Ground; } if (toIndex < 0) { toIndex = item.Class.Option.Slot; } Client.SendItemMove(from, to, fromIndex, toIndex, item.Count, LogicHuman, MapView.Instance.MouseCellX, MapView.Instance.MouseCellY); }
public static void SendItemMove(ServerCommands.ItemMoveLocation from, ServerCommands.ItemMoveLocation to, int fromIndex, int toIndex, int count, MapUnit currentUnit, int cellX, int cellY) { if (NetworkManager.IsClient) { /*Debug.LogFormat("from = {0}, to = {1}, fromIndex = {2}, toIndex = {3}, count = {4}", * from, to, fromIndex, toIndex, count);*/ ServerCommands.ItemMove imvCmd; imvCmd.Source = from; imvCmd.SourceIndex = fromIndex; imvCmd.Destination = to; imvCmd.DestinationIndex = toIndex; imvCmd.Count = count; imvCmd.UnitTag = (currentUnit != null) ? (currentUnit.Tag) : -1; imvCmd.CellX = cellX; imvCmd.CellY = cellY; ClientManager.SendCommand(imvCmd); } }