public PencilKeyInfo(Pencil.Gaming.Key key, int scancode, KeyAction action, KeyModifiers modifiers) { Key = key; Scancode = scancode; Action = action; Modifiers = modifiers; }
/// <summary> /// 如果是其它按键,进行转义 /// If it is the other, transtale it, for example [OemOpenBrackets] to "[" /// </summary> /// <param name="vm"> /// </param> /// <param name="key"> /// </param> /// <param name="keyAction"> /// </param> /// <returns></returns> public static bool TranslateOtherKeys(MainContentViewModel vm, string key, KeyAction action) { if (TranslateTable.ContainsKey(key.ToLower()) && action == KeyAction.Down) { int last = vm.Items.Count - 1; string input = TranslateTable[key.ToLower()]; if (last >= 11) { vm.Items = new ObservableCollection <KeyInput>(); last = -1; } if (last == -1 || input != vm.Items[last].Text || !vm.IsContinueInput) { vm.Items.Add(new KeyInput { Text = input, Flags = 1 }); } else { vm.Items[last].Flags += 1; vm.Items[last].Text = ""; vm.Items[last].Text = input; } return(true); } return(false); }
static void OnKeyPress(GlfwWindowPtr window, Key KeyCode, int Scancode, KeyAction Action, KeyModifiers Mods) { if (Action == KeyAction.Press && KeyCode == Key.Escape) { Glfw.SetWindowShouldClose(window, true); } }
private void KeyPress(object sender, myKeyEventArgs e) { char ch = e.key.KeyChar; if (char.ToLower(ch) != 'a' && char.ToLower(ch) != 'd' && char.ToLower(ch) != 'r' && char.ToLower(ch) != 'l' && char.ToLower(ch) != 'x' && ch != ' ') { e.Handled = true; } else { //действия switch (char.ToLower(ch)) { case 'a': Move(-1); break; case 'd': Move(1); break; case ' ': Shoot(); break; case 'r': KeyAction?.Invoke(1); break; case 'x': KeyAction?.Invoke(2); break; case 'l': KeyAction?.Invoke(3); break; } } }
public override void OnKeyDown(KeyAction key) { Console.WriteLine("KeyDown: {0} {1} {2}", key.Key, key.Flags, key.Repeat); cursorIndex++; cursorIndex %= systemcursors.Count; systemcursors[cursorIndex].SetCursor(); }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Esc: { MainProcess.ClearControls(); MainProcess.Process = new RegistrationProcess(MainProcess); break; } case KeyAction.F5: { PerformQuery("ПолучитьСписокПланаПриходаТары"); if (ResultParameters == null || ResultParameters[0] == null) { ShowMessage("Подойдите в зону беспроводного покрытия"); return; } var dataTable = ResultParameters[0] as DataTable; if (dataTable!=null&&dataTable.Rows.Count < 1) { ShowMessage("В полученном документе нет строк для приема!"); return; } MainProcess.ClearControls(); MainProcess.Process = new IncomingProcess(MainProcess, dataTable); break; } } }
private static void KeyCallback(Keys key, int scanCode, KeyAction action, KeyModifiers mods) { if (action == KeyAction.Repeat) { return; } void InputAction(Action <InputVariables> action) { action(fixedInput); action(renderInput); } switch (action) { case KeyAction.Press: InputAction(inputs => inputs.pressedKeys[key] = 0); break; case KeyAction.Release: InputAction(inputs => { if (inputs.pressedKeys.TryGetValue(key, out byte release)) { inputs.pressedKeys[key] = (byte)Math.Max(2, (int)release); } }); break; } }
/// <summary> /// 检查,并修改功能键状态 /// Check, and Update the Modifier Enabled Status in the <see cref="MainContentViewModel"/> /// </summary> /// <param name="vm"> /// </param> /// <param name="key"> /// </param> /// <param name="action"> /// </param> /// <returns> /// [True]: it is a modifier(Ctrl / Shift / Alt / Win) /// </returns> public static bool ModifierCheck(MainContentViewModel vm, string key, KeyAction action) { if (key.ToLower().Contains("ctrl")) { vm.IsCtrlEnabled = (action == KeyAction.Pressed || action == KeyAction.Down); return(true); } else if (key.ToLower().Contains("shift")) { vm.IsShiftEnabled = (action == KeyAction.Pressed || action == KeyAction.Down); return(true); } else if (key.ToLower().Contains("alt")) { vm.IsAltEnabled = (action == KeyAction.Pressed || action == KeyAction.Down); return(true); } else if (key.ToLower().Contains("win")) { vm.IsWinEnabled = (action == KeyAction.Pressed || action == KeyAction.Down); return(true); } else { return(false); } }
/// <summary> /// Initializes a new instance of the <see cref="FreezingArcher.Input.KeyboardInput"/> class. /// </summary> /// <param name="key">Key.</param> /// <param name="scancode">Scancode.</param> /// <param name="action">Action.</param> /// <param name="modifier">Modifier.</param> public KeyboardInput (Key key, int scancode, KeyAction action, KeyModifiers modifier) { Key = key; Scancode = scancode; Action = action; Modifier = modifier; }
bool ParseAction(KeyAction a, KeyCode key) { if (android) { KeyHudBool val; if (dict != null && dict.TryGetValue((int)key, out val)) { KeyHudBool keyHudBool = val; if (keyHudBool.down && a == KeyAction.KeyDown) { return(true); } if (keyHudBool.up && a == KeyAction.KeyUp) { return(true); } if (keyHudBool.hold && a == KeyAction.Key) { return(true); } } if (key >= KeyCode.Mouse0 && key < KeyCode.Mouse6) { return(false); } } return(a == KeyAction.Key ? Input.GetKey(key) : a == KeyAction.KeyDown ? Input.GetKeyDown(key) : Input.GetKeyUp(key)); }
public override void OnKeyDown(KeyAction key) { switch (key.Key) { case "q": { if (key.Flags.HasFlag(KeyFlags.Shift)) { mixer.LoopSound(beat1); } else { mixer.PlaySound(beat1); } break; } case "w": { if (key.Flags.HasFlag(KeyFlags.Shift)) { mixer.LoopSound(beat2); } else { mixer.PlaySound(beat2); } break; } } }
/// <summary> /// 指定したキーに文字列から動作を指定する /// </summary> /// <param name="key">キー</param> /// <param name="action">動作を表す文字列</param> public void set_action(char key, string action) { int n = 0; KeyAction a = string_to_action(action, ref n); set_action(key, a, n); }
private async void ApplyButton_Click(object sender, RoutedEventArgs e) { if (KeyConfigs.Count == 0) { MessageBox.Show("キーが設定されていません。割り当てるキーを設定してください", "エラー", MessageBoxButton.OK, MessageBoxImage.Error); return; } var action = new KeyAction(); action.KeyConfigs = KeyConfigs; var name = CustomNameTextBox.Text; action.Name = name; action.OnlyPress = false; action.FaceAction = true; action.FaceNames = faceItems.Select(d => d.Key).ToList(); action.FaceStrength = faceItems.Select(d => d.Value).ToList(); action.StopBlink = AutoBlinkCheckBox.IsChecked.Value; action.IsKeyUp = KeyUpCheckBox.IsChecked.Value; if (Globals.KeyActions == null) { Globals.KeyActions = new List <KeyAction>(); } Globals.KeyActions.Add(action); await Globals.Client.SendCommandAsync(new PipeCommands.SetKeyActions { KeyActions = Globals.KeyActions }); this.DialogResult = true; }
//Use in place of Input.GetKeyUP public static bool GetKeyUp(KeyAction key) { KeyCode _keyCode = KeyCode.None; keyDict.TryGetValue(key, out _keyCode); return(Input.GetKeyUp(_keyCode)); }
/// <summary> /// (Callback) Handles mouse inputs from the GLFW window. /// </summary> /// <param name="wnd">A pointer to the GLFW window.</param> /// <param name="btn">The mouse button that has had its state changed.</param> /// <param name="action">The action that occurred.</param> private void OnMouseButton(GlfwWindowPtr wnd, MouseButton btn, KeyAction action) { string inputString = String.Empty; switch (btn) { case MouseButton.LeftButton: inputString = "mb.left"; break; case MouseButton.MiddleButton: inputString = "mb.middle"; break; case MouseButton.RightButton: inputString = "mb.right"; break; } if (action == KeyAction.Press) { CurrentInputState.ReportPress(inputString); } else if (action == KeyAction.Release) { CurrentInputState.ReportRelease(inputString); } }
//Returns key code public static KeyCode GetKeyCode(KeyAction key) { KeyCode _keyCode = KeyCode.None; keyDict.TryGetValue(key, out _keyCode); return(_keyCode); }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { //Назад case KeyAction.Esc: MainProcess.ClearControls(); MainProcess.Process = new RegistrationProcess(MainProcess); break; //Очищення case KeyAction.Complate: if (MessageBox.Show( "Очистить все данные на ТСД?", "Очистка", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { dbArchitector.ClearAll(); } break; //Синхронізація case KeyAction.Proceed: new dbSynchronizer(MainProcess, serverIdProvider); MainProcess.ClearControls(); MainProcess.Process = new SelectingLampProcess(MainProcess); break; } }
protected bool CanRun(KeyAction item) { if (!string.IsNullOrEmpty(item.CastIfAddsVisible)) { var needAdds = bool.Parse(item.CastIfAddsVisible); if (needAdds != npcNameFinder.PotentialAddsExist) { item.LogInformation($"Only cast if adds exist = {item.CastIfAddsVisible} and it is {npcNameFinder.PotentialAddsExist}"); return(false); } } if (item.School != SchoolMask.None) { if (classConfig.ImmunityBlacklist.TryGetValue(playerReader.TargetId, out var list)) { if (list.Contains(item.School)) { return(false); } } } return(item.CanRun()); }
void HandleSubCategoriesTagging(AnalysisEventButtonVM buttonVM, TagVM subcategoryTagged = null) { if (subcategoryTagged != null) { buttonVM.SelectedTags.Add(subcategoryTagged); } KeyTemporalContext tempContext = new KeyTemporalContext { }; foreach (var subcategory in buttonVM.Tags) { KeyAction action = new KeyAction(new KeyConfig { Name = subcategory.Value, Key = subcategory.HotKey.Model }, () => HandleSubCategoriesTagging(buttonVM, subcategory)); tempContext.AddAction(action); } var analysisEventButton = (buttonVM.Model as AnalysisEventButton); if (analysisEventButton != null && analysisEventButton.TagMode == TagMode.Free) { tempContext.ExpiredTimeAction = buttonVM.ToggleIsCategoryClicked; } else { tempContext.Duration = Constants.TEMP_TAGGING_DURATION; tempContext.ExpiredTimeAction = buttonVM.Click; } App.Current.KeyContextManager.AddContext(tempContext); }
protected override void OnHotKey(KeyAction key) { switch (key) { case KeyAction.Esc: if ("Припинити виконання операції".Ask()) { MainProcess.ClearControls(); MainProcess.Process = new SelectingProcess(); } break; case KeyAction.Complate: if ("Завершити виконання операції".Ask()) { ComplateOperation(); } break; case KeyAction.F12: case KeyAction.Proceed: if (factPickingData != null && factPickingData.StickerId > 0) { proceed(); } break; } }
bool ParseCurlyPostfix( ParsePosition position, ref int repetitionCount, ref KeyAction keyAction) { return(ParseNumber(position: position, number: ref repetitionCount) || ParseDownUp(position: position, keyAction: ref keyAction)); }
public HandGestureControlKeyAddWindow(KeyAction action) : this() { CustomNameTextBox.Text = action.Name; if (action.Hand == Hands.Both) { BothHandRadioButton.IsChecked = true; } else if (action.Hand == Hands.Right) { RightHandRadioButton.IsChecked = true; } else { LeftHandRadioButton.IsChecked = true; } KeyUpCheckBox.IsChecked = action.IsKeyUp; isLoading = true; for (int i = 1; i <= 20; i++) { var slider = this.FindName("ValueSlider" + i.ToString("00")) as Slider; var textblock = this.FindName("ValueTextBlock" + i.ToString("00")) as TextBlock; slider.Value = action.HandAngles[i - 1]; textblock.Text = slider.Value.ToString(); handAngles[(int)slider.Tag - 1] = (int)slider.Value; } isLoading = false; KeyConfigs.AddRange(action.KeyConfigs); UpdateKeys(); }
private void showMessage(KeyAction danceMove, float affectionDelta) { if (messageController.isPlaying ()) { return; } if (woowee.affection <= 0.0f) { messageController.showRandomOverlayTextOfType (TextOverlayType.Lose); return; } else if (woowee.affection >= 1.0f) { messageController.showRandomOverlayTextOfType (TextOverlayType.Win); return; } affectionTrend += Mathf.Sign (affectionDelta); switch (danceMove) { case KeyAction.Fail: if (affectionTrend <= -3.0f) { messageController.showRandomOverlayTextOfType (TextOverlayType.Fail); affectionTrend = 0.0f; } break; case KeyAction.Miss: messageController.showRandomOverlayTextOfType (TextOverlayType.Miss); break; case KeyAction.BitchCombo: case KeyAction.DoNotStopCombo: case KeyAction.RiseCombo: messageController.showRandomOverlayTextOfType (TextOverlayType.Combo); break; default: if (affectionTrend >= 3.0f) { messageController.showRandomOverlayTextOfType (TextOverlayType.Hit); affectionTrend = 0.0f; } break; } }
public void AssignAction(KeyAction action, KeyCode code) { if(map.ContainsKey(action)) map[action] = code; else map.Add(action, code); }
public FunctionKeyAddWindow(KeyAction action) : this() { FunctionComboBox.SelectedIndex = (int)action.Function; KeyUpCheckBox.IsChecked = action.IsKeyUp; KeyConfigs.AddRange(action.KeyConfigs); UpdateKeys(); }
public IEnumerator ChangeKeybind(KeyAction selectedAction, bool isPrimary) { KeyValuePair <KeyAction, KeybindObject> conflictingKVP; KeyCombo capturedKeyCombo = KeyCombo.None; bool isConflictPrimary = true; // Wait for the keycombo to be captured KeyCapturePanel.SetActive(true); UIManager.IsInputFocus = true; while (capturedKeyCombo == KeyCombo.None) { capturedKeyCombo = keybindManager.CaptureKeyCombo(); yield return(null); } KeyCapturePanel.SetActive(false); // If null stop the function (null is returned if Escape was captured) if (capturedKeyCombo == null) { Logger.Log("Captured Escape key, cancelling change", Category.Keybindings); UIManager.IsInputFocus = false; yield break; } Logger.Log("Captured key combo: " + capturedKeyCombo.ToString(), Category.Keybindings); conflictingKVP = tempKeybinds.CheckConflict(capturedKeyCombo, ref isConflictPrimary); KeyAction conflictingAction = conflictingKVP.Key; KeybindObject conflictingKeybindObject = conflictingKVP.Value; if (conflictingAction == KeyAction.None) { // No conflicts found so set the new keybind and refresh the view tempKeybinds.Set(selectedAction, capturedKeyCombo, isPrimary); // Make sure the player can move around again UIManager.IsInputFocus = false; PopulateKeybindScrollView(); } // Check that the conflict isn't with itself, if it is just ignore it else if (conflictingAction != selectedAction) { // Check if the user wants to change the keybind modalPanelManager.Confirm( "Warning!\n\nThis combination is already being used by:\n" + conflictingKeybindObject.Name + "\nAre you sure you want to override it?", () => { // User confirms they want to change the keybind tempKeybinds.Set(selectedAction, capturedKeyCombo, isPrimary); tempKeybinds.Remove(conflictingAction, isConflictPrimary); UIManager.IsInputFocus = false; PopulateKeybindScrollView(); }, "Yes", () => { UIManager.IsInputFocus = false; } ); } }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Esc: { MainProcess.ClearControls(); MainProcess.Process = new RegistrationProcess(MainProcess); break; } case KeyAction.F5: { PerformQuery("ПолучитьСписокПланаПриходаТары"); if (ResultParameters == null || ResultParameters[0] == null) { ShowMessage("Подойдите в зону беспроводного покрытия"); return; } var dataTable = ResultParameters[0] as DataTable; if (dataTable != null && dataTable.Rows.Count < 1) { ShowMessage("В полученном документе нет строк для приема!"); return; } MainProcess.ClearControls(); MainProcess.Process = new IncomingProcess(MainProcess, dataTable); break; } } }
void HandleTeamTagging(LMTeamVM team, string taggedPlayer) { // limitation to the number of temporal contexts that can be created int position = taggedPlayer.Length; if (position == 3) { HandleTaggedPlayer(team, taggedPlayer); } KeyTemporalContext tempContext = new KeyTemporalContext { }; for (int i = 0; i < 10; i++) { string newTaggedPlayer = taggedPlayer + i; KeyAction action = new KeyAction(new KeyConfig { Name = taggedPlayer, Key = App.Current.Keyboard.ParseName(i.ToString()) }, () => HandleTeamTagging(team, newTaggedPlayer)); tempContext.AddAction(action); } tempContext.Duration = Constants.TEMP_TAGGING_DURATION; tempContext.ExpiredTimeAction = () => HandleTaggedPlayer(team, taggedPlayer); App.Current.KeyContextManager.AddContext(tempContext); }
private async void ApplyButton_Click(object sender, RoutedEventArgs e) { if (KeyConfigs.Count == 0) { MessageBox.Show(LanguageSelector.Get("KeyNotFoundError"), LanguageSelector.Get("Error"), MessageBoxButton.OK, MessageBoxImage.Error); return; } var action = new KeyAction(); action.KeyConfigs = KeyConfigs; var name = CustomNameTextBox.Text; action.Name = name; action.OnlyPress = false; action.FaceAction = true; action.FaceNames = faceItems.Select(d => d.Key).ToList(); action.FaceStrength = faceItems.Select(d => d.Value).ToList(); action.StopBlink = AutoBlinkCheckBox.IsChecked.Value; action.IsKeyUp = KeyUpCheckBox.IsChecked.Value; action.LipSyncMaxLevel = (float)LipSyncMaxLevelSlider.Value; if (Globals.KeyActions == null) { Globals.KeyActions = new List <KeyAction>(); } Globals.KeyActions.Add(action); await Globals.Client.SendCommandAsync(new PipeCommands.SetKeyActions { KeyActions = Globals.KeyActions }); this.DialogResult = true; }
protected void addProcessKeyAction(String name, KeyCodes k1, KeyCodes?k2 = null, KeyCodes?k3 = null, Action OnPress = null, Action OnRelease = null, Action OnHold = null) { KeyBundle keyBundle; if (k2 == null) { keyBundle = new KeyBundle(k1); } else if (k3 == null) { keyBundle = new KeyBundle((KeyCodes)k2, k1); } else { keyBundle = new KeyBundle((KeyCodes)k3, (KeyCodes)k2, k1); } var keyAction = new KeyAction(name, OnPress, new HashSet <KeyBundle>() { keyBundle }); keyAction.releaseAction = OnRelease; keyAction.holdAction = OnHold; processKeyActions.Add(keyAction, keyBundle); }
private void OnKeyboardActed(object sender, KeyboardActEventArgs e) { string key = e.Key; KeyAction keyAction = e.KeyAction; if (key == Key.LeftShift.ToString() || key == Key.RightShift.ToString()) { IsShiftPressed = (keyAction == KeyAction.Down || keyAction == KeyAction.Pressed); } else if (key == Key.LeftCtrl.ToString() || key == Key.RightCtrl.ToString()) { IsCtrlPressed = (keyAction == KeyAction.Down || keyAction == KeyAction.Pressed); } else if (key == Key.LeftAlt.ToString() || key == Key.RightAlt.ToString()) { IsAltPressed = (keyAction == KeyAction.Down || keyAction == KeyAction.Pressed); } else if (key == Key.Tab.ToString()) { IsTablePressed = (keyAction == KeyAction.Down || keyAction == KeyAction.Pressed); } else { LastKeyClick = key.ToString().ToUpper(); } Logger.Debug($"{key} {keyAction.ToString()}"); }
/// <summary> /// 检查是否是字母键 /// Check, if it a A~B /// </summary> /// <param name="vm"> /// </param> /// <param name="key"> /// </param> /// <param name="action"> /// </param> /// <returns> /// [True]: it is a Latter /// </returns> public static bool LatterCheck(MainContentViewModel vm, string key, KeyAction action) { if (key.Length == 1 && action == KeyAction.Down) { int last = vm.Items.Count - 1; if (last >= 11) { vm.Items = new ObservableCollection <KeyInput>(); last = -1; } if (last == -1 || key != vm.Items[last].Text || !vm.IsContinueInput) { vm.Items.Add(new KeyInput { Text = key, Flags = 1 }); } else { vm.Items[last].Flags += 1; vm.Items[last].Text = ""; vm.Items[last].Text = key; } return(true); } return(false); }
public MapKeystrokeForm(PadTieForm main, Controller cc, KeyAction editing) : this(main, cc) { this.editing = editing; capturedKey = editing.Key; ctrl.Checked = shift.Checked = alt.Checked = false; continuous.Checked = editing.Continuous; foreach (Keys mod in editing.Modifiers) { if (mod == Keys.Control) { ctrl.Checked = true; } else if (mod == Keys.Shift) { shift.Checked = true; } else if (mod == Keys.Alt) { alt.Checked = true; } } keyBox.Text = Util.GetKeyName(editing.Key); slotCapture.SetInput(editing.SlotDescription, true); }
private async void ApplyButton_Click(object sender, RoutedEventArgs e) { if (KeyConfigs.Count == 0) { MessageBox.Show("キーが設定されていません。割り当てるキーを設定してください", "エラー", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (FunctionComboBox.SelectedItem == null) { MessageBox.Show("機能が選択されていません。割り当てる機能を選択してください", "エラー", MessageBoxButton.OK, MessageBoxImage.Error); return; } var action = new KeyAction(); action.KeyConfigs = KeyConfigs; var name = FunctionComboBox.SelectedItem.ToString(); action.Name = name; action.OnlyPress = true; action.FunctionAction = true; action.Function = (Functions)FunctionComboBox.SelectedIndex; action.IsKeyUp = KeyUpCheckBox.IsChecked.Value; if (Globals.KeyActions == null) { Globals.KeyActions = new List <KeyAction>(); } Globals.KeyActions.Add(action); await Globals.Client.SendCommandAsync(new PipeCommands.SetKeyActions { KeyActions = Globals.KeyActions }); this.DialogResult = true; }
private int _flags; // bitwise combination of constants above /// <summary> /// Construct a ProcessKeyResult structure with the given action /// </summary> /// <param name="action"></param> internal ProcessKeyResult(KeyAction action) { _columnType = null; _branchType = null; _flags = LOCAL; _treeNav = NavigationDirection.Right; _action = action; }
public static void Add(String name, Keys key) { //TODO: Check for existing key. KeyAction newKey = new KeyAction(); newKey.name = name; newKey.key = key; keyList.Add(newKey); }
protected override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Proceed: break; } }
public override void OnHotKey(KeyAction key) { switch (key) { case KeyAction.Esc: leaveProcess(); break; } }
public float getAffectionDelta(KeyAction lastMove, float accuracy, WooeeController wooee, PlayerController player) { if (lastMove == KeyAction.Miss) { return -RuleBook.baseScore; } if (lastMove == KeyAction.Fail) { return -RuleBook.baseScore * 4; } return 0; }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Esc: MainProcess.ClearControls(); MainProcess.Process = new SelectingLampProcess(MainProcess); break; } }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Esc: MainProcess.ClearControls(); MainProcess.Process = new InstallingNewLighter(MainProcess, LampBarCode) { MapInfo = MapInfo }; break; } }
public void doDanceMove(KeyAction danceMove, float accuracy) { Debug.Log("Player got dance move:" + danceMove + " accuracy:" + accuracy); playSound (danceMove); animateDanceMove (danceMove); danceMoves.Add (danceMove); float affectionDelta = woowee.reactToMove (danceMove, accuracy, this); Debug.Log("isCombo:" + KeyActionHelper.isCombo(danceMove)); if (KeyActionHelper.isCombo(danceMove)) { comboEffect.instantiateEffect(); } showMessage (danceMove, affectionDelta); }
public bool GetKey(KeyCode key, KeyAction GetKey, bool force = false) { if (win.active && !force) return false; KeyValue kv = alternatives[(int)key]; if (kv == null) return ParseAction(GetKey, key); KeyCode[] keyCodeAlt = kv.keyCodeAlt; for (int i = 0; i < keyCodeAlt.Length; i++) { if (ParseAction(GetKey, keyCodeAlt[i]) && (!splitScreen || i % 2 == 0 && !secondPlayer || i % 2 == 1 && secondPlayer)) return true; } return false; }
protected override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Complate: exit(); return; case KeyAction.Esc: exit(); return; } }
public float getAffectionDelta(KeyAction lastMove, float accuracy, WooeeController wooee, PlayerController player) { if (KeyActionHelper.isFail(lastMove)) { return 0; } if (wooee.affection < 0.3) { return 6 * RuleBook.baseScore * accuracy; } else if (wooee.affection < 0.6) { return RuleBook.baseScore * accuracy; } return 0; }
protected override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Complate: complateProcess(); return; case KeyAction.Esc: if (processedPallets.Count == 0 || "��������� ��������?".Ask()) { exit(); } return; } }
public void AddWidget(KeyAction action, string desc, HotKey key, int position) { uint row_top, row_bottom, col_left, col_right; HBox box; Label descLabel, keyLabel; Button edit; Gtk.Image editImage; box = new HBox (); box.Spacing = 5; descLabel = new Label (); descLabel.Markup = String.Format ("<b>{0}</b>", desc); keyLabel = new Label (); keyLabel.Markup = GLib.Markup.EscapeText (key.ToString()); edit = new Button (); editImage = new Gtk.Image (LongoMatch.Gui.Helpers.Misc.LoadIcon ("longomatch-pencil", 24)); edit.Add (editImage); box.PackStart (descLabel, true, true, 0); box.PackStart (keyLabel, false, true, 0); box.PackStart (edit, false, true, 0); box.ShowAll (); sgroup.AddWidget (keyLabel); descLabel.Justify = Justification.Left; descLabel.SetAlignment (0f, 0.5f); edit.Clicked += (sender, e) => { HotKey hotkey = Config.GUIToolkit.SelectHotkey (key); if (hotkey != null) { if (Config.Hotkeys.ActionsHotkeys.ContainsValue (hotkey)) { Config.GUIToolkit.ErrorMessage (Catalog.GetString ("Hotkey already in use: ") + GLib.Markup.EscapeText (hotkey.ToString()), this); } else { Config.Hotkeys.ActionsHotkeys[action] = hotkey; Config.Save (); keyLabel.Markup = GLib.Markup.EscapeText (hotkey.ToString()); } } }; row_top = (uint)(position / table.NColumns); row_bottom = (uint)row_top + 1; col_left = (uint)position % table.NColumns; col_right = (uint)col_left + 1; table.Attach (box, col_left, col_right, row_top, row_bottom); }
public float getAffectionDelta(KeyAction lastMove, float accuracy, WooeeController wooee, PlayerController player) { if (KeyActionHelper.isFail(lastMove)) { return 0; } for(int i=4; i>=1; i--) { if (player.danceMoves.Count < i * 2) { continue; } ArrayList prevSequence = player.danceMoves.GetRange(player.danceMoves.Count - 2*i, i); ArrayList currentSequence = player.danceMoves.GetRange(player.danceMoves.Count - i, i); if (prevSequence.Cast<object>().SequenceEqual(currentSequence.Cast<object>())) { return - i * RuleBook.baseScore * 8; } } return 0; }
bool ParseAction(KeyAction a, KeyCode key) { if (android) { KeyHudBool val; if (dict != null && dict.TryGetValue((int)key, out val)) { KeyHudBool keyHudBool = val; if (keyHudBool.down && a == KeyAction.KeyDown) return true; if (keyHudBool.up && a == KeyAction.KeyUp) return true; if (keyHudBool.hold && a == KeyAction.Key) return true; } if (key >= KeyCode.Mouse0 && key < KeyCode.Mouse6) return false; } return a == KeyAction.Key ? Input.GetKey(key) : a == KeyAction.KeyDown ? Input.GetKeyDown(key) : Input.GetKeyUp(key); }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.Esc: //Якщо знаходимось на першому кроці - Вихід if (Stage == Stages.First) { MainProcess.ClearControls(); MainProcess.Process = new SelectingLampProcess(MainProcess); } else { //Інакше - на перший крок Stage = Stages.First; DrawControls(); } break; } }
protected override void OnHotKey(KeyAction TypeOfAction) { if (palletEditControls.Visible) { switch (TypeOfAction) { case KeyAction.Esc: startScanNextPallet(); return; } } else if (scanNextPalletControls.Visible) { switch (TypeOfAction) { case KeyAction.Complate: case KeyAction.Esc: complateProcess(); return; } } }
// returns the combo dance move that will be completed with `move` or `move` if it does not complete a combo. public KeyAction moveForNextDanceMove(KeyAction move) { ArrayList previousMoves = player.danceMoves; if (previousMoves.Count < 1) { return move; } //if (!isOneMoveFromCombo()) { // return move; //} foreach (Combo combo in combos) { int comboLength = combo.moveSequence.Length; if (previousMoves.Count < comboLength) { continue; } if (combo.isOneBeforeCombo (previousMoves) && combo.moveSequence [comboLength - 1] == move) { return combo.comboMove; } } return move; }
public void playSound(KeyAction danceMove) { AudioSource audio = GetComponent<AudioSource> (); switch (danceMove) { case KeyAction.Fail: audio.PlayOneShot (failSound); break; case KeyAction.Miss: //audio.PlayOneShot (missSound); break; case KeyAction.BitchCombo: audio.PlayOneShot (comboSound); break; case KeyAction.DoNotStopCombo: audio.PlayOneShot (comboSound); break; case KeyAction.RiseCombo: audio.PlayOneShot (comboSound); break; default: audio.PlayOneShot (hitNoteSound); break; } }
public static void AddAxis(Keys up = Keys.Up, Keys down = Keys.Down, Keys left = Keys.Left, Keys right = Keys.Right) { KeyAction newKey; newKey = new KeyAction(); newKey.name = "up"; newKey.key = up; keyList.Add(newKey); newKey = new KeyAction(); newKey.name = "down"; newKey.key = down; keyList.Add(newKey); newKey = new KeyAction(); newKey.name = "left"; newKey.key = left; keyList.Add(newKey); newKey = new KeyAction(); newKey.name = "right"; newKey.key = right; keyList.Add(newKey); }
private KeyHandler SetupKeyHandler() { // Reinstantiate the handler. m_keyHandler = new KeyHandler(); // Start at the end KeyAction quit = new KeyAction(this.Quit, null, null); m_keyHandler.AddAction("q", quit); // Scrolling KeyAction scrollup = new KeyAction(null, null, GetRenderer().Camera.ScrollUp); m_keyHandler.AddAction("uparrow", scrollup); KeyAction scrolldown = new KeyAction(null, null, GetRenderer().Camera.ScrollDown); m_keyHandler.AddAction("downarrow", scrolldown); KeyAction scrollleft = new KeyAction(null, null, GetRenderer().Camera.ScrollLeft); m_keyHandler.AddAction("leftarrow", scrollleft); KeyAction scrollright = new KeyAction(null, null, GetRenderer().Camera.ScrollRight); m_keyHandler.AddAction("rightarrow", scrollright); return m_keyHandler; }
private void OnCellHotKey(KeyAction Key) { if (Key == KeyAction.Proceed) { FormNumber = NextFormNumber; MainProcess.ClearControls(); MainProcess.OnBarcode = HandleBarcode; MainProcess.MainForm.SetOnHotKeyPressed(HandleHotKey); Start(); } }
protected abstract void OnHotKey(KeyAction key);
public void HandleHotKey(KeyAction key) { if (selectingFromList) { if (key == KeyAction.Esc) { selectingItemForm.CancelSelecting(); } return; } OnHotKey(key); }
public override void OnHotKey(KeyAction TypeOfAction) { switch (TypeOfAction) { case KeyAction.F9: if (CurrentControl != null) { ShowMessage(string.Format("Left = {0}\r\nTop = {1}\r\nWidth = {2}\r\nHeight = {3}", CurrentControl.Left, CurrentControl.Top, CurrentControl.Width, CurrentControl.Height)); } break; case KeyAction.F8: if (CurrentControl != null) { Control cont = CurrentControl; MainProcess.SelectNextControl(ref CurrentControl); CurrentControl.Paint += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); ControlColor = CurrentControl.BackColor; CurrentControl.BackColor = System.Drawing.Color.Red; CurrentControl.Refresh(); MainProcess.RemoveControl(cont); } break; case KeyAction.F10: MainProcess.CreateLabel("label", 5, 70, 100, ControlsStyle.LabelNormal); if (CurrentControl == null) { MainProcess.SelectNextControl(ref CurrentControl); CurrentControl.Paint += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); ControlColor = CurrentControl.BackColor; CurrentControl.BackColor = System.Drawing.Color.Red; CurrentControl.Refresh(); } break; case KeyAction.Complate: MainProcess.CreateTextBox(5, 100, 150, "ñreateTextBox", ControlsStyle.TextBoxNormal); if (CurrentControl == null) { MainProcess.SelectNextControl(ref CurrentControl); CurrentControl.Paint += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); ControlColor = CurrentControl.BackColor; CurrentControl.BackColor = System.Drawing.Color.Red; CurrentControl.Refresh(); } break; case KeyAction.F12: var t = MainProcess.CreateTable("WareList", 30); if (CurrentControl == null) { MainProcess.SelectNextControl(ref CurrentControl); CurrentControl.Paint += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); ControlColor = CurrentControl.BackColor; CurrentControl.BackColor = System.Drawing.Color.Red; CurrentControl.Refresh(); } t.Show(); break; case KeyAction.F5: if (CurrentControl != null) { CurrentControl.BackColor = ControlColor; CurrentControl.Paint -= new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); } MainProcess.SelectNextControl(ref CurrentControl); CurrentControl.Paint += new System.Windows.Forms.PaintEventHandler(DrawBorderForSelectObject); ControlColor = CurrentControl.BackColor; CurrentControl.BackColor = System.Drawing.Color.Red; CurrentControl.Refresh(); break; case KeyAction.Recount: MoveObjectsState = !MoveObjectsState; break; case KeyAction.UpKey: if (CurrentControl == null) break; if (MoveObjectsState) { CurrentControl.Top--; } else { CurrentControl.Height--; } break; case KeyAction.DownKey: if (CurrentControl == null) break; if (MoveObjectsState) { CurrentControl.Top++; } else { CurrentControl.Height++; } break; case KeyAction.LeftKey: if (CurrentControl == null) break; if (MoveObjectsState) { CurrentControl.Left--; } else { CurrentControl.Width--; } break; case KeyAction.RightKey: if (CurrentControl == null) break; if (MoveObjectsState) { CurrentControl.Left++; } else { CurrentControl.Width++; } break; } }