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


C# KeyEventArgs.GetHandled方法代码示例

本文整理汇总了C#中KeyEventArgs.GetHandled方法的典型用法代码示例。如果您正苦于以下问题:C# KeyEventArgs.GetHandled方法的具体用法?C# KeyEventArgs.GetHandled怎么用?C# KeyEventArgs.GetHandled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KeyEventArgs的用法示例。


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

示例1: KeyUp

 internal void KeyUp(int eKey)
 {
     keyboardStateRaw[eKey] = false;
     for (int i = 0; i < clientmodsCount; i++)
     {
         KeyEventArgs args_ = new KeyEventArgs();
         args_.SetKeyCode(eKey);
         clientmods[i].OnKeyUp(this, args_);
         if (args_.GetHandled())
         {
             return;
         }
     }
     keyboardState[eKey] = false;
     if (eKey == GetKey(GlKeys.ShiftLeft) || eKey == GetKey(GlKeys.ShiftRight))
     {
         IsShiftPressed = false;
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:19,代码来源:Game.ci.cs

示例2: KeyDown

    internal void KeyDown(int eKey)
    {
        keyboardStateRaw[eKey] = true;
        if (guistate != GuiState.MapLoading)
        {
            // only handle keys once game has been loaded
            for (int i = 0; i < clientmodsCount; i++)
            {
                KeyEventArgs args_ = new KeyEventArgs();
                args_.SetKeyCode(eKey);
                clientmods[i].OnKeyDown(this, args_);
                if (args_.GetHandled())
                {
                    return;
                }
            }
        }
        keyboardState[eKey] = true;
        InvalidVersionAllow();
        if (eKey == GetKey(GlKeys.F6))
        {
            float lagSeconds = one * (platform.TimeMillisecondsFromStart() - LastReceivedMilliseconds) / 1000;
            if ((lagSeconds >= DISCONNECTED_ICON_AFTER_SECONDS) || guistate == GuiState.MapLoading)
            {
                Reconnect();
            }
        }
        if (eKey == GetKey(GlKeys.ShiftLeft) || eKey == GetKey(GlKeys.ShiftRight))
        {
            IsShiftPressed = true;
        }
        if (guistate == GuiState.Normal)
        {
            string strFreemoveNotAllowed = "You are not allowed to enable freemove.";

            if (eKey == GetKey(GlKeys.F1))
            {
                if (!this.AllowFreemove)
                {
                    Log(strFreemoveNotAllowed);
                    return;
                }
                movespeed = basemovespeed * 1;
                Log("Move speed: 1x.");
            }
            if (eKey == GetKey(GlKeys.F2))
            {
                if (!this.AllowFreemove)
                {
                    Log(strFreemoveNotAllowed);
                    return;
                }
                movespeed = basemovespeed * 10;
                Log(platform.StringFormat(language.MoveSpeed(), platform.IntToString(10)));
            }
            if (eKey == GetKey(GlKeys.F3))
            {
                if (!this.AllowFreemove)
                {
                    Log(strFreemoveNotAllowed);
                    return;
                }
                stopPlayerMove = true;
                if (!controls.freemove)
                {
                    controls.freemove = true;
                    Log(language.MoveFree());
                }
                else if (controls.freemove && (!controls.noclip))
                {
                    controls.noclip = true;
                    Log(language.MoveFreeNoclip());
                }
                else if (controls.freemove && controls.noclip)
                {
                    controls.freemove = false;
                    controls.noclip = false;
                    Log(language.MoveNormal());
                }
            }
            if (eKey == GetKey(GlKeys.I))
            {
                drawblockinfo = !drawblockinfo;
            }
            int playerx = platform.FloatToInt(player.position.x);
            int playery = platform.FloatToInt(player.position.z);
            if ((playerx >= 0 && playerx < map.MapSizeX)
                && (playery >= 0 && playery < map.MapSizeY))
            {
                performanceinfo.Set("height", platform.StringFormat("height:{0}", platform.IntToString(d_Heightmap.GetBlock(playerx, playery))));
            }
            if (eKey == GetKey(GlKeys.F5))
            {
                CameraChange();
            }
            if (eKey == GetKey(GlKeys.Plus) || eKey == GetKey(GlKeys.KeypadPlus))
            {
                if (cameratype == CameraType.Overhead)
                {
                    overheadcameradistance -= 1;
//.........这里部分代码省略.........
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:101,代码来源:Game.ci.cs


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