Пример #1
0
 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)
         {
             this.m_buttonText.Text = InputReader.GetInputString(key, false, false, false).ToUpper();
         }
         else
         {
             this.m_buttonText.Text = InputReader.GetInputString(key, false, false, false);
         }
     }
     else
     {
         this.m_buttonText.Text = "";
     }
     this.m_buttonText.Y = (float)(-(float)(this.m_buttonText.Height / 2));
     this.m_buttonText.Visible = true;
     this.IsGamepadButton = false;
     base.CalculateBounds();
 }