Пример #1
0
 public HotKey(string pName, LKey pLKey, RKey pRKey, Func <int> pDelegate)
 {
     Name     = pName;
     LKey     = pLKey;
     RKey     = pRKey;
     Delegate = pDelegate;
 }
Пример #2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.L))
     {
         ZZZ.SetActive(false);
         LKey.SetActive(false);
         animator.SetTrigger("WakeUp");
     }
 }
Пример #3
0
        public bool RegisterHotKey(string pName, LKey pLKey, RKey pRKey, Func <int> pDelegate)
        {
            foreach (var item in HotKeyList)
            {
                if (item.Name == pName || (item.LKey == pLKey && item.RKey == pRKey))
                {
                    return(false);
                }
            }

            HotKeyList.Add(new HotKey(pName, pLKey, pRKey, pDelegate));

            return(true);
        }
Пример #4
0
 public override void OnKeyUp(LKey e)
 {
     foreach (Drawable drawable in drawablesToDraw)
     {
         if (drawable._enabled)
         {
             if (drawable != null)
             {
                 if (drawable.GetDrawableState() == Painting.DrawableState.Hidden)
                 {
                     continue;
                 }
                 drawable.Released(e);
             }
         }
     }
     Released(e);
 }
Пример #5
0
 public override void OnKeyUp(LKey e)
 {
     keySize = keyActions.Size();
     if (keySize > 0)
     {
         int keyCode = e.GetKeyCode();
         for (int i = 0; i < keySize; i++)
         {
             Int32 code = (Int32)keyActions.GetKey(i);
             if (code == keyCode)
             {
                 ActionKey act = (ActionKey)keyActions.GetValue(code);
                 act.Release();
             }
         }
     }
     Release(e);
 }
Пример #6
0
        public override void OnKeyDown(LKey e)
        {
            int size = keyActions.Size();

            if (size > 0)
            {
                int keyCode = e.GetKeyCode();
                for (int i = 0; i < size; i++)
                {
                    Int32 code = (Int32)keyActions.GetKey(i);
                    if (code == keyCode)
                    {
                        ActionKey act = (ActionKey)keyActions.GetValue(code);
                        act.Press();
                    }
                }
            }
            Press(e);
        }
Пример #7
0
    new void Awake()
    {
        base.Awake();

        _controlls = new Input();

        _controlls.InputPad.Jump.performed    += Button => initJump();
        _controlls.InputPad.Jump.canceled     += Button => killJumpInit();
        _controlls.InputPad.Run.performed     += Stick => _stickAxis = Stick.ReadValue <Vector2>();
        _controlls.InputPad.Run.canceled      += Stick => _stickAxis = Vector2.zero;
        _controlls.InputPad.JetPack.performed += Trigger => _triggerPressed = Trigger.ReadValue <float>();
        _controlls.InputPad.JetPack.canceled  += Trigger => _triggerPressed = 0;

        _controlls.Keyboard.Jump.performed     += Key => initJump();
        _controlls.Keyboard.Jump.canceled      += Key => killJumpInit();
        _controlls.Keyboard.RunLeft.performed  += LKey => _keyPressed = -LKey.ReadValue <float>();
        _controlls.Keyboard.RunLeft.canceled   += LKey => _keyPressed = 0;
        _controlls.Keyboard.RunRight.performed += RKey => _keyPressed = RKey.ReadValue <float>();
        _controlls.Keyboard.RunRight.canceled  += RKey => _keyPressed = 0;
        _controlls.Keyboard.JetPack.performed  += Trigger => _triggerPressed = Trigger.ReadValue <float>();
        _controlls.Keyboard.JetPack.canceled   += Trigger => _triggerPressed = 0;
    }
Пример #8
0
 public override void Release(LKey e)
 {
 }
Пример #9
0
 public override void Press(LKey e)
 {
 }
Пример #10
0
 public abstract void Released(LKey e);
Пример #11
0
 public abstract void Pressed(LKey e);
Пример #12
0
        /// <summary>Inserts the given row into all the indexes of the TableBuffer.</summary>
        /// <param name="ARow">The given row must conform to the structure of the TableBuffer.</param>
        public void Insert(ServerProcess AProcess, Row ARow)
        {
            // Insert the row into all indexes
            Row LKey;
            Row LData;
            int LColumnIndex;

                        #if USEINTERNALID
            Scalar LScalar = new Scalar(AProcess, (Schema.IScalarType)FInternalIDColumn.DataType, Guid.NewGuid());
                        #endif
            foreach (TableBufferIndex LBufferIndex in Indexes)
            {
                LKey = AProcess.RowManager.RequestRow(AProcess, LBufferIndex.KeyRowType);
                try
                {
                    LData = AProcess.RowManager.RequestRow(AProcess, LBufferIndex.DataRowType);
                    try
                    {
                        LKey.ValuesOwned  = false;
                        LData.ValuesOwned = false;

                        for (int LIndex = 0; LIndex < LKey.DataType.Columns.Count; LIndex++)
                                                        #if USEINTERNALID
                            if (LKey.DataType.Columns[LIndex].Name == CInternalIDColumnName)
                            {
                                LKey[LIndex] = LScalar;
                            }
                            else
                                                        #endif
                        {
                            LColumnIndex = ARow.DataType.Columns.IndexOf(LKey.DataType.Columns[LIndex].Name);
                            if (((Row)ARow).HasValue(LColumnIndex))
                            {
                                LKey[LIndex] = ARow[LColumnIndex];
                            }
                            else
                            {
                                LKey.ClearValue(LIndex);
                            }
                        }

                        for (int LIndex = 0; LIndex < LData.DataType.Columns.Count; LIndex++)
                                                        #if USEINTERNALID
                            if (LData.DataType.Columns[LIndex].Name == CInternalIDColumnName)
                            {
                                LData[LIndex] = LScalar;
                            }
                            else
                                                        #endif
                        {
                            LColumnIndex = ARow.DataType.Columns.IndexOf(LData.DataType.Columns[LIndex].Name);
                            if (((Row)ARow).HasValue(LColumnIndex))
                            {
                                LData[LIndex] = ARow[LColumnIndex];
                            }
                            else
                            {
                                LData.ClearValue(LIndex);
                            }
                        }

                        LBufferIndex.Insert(AProcess, LKey.Stream, LData.Stream);
                    }
                    finally
                    {
                        AProcess.RowManager.ReleaseRow(LData);
                    }
                }
                finally
                {
                    AProcess.RowManager.ReleaseRow(LKey);
                }
            }
        }
Пример #13
0
        /// <summary>
        /// Is the associated key pressed or not?
        /// </summary>
        /// <returns>Whether the key is pressed or not, or false if the input is currently swallowed.</returns>
        public bool IsKeyPressed(LKey key)
        {
            // don't do anything if it's swallowed
            if (LKernel.GetG<InputSwallowerManager>().IsSwallowed())
                return false;

            return LKernel.GetG<InputMain>().InputKeyboard.IsKeyDown(LKeysDict[key]);
        }
Пример #14
0
 /// <summary>
 /// Changes the binding of "command" to "newKey"
 /// </summary>
 /// <param name="command"></param>
 /// <param name="newKey"></param>
 public void ChangeBinding(LKey command, KeyCode newKey)
 {
     LKeysDict[command] = newKey;
     MOISKeysDict[newKey] = command;
 }