当前位置: 首页>>代码示例>>C#>>正文


C# KeyEvent类代码示例

本文整理汇总了C#中KeyEvent的典型用法代码示例。如果您正苦于以下问题:C# KeyEvent类的具体用法?C# KeyEvent怎么用?C# KeyEvent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyEvent类属于命名空间,在下文中一共展示了KeyEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnKeyDown

        protected override bool OnKeyDown( KeyEvent e )
        {
            //If atop openly any window to not process
            if( Controls.Count != 1 )
                return base.OnKeyDown( e );

            //change camera type
            if( e.Key == EKeys.F7 )
            {
                FreeCameraEnabled = !FreeCameraEnabled;

                GameEngineApp.Instance.AddScreenMessage(
                    string.Format( "Camera type: {0}", FreeCameraEnabled ? "Free" : "Default" ) );

                return true;
            }

            //select another demo map
            if( e.Key == EKeys.F3 )
            {
                GameWorld.Instance.NeedChangeMap( "Maps\\MainDemo\\Map.map", "Teleporter_Maps", null );
                return true;
            }

            return base.OnKeyDown( e );
        }
开发者ID:whztt07,项目名称:SDK,代码行数:26,代码来源:BallGameWindow.cs

示例2: HandleInput

        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed)
            {
            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenHighscore);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenHighscore);
                        break;

                    case Keys.Left:
                        ChangeRound(-1);
                        break;

                    case Keys.Right:
                        ChangeRound(1);
                        break;
                }
            }
            return true;
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:29,代码来源:CScreenScore.cs

示例3: HandleInput

        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        Close();
                        break;

                    case Keys.Enter:
                        if (Buttons[htButtons(ButtonExit)].Selected)
                        {
                            Close();
                        }
                        break;

                    case Keys.Left:
                        OnChange();
                        break;

                    case Keys.Right:
                        OnChange();
                        break;
                }
            }
            return true;
        }
开发者ID:HansMaiser,项目名称:Vocaluxe,代码行数:35,代码来源:CScreenOptionsTheme.cs

示例4: HandleInput

        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {

            }
            else
            {
                bool processed = false;
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenSong);
                        break;

                    case Keys.Enter:

                        for (int i = 0; i < ButtonPlayer.Length; i++)
                        {
                            if (Buttons[htButtons(ButtonPlayer[i])].Selected)
                            {
                                processed = true;
                                CGame.NumPlayer = i + 1;

                                UpdateSelection();
                                UpdateVisibility();

                                CConfig.NumPlayer = CGame.NumPlayer;
                                CConfig.SaveConfig();

                                CheckMics();

                                break;
                            }
                        }

                        if (!processed && Buttons[htButtons(ButtonBack)].Selected)
                        {
                            processed = true;
                            CGraphics.FadeTo(EScreens.ScreenSong);
                        }

                        if (!processed && Buttons[htButtons(ButtonStart)].Selected)
                        {
                            processed = true;
                            StartSong();
                        }

                        break;
                }

                if (!processed)
                    UpdateSelection();
            }

            return true;
        }
开发者ID:hessbe,项目名称:Vocaluxe,代码行数:60,代码来源:CScreenNames.cs

示例5: OnKeyboardPress

        void OnKeyboardPress(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            Kart kart = LKernel.GetG<PlayerManager>().MainPlayer.Kart;

            Vector3 pos;
            Quaternion quat;

            switch (eventArgs.key) {
                case KeyCode.KC_NUMPAD0:
                    pos = new Vector3(122.245f, 55f, 135.99f);
                    quat = new Quaternion(0.3107f, 0.001f, 0.9505f, 0.0029f);
                    break;
                default:
                    return;
            }

            Matrix4 mat = new Matrix4();
            mat.MakeTransform(pos, Vector3.UNIT_SCALE, quat);

            kart.Body.WorldTransform = mat;
            kart.Body.Activate();
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:25,代码来源:WTW_JumpAround.cs

示例6: OnKeyboardPress_Anything

        void OnKeyboardPress_Anything(KeyEvent ke)
        {
            // if the input is swallowed, don't do anything
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            string s = string.Empty;
            switch (ke.key) {
                case KeyCode.KC_0:
                    s = Settings.Default.MainMenuName; break;
                case KeyCode.KC_1:
                    s = "flat"; break;
                case KeyCode.KC_2:
                    s = "testlevel"; break;
                case KeyCode.KC_3:
                    s = "SweetAppleAcres"; break;
                case KeyCode.KC_4:
                    s = "WhitetailWoods"; break;
                case KeyCode.KC_5:
                    s = "TestAI"; break;
            }
            if (!string.IsNullOrEmpty(s)) {
                LKernel.GetG<LevelManager>().LoadLevel(new LevelChangeRequest() {
                    NewLevelName = s,
                    CharacterNames = LKernel.GetG<Players.PlayerManager>().MakeCharacterString(),
                });
            }
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:28,代码来源:LevelChangerHandler.cs

示例7: OnKeyDown

        protected override bool OnKeyDown(KeyEvent e)
        {
            //If atop openly any window to not process
            if (Controls.Count != 1)
                return base.OnKeyDown(e);

            //change camera type
            if (e.Key == EKeys.F7)
            {
                FreeCameraEnabled = !FreeCameraEnabled;
                GameEngineApp.Instance.AddScreenMessage(
                    string.Format("Camera type: {0}", FreeCameraEnabled ? "Free" : "Default"));
                return true;
            }

            //GameControlsManager
            if (EntitySystemWorld.Instance.Simulation)
            {
                if (!FreeCameraEnabled && !IsCutSceneEnabled())
                {
                    if (GameControlsManager.Instance.DoKeyDown(e))
                        return true;
                }
            }

            return base.OnKeyDown(e);
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:27,代码来源:PlatformerDemoGameWindow.cs

示例8: HandleInput

        public override bool HandleInput(KeyEvent KeyEvent)
        {
            if (KeyEvent.KeyPressed && !Char.IsControl(KeyEvent.Unicode))
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenMain);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenMain);
                        break;

                    case Keys.F:
                        FadeAndPause();
                        break;

                    case Keys.S:
                        PlayFile();
                        break;

                    case Keys.P:
                        PauseFile();
                        break;
                }
            }

            return true;
        }
