本文整理汇总了C#中MouseEventArgs.GetButton方法的典型用法代码示例。如果您正苦于以下问题:C# MouseEventArgs.GetButton方法的具体用法?C# MouseEventArgs.GetButton怎么用?C# MouseEventArgs.GetButton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MouseEventArgs
的用法示例。
在下文中一共展示了MouseEventArgs.GetButton方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MouseUp
internal void MouseUp(MouseEventArgs args)
{
if (args.GetButton() == MouseButtonEnum.Left) { mouseLeft = false; }
if (args.GetButton() == MouseButtonEnum.Middle) { mouseMiddle = false; }
if (args.GetButton() == MouseButtonEnum.Right) { mouseRight = false; }
if (args.GetButton() == MouseButtonEnum.Left)
{
mouseleftdeclick = true;
}
if (args.GetButton() == MouseButtonEnum.Right)
{
mouserightdeclick = true;
}
for (int i = 0; i < clientmodsCount; i++)
{
if (clientmods[i] == null) { continue; }
clientmods[i].OnMouseUp(this, args);
}
}
示例2: OnMouseDown
public override void OnMouseDown(Game game_, MouseEventArgs args)
{
if (game.guistate != GuiState.Inventory)
{
return;
}
PointRef scaledMouse = PointRef.Create(args.GetX(), args.GetY());
//material selector
if (SelectedMaterialSelectorSlot(scaledMouse) != null)
{
//int oldActiveMaterial = ActiveMaterial.ActiveMaterial;
game.ActiveMaterial = SelectedMaterialSelectorSlot(scaledMouse).value;
//if (oldActiveMaterial == ActiveMaterial.ActiveMaterial)
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.MaterialSelector;
p.MaterialId = game.ActiveMaterial;
controller.InventoryClick(p);
}
args.SetHandled(true);
return;
}
if (game.guistate != GuiState.Inventory)
{
return;
}
//main inventory
PointRef cellInPage = SelectedCell(scaledMouse);
//grab from inventory
if (cellInPage != null)
{
if (args.GetButton() == MouseButtonEnum.Left)
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.MainArea;
p.AreaX = cellInPage.X;
p.AreaY = cellInPage.Y + ScrollLine;
controller.InventoryClick(p);
args.SetHandled(true);
return;
}
else
{
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.MainArea;
p.AreaX = cellInPage.X;
p.AreaY = cellInPage.Y + ScrollLine;
controller.InventoryClick(p);
}
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.WearPlace;
p.WearPlace = WearPlace_.RightHand;
p.ActiveMaterial = game.ActiveMaterial;
controller.InventoryClick(p);
}
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.MainArea;
p.AreaX = cellInPage.X;
p.AreaY = cellInPage.Y + ScrollLine;
controller.InventoryClick(p);
}
}
if (game.guistate == GuiState.Inventory)
{
args.SetHandled(true);
return;
}
}
// //drop items on ground
//if (scaledMouse.X < CellsStartX() && scaledMouse.Y < MaterialSelectorStartY())
//{
// int posx = game.SelectedBlockPositionX;
// int posy = game.SelectedBlockPositionY;
// int posz = game.SelectedBlockPositionZ;
// Packet_InventoryPosition p = new Packet_InventoryPosition();
// {
// p.Type = Packet_InventoryPositionTypeEnum.Ground;
// p.GroundPositionX = posx;
// p.GroundPositionY = posy;
// p.GroundPositionZ = posz;
// }
// controller.InventoryClick(p);
//}
if (SelectedWearPlace(scaledMouse) != null)
{
Packet_InventoryPosition p = new Packet_InventoryPosition();
p.Type = Packet_InventoryPositionTypeEnum.WearPlace;
p.WearPlace = (SelectedWearPlace(scaledMouse).value);
p.ActiveMaterial = game.ActiveMaterial;
controller.InventoryClick(p);
args.SetHandled(true);
return;
}
if (scaledMouse.X >= ScrollUpButtonX() && scaledMouse.X < ScrollUpButtonX() + ScrollButtonSize()
//.........这里部分代码省略.........
示例3: MouseDown
internal void MouseDown(MouseEventArgs args)
{
if (args.GetButton() == MouseButtonEnum.Left) { mouseLeft = true; }
if (args.GetButton() == MouseButtonEnum.Middle) { mouseMiddle = true; }
if (args.GetButton() == MouseButtonEnum.Right) { mouseRight = true; }
if (args.GetButton() == MouseButtonEnum.Left)
{
mouseleftclick = true;
}
if (args.GetButton() == MouseButtonEnum.Right)
{
mouserightclick = true;
}
for (int i = 0; i < clientmodsCount; i++)
{
if (clientmods[i] == null) { continue; }
clientmods[i].OnMouseDown(this, args);
}
if (mousePointerLockShouldBe)
{
platform.RequestMousePointerLock();
mouseDeltaX = 0;
mouseDeltaY = 0;
}
InvalidVersionAllow();
}