// Update is called once per frame void Update() { transform.position += targetObj.transform.position - targetPos; targetPos = targetObj.transform.position; // ゲームパッドの情報取得 var playerNo = GamePadIndex; var keyState = GamePad.GetState(playerNo, false); var playerKeyNo = (KeyBoard.Index)playerNo; var keyboardState = KeyBoard.GetState(KeyboardIndex, false); // ゲームパッドの入力情報取得 if (GamePad.GetButtonDown(GamePad.Button.Start, playerNo)) { SwitchInput = !SwitchInput; //Debug.Log("Switch Mode " + playerNo); } float LeftTrigger = keyState.LeftTrigger + 1.0f; float RightTrigger = keyState.RightTrigger + 1.0f; float inputViewHorizontal = (RightTrigger - LeftTrigger) * 0.5f; inputViewHorizontal += keyboardState.rightStickAxis.x; if (SwitchInput) { inputViewHorizontal = keyState.rightStickAxis.x; } this.transform.RotateAround(targetPos, Vector3.up, inputViewHorizontal * Time.deltaTime * 200f); }
public void Post([FromBody] KeyBoard keyBoard) { keyBoard.Id = Guid.NewGuid(); keyBoard.Brands = null; _gearContext.KeyBoards.Add(keyBoard); _gearContext.SaveChanges(); }
void view_OnKeyboard(object sender, EventArgs e) { Control ctrl = sender as Control; KeyBoard keyBoard = KeyBoard.CreateKeyBoard(ctrl.Location); keyBoard.ShowDialog(); }
public virtual void UseItem(GamePad.Index playerNo, KeyBoard.Index playerKeyNo) { if (GamePad.GetButton(GamePad.Button.B, playerNo) || KeyBoard.GetButton(KeyBoard.Button.B, playerKeyNo)) { // アイテムを所持しているか if (m_sItemData != null) { // 置く場所が適切かどうか if (IsUseItem() == true) { // アクション時間が経過しているか if (m_fActionTime <= 0f) { UseItem(); // アクション経過時間を再設定 m_fActionTime = m_fLimitActionTime; ItemHolderManager.Instance.UsingFromHolder(0, playerNo, playerKeyNo); } else { // アクション時間を経過させる m_fActionTime -= Time.deltaTime; float TimeParLimitTime = (m_fLimitActionTime - m_fActionTime) / m_fLimitActionTime; ItemHolderManager.Instance.UsingFromHolder(TimeParLimitTime, playerNo, playerKeyNo); } } } } else { // アクション経過時間を再設定 m_fActionTime = m_fLimitActionTime; ItemHolderManager.Instance.UsingFromHolder(0, playerNo, playerKeyNo); } }
private void Buy_Clicked(object sender, EventArgs e) { var buttonSender = (Button)sender; KeyBoard keyBoard = buttonSender.CommandParameter as KeyBoard; viewModels.keyBoardsChoose.Add(keyBoard); }
public async void Init(KeyBoard _keyboard) { viewModel.keyBoard = _keyboard; await viewModel.GetBrand(); viewModel.keyBoard.Brands = viewModel.Brandss.Single(x => x.Id == _keyboard.BrandId); }
public override void Draw() { int textIndex = 0; uint y = Y; for (uint row = 0; row < RowNum; row++) { uint x = X; for (uint col = 0; col < CollNum; col++) { var box = new Box() { X = x, Y = y, ConnectToTop = row != 0, ConnectToLeft = col != 0, TextColor = TextColor, BorderColor = BorderColor, Height = CellHeight, Width = CellWidth, Text = Texts[textIndex++] }; box.Draw(); x += CellWidth - 1; } if (WaitAfterRow) { KeyBoard.WaitForKeys(); } y += CellHeight - 1; } }
public Player(float x, float y, KeyBoard input) : base() { position.X = x; position.Y = y; this.input = input; fireRate = 0; Ammo = 100; }
public void BackToControls() { Sound.SetActive(false); Controls.SetActive(true); Video.SetActive(false); KeyBoard.SetActive(false); Gamepad.SetActive(false); }
void Initialize() { keyboard = GetComponentInParent <KeyBoard>(); animator = GetComponent <Animator>(); note = gameObject.name; noteIndex = keyboard.GetNoteIndex(note); initialized = true; }
public AddressBook(WindowHandler wh) { this.com = wh.COMMUNICATOR; this.kb = wh.KEYBOARD; m = wh.MOUSE; pm = wh.PMOUSE; this.wh = wh; }
public void SetPosition() { if (KeyBoard == null) { KeyBoard = KeyBoard.Instance; } KeyBoard.transform.localPosition = localPositon; }
public void GoToGamePad() { Sound.SetActive(false); Controls.SetActive(false); Video.SetActive(false); KeyBoard.SetActive(false); Gamepad.SetActive(true); }
private void Start() { HPmax = 1000; HP = HPmax; transform.localScale = new Vector2(face * 1.8f, 1.8f); shield = GetComponentInChildren <Shield>(); keyboard = GetComponentInParent <Transform>().gameObject.GetComponentInChildren <KeyBoard>(); }
private void Update() { if (_strTemp != null) { //Debug.Log(_strTemp); Thread t = null; switch (_strTemp) { case "P": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyP); }); break; case "Z": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyZ); }); //com = KeyBoard.vKeyZ; break; case "S": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyS); }); //com = KeyBoard.vKeyS; break; case "UP": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyUp); }); // com = KeyBoard.vKeyUp; break; case "Down": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyDown); }); //com = KeyBoard.vKeyDown; break; case "A": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyA); }); //com = KeyBoard.vKeyA; break; case "B": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyB); }); //com = KeyBoard.vKeyB; break; case "C": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyC); }); //com = KeyBoard.vKeyC; break; case "D": t = new Thread(() => { KeyBoard.keyPress(KeyBoard.vKeyD); }); //com = KeyBoard.vKeyD; break; } // Thread.Sleep(2 * 1000); if (t != null) { t.Start(); Text.text = "UDP发送过来的消息是=> " + _strTemp; } _strTemp = null; } }
public override void Execute() { //Debug.Log("State:SlowDown"); var playerNo = m_cOwner.GamePadIndex; var keyState = GamePad.GetState(playerNo, false); var playerKeyNo = (KeyBoard.Index)playerNo; var keyboardState = KeyBoard.GetState(m_cOwner.KeyboardIndex, false); // 速度設定 m_cOwner.m_fmoveSpeed = m_cOwner.m_fDefaultSpeed * m_cOwner.m_fSlowDownRate; // ゲームパッドの入力情報取得 m_cOwner.inputHorizontal = 0f; m_cOwner.inputVertical = 0f; m_cOwner.inputHorizontal = keyState.LeftStickAxis.x; m_cOwner.inputVertical = keyState.LeftStickAxis.y; m_cOwner.inputHorizontal += keyboardState.LeftStickAxis.x; m_cOwner.inputVertical += keyboardState.LeftStickAxis.y; // カメラの方向から、x-z平面の単位ベクトルを取得 Vector3 cameraForward = Vector3.Scale(m_cOwner.targetCamera.transform.forward, new Vector3(1, 0, 1)).normalized; // 移動量 Vector3 moveForward = cameraForward * m_cOwner.inputVertical + m_cOwner.targetCamera.transform.right * m_cOwner.inputHorizontal; if (moveForward != Vector3.zero) { m_cOwner.transform.rotation = Quaternion.LookRotation(moveForward); } // 移動判定 if (m_cOwner.IsMove(moveForward)) { } else { var correctionMove = m_cOwner.hMoveColliderScript.hit.normal; moveForward += correctionMove; if (m_cOwner.IsMove(moveForward)) { moveForward -= correctionMove; } } // 移動処理 m_cOwner.transform.position += moveForward * m_cOwner.m_fmoveSpeed * Time.deltaTime; // 経過時間処理 m_cOwner.m_fSlowTime -= Time.deltaTime; // タイマーが過ぎたらnormalに遷移する if (m_cOwner.m_fSlowTime <= 0f) { m_cOwner.ChangeState(0, EMouseState.Normal); } // Debug:ステート変更 }
public Ship(WindowHandler wh) { overviewhandler = wh.OVERVIEW; com = wh.COMMUNICATOR; menu = wh.MENU; pm = wh.PMOUSE; m = wh.MOUSE; kb = wh.KEYBOARD; }
protected override void OnKeyPress(KeyPressEventArgs e) { if (cw.AllowInput) { kb = wh.getKeyBoard(); kb.sendChar(e.KeyChar); } base.OnKeyPress(e); }
/// <summary> /// Build a menuhandler with the given mouse, precisemouse and communicator /// </summary> /// <param name="m">The bot's Mouse</param> /// <param name="pm">The bot's PreciseMouse</param> /// <param name="com">The bot's communicator</param> public MenuHandler(Mouse m, PreciseMouse pm, Communicator com, KeyBoard kb) { this.pm = pm; pm.Speed = 20; this.m = m; this.comm = com; this.kb = kb; random = new Random(); }
public LocalHandler(WindowHandler wh) { com = wh.COMMUNICATOR; m = wh.MOUSE; pm = wh.PMOUSE; ran = new Random(); mh = wh.MENU; kb = wh.KEYBOARD; }
/// <summary> /// Handles the agent interaction /// </summary> /// <param name="wh"></param> public AgentHandler(WindowHandler wh) { com = wh.COMMUNICATOR; m = wh.MOUSE; pm = wh.PMOUSE; ran = new Random(); mh = wh.MENU; kb = wh.KEYBOARD; sess = wh.SESSION; }
/// <summary> /// Builds the session object with the given windowhandler /// </summary> /// <param name="wh">The reference to the bot's windowhandler</param> public Session(WindowHandler wh) { this.com = wh.COMMUNICATOR; this.kb = wh.KEYBOARD; m = wh.MOUSE; pm = wh.PMOUSE; this.wh = wh; addBook = new AddressBook(wh); local = new LocalHandler(wh); }
void Awake() { if (Instance == null) { Instance = this; } rectTransform = GetComponent <RectTransform>(); rectTransform.SetParent(canvasRoot); Hide(); InitKeyboard(); }
public void Play() { if (keyboard == null) { keyboard = GetComponent <KeyBoard>(); } if (keyboard != null) { keyboard.PlayNoteByName(note); } }
private void button3_Click(object sender, EventArgs e) { Win32API.SetForegroundWindow(Program.CoreAnalysis.AppMainHandler); string Input = "SZ000020"; byte[] ch = (ASCIIEncoding.ASCII.GetBytes(Input)); for (int i = 0; i < ch.Length; i++) { KeyBoard.keyPress(ch[i]); } KeyBoard.keyPress(KeyBoard.vKeyExecute); }
public virtual string GetDescription() { var descriptionBuilder = new StringBuilder(); descriptionBuilder.AppendLine($"Model name: {ModelName}"); descriptionBuilder.AppendLine($"{Battery.ToString()}"); descriptionBuilder.AppendLine($"{Speaker.ToString()}"); descriptionBuilder.AppendLine($"Keyboard type : {KeyBoard.ToString()}"); descriptionBuilder.AppendLine($"Microphone : {Microphone.ToString()}"); descriptionBuilder.AppendLine($"Sim card : {SimCard.ToString()}"); descriptionBuilder.AppendLine($"{Screen.ToString()}"); return(descriptionBuilder.ToString()); }
void GameState.tick() { for (int i = 0; i < cloud.Length; i++) { cloud[i].tick(); } if (KeyBoard.ifAny()) { KeyBoard.consume(); GameStatus.changeState(GameStatus.GAME_STATES.GAME); } }
private void Test() { ///MouseFlag.MouseLeftClickEvent(350, 70, 0); ///System.Threading.Thread.Sleep(5*1000); ///MouseFlag.MouseLeftClickEvent(20, 30, 0);a ///System.Threading.Thread.Sleep(5 * 1000); Thread t = new Thread((() => { KeyBoard.keyPress(KeyBoard.vKeyF); })); Thread.Sleep(3 * 1000); t.Start(); }
/// <summary> /// 桥接 /// </summary> static void Bridge() { Console.WriteLine($"桥接{Environment.NewLine}-------------------------------------------"); IBrand Logitech = new Logitech(); //创建品牌 Product mouse = new Mouse(Logitech); //创建产品 Console.WriteLine(mouse.ShowMyself()); IBrand raze = new Raze(); //创建品牌 Product keyboard = new KeyBoard(raze); //创建产品 Console.WriteLine(keyboard.ShowMyself()); Console.ReadKey(); }
public void commandKeyBoard() { KeyBoard keyBoard = new KeyBoard(); keyBoard.setCommand("\\KEY BOARD"); Assert.AreEqual(true, keyBoard.verifyCommand()); Assert.AreEqual("\n KEY BOARD: " + "\nENTER - Confirm command." + "\nBACKSPACE - Delete character." + "\nDELETE - Delete line." + "\nEND - Clear Terminal." + "\nUP ARROW - Returns command confirmed." + "\nDOWN ARROW - Returns command confirmed." + "\nLEFT ARROW - Navigate the characters." + "\nRIGHT ARROW - Navigate the characters.", keyBoard.action()); }
public virtual void InitDevices(ActiveDevice device) { Device = device; if ((Device & ActiveDevice.Keyboard) != 0) { KeyBoard = new KeyBoard(); } if ((Device & ActiveDevice.Pad) != 0) { int padNum = GetPadNum(); if (padNum == 0) { Device -= ActiveDevice.Pad; } else { GamePads = Enumerable.Range(0, padNum) .Select<int, GamePadBase>(i => new GamePad(LeverDead, i, DirectInput)) .Concat(XInputPad.GetAvailableControllers() .Select(x=>new XInputPad(x))) .ToArray(); } //try //{ // gamePad = new GamePad(game, lever); //} //catch (Exception) //{ // Device -= ActiveDevice.Pad; //} } ApplyConfig(); }