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

C# MyKeys类代码示例

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

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



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

示例1: GetValueScroll

        public static double GetValueScroll(string id, double initial, double step, MyKeys modifier = MyKeys.None, int roundDigits = 10, int notifyTime = 16)
        {
            if(!values.ContainsKey(id))
                values.Add(id, initial);

            var val = values[id];

            if(modifier != MyKeys.None && !MyAPIGateway.Input.IsKeyPress(modifier))
                return val;

            var scroll = MyAPIGateway.Input.DeltaMouseScrollWheelValue();

            if(scroll != 0)
            {
                val += (scroll > 0 ? step : -step);

                if(roundDigits > -1)
                    val = Math.Round(val, roundDigits);

                values[id] = val;
            }

            MyAPIGateway.Utilities.ShowNotification(id + "=" + val.ToString("#,###,###,##0.##########"), notifyTime);
            return val;
        }
开发者ID:THDigi,项目名称:Helmet,代码行数:25,代码来源:DevUtils.cs


示例2: GetKeyStatus

        public ThrottledKeyStatus GetKeyStatus(MyKeys key)
        {
            if (!MyInput.Static.IsKeyPress(key))
                return ThrottledKeyStatus.UNPRESSED;

            var controller = GetKeyController(key);

            // If we find no controller, we cannot time so we assume the key is ready.
            if (controller == null)
                return ThrottledKeyStatus.PRESSED_AND_READY;

            // If the key was pressed during this update cycle, the key is deemed as instantly
            // ready, but it will be a longer delay before the next repeat is allowed.
            var wasPressedNow = MyInput.Static.IsNewKeyPressed(key);
            if (wasPressedNow)
            {
                controller.RequiredDelay = MyGuiConstants.TEXTBOX_INITIAL_THROTTLE_DELAY;
                controller.LastKeyPressTime = MyGuiManager.TotalTimeInMilliseconds;
                return ThrottledKeyStatus.PRESSED_AND_READY;
            }

            // If this is a continuous key press, we want to make sure we wait a minimum amount of time before allowing a repeat
            // of the action this key enables.
            if ((MyGuiManager.TotalTimeInMilliseconds - controller.LastKeyPressTime) > controller.RequiredDelay)
            {
                // Reset the required delay to the default for the next repeat.
                controller.RequiredDelay = MyGuiConstants.TEXTBOX_REPEAT_THROTTLE_DELAY;
                controller.LastKeyPressTime = MyGuiManager.TotalTimeInMilliseconds;
                return ThrottledKeyStatus.PRESSED_AND_READY;
            }

            // The key was pressed, but we're still waiting for the required delay.
            return ThrottledKeyStatus.PRESSED_AND_WAITING;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:34,代码来源:MyKeyThrottler.cs


示例3: GetKeyController

        private MyKeyThrottleState GetKeyController(MyKeys key)
        {
            MyKeyThrottleState controller;
            if (m_keyTimeControllers.TryGetValue(key, out controller))
                return controller;

            controller = new MyKeyThrottleState();
            m_keyTimeControllers[key] = controller;
            return controller;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:10,代码来源:MyKeyThrottler.cs


示例4: SetControl

        public void SetControl(MyGuiInputDeviceEnum device, MyKeys key)
        {
            Debug.Assert(device == MyGuiInputDeviceEnum.Keyboard ||
                         device == MyGuiInputDeviceEnum.KeyboardSecond);

            if (device == MyGuiInputDeviceEnum.Keyboard)
                m_keyboardKey = key;
            else if (device == MyGuiInputDeviceEnum.KeyboardSecond)
                m_KeyboardKey2 = key;
            else
                MyLog.Default.WriteLine("ERROR: Setting non-keyboard device to keyboard control.");
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:12,代码来源:MyControl.cs


示例5: MyControl

 public MyControl(MyStringId controlId,
     MyStringId name,
     MyGuiControlTypeEnum controlType,
     MyMouseButtonsEnum? defaultControlMouse,
     MyKeys? defaultControlKey,
     MyStringId? helpText = null,
     MyKeys? defaultControlKey2 = null,
     MyStringId? description = null)
 {
     m_controlId = controlId;
     m_name = name;
     m_controlType = controlType;
     m_mouseButton = defaultControlMouse ?? MyMouseButtonsEnum.None;
     m_keyboardKey = defaultControlKey ?? MyKeys.None;
     m_KeyboardKey2 = defaultControlKey2 ?? MyKeys.None;
     m_data.Description = description;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:17,代码来源:MyControl.cs


示例6: IsNewPressAndThrottled

        /// <summary>
        /// Determines if the given key was pressed during this update cycle, but it also
        /// makes sure a minimum amount of time has passed before allowing a press.
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool IsNewPressAndThrottled(MyKeys key)
        {
            if (!MyInput.Static.IsNewKeyPressed(key))
                return false;

            var controller = GetKeyController(key);

            // If we find no controller, we cannot time so we assume the key is ready.
            if (controller == null)
                return true;

            // Make sure we wait a minimum amount of time before allowing a repeat of the action this key enables. This
            // version of the check overrides the currently configured required delay for the key on purpose.
            if ((MyGuiManager.TotalTimeInMilliseconds - controller.LastKeyPressTime) > MyGuiConstants.TEXTBOX_MOVEMENT_DELAY)
            {
                // Reset the required delay to the default for the next repeat.
                controller.LastKeyPressTime = MyGuiManager.TotalTimeInMilliseconds;
                return true;
            }

            // The key was pressed but was choked by the minimum time requirement.
            return false;
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:29,代码来源:MyKeyThrottler.cs


示例7: IsNewKeyReleased

 //  Return true if key was pressed in previous update and now it is not.
 bool ModAPI.IMyInput.IsNewKeyReleased(MyKeys key) { return IsNewKeyReleased(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs


示例8: IsKeyPress

 //  Return true if new key pressed right now. Don't care if it was pressed in previous update too.
 bool ModAPI.IMyInput.IsKeyPress(MyKeys key) { return IsKeyPress(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs


示例9: GetControl

 //  Return true if key is used by some user control
 ModAPI.IMyControl ModAPI.IMyInput.GetControl(MyKeys key) { return GetControl(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs


示例10: IsKeyValid

 //  Return true if key is valid for user controls
 bool ModAPI.IMyInput.IsKeyValid(MyKeys key) { return IsKeyValid(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:2,代码来源:MyDirectXInput_ModAPI.cs


示例11:

 bool IMyInput.IsNewKeyPressed(MyKeys key) { return false; }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:1,代码来源:MyNullInput.cs


示例12: IsKeyUp

 public bool IsKeyUp(MyKeys key)
 {
     return !IsKeyDown(key);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyKeyboardState.cs


示例13: IsKeyDown

 public bool IsKeyDown(MyKeys key)
 {
     return m_buffer.GetBit((byte)key);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyKeyboardState.cs


示例14: SetKey

 public void SetKey(MyKeys key, bool value)
 {
     m_buffer.SetBit((byte)key, value);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:4,代码来源:MyKeyboardState.cs


示例15: IsSkipCharacter

 public bool IsSkipCharacter(MyKeys character)
 {
     if (SkipCombinations != null)
         foreach (var skipCombination in SkipCombinations)
         {
             if (skipCombination.Alt == MyInput.Static.IsAnyAltKeyPressed() &&
                 skipCombination.Ctrl == MyInput.Static.IsAnyCtrlKeyPressed() &&
                 skipCombination.Shift == MyInput.Static.IsAnyShiftKeyPressed() &&
                 (skipCombination.Keys == null ||
                 skipCombination.Keys.Contains((MyKeys)character)))
             {
                 return true;
             }
         }
     return false;
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:16,代码来源:MyGuiControlTextbox.cs


示例16: IsKeyDigit

 public bool IsKeyDigit(MyKeys key)
 {
     Debug.Assert(false, "Not keyboard support!");
     return false;
     
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:6,代码来源:MyXInputInput.cs


示例17: GetControl

 //  Return true if key is used by some user control
 public MyControl GetControl(MyKeys key)
 {
     foreach (var item in m_gameControlsList.Values)
     {
         if (item.GetKeyboardControl() == key ||
             item.GetSecondKeyboardControl() == key) return item;
     }
     return null;
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:10,代码来源:MyXInputInput.cs


示例18: IsKeyDigit

 bool ModAPI.IMyInput.IsKeyDigit(MyKeys key) { return IsKeyDigit(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:1,代码来源:MyDirectXInput_ModAPI.cs


示例19: GetKeyName

 public string GetKeyName(MyKeys key)
 {
     return m_nameLookup.GetKeyName(key);
 }
开发者ID:ales-vilchytski,项目名称:SpaceEngineers,代码行数:4,代码来源:MyXInputInput.cs


示例20: GetKeyName

 string ModAPI.IMyInput.GetKeyName(MyKeys key) { return GetKeyName(key); }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:1,代码来源:MyDirectXInput_ModAPI.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# MyList类代码示例发布时间:2022-05-24
下一篇:
C# MyJoystickButtonsEnum类代码示例发布时间: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