public static HitObject CreateParse(StreamReader stream, SongData song) { HitObject.Data data = new Data(); string line = data.Parse(stream); HitObject ret = null; if (line != null) { switch (data.Type) { default: case 1: ret = new BeatCircle(); break; case 2: case 6: ret = new Slider(); break; case 12: ret = new Spinner(); break; } if (ret != null) { ret.HitData = data; ret.Parse(stream, line); } } return ret; }
public void SetSong(osu.SongData songdata) { m_songData = songdata; m_hasBeenActed.Clear(); m_actors.Clear(); for (int i = 0; i < m_songData.HitObjects.Count; i++) { m_hasBeenActed.Add(false); m_actors.Add(osu.HitActor.GetActor(m_songData.HitObjects[i])); } m_started = false; }
static void Main(string[] args) { #region oldmain Console.Clear(); if (args.Length > 0) { const char GRAB_WINDOW_KEY = 'Q'; const char PLAY_SONG_KEY = 'W'; const char DTIME_KEY = 'E'; const char RESET_KEY = 'R'; const char QUIT_KEY = 'T'; Console.WriteLine("Loading: " + args[0]); Console.WriteLine("Press: " + GRAB_WINDOW_KEY + " to set the osu window"); Console.WriteLine("Press: " + PLAY_SONG_KEY + " to start the song after the first note"); Console.WriteLine("Press: " + DTIME_KEY + " to toggle double time"); Console.WriteLine("Press: " + RESET_KEY + " to reset"); Console.WriteLine("Press: " + QUIT_KEY + " to force close the bot"); bool allow_toggle = false; bool windowSet = false; Controller.Win_Controller controller = new Controller.Win_Controller(null); bool doubleTime = false; RESET_POINT: osu.SongData song = new osu.SongData(); song.Parse(File.OpenRead(args[0])); Player osuPlayer = new Player(controller); osuPlayer.Reset(); osuPlayer.SetSong(song); bool songPlayed = false; while (true) { osuPlayer.DoubleTime = doubleTime; WinAPI.POINT point = new WinAPI.POINT(); WinAPI.GetCursorPos(ref point); if (!windowSet && WinAPI.GetAsyncKeyState(GRAB_WINDOW_KEY) != 0) { windowSet = true; IntPtr handle = WinAPI.WindowFromPoint(point); controller.WindowHandle = new Win32.Window(handle); Console.WriteLine(controller.WindowHandle.Title()); Console.WriteLine("Window set"); } if (WinAPI.GetAsyncKeyState(QUIT_KEY) != 0) { return; } if (WinAPI.GetAsyncKeyState(RESET_KEY) != 0 && osuPlayer.IsPlaying) { Console.WriteLine("Reset"); goto RESET_POINT; } if (WinAPI.GetAsyncKeyState(DTIME_KEY) != 0) { if (allow_toggle) { allow_toggle = false; if (doubleTime) { doubleTime = false; Console.WriteLine("Double time is OFF..."); } else { doubleTime = true; Console.WriteLine("Double time is ON..."); } } } else { allow_toggle = true; } if (windowSet) { if (!songPlayed && WinAPI.GetAsyncKeyState(PLAY_SONG_KEY) != 0) { songPlayed = true; osuPlayer.StartFirstNote(); Console.WriteLine("Song started"); } osuPlayer.Update(); } System.Threading.Thread.Sleep(2); } } else { Console.WriteLine("Please drag an osu file into the EXE to begin..."); } #endregion }
public virtual void Init(SongData songData, AController controller, TimeSpan totalTime, TimeSpan elapsed, bool doubletime) { HasBeenInit = true; }