//In this function you will be able to add a key with a inputcallback to the dictionary. public static void AddToDict(KeyCode key, InputCallback value) { if (!_inputs.ContainsKey(key)) { _inputs.Add(key, value); } }
public DatepickerWindow(string windowTitle, string labelText, InputCallback inputCallback) { InitializeComponent(); this.inputCallback = inputCallback; Owner = Application.Current.MainWindow; Title = windowTitle; InputLabel.Content = labelText; }
public static void RegisterInputCallback(int callbackID, InputCallback callback) { if (!InputCallbackDatabase.ContainsKey(callbackID)) { InputCallbackDatabase.Add(callbackID, callback); } else { throw new CallbackAlreadyRegisteredException("The Input Callback of Type" + callbackID + "is already registered."); } }
public InputWindow(string windowTitle, string labelText, string defaultText, InputCallback inputCallback, bool allowWhitespaceOnSave = true) { InitializeComponent(); this.inputCallback = inputCallback; this.allowWhitespaceOnSave = allowWhitespaceOnSave; Owner = Application.Current.MainWindow; Title = windowTitle; InputLabel.Content = labelText; InputBox.Text = defaultText; InputBox.Focus(); InputBox.CaretIndex = InputBox.Text.Length; }
public static void RegisterInputEvent(Type target, InputCallback callback, PriorityType priority = PriorityType.UI) { if (Instance != null) { if (Instance._typeToInputListenerDict.ContainsKey(target)) { Instance._typeToInputListenerDict.Remove(target); Instance._typeToPriorityDict.Remove(target); } Instance._typeToInputListenerDict.Add(target, new InputListener() { Callback = callback }); Instance._typeToPriorityDict.Add(target, priority); } }
public static void RegisterSelectEvent(GameObject target, InputCallback callback) { if (Instance != null) { if (Instance._objectToSelectListenerDict.ContainsKey(target)) { Instance._objectToSelectListenerDict.Remove(target); } Instance._objectToSelectListenerDict.Add(target, new InputListener() { Callback = callback }); Instance._isFreshRegisterInfo = true; } }
public static void RegisterInputEvent(GameObject target, InputCallback callback, PriorityType priority = PriorityType.UI) { if (Instance != null) { if (Instance._objectToInputListenerDict.ContainsKey(target)) { Instance._objectToInputListenerDict.Remove(target); Instance._objectToPriorityDict.Remove(target); } Instance._objectToInputListenerDict.Add(target, new InputListener() { Callback = callback }); Instance._objectToPriorityDict.Add(target, priority); Instance._isFreshRegisterInfo = true; } }
// We want to be able to serialize callbacks with an int id. This is a hacky way that lets us do that // with reflection without having to explicitly register each one. public static void Initialize() { Type type = typeof(Callbacks); foreach (MethodInfo mi in type.GetMethods()) { // Identify ones that match the callbacks InputCallback temp = null; try { temp = (InputCallback)Delegate.CreateDelegate(typeof(InputCallback), mi); } catch (Exception) { } if (temp != null) { idToCallbacks[mi.Name.CRC32Hash()] = temp; } } }
private static Dictionary <KeyCode, InputCallback> _inputs = new Dictionary <KeyCode, InputCallback>(); //This variable saves all keycodes together with a inputcallback, the inputcallback is explained in another class. //Every frame we will check if the inputs dictionary has 1 or more indexes, if so we will loop through all possible keycodes to check //if the input dictionary contains this keycode. If this is the case check for all three sorts of key press if the input callback has a function. //Then call this method. private void FixedUpdate() { if (_inputs.Count == 0) { return; } foreach (KeyCode kc in System.Enum.GetValues(typeof(KeyCode))) { if (_inputs.ContainsKey(kc)) { InputCallback icb = _inputs [kc]; if (Input.GetKeyDown(kc)) { if (icb.KeyDown != null) { icb.KeyDown(); } } if (Input.GetKeyUp(kc)) { if (icb.KeyUp != null) { icb.KeyUp(); } } if (Input.GetKey(kc)) { if (icb.KeyPressed != null) { icb.KeyPressed(); } } } } }
void FixedUpdate() { InputCallback ic = new InputCallback(); ic.KeyDown = Jump; KeyboardInput.AddToDict(KeyCode.Space, ic); //jump animation handling if (!_isGrounded && !_playerDamage.IsDamaged) { float currentY = transform.position.y; if (currentY - _lastY > 0) { _animHandler.AnimState = Constants.PLAYERRISE; } else if (currentY - _lastY < 0) { _animHandler.AnimState = Constants.PLAYERFALL; } _lastY = currentY; } }
public AttachmentEditWindow(string windowTitle, string defaultTitle, string defaultLink, InputCallback inputCallback, AttachmentEditWindowType type) { InitializeComponent(); this.inputCallback = inputCallback; this.type = type; Owner = Application.Current.MainWindow; Title = windowTitle; if (type == AttachmentEditWindowType.File) { LinkLabel.Content = "Datei:"; } else { LinkLabel.Content = "URL:"; FileButton.Visibility = Visibility.Collapsed; LinkBox.Width = TitleBox.Width; } TitleBox.Text = defaultTitle; LinkBox.Text = defaultLink; TitleBox.Focus(); TitleBox.CaretIndex = TitleBox.Text.Length; }
public abstract void sameboy_setinputcallback(IntPtr core, InputCallback callback);
public abstract void TI83_SetInputCallback(IntPtr context, InputCallback callback);
/// Public Methods /// <summary> /// Registers a callback method to be called whenever a key is pressed. /// Called regardless of modifier /// </summary> /// <param name="keyPress">What key should trigger the callback</param> /// <param name="callback">Callback method</param> public void M_RegisterInputCallbackPressed(KeyCode keyPress, InputMethod callback) { InputCallback newCb = new InputCallback(callback, KeyModifier.Any); this.m_inputPressedCallbacks.AddToList(keyPress, newCb); }
public static void Register <TElement, TArgs>(InputCallback <TElement, TArgs> handler) where TElement : IInputElement where TArgs : InputEventArgs { InputMappers.Add(typeof(TArgs), (element, args) => handler((TElement)element, (TArgs)args)); }
/// <summary> /// Registers a callback method to be called whenever a key is released and /// when the specified modifier is held down (including only when no modifier /// is held down) /// </summary> /// <param name="keyPress">What key should trigger the callback</param> /// <param name="modifier">Callback method</param> /// <param name="callback">What modifier should be held down to trigger callback</param> public void M_RegisterInputCallbackReleased(KeyCode keyPress, KeyModifier modifier, InputMethod callback) { InputCallback newCb = new InputCallback(callback, modifier); this.m_inputUpCallbacks.AddToList(keyPress, newCb); }
public void SetM64PInputCallbacks(InputCallback inputCallback, RumbleCallback rumbleCallback) { InpSetInputCallback(InpInputCallback = inputCallback); _ = InpSetRumbleCallback(m64pRumbleCallback = rumbleCallback); }
public static extern void libmeteor_setkeycallback(InputCallback callback);
/// <summary> /// Registers a callback method to be called whenever a key is held down and /// when the specified modifier is held down (including only when no modifier /// is held down) /// </summary> /// <param name="keyPress">What key should trigger the callback</param> /// <param name="modifier">Callback method</param> /// <param name="callback">What modifier should be held down to trigger callback</param> public void M_RegisterInputCallbackDown(KeyCode keyPress, KeyModifier modifier, InputMethod callback) { InputCallback newCb = new InputCallback(callback, modifier); m_inputDownCallbacks.AddToList(keyPress, newCb); }
public static extern void sameboy_setinputcallback(IntPtr core, InputCallback callback);
public void SetM64PInputCallback(InputCallback inputCallback) { InpInputCallback = inputCallback; InpSetInputCallback(InpInputCallback); }
public static extern void libyabause_setinputcallback(InputCallback cb);
public abstract void BizSetInputCallback(IntPtr ctx, InputCallback cb);
private void Awake() { Instance = this; Clear(); InputListenerManager.RegisterInputEvent(Button_LeftMove.gameObject, new InputCallback() { PressCallBack = () => { CurrentButtonState = InputButtonState.Left; }, CancelCallBack = (o) => { if (CurrentButtonState == InputButtonState.Left) { CurrentButtonState = InputButtonState.None; } } }, InputListenerManager.PriorityType.UITigger); InputListenerManager.RegisterInputEvent(Button_RightMove.gameObject, new InputCallback() { PressCallBack = () => { CurrentButtonState = InputButtonState.Right; }, CancelCallBack = (o) => { if (CurrentButtonState == InputButtonState.Right) { CurrentButtonState = InputButtonState.None; } } }, InputListenerManager.PriorityType.UITigger); InputListenerManager.RegisterInputEvent(Button_Confire.gameObject, new InputCallback() { ClickCallBack = () => { if (CharacterControl.Instance != null) { CharacterControl.Instance.OnConfire(); } } }, InputListenerManager.PriorityType.UITigger); var input = new InputCallback() { ClickCallBack = () => { if (IsShow) { NovelsManager.Instance.IsAcceptConfirm = true; } } }; InputListenerManager.RegisterInputEvent(typeof(UIConfirmBlock), input, InputListenerManager.PriorityType.UI); }