void Awake() { if (GameObject.Find("SongSettings") != null) { songSettings = GameObject.Find("SongSettings").GetComponent <SongSettings> (); } }
private void Awake() { SongSettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); ScoreHandling = GameObject.FindGameObjectWithTag("ScoreHandling").GetComponent <ScoreHandling>(); highScoreLocal.AddHighScoreToSong(SongSettings.CurrentSong.Hash, PlayerPrefs.GetString("Username"), SongSettings.CurrentSong.SelectedDifficulty, ScoreHandling.ActualScore); if (PlayerPrefs.GetInt("UseGlobalHighscore") == 1) { HighScoreTitle.text = "GLOBAL HIGHSCORES"; highScore.AddHighScoreToSong(SongSettings.CurrentSong.Hash, PlayerPrefs.GetString("Username"), SongSettings.CurrentSong.Name, SongSettings.CurrentSong.SelectedDifficulty, ScoreHandling.ActualScore); var highscoreList = highScore.GetFirstTenHighScoreOfSong(SongSettings.CurrentSong.Hash, SongSettings.CurrentSong.SelectedDifficulty); string formatString = Highscore[0].text; for (int i = 0; i < highscoreList.Count; i++) { Highscore[i].text = string.Format(formatString, highscoreList[i].Username, highscoreList[i].Score); } } else { HighScoreTitle.text = "LOCAL HIGHSCORES"; var highscoreListLocal = highScoreLocal.GetFirstTenHighScoreOfSong(SongSettings.CurrentSong.Hash, SongSettings.CurrentSong.SelectedDifficulty); string formatStringLocal = Highscore[0].text; for (int i = 0; i < highscoreListLocal.Count; i++) { Highscore[i].text = string.Format(formatStringLocal, highscoreListLocal[i].Username, highscoreListLocal[i].Score); } } CurrentScore.text = ScoreHandling.ActualScore.ToString(); }
// Use this for initialization void Start() { songSettings = GameObject.Find("SongSettings").GetComponent <SongSettings>(); bpm.text = songSettings.bpm.ToString(); beatsPerMeasure.text = songSettings.beatsPerMeasure.ToString(); bpmTemp = songSettings.bpm; }
public SongService(IOptions <YoutubeDlSettings> youtubeDlSettings, IOptions <SongSettings> songSettings, ILogService logService) { _youtubeDlSettings = youtubeDlSettings.Value; _songSettings = songSettings.Value; _logService = logService; }
private void Awake() { songSettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); sceneHandling = GameObject.FindGameObjectWithTag("SceneHandling").GetComponent <SceneHandling>(); scoreHandling = GameObject.FindGameObjectWithTag("ScoreHandling").GetComponent <ScoreHandling>(); scoreSystem = GameObject.FindGameObjectWithTag("HighScore").GetComponent <HighScoreSystem>(); scoreBoard = GetComponentInChildren <HighScoreBoard>(true); }
void FindAndSetSongSettings() { if (GameObject.Find("SongSettings") != null) { songSettings = GameObject.Find("SongSettings").GetComponent <SongSettings> (); bpm = songSettings.bpm; beatsPerMeasure = songSettings.beatsPerMeasure; } }
public PlayScreen(MainGame.Globals globals, SongLoader previous, Song s, SongSettings songSettings) { this.globals = globals; this.previous = previous; ts = new SimpleTimeSource(s.PPQ, s.InitialTempo); //var stf = new StaffRenderer(theme, , s); sR = new StaffRenderer(globals.Theme, new MV { ts = ts, interval = s.PPQ * 4, }, s); g = new Core.Game(s, songSettings.MidiOut, ts, this); inp = new Mono.KeyboardMIDIInput(g); ctr = new ComboCounter(globals.Theme.TestFont, ts); g.Play(); }
public List <DataPoint> determineKeyPoints(SongSettings song) { int chunkSize = (int)(song.SampleRate / FrequencyResolution); if (!((chunkSize & (chunkSize - 1)) == 0)) { chunkSize++; } double timeForOneHash = Math.Round((double)chunkSize / song.SampleRate, 3); Complex[][] results = transformToFFT(song.SongRepresentation, chunkSize); List <DataPoint> hashes = new List <DataPoint>(); highscores = new double[results.Length][]; for (int i = 0; i < results.Length; i++) { highscores[i] = new double[RANGE.Length]; for (int j = 0; j < RANGE.Length; j++) { highscores[i][j] = 0; } } points = new long[results.Length][]; for (int i = 0; i < results.Length; i++) { points[i] = new long[RANGE.Length]; for (int j = 0; j < RANGE.Length; j++) { points[i][j] = 0; } } for (int t = 0; t < results.Length; t++) { for (int freq = LOWER_LIMIT; freq < UPPER_LIMIT - 1; freq++) { // Get the magnitude: double mag = Math.Log(results[t][freq].abs() + 1); // Find out which range we are in: int index = getIndex(freq); // Save the highest magnitude and corresponding frequency: if (mag > highscores[t][index] && mag > 3) { highscores[t][index] = mag; points[t][index] = freq; } } long[] hashPoints = CreateHashPoint(points[t]).ToArray(); foreach (long hash in hashPoints) { hashes.Add(new DataPoint(Math.Round(timeForOneHash * (t + 1), 3), hash)); } } return(hashes); }
void Start() { Songsettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); CameraHead = GameObject.FindGameObjectWithTag("MainCamera"); SceneHandling = GameObject.FindGameObjectWithTag("SceneHandling").GetComponent <SceneHandling>(); string path = Songsettings.CurrentSong.Path; if (Directory.Exists(path)) { if (Directory.GetFiles(path, "info.dat").Length > 0) { JSONObject infoFile = JSONObject.Parse(File.ReadAllText(Path.Combine(path, "info.dat"))); var difficultyBeatmapSets = infoFile.GetArray("_difficultyBeatmapSets"); foreach (var beatmapSets in difficultyBeatmapSets) { foreach (var difficultyBeatmaps in beatmapSets.Obj.GetArray("_difficultyBeatmaps")) { if (difficultyBeatmaps.Obj.GetString("_difficulty") == Songsettings.CurrentSong.SelectedDifficulty) { _noteSpeed = (float)difficultyBeatmaps.Obj.GetNumber("_noteJumpMovementSpeed"); audioFilePath = Path.Combine(path, infoFile.GetString("_songFilename")); jsonString = File.ReadAllText(Path.Combine(path, difficultyBeatmaps.Obj.GetString("_beatmapFilename"))); break; } } } } } audioSource = GetComponent <AudioSource>(); StartCoroutine("LoadAudio"); JSONObject json = JSONObject.Parse(jsonString); var bpm = Convert.ToDouble(Songsettings.CurrentSong.BPM); //Notes var notes = json.GetArray("_notes"); foreach (var note in notes) { var n = new Note { Hand = (NoteType)note.Obj.GetNumber("_type"), CutDirection = (CutDirection)note.Obj.GetNumber("_cutDirection"), LineIndex = (int)note.Obj.GetNumber("_lineIndex"), LineLayer = (int)note.Obj.GetNumber("_lineLayer"), TimeInSeconds = (note.Obj.GetNumber("_time") / bpm) * 60, Time = (note.Obj.GetNumber("_time")) }; NotesToSpawn.Add(n); } var obstacles = json.GetArray("_obstacles"); foreach (var obstacle in obstacles) { var o = new Obstacle { Type = (ObstacleType)obstacle.Obj.GetNumber("_type"), Duration = obstacle.Obj.GetNumber("_duration"), LineIndex = (int)obstacle.Obj.GetNumber("_lineIndex"), TimeInSeconds = (obstacle.Obj.GetNumber("_time") / bpm) * 60, Time = (obstacle.Obj.GetNumber("_time")), Width = (obstacle.Obj.GetNumber("_width")) }; ObstaclesToSpawn.Add(o); } Comparison <Note> NoteCompare = (x, y) => x.Time.CompareTo(y.Time); NotesToSpawn.Sort(NoteCompare); Comparison <Obstacle> ObsticaleCompare = (x, y) => x.Time.CompareTo(y.Time); ObstaclesToSpawn.Sort(ObsticaleCompare); BeatsPerMinute = bpm; UpdateBeats(); }
void Start() { Songsettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); SceneHandling = GameObject.FindGameObjectWithTag("SceneHandling").GetComponent <SceneHandling>(); string path = Songsettings.CurrentSong.Path; if (Directory.Exists(path)) { if (Directory.GetFiles(path, "info.dat").Length > 0) { JSONObject infoFile = JSONObject.Parse(File.ReadAllText(Path.Combine(path, "info.dat"))); var difficultyBeatmapSets = infoFile.GetArray("_difficultyBeatmapSets"); foreach (var beatmapSets in difficultyBeatmapSets) { foreach (var difficultyBeatmaps in beatmapSets.Obj.GetArray("_difficultyBeatmaps")) { if (difficultyBeatmaps.Obj.GetString("_difficulty") == Songsettings.CurrentSong.SelectedDifficulty) { audioFilePath = Path.Combine(path, infoFile.GetString("_songFilename")); jsonString = File.ReadAllText(Path.Combine(path, difficultyBeatmaps.Obj.GetString("_beatmapFilename"))); break; } } } } } audioSource = GetComponent <AudioSource>(); StartCoroutine("LoadAudio"); JSONObject json = JSONObject.Parse(jsonString); var bpm = Convert.ToDouble(Songsettings.CurrentSong.BPM); //Notes var notes = json.GetArray("_notes"); foreach (var note in notes) { var n = new Note { Hand = (NoteType)note.Obj.GetNumber("_type"), CutDirection = (CutDirection)note.Obj.GetNumber("_cutDirection"), LineIndex = (int)note.Obj.GetNumber("_lineIndex"), LineLayer = (int)note.Obj.GetNumber("_lineLayer"), TimeInSeconds = (note.Obj.GetNumber("_time") / bpm) * 60, Time = (note.Obj.GetNumber("_time")) }; NotesToSpawn.Add(n); } //Obstacles //var obstacles = json.GetArray("_obstacles"); //foreach (var obstacle in obstacles) //{ // var o = new Obstacle // { // Type = (ObstacleType)obstacle.Obj.GetNumber("_type"), // Duration = obstacle.Obj.GetNumber("_duration"), // LineIndex = (int)obstacle.Obj.GetNumber("_lineIndex"), // TimeInSeconds = (obstacle.Obj.GetNumber("_time") / bpm) * 60, // Time = (obstacle.Obj.GetNumber("_time")), // Width = (obstacle.Obj.GetNumber("_width")) // }; // ObstaclesToSpawn.Add(o); //} BeatsPerMinute = bpm; BeatsPreloadTimeTotal = (beatAnticipationTime + beatWarmupTime); }
private void Awake() { Songsettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); SceneHandling = GameObject.FindGameObjectWithTag("SceneHandling").GetComponent <SceneHandling>(); ScoreHandling = GameObject.FindGameObjectWithTag("ScoreHandling").GetComponent <ScoreHandling>(); }
private void Awake() { Songsettings = GameObject.FindGameObjectWithTag("SongSettings").GetComponent <SongSettings>(); }