public void Mouse_ButtonDown(object sender, MouseButtonEventArgs e)
{
Point scaledMouse = mouse_current.MouseCurrent;
//main inventory
Point? cell = SelectedCell(scaledMouse);
//grab from inventory
if (cell != null)
{
controller.InventoryClick(new InventoryPosition()
{
type = InventoryPositionType.MainArea,
AreaX = cell.Value.X,
AreaY = cell.Value.Y,
});
}
//drop items on ground
if (scaledMouse.X < CellsStart.X && scaledMouse.Y < MaterialSelectorStart.Y)
{
Vector3i pos = viewport3d.SelectedBlock();
controller.InventoryClick(new InventoryPosition()
{
type = InventoryPositionType.Ground,
GroundPositionX = pos.x,
GroundPositionY = pos.y,
GroundPositionZ = pos.z,
});
}
//material selector
if (SelectedMaterialSelectorSlot(scaledMouse) != null)
{
int oldActiveMaterial = ActiveMaterial.ActiveMaterial;
ActiveMaterial.ActiveMaterial = SelectedMaterialSelectorSlot(scaledMouse).Value;
if (oldActiveMaterial == ActiveMaterial.ActiveMaterial)
{
controller.InventoryClick(new InventoryPosition()
{
type = InventoryPositionType.MaterialSelector,
MaterialId = ActiveMaterial.ActiveMaterial,
});
}
}
if (SelectedWearPlace(scaledMouse) != null)
{
controller.InventoryClick(new InventoryPosition()
{
type = InventoryPositionType.WearPlace,
WearPlace = (int)(SelectedWearPlace(scaledMouse).Value),
ActiveMaterial = ActiveMaterial.ActiveMaterial,
});
}
}