• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# KeyEvent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: onEditorAction

			public override bool onEditorAction(TextView textView, int actionId, KeyEvent keyEvent)
			{
				if (actionId == EditorInfo.IME_NULL && keyEvent.Action == KeyEvent.ACTION_DOWN)
				{
					outerInstance.sendMessage();
				}
				return true;
			}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:8,代码来源:MainActivity.cs


示例17: BrowserTabView

        public BrowserTabView()
        {
            InitializeComponent();

            browser.RequestHandler = new RequestHandler();
            if (CefSharpSettings.WcfEnabled)
            {
                browser.RegisterJsObject("bound", new BoundObject());
            }
            browser.RegisterAsyncJsObject("boundAsync", new AsyncBoundObject());

            browser.LifeSpanHandler = new LifespanHandler();
            browser.MenuHandler = new MenuHandler();
            browser.GeolocationHandler = new GeolocationHandler();
            browser.DownloadHandler = new DownloadHandler();
            browser.PreviewTextInput += (sender, args) =>
            {
                var host = browser.GetBrowser().GetHost();
                var keyEvent = new KeyEvent();

                foreach (var character in args.Text)
                {
                    keyEvent.WindowsKeyCode = character;
                    keyEvent.Type = KeyEventType.Char;
                    host.SendKeyEvent(keyEvent);
                }

                args.Handled = true;
            };

            browser.LoadError += (sender, args) =>
            {
                // Don't display an error for downloaded files.
                if (args.ErrorCode == CefErrorCode.Aborted)
                {
                    return;
                }

                // Don't display an error for external protocols that we allow the OS to
                // handle. See OnProtocolExecution().
                //if (args.ErrorCode == CefErrorCode.UnknownUrlScheme)
                //{
                //	var url = args.Frame.Url;
                //	if (url.StartsWith("spotify:"))
                //	{
                //		return;
                //	}
                //}

                // Display a load error message.
                var errorBody = string.Format("<html><body bgcolor=\"white\"><h2>Failed to load URL {0} with error {1} ({2}).</h2></body></html>",
                                              args.FailedUrl, args.ErrorText, args.ErrorCode);

                args.Frame.LoadStringForUrl(errorBody, args.FailedUrl);
            };

            CefExample.RegisterTestResources(browser);
        }
开发者ID:bjarteskogoy,项目名称:CefSharp,代码行数:58,代码来源:BrowserTabView.xaml.cs


示例18: Release

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

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


示例19: OnEscPress

        /// <summary>
        /// Eventually we'll probably want something so if there's a panel open, pressing escape closes the topmost one,
        /// and when you've closed all of them, this should pause, and not quit. But oh well this is temporary really.
        /// </summary>
        void OnEscPress(KeyEvent eventArgs)
        {
            var lcm = LKernel.GetG<LuaConsoleManager>();

            if (lcm.IsVisible)
                lcm.Hide();
            else
                Launch.Quit = true;
        }
开发者ID:CisciarpMaster,项目名称:PonyKart,代码行数:13,代码来源:EscHandler.cs


示例20: KeyBinding

 public KeyBinding(string alias, Keys k, bool ctrl, bool shift, bool alt, KeyEvent kevent)
 {
     Alias = alias;
     Key = k;
     Ctrl = ctrl;
     Shift = shift;
     Alt = alt;
     KeyEvent = kevent;
 }
开发者ID:colbybhearn,项目名称:3DPhysics,代码行数:9,代码来源:KeyBinding.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KeyEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# KeyCode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap