public void Init(int tKey = -1) // init the key binder, can be called more than once { if (KeyController.current.currentController == 3) { return; // MobileCheck } if (!alwaysInit && KeyController.current.currentController == 0) { return; // StandaloneCheck } if (tKey != -1) { targetKey = tKey; } if (kk != null) { Destroy(kk.gameObject); } KeyMap km = KeyController.current.keyMaps[KeyController.current.currentController]; kk = Instantiate(GameManager.singleton.keyCode, transform); kk.localPosition = keyCodeOffset; kk.gameObject.SetActive(true); keyCode = km.keys[targetKey].key; Text kt = kk.GetComponentInChildren <Text>(); kt.text = km.keys[targetKey].keyName.ToString(); kt.color = km.keys[targetKey].keyColor; Image ki = kk.GetComponent <Image>(); ki.color = km.keys[targetKey].color; ki.sprite = km.keys[targetKey].sprite; }
private bool GetControlDown(KeyMap control, bool upCheck = false) { if (this.Controlled) { float result; if ((result = Input.GetAxis(control.XBOXkey)) != control.PreviousFrame) { if (!upCheck) { control.PreviousFrame = result; } //Debug.Log(result); if (result != 0) { control.PreviousFrame = result; return(true); } } if (Input.GetKeyDown(control.PCkey)) { return(true); } return(false); } else { return(false); } }
override protected void DoCreate() { list = new SwitchList <string>(); tabBar = new TabBar <string>(list, TabBar <string> .DefaultStringOf); tabBar.Text = "Info"; tabBar.CloseClick += OnCloseClick; Controls.Add(tabBar); KeyMap frameKeyMap = new KeyMap(); frameKeyMap.AddItem(new KeyItem(Keys.Escape, null, new KeyAction("&View\\Close info", DoClose, null, false))); frameKeyMap.AddItem(new KeyItem(Keys.Enter, null, new KeyAction("&View\\Close info", DoClose, null, false))); textBox = new MulticaretTextBox(); textBox.KeyMap.AddAfter(KeyMap); textBox.KeyMap.AddAfter(frameKeyMap, 1); textBox.KeyMap.AddAfter(DoNothingKeyMap, -1); textBox.FocusedChange += OnTextBoxFocusedChange; textBox.Controller.isReadonly = true; textBox.ViShortcut += OnViShortcut; SetTextBoxParameters(); Controls.Add(textBox); tabBar.MouseDown += OnTabBarMouseDown; InitResizing(tabBar, null); Height = MinSize.Height; }
protected override void PreProcess() { try { lastKeyPressed = DateTime.Now; KeyMap.Load(); Debugger.Instance().AppendLine("Started Display: " + DateTime.Now.ToLongTimeString()); DisplayAdapter.Instance(); DisplayAdapter.Both.Show(PosMessage.PLEASE_WAIT); Application.DoEvents(); Debugger.Instance().AppendLine("Finished Display" + DateTime.Now.ToLongTimeString()); if (PosConfiguration.Get("BarcodeComPort") != "") { ConnectBarcode(); } //Console.CancelKeyPress += new ConsoleCancelEventHandler(pos_OnClosed); CashRegister.Instance(); CashRegister.Printer.DateTimeChanged += new EventHandler(Printer_DateTimeChanged); Debugger.Instance().AppendLine("Started BackgroundWorker: " + DateTime.Now.ToLongTimeString()); Thread thread = new Thread(new ThreadStart(BackgroundWorker.Start)); thread.Name = "BackgroundWorker"; thread.IsBackground = true; thread.Priority = ThreadPriority.BelowNormal; thread.Start(); } catch (UnauthorizedAccessException ex) { throw ex; } }
private static void AddCursorKeys() { KeyMap.Add(0x25, Key.CursorLeft); KeyMap.Add(0x26, Key.CursorUp); KeyMap.Add(0x27, Key.CursorRight); KeyMap.Add(0x28, Key.CursorDown); }
public void ResetDefaultSingleLineKeyMap() { ClearKeyMap(); // --- move --- KeyMap.SetAction(Keys.Left, (focus) => MoveBackwardChar()); KeyMap.SetAction(Keys.Right, (focus) => MoveForwardChar()); // --- select --- KeyMap.SetAction(Keys.Left | Keys.Shift, (focus) => SelectBackwardChar()); KeyMap.SetAction(Keys.Right | Keys.Shift, (focus) => SelectForwardChar()); // --- enter --- KeyMap.SetAction(Keys.Enter, (focus) => CommitAndSelect()); KeyMap.SetAction(Keys.Enter | Keys.Shift, (focus) => CommitAndSelect()); KeyMap.SetAction(Keys.Enter | Keys.Control, (focus) => CommitAndSelect()); // --- clipboard --- KeyMap.SetAction(Keys.V | Keys.Control, (focus) => PasteLastLine()); KeyMap.SetAction(Keys.X | Keys.Control, (focus) => Cut()); KeyMap.SetAction(Keys.C | Keys.Control, (focus) => Copy()); // --- undo --- KeyMap.SetAction(Keys.Z | Keys.Control, (focus) => Undo()); KeyMap.SetAction(Keys.Y | Keys.Control, (focus) => Redo()); // --- remove --- KeyMap.SetAction(Keys.Delete, (focus) => RemoveForward()); KeyMap.SetAction(Keys.Back, (focus) => RemoveBackward()); }
private void OnAppClose() { InterceptKeys.ReleaseHook(); string stopMessage = settings.stopMessage; if (port != null && !string.IsNullOrEmpty(stopMessage)) { WriteToPort(stopMessage); } DateTime endTime = DateTime.Now; TimeSpan totalTimeTaken = endTime.Subtract(startTime); stats.seconds += (long)totalTimeTaken.TotalSeconds; for (int i = 0; i < keyMap.Length; i++) { KeyMap currentKeymap = keyMap[i]; if (currentKeymap != null && currentKeymap.count > 0) { long currentKeyCount; Keys key = (Keys)i; stats.keyStats.TryGetValue(key, out currentKeyCount); stats.keyStats[key] = currentKeyCount + currentKeymap.count; } } ConfigHelper.SaveStats(stats); }
private IKeyMap <IFocus> CreateMemoTableCellFocusKeyMap() { var ret = new KeyMap <IFocus>(); MemoTableCellFocusKeyBinder.Bind(ret); return(ret); }
private IKeyMap <IEditor> CreateUmlFeatureEditorKeyMap() { var ret = new KeyMap <IEditor>(); UmlFeatureEditorKeyBinder.Bind(ret); return(ret); }
private IKeyMap <IEditor> CreateMemoContentEditorKeyMap() { var ret = new KeyMap <IEditor>(); MemoContentEditorKeyBinder.Bind(ret); return(ret); }
private IKeyMap <IEditor> CreateMemoTableCellEditorKeyMap() { var ret = new KeyMap <IEditor>(); MemoTableCellEditorKeyBinder.Bind(ret); return(ret); }
private IKeyMap <IFocus> CreateMemoContentSingleLineFocusKeyMap() { var ret = new KeyMap <IFocus>(); MemoContentSingleLineFocusKeyBinder.Bind(ret); return(ret); }
private IKeyMap <EditorCanvas> CreateNoSelectionKeyMap() { var ret = new KeyMap <EditorCanvas>(); NoSelectionKeyBinder.Bind(ret); return(ret); }
public OpenTKWindow(GameEngine engine) : base(800, 600, new GraphicsMode(32, 24, 0, 2), "ORTS.Test") { VSync = VSyncMode.Off; Views= new ConcurrentDictionary<Type,IGameObjectView>(); this.Engine = engine; this.Engine.Bus.OfType<LoadObjectView>().Subscribe(m => Views.TryAdd(m.GameObjectType,m.View)); KeyMap map = new KeyMap(); Keyboard.KeyDown += (object sender, KeyboardKeyEventArgs e) => { this.Engine.Bus.Add(new KeyDown(this.Engine.Timer.LastTickTime, map.Do(e.Key))); }; Keyboard.KeyUp += (object sender, KeyboardKeyEventArgs e) => { this.Engine.Bus.Add(new KeyUp(this.Engine.Timer.LastTickTime, map.Do(e.Key))); }; Mouse.WheelChanged += (object sender, MouseWheelEventArgs e) => { camera.Translate(new Vect3(0,0,-e.DeltaPrecise)); }; engine.Bus.Add(new GraphicsLoadedMessage(engine.Timer.LastTickTime)); camera = new Camera(); camera.Translate(new Vect3(0, 0, 30)); }
private void ButtonExport_Click(object sender, RoutedEventArgs e) { try { using (StreamWriter file = new StreamWriter(@"keystat.csv", false)) { foreach (Keys key in settings.keyMap.Keys) { KeyMap keyMap = settings.keyMap[key]; string[] statData = new string[5]; statData[0] = key.ToString(); statData[1] = keyMap.name; statData[2] = keyMap.group; statData[3] = keyMap.subgroup; long count; stats.keyStats.TryGetValue(key, out count); statData[4] = (keyMap.count + count).ToString(); String line = CreateCsvLine(statData); file.WriteLine(line); } } System.Windows.MessageBox.Show("keystat.csv file created", "ArcadeMgr", MessageBoxButton.OK, MessageBoxImage.Information); } catch (Exception ex) { HandleError("Unable to write file (keystat.csv)", ex, false); } }
public IActionResult RenderLayerIcon(string deviceId, string layerId, int keyId) { Bitmap icon; try { DeviceModel device = _deviceManager.GetDevice(deviceId); KeyMap keyMap = device.Layers.GetLayerById(layerId).Keys; if (keyMap.ContainsKey(keyId)) { KeyModel key = keyMap[keyId]; icon = _deviceManager.GenerateKeyIcon(key, deviceId); } else { icon = IconHelpers.DrawBlankKeyIcon(244, 244); } } catch (Exception e) { icon = IconHelpers.DrawBlankKeyIcon(244, 244); } return(File(icon.ToMemoryStream(), "image/png", "key.png")); }
// ReSharper disable once UnusedMember.Local private void Start() { //CreateTestMenu(new Vector3(100, -150, 0)); var m2 = new KeyMap("Menu2", "Help2"); m2.Define(new[] { "1" }, new MenuLineBaseSimple("Help2.1", "?I1", "Help Item1")); m2.Define(new[] { "2" }, new MenuLineBaseSimple("Help2.2", "?I2", "Help Item2")); m2.Define(new[] { "3" }, new MenuLineBaseSimple("Help2.3", "?I3", "Help Item3")); m2.Define(new[] { "4" }, new MenuLineBaseSimple("Help2.4", "?I4", "Help Item4")); m2.Define(new[] { "-3" }, new MenuSeparator(MenuSeparator.Type.Space)); var m = new KeyMap("Menu1", "Help1"); m.Define(new[] { "1" }, new MenuLineBaseSimple("Menu1.1", m2, "?I1", "Help Item1")); m.Define(new[] { "2" }, new MenuLineBaseSimple("Menu1.2", "help", "?I2", "Help Item2")); m.Define(new[] { "3" }, new MenuLineBaseSimple("Menu1.3", m2, "?I3", "Help Item3")); m.Define(new[] { "4" }, new MenuLineBaseSimple("Menu1.4", "?I4", "Help Item4")); m.Define(new[] { "5" }, new MenuLineBaseSimple("Menu1.5", "?I5", "Help Item5")); m.Define(new[] { "6" }, new MenuLineBaseSimple("Menu1.6", "?I6", "Help Item6")); curentMenu = CreateMenu(m, new Vector3(0, 0, 0), 200f); // KeyMap.GlobalKeymap.Define(new[]) //m.Define(new[] { "-1" }, new MenuSeparator(MenuSeparator.Type.NoLine)); //m.Define(new[] { "-2" }, new MenuSeparator(MenuSeparator.Type.SingleLine)); //m.Define(new[] { "-3" }, new MenuSeparator(MenuSeparator.Type.Space)); //m.Define(new[] { "-4" }, new MenuSeparator(MenuSeparator.Type.DashedLine)); }
public void Remove(String key) { if (key == null || keys == null) { throw new ArgumentException (S._("VB_InvalidCollectionIndex")); } KeyMap map = keys; KeyMap prev = null; while (map != null) { if (map.key == key) { if (prev != null) { prev.next = map.next; } else { keys = map.next; } int index = map.index; list.RemoveAt(index); AdjustAfter(index, -1); return; } prev = map; map = map.next; } throw new ArgumentException (S._("VB_InvalidCollectionIndex")); }
public bool SetKey(IEnumerable <Tuple <Key, Color> > keys) { WriteRead(Packets.Start); Packets.Mode[8] = (byte)Mode.Custom; WriteRead(Packets.Mode); foreach (var key in keys) { if (!KeyMap.TryGetValue(key.Item1, out var coords)) { continue; } Packets.KeyPacket[5 + 0] = coords.x; Packets.KeyPacket[5 + 1] = coords.y; Packets.KeyPacket[8 + 0] = key.Item2.R; Packets.KeyPacket[8 + 1] = key.Item2.G; Packets.KeyPacket[8 + 2] = key.Item2.B; WriteRead(Packets.KeyPacket); } stream.Write(Packets.Finish); return(true); }
public ContextCommand( KeyMap keyMap, KeyMap.GameInput input, Action<float> cb, TriggerType triggerType = TriggerType.Down ) { input_ = input; callback_ = cb; keyMap_ = keyMap; triggerType_ = triggerType; }
public Object this[Object index] { get { if (index is int) { return(this[(int)index]); } else if (index is String) { String key = (String)index; KeyMap map = keys; while (map != null) { if (map.key == key) { return(list[map.index]); } map = map.next; } throw new ArgumentException (S._("VB_InvalidCollectionIndex")); } else { throw new ArgumentException (S._("VB_InvalidCollectionIndex")); } } }
override protected void DoCreate() { tabBar = new TabBar <string>(new SwitchList <string>(), TabBar <string> .DefaultStringOf); tabBar.Text = Name; tabBar.CloseClick += OnCloseClick; Controls.Add(tabBar); KeyMap frameKeyMap = new KeyMap(); KeyItem escape = new KeyItem(Keys.Escape, null, new KeyAction("&View\\File tree\\Cancel renaming", DoCancel, null, false)); frameKeyMap.AddItem(escape); frameKeyMap.AddItem(new KeyItem(Keys.Enter, null, new KeyAction("&View\\File tree\\Complete renaming", DoComplete, null, false))); KeyMap beforeKeyMap = new KeyMap(); beforeKeyMap.AddItem(escape); textBox = new MulticaretTextBox(); textBox.KeyMap.AddBefore(beforeKeyMap); textBox.KeyMap.AddAfter(KeyMap); textBox.KeyMap.AddAfter(frameKeyMap, 1); textBox.KeyMap.AddAfter(DoNothingKeyMap, -1); textBox.FocusedChange += OnTextBoxFocusedChange; Controls.Add(textBox); tabBar.MouseDown += OnTabBarMouseDown; InitResizing(tabBar, null); }
public override bool HandlesKeyDown(Key key) { if (key == Key.Escape) { game.Gui.SetNewScreen(null); } else if (curWidget != null) { int index = Array.IndexOf <Widget>(widgets, curWidget) - 2; KeyBind mapping = Get(index, left, right); KeyMap map = game.InputHandler.Keys; Key oldKey = map[mapping]; string reason; string desc = Get(index, leftDesc, rightDesc); if (!map.IsKeyOkay(oldKey, key, out reason)) { const string format = "&eFailed to change \"{0}\". &c({1})"; statusWidget.SetText(String.Format(format, desc, reason)); } else { const string format = "&e\"{0}\" changed from &7{1} &eto &7{2}&e."; statusWidget.SetText(String.Format(format, desc, oldKey, key)); string text = desc + ": " + keyNames[(int)key]; curWidget.SetText(text); map[mapping] = key; } curWidget = null; } return(key < Key.F1 || key > Key.F35); }
public TabList(Buffer buffer, MainForm mainForm) : base(null, "Tab list", SettingsMode.TabList) { this.buffer = buffer; this.mainForm = mainForm; expanded = new Dictionary <int, bool>(); showEncoding = false; Controller.isReadonly = true; onSelected = OnBufferSelected; additionKeyMap = new KeyMap(); { KeyAction action = new KeyAction("&View\\Tab list\\Close tab list", DoCloseBuffer, null, false); additionKeyMap.AddItem(new KeyItem(Keys.Escape, null, action)); additionKeyMap.AddItem(new KeyItem(Keys.Control | Keys.OemOpenBrackets, null, action)); } { KeyAction action = new KeyAction("&View\\Tab list\\Select tab", DoOpenTab, null, false); additionKeyMap.AddItem(new KeyItem(Keys.Enter, null, action)); } additionBeforeKeyMap = new KeyMap(); { KeyAction action = new KeyAction("&View\\Tab list\\Remove tab", DoRemoveTab, null, false); additionBeforeKeyMap.AddItem(new KeyItem(Keys.Delete, null, action)); } }
public KeyMapTest() { _globalSettings = new GlobalSettings(); _variableMap = new Dictionary<string, VariableValue>(); _mapRaw = new KeyMap(_globalSettings, _variableMap); _map = _mapRaw; }
private void RebuildCommands() { KeyMap = InputController.Singleton.Entry; var i = 0; var commands = typeof(KeyMapData).GetFields().Where(x => x.FieldType == typeof(KeyCode[])).Select(x => new { x.Name, Keys = (KeyCode[])x.GetValue(KeyMap.Data) }).ToArray(); Commands = new Command[commands.Length]; foreach (var keys in commands) { var previous_command = Keys.Find(keys.Name); if (previous_command != null) { Destroy(previous_command.gameObject); } var go = Instantiate(CommandTemplate, Keys); go.name = keys.Name; var command = go.GetComponent <Command>(); command.Name.text = keys.Name; command.Index = i; command.Keys = keys.Keys; if (keys.Keys.Length > 0) { command.SetValuesText(); } command.Append.onClick.AddListener(() => Append(command.Index)); command.Replace.onClick.AddListener(() => Replace(command.Index)); command.Restore.onClick.AddListener(() => Restore(command.Index)); Commands[i] = command; i++; } }
public void Clear1() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Normal)); map.Clear(KeyRemapMode.Normal); Assert.IsTrue(map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal).IsNoMapping); }
public KeyMapTest() { _globalSettings = new GlobalSettings(); _variableMap = new Dictionary <string, VariableValue>(); _mapRaw = new KeyMap(_globalSettings, _variableMap); _map = _mapRaw; }
public IEnumerable <KeyMap> Collect(UInt32 lowerVKey, UInt32 upperVKey, Boolean complete) { if (lowerVKey < this.MinVKey) { lowerVKey = this.MinVKey; } if (upperVKey > this.MaxVKey) { upperVKey = this.MaxVKey; } List <KeyMap> results = new List <KeyMap>(); for (UInt32 vKey = lowerVKey; vKey <= upperVKey; vKey++) { KeyMap current = new KeyMap(vKey); if (!complete && !current.IsVisible) { continue; } results.Add(new KeyMap(vKey)); } this.DumpResults(results); return(results); }
public static bool KeyDown(Control control, NSEvent theEvent) { if (control != null) { char keyChar = !string.IsNullOrEmpty(theEvent.Characters) ? theEvent.Characters [0] : '\0'; Key key = KeyMap.MapKey(theEvent.KeyCode); KeyPressEventArgs kpea; Key modifiers = KeyMap.GetModifiers(theEvent); key |= modifiers; //Console.WriteLine("\t\tkeymap.Add({2}, Key.{0}({1})); {3}", theEvent.Characters, (int)keyChar, theEvent.KeyCode, theEvent.ModifierFlags); //Console.WriteLine("\t\t{0} {1} {2}", key & Key.ModifierMask, key & Key.KeyMask, (NSKey)keyChar); if (key != Key.None) { if (((modifiers & ~(Key.Shift | Key.Alt)) == 0)) { kpea = new KeyPressEventArgs(key, keyChar); } else { kpea = new KeyPressEventArgs(key); } } else { kpea = new KeyPressEventArgs(key, keyChar); } control.OnKeyDown(kpea); return(kpea.Handled); } return(false); }
private void WriteChar(int order, PosKey key) { byte sequence = 0; char c = KeyMap.GetLetter(key, order, ref sequence); Append(c, true); }
protected virtual void OnFigureShortcutKeyProcess(ShortcutKeyProcessEventArgs e) { var keyData = e.KeyData; if (keyData == Keys.ProcessKey && !Host.Site.EditorCanvas.IsInImeComposition) { keyData = Host.Site.EditorCanvas._ImmVirtualKey; } if (_keyMap != null && _keyMap.IsDefined(keyData)) { var action = KeyMap.GetAction(keyData); if (action != null) { if (action(this)) { e.Handled = true; } } } var handler = ShortcutKeyProcess; if (handler != null) { handler(this, e); } }
void Reset_Key(object sender, EventArgs e) { ToolStripMenuItem item = sender as ToolStripMenuItem; KeyMap map = Warp.GetClosest((double)item.Tag); Warp.MoveKey(map.WarpKey, map.RealKey); Invalidate(); }
public void GetKeyMappingResult1() { var map = new KeyMap(); Assert.IsTrue(map.MapWithRemap("a", "b", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithRemap("b", "a", KeyRemapMode.Normal)); var ret = map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal); Assert.IsTrue(ret.IsRecursiveMapping); }
public void KeyMap_UnmapByExpansionUsingBang() { Create(""); RunCommand("imap cat dog"); Assert.Equal(1, KeyMap.GetKeyMappingsForMode(KeyRemapMode.Insert).Length); RunCommand("unmap! dog"); Assert.Equal(0, KeyMap.GetKeyMappingsForMode(KeyRemapMode.Insert).Length); }
public void GetKeyMapping1() { var map = new KeyMap(); Assert.IsTrue(map.MapWithRemap("a", "b", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithRemap("b", "a", KeyRemapMode.Normal)); var ret = map.GetKeyMapping(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal).Single(); Assert.AreEqual('b', ret.Char); }
public void GetKeyMapping1() { var map = new KeyMap(); Assert.IsTrue(map.MapWithRemap("a", "b", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithRemap("b", "a", KeyRemapMode.Normal)); var ret = map.GetKeyMapping(KeyInputSetUtil.ofChar('a'), KeyRemapMode.Normal); Assert.IsTrue(ret.IsRecursiveMapping); Assert.AreEqual('b', ret.AsRecursiveMapping().Item.KeyInputs.Single().Char); }
public static float GetControlValue(KeyMap control) { if (Input.GetKey(control.PCkey)) return 1; else if (Input.GetKey((KeyCode)control.nPCkey)) return -1; else return Input.GetAxis(control.XBOXkey); }
public void Clear2() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Insert)); map.Clear(KeyRemapMode.Normal); var res = map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Insert); Assert.IsTrue(res.IsSingleKey); Assert.AreEqual('b', res.AsSingleKey().Item.Char); }
/// <inheritdoc/> public void AddKeyMap(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentNullException("name"); } var keyMap = new KeyMap("keymap"); this.nameToKeyMapMapping.Add(name, keyMap); }
public void GetKeyMappingResult4() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "bc", KeyRemapMode.Normal)); var res = map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal); Assert.IsTrue(res.IsKeySequence); var list = res.AsKeySequence().Item.ToList(); Assert.AreEqual(2, list.Count); Assert.AreEqual('b', list[0].Char); Assert.AreEqual('c', list[1].Char); }
public void ClearAll() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Insert)); map.ClearAll(); var res = map.GetKeyMappingResult(KeyInputUtil.CharToKeyInput('a'), KeyRemapMode.Insert); Assert.IsTrue(res.IsNoMapping); res = map.GetKeyMappingResult(KeyInputUtil.CharToKeyInput('a'), KeyRemapMode.Normal); Assert.IsTrue(res.IsNoMapping); }
//protected Dictionary<int, MappedInput> mappingDict_ = new Dictionary<int, MappedInput>(); public bool PollInput( KeyMap.GameInput input, ContextCommand.TriggerType triggerType, out float axis) { switch (triggerType) { case ContextCommand.TriggerType.Down: return mappings_[(int)input].PollInputDown(out axis); case ContextCommand.TriggerType.Changed: return mappings_[(int)input].PollInputChanged(out axis); default: return mappings_[(int)input].PollInputHold(out axis); } }
void DrawMapping( KeyMap keymap, Mapping mapping ) { var keyMapping = mapping as KeyMapping; if( keyMapping != null ) { EditorGUILayout.LabelField( keyMapping.inputName_ ); keyMapping.key_ = (KeyCode)EditorGUILayout.EnumPopup( keyMapping.key_ ); } else { //EditorGUILayout.LabelField( "Not a keymapping, it's: " + mapping.GetType ().Name ); } }
internal static ICommonOperations CreateCommonOperations( ITextView textView, IVimLocalSettings localSettings, IOutliningManager outlining = null, IStatusUtil statusUtil = null, ISearchService searchService = null, IUndoRedoOperations undoRedoOperations = null, IVimData vimData = null, IVimHost vimHost = null, ITextStructureNavigator navigator = null, IClipboardDevice clipboardDevice = null, IFoldManager foldManager = null) { var editorOperations = EditorUtil.GetOperations(textView); var editorOptions = EditorUtil.FactoryService.EditorOptionsFactory.GetOptions(textView); var jumpList = new JumpList(new TrackingLineColumnService()); var keyMap = new KeyMap(); foldManager = foldManager ?? new FoldManager(textView.TextBuffer); statusUtil = statusUtil ?? new StatusUtil(); searchService = searchService ?? CreateSearchService(localSettings.GlobalSettings); undoRedoOperations = undoRedoOperations ?? new UndoRedoOperations(statusUtil, FSharpOption<ITextUndoHistory>.None); vimData = vimData ?? new VimData(); vimHost = vimHost ?? new MockVimHost(); navigator = navigator ?? CreateTextStructureNavigator(textView.TextBuffer); clipboardDevice = clipboardDevice ?? new MockClipboardDevice(); var operationsData = new OperationsData( editorOperations, editorOptions, foldManager, jumpList, keyMap, localSettings, outlining != null ? FSharpOption.Create(outlining) : FSharpOption<IOutliningManager>.None, CreateRegisterMap(clipboardDevice), searchService, EditorUtil.FactoryService.SmartIndentationService, statusUtil, textView, undoRedoOperations, vimData, vimHost, navigator); return new CommonOperations(operationsData); }
public VoxelRTSWindow(GameEngine engine) : base(1280, 720, new GraphicsMode(32, 24, 0, 1), "ORTS.Test") { VSync = VSyncMode.Off; Views= new ConcurrentDictionary<Type,IGameObjectView>(); Engine = engine; Engine.Bus.OfType<GraphicsDirtyMessage>().Subscribe(m => _graphicsDirty = true); var map = new KeyMap(); Keyboard.KeyDown += (sender, e) => Engine.Bus.Add(new KeyDownMessage(Engine.Timer.LastTickTime, map.Match(e.Key))); Keyboard.KeyUp += (sender, e) => Engine.Bus.Add(new KeyUpMessage(Engine.Timer.LastTickTime, map.Match(e.Key))); Mouse.WheelChanged += (sender, e) => Camera.Translate(new Vect3(0,0,-e.DeltaPrecise)); Camera = new Camera(); Camera.Translate(new Vect3(0, 0, 30)); engine.Bus.Add(new GraphicsLoadedMessage(engine.Timer.LastTickTime)); }
public override void OnEnter(string oldState) { _SM.IsMouseVisible = true; (_SM as InfiniminerGame).ResetPropertyBag(); _P = _SM.propertyBag; texMenu = _SM.Content.Load<Texture2D>("menus/tex_menu_server"); drawRect = new Rectangle(_SM.GraphicsDevice.Viewport.Width / 2 - 1024 / 2, _SM.GraphicsDevice.Viewport.Height / 2 - 768 / 2, 1024, 1024); uiFont = _SM.Content.Load<SpriteFont>("font_04b08"); keyMap = new KeyMap(); serverList = (_SM as InfiniminerGame).EnumerateServers(0.5f); }
public static KeyMap WhatControllerAmI(int joystickNumber) { KeyMap output = new KeyMap(); if (joystickNumber == 0) { output._horizontalAxis = "Horizontal"; output._verticalAxis = "Vertical"; output._button01 = KeyCode.Space; output._buttonPause = KeyCode.Escape; } else if (joystickNumber == 1) { output._horizontalAxis = "Joystick1_Horizontal"; output._verticalAxis = "Joystick1_Vertical"; output._button01 = KeyCode.Joystick1Button0; output._buttonPause = KeyCode.Joystick1Button7; } else if (joystickNumber == 2) { output._horizontalAxis = "Joystick2_Horizontal"; output._verticalAxis = "Joystick2_Vertical"; output._button01 = KeyCode.Joystick2Button0; output._buttonPause = KeyCode.Joystick2Button7; } else if (joystickNumber == 3) { output._horizontalAxis = "Joystick3_Horizontal"; output._verticalAxis = "Joystick3_Vertical"; output._button01 = KeyCode.Joystick3Button0; output._buttonPause = KeyCode.Joystick3Button7; } else if (joystickNumber == 4) { output._horizontalAxis = "Joystick4_Horizontal"; output._verticalAxis = "Joystick4_Vertical"; output._button01 = KeyCode.Joystick4Button0; output._buttonPause = KeyCode.Joystick4Button7; } return output; }
private bool GetControlUp(KeyMap control, bool downCheck = false) { float result; if ((result = Input.GetAxis(control.XBOXkey)) != control.PreviousFrame) { if (!downCheck) control.PreviousFrame = result; if (result == 0) { control.PreviousFrame = result; return true; } } if (Input.GetKeyUp(control.PCkey)) return true; return false; }
public void GetKeyMappingResult5() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("aa", "b", KeyRemapMode.Normal)); var res = map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal); Assert.IsTrue(res.IsMappingNeedsMoreInput); }
public KeyMap Vertical; // = new KeyMap("Vertical", KeyCode.Mouse0); #endregion Fields #region Constructors public PlayerControls(int n) { Activate = new KeyMap("Activate", "Activate" + n, KeyCode.Mouse1); Explode = new KeyMap("Explode", "Explode" + n, KeyCode.Mouse0); Jump = new KeyMap("Jump", "Jump" + n, KeyCode.Space); Horizontal = new KeyMap("Horizontal", "Horizontal" + n, KeyCode.Mouse0); Vertical = new KeyMap("Vertical", "Vertical" + n, KeyCode.Mouse0); MoveHorizontal = new KeyMap("MoveHorizontal", "MoveHorizontal" + n, KeyCode.D, KeyCode.A); MoveVertical = new KeyMap("MoveVertical", "MoveVertical" + n, KeyCode.W, KeyCode.S); LockMouseMovement = new KeyMap("LockMouseMovement", "LockMouseMovement" + n, KeyCode.Backslash); }
public void GetKeyMappingResult2() { var map = new KeyMap(); var ret = map.GetKeyMappingResult(InputUtil.CharToKeyInput('b'), KeyRemapMode.Normal); Assert.IsTrue(ret.IsNoMapping); }
public void GetKeyMappingResultFromMultiple1() { IKeyMap map = new KeyMap(); map.MapWithNoRemap("aa", "b", KeyRemapMode.Normal); var input = "aa".Select(InputUtil.CharToKeyInput); var res = map.GetKeyMappingResultFromMultiple(input, KeyRemapMode.Normal); Assert.IsTrue(res.IsSingleKey); Assert.AreEqual('b', res.AsSingleKey().Item.Char); }
public void MapWithRemap4() { var map = new KeyMap(); Assert.IsTrue(map.MapWithRemap("a", "bc", KeyRemapMode.Normal)); Assert.IsTrue(map.MapWithRemap("b", "d", KeyRemapMode.Normal)); var ret = map.GetKeyMapping(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal).ToList(); Assert.AreEqual(2, ret.Count); Assert.AreEqual('d', ret[0].Char); Assert.AreEqual('c', ret[1].Char); }
public void Unmap2() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "b", KeyRemapMode.Normal)); Assert.IsFalse(map.Unmap("a", KeyRemapMode.Insert)); Assert.IsTrue(map.GetKeyMappingResult(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal).IsSingleKey); }
public void MapWithNoRemap8() { var map = new KeyMap(); Assert.IsFalse(map.MapWithNoRemap("a", "", KeyRemapMode.Normal)); }
public void GetKeyMappingResultFromMultiple2() { IKeyMap map = new KeyMap(); map.MapWithNoRemap("aa", "b", KeyRemapMode.Normal); var input = "a".Select(InputUtil.CharToKeyInput); var res = map.GetKeyMappingResultFromMultiple(input, KeyRemapMode.Normal); Assert.IsTrue(res.IsMappingNeedsMoreInput); }
public void MapWithNoRemap5() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("&", "!", KeyRemapMode.Normal)); }
public void MapWithNoRemap4() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("aaoue", "b", KeyRemapMode.Normal)); }
public void MapWithNoRemap2() { var map = new KeyMap(); Assert.IsTrue(map.MapWithNoRemap("a", "1", KeyRemapMode.Normal)); var ret = map.GetKeyMapping(InputUtil.CharToKeyInput('a'), KeyRemapMode.Normal).Single(); Assert.AreEqual(InputUtil.CharToKeyInput('1'), ret); }