private void AStartg__doKeyboardInput11_1(ref Ac__DisplayClass11_0 P_0) { if (playKeyboard) { if (P_0.frame.StandardKeys == StandardKeys.K1 || P_0.frame.StandardKeys == StandardKeys.BOTH) { inputSimulator.Keyboard.KeyDown(P_0.key1); } else { inputSimulator.Keyboard.KeyUp(P_0.key1); } if (P_0.frame.StandardKeys == StandardKeys.K2 || P_0.frame.StandardKeys == StandardKeys.BOTH) { inputSimulator.Keyboard.KeyDown(P_0.key2); } else { inputSimulator.Keyboard.KeyUp(P_0.key2); } if (P_0.frame.StandardKeys == StandardKeys.Smoke) { inputSimulator.Keyboard.KeyDown(P_0.smoke); } else { inputSimulator.Keyboard.KeyUp(P_0.smoke); } } }
private void AStartg__doMouseInput11_0(ref Ac__DisplayClass11_0 P_0) { if (playMouse) { Vector2 mousePosition = osu.Player.Ruleset.MousePosition; Vector2 vector = osu.WindowManager.PlayfieldToScreen(new Vector2(P_0.frame.X, P_0.frame.Y)); inputSimulator.Mouse.MoveMouseTo((double)((vector.X + (float)P_0.osuWindowRect.Left + (float)P_0.windowBorders) * 65536f / (float)P_0.monitorWidth), (double)((vector.Y + (float)P_0.osuWindowRect.Top + (float)P_0.titleBarHeight) * 65536f / (float)P_0.monitorHeight)); } }
private void AStartg__waitForMapStart11_2(ref Ac__DisplayClass11_0 P_0) { while (P_0.currentTime >= P_0.totalElapsedFrameTime || P_0.frame.X < 0f || P_0.frame.X > 512f || P_0.frame.Y < 0f || P_0.frame.Y > 384f || P_0.frame.TimeDiff < 0) { P_0.frameIndex++; if (P_0.frameIndex < replayFrames.Count) { P_0.frame = replayFrames[P_0.frameIndex]; } P_0.totalElapsedFrameTime += P_0.frame.TimeDiff; } AStartg__doMouseInput11_0(ref P_0); }
public void Start(OsuBeatmap beatmap) { Ac__DisplayClass11_0 ac__DisplayClass11_ = default(Ac__DisplayClass11_0); ac__DisplayClass11_.A4__this = this; this.beatmap = beatmap; enabled = true; if (replayFrames == null) { return; } ac__DisplayClass11_.key1 = (VirtualKeyCode)osu.BindingManager.GetKeyCode(Bindings.OsuLeft); ac__DisplayClass11_.key2 = (VirtualKeyCode)osu.BindingManager.GetKeyCode(Bindings.OsuRight); ac__DisplayClass11_.smoke = (VirtualKeyCode)osu.BindingManager.GetKeyCode(Bindings.OsuSmoke); ac__DisplayClass11_.osuWindowRect = osu.OsuProcess.getOsuWindowRect(); Rect osuClientRect = osu.OsuProcess.getOsuClientRect(); ac__DisplayClass11_.monitorWidth = Screen.PrimaryScreen.Bounds.Width; ac__DisplayClass11_.monitorHeight = Screen.PrimaryScreen.Bounds.Height; ac__DisplayClass11_.windowBorders = (ac__DisplayClass11_.osuWindowRect.Right - ac__DisplayClass11_.osuWindowRect.Left - osuClientRect.Right) / 2; ac__DisplayClass11_.titleBarHeight = ac__DisplayClass11_.osuWindowRect.Bottom - ac__DisplayClass11_.osuWindowRect.Top - osuClientRect.Bottom - ac__DisplayClass11_.windowBorders; ac__DisplayClass11_.frameIndex = 0; ac__DisplayClass11_.frame = replayFrames[ac__DisplayClass11_.frameIndex]; ac__DisplayClass11_.totalElapsedFrameTime = 0; ac__DisplayClass11_.currentTime = osu.CurrentTime; AStartg__waitForMapStart11_2(ref ac__DisplayClass11_); while (osu.CanPlay && enabled && ac__DisplayClass11_.frameIndex < replayFrames.Count + 1) { ac__DisplayClass11_.currentTime = osu.CurrentTime; if (osu.IsPaused) { Thread.Sleep(5); } else if (ac__DisplayClass11_.currentTime >= ac__DisplayClass11_.totalElapsedFrameTime) { AStartg__doMouseInput11_0(ref ac__DisplayClass11_); AStartg__doKeyboardInput11_1(ref ac__DisplayClass11_); ac__DisplayClass11_.frameIndex++; if (ac__DisplayClass11_.frameIndex < replayFrames.Count) { ac__DisplayClass11_.frame = replayFrames[ac__DisplayClass11_.frameIndex]; } ac__DisplayClass11_.totalElapsedFrameTime += ac__DisplayClass11_.frame.TimeDiff; } } Console.WriteLine("Replay Ended."); while (osu.CanPlay && enabled) { Thread.Sleep(5); } }