本文整理汇总了C#中InputState.IsNewLeftMouseClick方法的典型用法代码示例。如果您正苦于以下问题:C# InputState.IsNewLeftMouseClick方法的具体用法?C# InputState.IsNewLeftMouseClick怎么用?C# InputState.IsNewLeftMouseClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputState
的用法示例。
在下文中一共展示了InputState.IsNewLeftMouseClick方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleInput
public override void HandleInput(GameTime gameTime, InputState inputState)
{
if (menuAction.Evaluate(inputState))
{
Manager.AddScreen(new MapEditorMenuScreen());
}
if (inputState.IsNewLeftMouseClick())
{
editor.CycleNode(inputState.GetMousePosition());
}
}
示例2: HandleInput
public override void HandleInput(InputState input)
{
Vector2 mouse = new Vector2(input.CurrentMouseState.X, input.CurrentMouseState.Y);
Rectangle mouseRec = new Rectangle((int)mouse.X, (int)mouse.Y, 1, 1);
Rectangle bounds = new Rectangle((int)Position.X, (int)Position.Y,
Texture.Width, Texture.Height);
if (IsEnabled) {
IsMouseOver = bounds.Contains(mouseRec);
if (IsMouseOver && input.IsNewLeftMouseClick()) {
IsSelected = true;
}
if (IsSelected && !IsMouseOver) {
if (input.IsNewRightMouseClick()) {
IsSelected = false;
}
}
}
}
示例3: HandleInput
public override void HandleInput(GameTime gameTime, InputState inputState)
{
if (pauseAction.Evaluate(inputState))
{
PauseMenuScreen screen = new PauseMenuScreen();
screen.IsPopup = true;
Manager.AddScreen(screen);
}
if (spawnNightmareAction.Evaluate(inputState))
{
level.CreateNightmare();
}
if (inputState.IsNewLeftMouseClick())
{
level.CreateTower(inputState.GetMousePosition());
}
}
示例4: HandleInput
public override void HandleInput(InputState input)
{
// previous entry
if (input.IsMenuUp(ControllingPlayer))
{
useMouse = false;
selectedEntry--;
if (selectedEntry < 0)
selectedEntry = menuEntries.Count - 1;
if (!menuEntries[selectedEntry].Enabled && selectedEntry >= 0)
{
for (int i = selectedEntry; i >= 0; i--)
{
if (menuEntries[i].Enabled)
{
selectedEntry = i;
break;
}
}
return;
}
}
// next entry
if (input.IsMenuDown(ControllingPlayer))
{
useMouse = false;
selectedEntry++;
if (selectedEntry >= menuEntries.Count)
selectedEntry = 0;
if (!menuEntries[selectedEntry].Enabled && selectedEntry < menuEntries.Count)
{
for (int i = selectedEntry; i < menuEntries.Count - 1; i++)
{
if (menuEntries[i].Enabled)
{
selectedEntry = i;
break;
}
}
return;
}
}
if (input.LastMouseState.X != mousePos.X || input.LastMouseState.Y != mousePos.Y)
{
useMouse = true;
}
for (int i = 0; i < menuEntries.Count; i++)
{
if (input.LastMouseState.Y > menuEntries[i].Position.Y - Assets.menuFont.LineSpacing / 2 &&
input.LastMouseState.Y < menuEntries[i].Position.Y + Assets.menuFont.LineSpacing / 2 &&
input.LastMouseState.X > menuEntries[i].Position.X &&
input.LastMouseState.X < menuEntries[i].Position.X + Assets.menuFont.MeasureString(menuEntries[i].Text).X && useMouse)
{
selectedEntry = i;
}
}
// Accept or cancel the menu? We pass in our ControllingPlayer, which may
// either be null (to accept input from any player) or a specific index.
// If we pass a null controlling player, the InputState helper returns to
// us which player actually provided the input. We pass that through to
// OnSelectEntry and OnCancel, so they can tell which player triggered them.
PlayerIndex playerIndex;
if (input.IsMenuSelect(ControllingPlayer, out playerIndex))
{
//if (OptionsFile.IsSound())
// Assets.menuSelectSound.Play();
OnSelectEntry(selectedEntry, playerIndex);
}
else if (input.IsMenuCancel(ControllingPlayer, out playerIndex))
{
//if (OptionsFile.IsSound())
// Assets.menuSelectSound.Play();
OnCancel(playerIndex);
}
else if (input.IsNewLeftMouseClick())
{
for (int i = 0; i < menuEntries.Count; i++)
{
if (input.LastMouseState.Y > menuEntries[i].Position.Y &&
input.LastMouseState.Y < menuEntries[i].Position.Y + Assets.menuFont.LineSpacing)
{
//if (OptionsFile.IsSound())
// Assets.menuSelectSound.Play();
OnSelectEntry(i, playerIndex);
}
}
}
//.........这里部分代码省略.........