本文整理汇总了C#中Keys.GetValueOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# Keys.GetValueOrDefault方法的具体用法?C# Keys.GetValueOrDefault怎么用?C# Keys.GetValueOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keys
的用法示例。
在下文中一共展示了Keys.GetValueOrDefault方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetKey
public void SetKey(Keys? key, bool upperCase = true)
{
this.m_storedKey = key.Value;
this.m_buttonText.FontSize = 20f;
bool flag = true;
Keys valueOrDefault = key.GetValueOrDefault();
if (key.HasValue)
{
if (valueOrDefault <= Keys.Escape)
{
switch (valueOrDefault)
{
case Keys.Back:
case Keys.Tab:
break;
default:
if (valueOrDefault != Keys.Enter && valueOrDefault != Keys.Escape)
{
goto IL_186;
}
break;
}
}
else
{
switch (valueOrDefault)
{
case Keys.Space:
base.GetChildAt(0).ChangeSprite("KeyboardSpacebar_Sprite");
goto IL_1A7;
case Keys.PageUp:
case Keys.PageDown:
case Keys.End:
case Keys.Home:
goto IL_186;
case Keys.Left:
base.GetChildAt(0).ChangeSprite("KeyboardArrowLeft_Sprite");
flag = false;
goto IL_1A7;
case Keys.Up:
base.GetChildAt(0).ChangeSprite("KeyboardArrowUp_Sprite");
flag = false;
goto IL_1A7;
case Keys.Right:
base.GetChildAt(0).ChangeSprite("KeyboardArrowRight_Sprite");
flag = false;
goto IL_1A7;
case Keys.Down:
base.GetChildAt(0).ChangeSprite("KeyboardArrowDown_Sprite");
flag = false;
goto IL_1A7;
default:
switch (valueOrDefault)
{
case Keys.NumPad0:
case Keys.NumPad1:
case Keys.NumPad2:
case Keys.NumPad3:
case Keys.NumPad4:
case Keys.NumPad5:
case Keys.NumPad6:
case Keys.NumPad7:
case Keys.NumPad8:
case Keys.NumPad9:
base.GetChildAt(0).ChangeSprite("KeyboardButtonLong_Sprite");
goto IL_1A7;
default:
switch (valueOrDefault)
{
case Keys.LeftShift:
case Keys.RightShift:
case Keys.LeftControl:
case Keys.RightControl:
case Keys.LeftAlt:
case Keys.RightAlt:
break;
default:
goto IL_186;
}
break;
}
break;
}
}
base.GetChildAt(0).ChangeSprite("KeyboardButtonLong_Sprite");
this.m_buttonText.FontSize = 16f;
goto IL_1A7;
}
IL_186:
base.GetChildAt(0).ChangeSprite("KeyboardButton_Sprite");
this.m_buttonText.FontSize = 24f;
IL_1A7:
if (!key.HasValue)
{
base.GetChildAt(0).ChangeSprite("KeyboardButtonLong_Sprite");
}
if (flag)
{
if (upperCase)
{
//.........这里部分代码省略.........