开发者ID:hessbe,项目名称:Vocaluxe,代码行数:35,代码来源:CScreenTest.cs

示例9: KeyEventArgs

 ////////////////////////////////////////////////////////////
 /// <summary>
 /// Construct the key arguments from a key event
 /// </summary>
 /// <param name="e">Key event</param>
 ////////////////////////////////////////////////////////////
 public KeyEventArgs(KeyEvent e)
 {
     Code    = e.Code;
     Alt     = e.Alt != 0;
     Control = e.Control != 0;
     Shift   = e.Shift != 0;
 }
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:13,代码来源:EventArgs.cs

示例10: HandleInput

        public override bool HandleInput(KeyEvent KeyEvent)
        {
            base.HandleInput(KeyEvent);

            if (KeyEvent.KeyPressed)
            {

            }
            else
            {
                switch (KeyEvent.Key)
                {
                    case Keys.Escape:
                    case Keys.Back:
                        CGraphics.FadeTo(EScreens.ScreenOptions);
                        break;

                    case Keys.S:
                        CGraphics.FadeTo(EScreens.ScreenSong);
                        break;

                    case Keys.Enter:
                        CGraphics.FadeTo(EScreens.ScreenTest);
                        break;
                }
            }
            return true;
        }
开发者ID:bohning,项目名称:Vocaluxe,代码行数:28,代码来源:CScreenOptionsSound.cs

示例11: ShootPrimitive

        void ShootPrimitive(KeyEvent ke)
        {
            #if Debug
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            if (ke.key == KeyCode.KC_B) {
                string type;
                switch ((int) Math.RangeRandom(0, 5)) {
                    case 0:
                    default:
                        type = "Box"; break;
                    case 1:
                        type = "Sphere"; break;
                    case 2:
                        type = "Cylinder"; break;
                    case 3:
                        type = "Cone"; break;
                    case 4:
                        type = "Capsule"; break;
                }
                Vector3 pos = LKernel.GetG<PlayerManager>().MainPlayer.NodePosition + Vector3.UNIT_Y;

                LKernel.GetG<Spawner>().Spawn(type, pos);
            }
            #endif
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:27,代码来源:PrimitiveCreatorHandler.cs

示例12: OnKeyDown

		/// <summary>
		/// Process pressed key in order to bind it 
		/// </summary>
		protected override bool OnKeyDown( KeyEvent e )
		{
			if( base.OnKeyDown( e ) )
				return true;
			//new key allready detected
			if( _newJoystickValue != null || _newKeyboardMousevalue != null )
				return true;

			if( e.Key == EKeys.Escape )
			{
				SetShouldDetach();
				return true;
			}

			if( controlItem != null && _oldKeyboardMouseValue != null )
			{
				_newKeyboardMousevalue = new GameControlsManager.SystemKeyboardMouseValue( e.Key ) { Parent = controlItem };
				GameControlsManager.SystemKeyboardMouseValue key;
				if( GameControlsManager.Instance.IsAlreadyBinded( e.Key, out key ) )
				{
					_conflictKeyboardMouseValue = key;
					CreateConfirmDialogue( "Key " + e.Key + " is already bound to " + key.Parent.ControlKey + ". Override ?, or Click Clear to remove the bind" );

					return true;
				}
				SetKey();
				SetShouldDetach();
				return true;
			}

			return false;
		}
开发者ID:whztt07,项目名称:NeoAxisCommunity,代码行数:35,代码来源:KeyListener.cs

示例13: ContainerKeyDownEvent

 public void ContainerKeyDownEvent(KeyEvent evt)
 {
     foreach (Control control in Controls)
     {
         //if (control.Bound.Contains(evt.Position.X, evt.Position.Y))
         control.KeyDown(evt);
     }
 }
开发者ID:maesse,项目名称:CubeHags,代码行数:8,代码来源:Container.cs

示例14: Press

        void Press(KeyEvent eventArgs)
        {
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return;

            if (eventArgs.key == KeyCode.KC_H)
                LKernel.GetG<PlayerManager>().MainPlayer.Kart.ForEachWheel(w => w.Friction = 0.8f);
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:8,代码来源:DisableWheelFrictionHandler.cs

示例15: KeyDown

        public override void KeyDown(KeyEvent ev)
        {
            if (DelegateTool != null)
                DelegateTool.KeyDown (ev);

            if (ev.Key == Gdk.Key.Delete)
                DeleteFigures (ev.View);
        }
开发者ID:erbriones,项目名称:monodevelop-classdesigner,代码行数:8,代码来源:SelectionTool.cs


注:本文中的KeyEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。