private void SetSelectedScreen(DispatcherTimer _hive, InventoryScreen InvScr, String tabIndex) { _hive.IsEnabled = false; InvScr.tabControl1.SelectedTab = InvScr.tabControl1.TabPages[tabIndex]; InvScr.tabControl1.SelectedTab.Focus(); if (tabIndex.Equals("tabPage1")) InvScr.Inventory.Focus(); else InvScr.EquippedInventory.Focus(); InvScr.ShowDialog(); }
private void OnButtonKeyDown(object sender, System.Windows.Input.KeyEventArgs e) { InventoryScreen InvScr; switch (e.Key) { case Key.W: Player.GetInstance().Interact(EnumDirection.Up); break; case Key.A: Player.GetInstance().Interact(EnumDirection.Left); break; case Key.S: Player.GetInstance().Interact(EnumDirection.Down); break; case Key.D: Player.GetInstance().Interact(EnumDirection.Right); break; case Key.K: HiveMind.GetInstance().ClearHive(); break; case Key.I: PauseHive(); InvScr = new InventoryScreen(_hive, "tabPage1"); InvScr.ShowDialog(); //SetSelectedScreen(_hive, InvScr, "tabPage1"); break; case Key.C: _hive.IsEnabled = false; InvScr = new InventoryScreen(_hive, "tabPage2"); InvScr.ShowDialog(); //SetSelectedScreen(_hive, InvScr, "tabPage2"); break; } Maze.GetInstance().Refresh(Player.GetInstance()); }