本文整理汇总了C#中InputHelper.IsNewPress方法的典型用法代码示例。如果您正苦于以下问题:C# InputHelper.IsNewPress方法的具体用法?C# InputHelper.IsNewPress怎么用?C# InputHelper.IsNewPress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputHelper
的用法示例。
在下文中一共展示了InputHelper.IsNewPress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public override void Update(InputHelper Input, GameTime GTime)
{
if(IsMouseOver(Input) || PixelCheck(Input, (int)m_Size.X))
{
if (Input.IsNewPress(MouseButtons.LeftButton))
{
if (!m_IsButtonClicked && Enabled)
{
TextDrawingColor = TextColorHighlighted;
m_SourcePosition.X += m_Size.X;
if (OnButtonClicked != null)
OnButtonClicked(this);
m_IsButtonClicked = true;
}
else if(Enabled == false)
m_SourcePosition.X = m_Size.X * 3;
}
else
{
if (m_IsButtonClicked)
{
TextDrawingColor = TextColorSelected;
m_SourcePosition.X -= m_Size.X;
}
m_IsButtonClicked = false;
}
if (!m_IsMouseHovering && Enabled)
{
TextDrawingColor = TextColorSelected;
m_SourcePosition.X -= m_Size.X;
m_IsMouseHovering = true;
}
}
else
{
if (Enabled)
{
TextDrawingColor = TextColor;
m_SourcePosition.X = (m_Size.X * 2);
m_IsMouseHovering = false;
}
else
m_SourcePosition.X = (m_Size.X * 3);
}
}
示例2: Update
/// <summary>
/// Handles update logic for this UIElement.
/// </summary>
/// <param name="Helper">InputHelper instance for input data.</param>
public virtual void Update(InputHelper Helper, GameTime GTime)
{
if (IsMouseOver(Helper))
{
if (Helper.IsNewPress(MouseButtons.LeftButton))
{
m_HasFocus = true;
m_Screen.OverrideFocus(this);
}
}
}
示例3: Update
public override void Update(InputHelper Input, GameTime GTime)
{
base.Update(Input, GTime);
if (m_Mode != TextEditMode.ReadOnly)
{
m_VerticalTextBoundary = (int)(Position.X + m_Font.MeasureString(m_Lines[m_Cursor.LineIndex].SBuilder.ToString()).X);
m_IsUpperCase = IsUpperCase(Input);
if (m_HasFocus)
{
Keys[] PressedKeys = Input.CurrentKeyboardState.GetPressedKeys();
foreach (Keys K in PressedKeys)
{
if (Input.IsNewPress(K))
{
switch (K)
{
case Keys.Divide:
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '/';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("/");
m_Cursor.Position.X += m_Font.MeasureString("/").X;
m_Cursor.CharacterIndex++;
m_RemovingTxt = false;
break;
case Keys.OemSemicolon:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English":
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = ';';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append(";");
m_Cursor.CharacterIndex++;
m_MovingCursor = false;
m_RemovingTxt = false;
m_Cursor.Position.X += m_Font.MeasureString(";").X;
break;
}
}
break;
case Keys.OemQuotes:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English": //TODO: Should this be double quote if upper??
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '\'';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("'");
m_Cursor.CharacterIndex++;
m_MovingCursor = false;
m_RemovingTxt = false;
m_Cursor.Position.X += m_Font.MeasureString("'").X;
break;
}
}
break;
case Keys.OemCloseBrackets:
if (Input.InputRegion != null)
{
switch (Input.InputRegion.LayoutName)
{
case "English":
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '}';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("}");
m_Cursor.Position.X += m_Font.MeasureString("}").X;
break;
case "Norwegian":
case "Swedish":
case "Finnish":
case "Danish":
if (IsUpperCase(Input))
{
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '^';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("^");
m_Cursor.Position.X += m_Font.MeasureString("^").X;
}
else if (Input.IsCurPress(Keys.RightAlt))
{
if (m_Cursor.CharacterIndex < m_Lines[m_Cursor.LineIndex].SBuilder.Length)
m_Lines[m_Cursor.LineIndex].SBuilder[m_Cursor.CharacterIndex] = '~';
else
m_Lines[m_Cursor.LineIndex].SBuilder.Append("~");
//.........这里部分代码省略.........
示例4: Update
public override void Update(InputHelper Helper, GameTime GTime)
{
m_Counter = m_Index;
for (int X = 0; X <= m_Map.GetUpperBound(1); X++)
{
for (int Y = 0; Y <= m_Map.GetUpperBound(0); Y++)
{
m_BtnWidth = m_SkinBtns[m_Counter + Y].BtnTex.Width / 4;
Vector2 TexturePosition = new Vector2(X * (HeadTileSize.X + 10), Y * (HeadTileSize.Y));
Vector2 ButtonPosition = new Vector2(TexturePosition.X - 3, TexturePosition.Y - 5);
if (IsMouseOverButton(Helper, m_SkinBtns[Y + m_Counter], Position + ButtonPosition))
{
if (Helper.IsNewPress(MouseButtons.LeftButton))
{
if (!m_SkinBtns[Y + m_Counter].IsButtonClicked)
{
m_SkinBtns[Y + m_Counter].SourcePosition.X += m_BtnWidth;
if (OnButtonClicked != null)
{
UISkinButtonClickedEventArgs EArgs = new UISkinButtonClickedEventArgs();
switch (m_SelectedSkintype)
{
case Elements.SkinType.Light:
EArgs.SkinType = 0;
EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
m_LightAppearances[(Y * X) + m_Counter].Oft :
m_LightFemaleAppearances[(Y * X) + m_Counter].Oft);
OnButtonClicked(this, EArgs);
break;
case Elements.SkinType.Medium:
EArgs.SkinType = 1;
EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
m_MediumAppearances[(Y * X) + m_Counter].Oft :
m_MediumFemaleAppearances[(Y * X) + m_Counter].Oft);
OnButtonClicked(this, EArgs);
break;
case Elements.SkinType.Dark:
EArgs.SkinType = 2;
EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
m_DarkAppearances[(Y * X) + m_Counter].Oft :
m_DarkFemaleAppearances[(Y * X) + m_Counter].Oft);
OnButtonClicked(this, EArgs);
break;
}
}
m_SkinBtns[Y + m_Counter].IsButtonClicked = true;
}
}
else
{
if (m_SkinBtns[Y + m_Counter].IsButtonClicked)
m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;
m_SkinBtns[Y + m_Counter].IsButtonClicked = false;
}
if (!m_SkinBtns[Y + m_Counter].IsMouseHovering)
{
m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;
m_SkinBtns[Y + m_Counter].IsMouseHovering = true;
}
}
else
{
m_SkinBtns[Y + m_Counter].SourcePosition.X = (m_BtnWidth * 2);
m_SkinBtns[Y + m_Counter].IsMouseHovering = false;
}
if (m_Counter < m_NumberOfSkinsToDisplay)
m_Counter++;
}
}
if (Index == 0)
m_SkinBrowserArrowRight.Enabled = false;
else
m_SkinBrowserArrowRight.Enabled = true;
base.Update(Helper, GTime);
}