Exemplo n.º 1
0
 private void BSEvents_songUnpaused()
 {
     TimeElapsedLogger.Start();
     TimeElapsed.Start();
     LiveData.LevelPaused = false;
     LiveData.Send();
 }
Exemplo n.º 2
0
 private void BSEvents_songPaused()
 {
     TimeElapsedLogger.Stop();
     TimeElapsed.Stop();
     TimeElapsedLogger.Interval = TimeElapsed.ElapsedMilliseconds % 1000;
     LiveData.LevelPaused       = true;
     LiveData.Send();
 }
Exemplo n.º 3
0
 private void SceneExit()
 {
     TimeElapsedLogger.Stop();
     TimeElapsed.Stop();
     LiveData.InLevel = false;
     LiveData.Send();
     scoreController = null;
     noteCutInfo     = null;
 }
Exemplo n.º 4
0
 private void BSEvents_noteWasMissed(NoteData noteData, int arg2)
 {
     if (noteData.colorType != ColorType.None)
     {
         LiveData.Combo     = 0;
         LiveData.FullCombo = false;
         LiveData.Misses++;
         LiveData.Send();
     }
 }
Exemplo n.º 5
0
 private void TimeElapsed_Elapsed(object se, ElapsedEventArgs ev)
 {
     LiveData.TimeElapsed = (int)(startSongTime.Add(TimeElapsed.Elapsed).TotalMilliseconds / 1000);
     if (TimeElapsedLogger.Interval != 1000)
     {
         TimeElapsedLogger.Interval = 1000;
     }
     if (Math.Truncate(DateTime.Now.Subtract(LiveData.LastSend).TotalMilliseconds) > 900)
     {
         LiveData.Send();
     }
 }
Exemplo n.º 6
0
        private void BSEvents_noteWasCut(NoteData arg1, NoteCutInfo nci, int arg3)
        {
            noteCutInfo = nci;

            if (noteCutInfo.allIsOK)
            {
                LiveData.Combo++;
                if (noteCutInfo == null)
                {
                    noteCutInfo.swingRatingCounter.didFinishEvent += SwingRatingCounter_didFinishEvent;
                }
            }
            else
            {
                LiveData.Combo     = 0;
                LiveData.FullCombo = false;
                LiveData.Misses++;
            }
            LiveData.Send();
        }
Exemplo n.º 7
0
 private void BSEvents_energyDidChange(float health)
 {
     LiveData.PlayerHealth = health * 100;
     LiveData.Send();
 }
Exemplo n.º 8
0
 private void ScoreController_scoreDidChangeEvent(int arg1, int arg2)
 {
     LiveData.Score    = arg1;
     LiveData.Accuracy = arg1 / scoreController.immediateMaxPossibleRawScore * 100f;
     LiveData.Send();
 }
Exemplo n.º 9
0
        private void BSEvents_gameSceneLoaded()
        {
            ResetData();

            LiveData.InLevel = true;
            scoreController  = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault();
            scoreController.scoreDidChangeEvent += ScoreController_scoreDidChangeEvent;

            AudioTimeSyncController audioController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
            PlayerData playerData = Resources.FindObjectsOfTypeAll <PlayerDataModel>().FirstOrDefault().playerData;
            GameplayCoreSceneSetupData currentMap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData;

            IBeatmapLevel levelData = currentMap.difficultyBeatmap.level;

            StaticData.SongName    = levelData.songName;
            StaticData.SongSubName = levelData.songSubName;
            StaticData.SongAuthor  = levelData.songAuthorName;
            StaticData.Mapper      = levelData.levelAuthorName;
            StaticData.BPM         = Convert.ToInt32(Math.Round(levelData.beatsPerMinute));
            StaticData.Length      = Convert.ToInt32(Math.Round(audioController.songLength));
            PlayerLevelStatsData playerLevelStats = playerData.GetPlayerLevelStatsData(levelData.levelID, currentMap.difficultyBeatmap.difficulty,
                                                                                       currentMap.difficultyBeatmap.parentDifficultyBeatmapSet.beatmapCharacteristic);

            StaticData.PreviousRecord = playerLevelStats.highScore;

            if (previousMap == null || previousBeatmap == null || (levelData.levelID != previousMap.difficultyBeatmap.level.levelID))
            {
                Task.Run(async() =>
                {
                    if (previousBeatmap != null)
                    {
                        StaticData.PreviousBSR = previousBeatmap.Key;
                    }
                    Beatmap bm = await beatSaver.Hash(levelData.levelID.Replace("custom_level_", ""));
                    if (bm != null)
                    {
                        StaticData.BSRKey     = bm.Key;
                        StaticData.coverImage = BeatSaver.BaseURL + bm.CoverURL;
                        previousBeatmap       = bm;
                    }
                    else
                    {
                        StaticData.BSRKey = null; StaticData.coverImage = null; previousBeatmap = null;
                    }
                    StaticData.Send();
                });
            }
            else
            {
                StaticData.BSRKey = previousBeatmap.Key; StaticData.coverImage = BeatSaver.BaseURL + previousBeatmap.CoverURL;
            }

            StaticData.Difficulty = currentMap.difficultyBeatmap.difficultyRank;
            StaticData.NJS        = currentMap.difficultyBeatmap.noteJumpMovementSpeed;

            StaticData.Modifiers.Add("instaFail", currentMap.gameplayModifiers.instaFail);
            StaticData.Modifiers.Add("batteryEnergy", currentMap.gameplayModifiers.energyType == GameplayModifiers.EnergyType.Battery);
            StaticData.Modifiers.Add("disappearingArrows", currentMap.gameplayModifiers.disappearingArrows);
            StaticData.Modifiers.Add("ghostNotes", currentMap.gameplayModifiers.ghostNotes);
            StaticData.Modifiers.Add("fasterSong", currentMap.gameplayModifiers.songSpeedMul == 1.2f ? true : false);
            StaticData.Modifiers.Add("noFail", currentMap.gameplayModifiers.noFail);
            LiveData.PlayerHealth = StaticData.Modifiers["noFail"] ? 100 : 50;
            StaticData.Modifiers.Add("noObstacles", currentMap.gameplayModifiers.enabledObstacleType == GameplayModifiers.EnabledObstacleType.NoObstacles);
            StaticData.Modifiers.Add("noBombs", currentMap.gameplayModifiers.noBombs);
            StaticData.Modifiers.Add("slowerSong", currentMap.gameplayModifiers.songSpeedMul == 0.85f ? true : false);
            StaticData.Modifiers.Add("noArrows", currentMap.gameplayModifiers.noArrows);
            if (currentMap.practiceSettings != null) //In Practice mode
            {
                StaticData.PracticeMode = true;
                startSongTime           = new TimeSpan(0, 0, (int)Math.Round(currentMap.practiceSettings.startSongTime) - 1); //1s time desync
                StaticData.PracticeModeModifiers.Add("songSpeedMul", currentMap.practiceSettings.songSpeedMul);
            }

            previousMap = currentMap;

            TimeElapsed.Start();
            TimeElapsedLogger.Start();

            StaticData.Send();
            LiveData.Send();
        }