private void UpdateWiimoteChanged(WiimoteChangedEventArgs args) { var ws = args.WiimoteState; CheckAction(ws); previousBtns = ws.ButtonState; }
private void UpdateWiimoteChanged(WiimoteChangedEventArgs args) { WiimoteState ws = args.WiimoteState; pressingHome = ws.ButtonState.Home; if (!easterEgg) { CheckAction(ws); } else { // 裏モード // ボタンログ var btn = BtnToString(ws.ButtonState); if (btn != null) { if (btn == "Home") { var com = ""; foreach (var b in Log) { com += b; } Debug.WriteLine(com); if (com.Contains("UpUpDownDownLeftRightLeftRightBA") && !dialogShowing) { dialogShowing = true; MessageBox.Show("KONMAI", "", MessageBoxButtons.OK, MessageBoxIcon.Information); dialogShowing = false; } Log.Clear(); } else if (Log.Count > 12) { Log.Clear(); } else { Log.Enqueue(btn); } } // 1ボタン + 2ボタンで終了 if (ws.ButtonState.One && ws.ButtonState.Two) { this.Close(); Environment.Exit(0); } } previousBtns = ws.ButtonState; // バッテリー残量 statPbBattery.Value = (ws.Battery > 0xc8 ? 0xc8 : (int)ws.Battery); statLblBattery.Text = statPbBattery.Value.ToString() + "%"; }
private string BtnToString(WiimoteLib.ButtonState btn) { if (!btn.A && previousBtns.A) { return("A"); } if (!btn.B && previousBtns.B) { return("B"); } if (!btn.Down && previousBtns.Down) { return("Down"); } if (!btn.Home && previousBtns.Home) { return("Home"); } if (!btn.Left && previousBtns.Left) { return("Left"); } if (!btn.Minus && previousBtns.Minus) { return("Minus"); } if (!btn.One && previousBtns.One) { return("One"); } if (!btn.Plus && previousBtns.Plus) { return("Plus"); } if (!btn.Right && previousBtns.Right) { return("Right"); } if (!btn.Two && previousBtns.Two) { return("Two"); } if (!btn.Up && previousBtns.Up) { return("Up"); } return(null); }
void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args) { lock (lockObj) { WiimoteLib.ButtonState bs = args.WiimoteState.ButtonState; //extract the wiimote state IRSensor ws = args.WiimoteState.IRState.IRSensors[0]; if (ws.Found) //move cursor { PointF position = new PointF(ws.RawPosition.X, ws.RawPosition.Y); PointF warpedPos = position; warper.warp(position, ref warpedPos); SmoothingBuffer[SmoothingBufferIndex % SMOOTHING_BUFFER_SIZE] = warpedPos; SmoothingBufferIndex++; if (!lastWiiState.Found) //mouse down { SmoothingBufferIndex = 0; //resets the count if (CursorEnabled) { InputCont.MoveMouse(warpedPos); //move the mouse to x,y InputCont.LeftMouseDown(); //left click down } else if (CalibrationState.State > 0) { ContinueCalibration(position); } } else if (CursorEnabled) //dragging { //if (((x != lastWiiState.RawPosition.X) || (y != lastWiiState.RawPosition.Y)) && cursorControl) if (SmoothingEnabled) { PointF s = GetSmoothedCursor(SmoothingAmount); InputCont.MoveMouse(s); //move the mouse to x,y } else { InputCont.MoveMouse(warpedPos); //move the mouse to x,y } } } else if (lastWiiState.Found && CursorEnabled) { //mouse up InputCont.LeftMouseUp(); InputCont.MoveMouse(new PointF(0, 0)); //move the mouse to x,y } if (!lastButtonState.A && bs.A) { Calibrate(); } lastButtonState = bs; lastWiiState = ws; if (StatusInfoChanged != null) { StatusInfoChanged(this, new EventArgs <WiimoteState>(args.WiimoteState)); } } }
private void UpdateWiimoteChanged(WiimoteChangedEventArgs args) { WiimoteState ws = args.WiimoteState; if (previousBtns.A && !ws.ButtonState.A) { wmActivated = !wmActivated; } if (previousBtns.Minus && !ws.ButtonState.Minus) { // 移動速度減少 speed -= 0.1f; if (speed < 0.1f) { speed = 0.1f; } } if (previousBtns.Plus && !ws.ButtonState.Plus) { // 移動速度増加 speed += 0.1f; } if (wmActivated) { // 移動有効なら、リモコンの加速度で視点変更 V_point.x += ws.AccelState.Values.X / 10 * speed; V_point.y -= ws.AccelState.Values.Y / 10 * speed; } // 1ボタンと2ボタンで終了 if (ws.ButtonState.One && ws.ButtonState.Two) { this.Close(); } // カメラ・視点・スピード のリセット if (previousBtns.Home && ws.ButtonState.Home) { setVec(ref Model, 0.0f); setVec(ref Camera, 0.0f, 20.0f, -30.0f); setVec(ref V_point, 0.0f, 10.0f, 0.0f); speed = 4.0f; } switch (ws.ExtensionType) { case ExtensionType.Nunchuk: var joy = ws.NunchukState.Joystick; // スティックでカメラの位置の変更 const float d_cam = 0.1f; if (joy.X > 0.3) { Camera.x += d_cam; } if (joy.X < -0.3) { Camera.x -= d_cam; } if (joy.Y > 0.3) { Camera.z += d_cam; } if (joy.Y < -0.3) { Camera.z -= d_cam; } if (ws.NunchukState.C) { Camera.y += d_cam; } if (ws.NunchukState.Z) { Camera.y -= d_cam; } break; } previousBtns = ws.ButtonState; }
internal override void WiimoteChanged(WiimoteState ws) { buttonState = ws.ButtonState; UpdateView(); }
// Token: 0x0600303B RID: 12347 // RVA: 0x001378C0 File Offset: 0x00135AC0 internal static void smethod_3(List<Keys> list_0) { if (!Class808.GetState()) { return; } Class808.buttonState_1 = Class808.buttonState_0; Class808.buttonState_0 = Class808.wiimoteState_0.ButtonState; Class808.taikoDrumState_1 = Class808.taikoDrumState_0; Class808.taikoDrumState_0 = Class808.wiimoteState_0.TaikoDrumState; if (Class331.bool_0) { Class808.wiimote_0.SetLEDs(Class331.int_0 % 4 == 0, Class331.int_0 % 4 == 1, Class331.int_0 % 4 == 2, Class331.int_0 % 4 == 3); } bool flag = (!Class808.taikoDrumState_1.InnerLeft && Class808.taikoDrumState_0.InnerLeft) || (!Class808.buttonState_1.Down && Class808.buttonState_0.Down); bool flag2 = (!Class808.taikoDrumState_1.InnerRight && Class808.taikoDrumState_0.InnerRight) || (!Class808.buttonState_1.One && Class808.buttonState_0.One); bool flag3 = (!Class808.taikoDrumState_1.OuterLeft && Class808.taikoDrumState_0.OuterLeft) || (!Class808.buttonState_1.Up && Class808.buttonState_0.Up); bool flag4 = (!Class808.taikoDrumState_1.OuterRight && Class808.taikoDrumState_0.OuterRight) || (!Class808.buttonState_1.Two && Class808.buttonState_0.Two); if (!Class802.smethod_0()) { Class802.bool_4 |= flag; Class802.bool_6 |= flag2; Class802.bool_19 |= flag3; Class802.bool_21 |= flag4; Class802.bool_3 |= (Class808.taikoDrumState_0.InnerLeft || Class808.buttonState_0.Down); Class802.bool_5 |= (Class808.taikoDrumState_0.InnerRight || Class808.buttonState_0.One); Class802.bool_18 |= (Class808.taikoDrumState_0.OuterLeft || Class808.buttonState_0.Up); Class802.bool_20 |= (Class808.taikoDrumState_0.OuterRight || Class808.buttonState_0.Two); } OsuModes osuModes_ = Class115.osuModes_1; switch (osuModes_) { case OsuModes.Menu: if ((flag || flag2) && Class115.enum113_0 == Enum113.const_2) { Class62.Mode = PlayModes.Taiko; Class115.smethod_70(OsuModes.SelectPlay, false); Class331.smethod_60("menuhit", 1f, Enum112.flag_5); } if (Class808.buttonState_0.A && Class115.enum113_0 == Enum113.const_2) { Class62.Mode = PlayModes.Taiko; Class115.smethod_70(OsuModes.SelectPlay, false); Class331.smethod_60("menuhit", 1f, Enum112.flag_5); } if (Class808.buttonState_0.B) { list_0.Add(27); } break; case OsuModes.Edit: break; case OsuModes.Play: if (Class808.wiimoteState_0.BalanceBoardState.CenterOfGravity.X < 0f || Class808.buttonState_0.Left) { list_0.Add(Class795.smethod_3(Bindings.FruitsLeft)); } if (Class808.wiimoteState_0.BalanceBoardState.CenterOfGravity.X > 0f || Class808.buttonState_0.Right) { list_0.Add(Class795.smethod_3(Bindings.FruitsRight)); } if (Class808.buttonState_0.A || Class808.buttonState_0.B) { list_0.Add(Class795.smethod_3(Bindings.FruitsDash)); } break; default: if (osuModes_ == OsuModes.SelectPlay) { if (!Class808.taikoDrumState_0.InnerLeft && !Class808.taikoDrumState_0.InnerRight && !Class808.buttonState_0.Two) { if (!Class808.taikoDrumState_1.OuterLeft && !Class808.buttonState_0.Up && !Class808.buttonState_0.Right) { if (Class808.taikoDrumState_1.OuterRight || Class808.buttonState_0.Down || Class808.buttonState_0.Left) { list_0.Add(40); } } else { list_0.Add(38); } } else { list_0.Add(13); } if (Class808.buttonState_0.B || Class808.buttonState_0.One) { list_0.Add(27); } } break; } if (Class808.buttonState_0.Plus || (Class62.bool_11 && Class808.buttonState_0.Up) || Class808.buttonState_0.Right) { list_0.Add(38); } if (Class808.buttonState_0.Minus || (Class62.bool_11 && Class808.buttonState_0.Down) || Class808.buttonState_0.Left) { list_0.Add(40); } if (Class808.buttonState_0.Home) { list_0.Add(27); } if (Class808.buttonState_0.A) { if (Class62.bool_6 && !Class62.bool_11) { list_0.Add(27); return; } if (Class115.osuModes_1 == OsuModes.Play && !Class62.bool_11) { list_0.Add(Class795.smethod_3(Bindings.Skip)); return; } list_0.Add(13); } }
internal static void Update(List <Keys> keys) { if (!GetState()) { return; } buttonStateLast = buttonState; buttonState = State.ButtonState; taikoStateLast = taikoState; taikoState = State.TaikoDrumState; if (AudioEngine.SyncNewBeat) { Wiimote.SetLEDs(AudioEngine.SyncBeat % 4 == 0, AudioEngine.SyncBeat % 4 == 1, AudioEngine.SyncBeat % 4 == 2, AudioEngine.SyncBeat % 4 == 3); } bool il = (!taikoStateLast.InnerLeft && taikoState.InnerLeft) || (!buttonStateLast.Down && buttonState.Down); bool ir = (!taikoStateLast.InnerRight && taikoState.InnerRight) || (!buttonStateLast.One && buttonState.One); bool ol = (!taikoStateLast.OuterLeft && taikoState.OuterLeft) || (!buttonStateLast.Up && buttonState.Up); bool or = (!taikoStateLast.OuterRight && taikoState.OuterRight) || (!buttonStateLast.Two && buttonState.Two); if (!InputManager.ReplayMode) { InputManager.leftButton1i |= il; InputManager.leftButton2i |= ir; InputManager.rightButton1i |= ol; InputManager.rightButton2i |= or; InputManager.leftButton1 |= taikoState.InnerLeft || buttonState.Down; InputManager.leftButton2 |= taikoState.InnerRight || buttonState.One; InputManager.rightButton1 |= taikoState.OuterLeft || buttonState.Up; InputManager.rightButton2 |= taikoState.OuterRight || buttonState.Two; } switch (GameBase.Mode) { case OsuModes.Menu: if (il || ir) { if (GameBase.FadeState == FadeStates.Idle) { Player.Mode = PlayModes.Taiko; GameBase.ChangeMode(OsuModes.SelectPlay); AudioEngine.PlaySamplePositional(@"menuhit"); } } if (buttonState.A) { if (GameBase.FadeState == FadeStates.Idle) { Player.Mode = PlayModes.Taiko; GameBase.ChangeMode(OsuModes.SelectPlay); AudioEngine.PlaySamplePositional(@"menuhit"); } } if (buttonState.B) { keys.Add(Keys.Escape); } break; case OsuModes.SelectPlay: if (taikoState.InnerLeft || taikoState.InnerRight || buttonState.Two) { keys.Add(Keys.Enter); } else if (taikoStateLast.OuterLeft || buttonState.Up || buttonState.Right) { keys.Add(Keys.Up); } else if (taikoStateLast.OuterRight || buttonState.Down || buttonState.Left) { keys.Add(Keys.Down); } if (buttonState.B || buttonState.One) { keys.Add(Keys.Escape); } break; case OsuModes.Play: if (State.BalanceBoardState.CenterOfGravity.X < 0 || buttonState.Left) { keys.Add(BindingManager.For(Bindings.FruitsLeft)); } if (State.BalanceBoardState.CenterOfGravity.X > 0 || buttonState.Right) { keys.Add(BindingManager.For(Bindings.FruitsRight)); } if (buttonState.A || buttonState.B) { keys.Add(BindingManager.For(Bindings.FruitsDash)); } break; } if (buttonState.Plus || (Player.Paused && buttonState.Up || buttonState.Right)) { keys.Add(Keys.Up); } if (buttonState.Minus || (Player.Paused && buttonState.Down || buttonState.Left)) { keys.Add(Keys.Down); } if (buttonState.Home) { keys.Add(Keys.Escape); } if (buttonState.A) { if (Player.Failed && !Player.Paused) { keys.Add(Keys.Escape); } else if (GameBase.Mode == OsuModes.Play && !Player.Paused) { keys.Add(BindingManager.For(Bindings.Skip)); } else { keys.Add(Keys.Enter); } } }
void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args) { lock (lockObj) { WiimoteLib.ButtonState bs = args.WiimoteState.ButtonState; //extract the wiimote state IRSensor ws = args.WiimoteState.IRState.IRSensors[0]; if (ws.Found) //move cursor { PointF position = new PointF(ws.RawPosition.X, ws.RawPosition.Y); PointF warpedPos = position; warper.warp(position, ref warpedPos); SmoothingBuffer[SmoothingBufferIndex % SMOOTHING_BUFFER_SIZE] = warpedPos; SmoothingBufferIndex++; if (!lastWiiState.Found) //mouse down { SmoothingBufferIndex = 0; //resets the count if (CursorEnabled) { InputCont.MoveMouse(warpedPos); //move the mouse to x,y InputCont.LeftMouseDown(); //left click down } else if (CalibrationState.State > 0) ContinueCalibration(position); } else if (CursorEnabled) //dragging { //if (((x != lastWiiState.RawPosition.X) || (y != lastWiiState.RawPosition.Y)) && cursorControl) if (SmoothingEnabled) { PointF s = GetSmoothedCursor(SmoothingAmount); InputCont.MoveMouse(s); //move the mouse to x,y } else InputCont.MoveMouse(warpedPos); //move the mouse to x,y } } else if (lastWiiState.Found && CursorEnabled) {//mouse up InputCont.LeftMouseUp(); InputCont.MoveMouse(new PointF(0,0)); //move the mouse to x,y } if (!lastButtonState.A && bs.A) Calibrate(); lastButtonState = bs; lastWiiState = ws; if (StatusInfoChanged != null) StatusInfoChanged(this, new EventArgs<WiimoteState>(args.WiimoteState)); } }