private void LevelClearEvent(StandardLevelScenesTransitionSetupDataSO data, LevelCompletionResults result) { var _mainGameSceneSetupData = BS_Utils.Plugin.LevelData; var _beatmapData = _mainGameSceneSetupData?.GameplayCoreSceneSetupData?.difficultyBeatmap?.beatmapData; if (_beatmapData != null) { var songDuration = _mainGameSceneSetupData?.GameplayCoreSceneSetupData?.difficultyBeatmap?.level?.beatmapLevelData?.audioClip?.length ?? -1f; var songName = _mainGameSceneSetupData.GameplayCoreSceneSetupData.difficultyBeatmap.level.songName; DiaryData.LevelCleared(songName, songDuration, _beatmapData.notesCount); } string date = DateTime.Now.ToString("yyyy_MM_dd_"); String filepath = "D:/BeatSaberMod/" + date + "record.csv"; DiaryData.WritePlayData(filepath); DiaryData.Update(); List <Vector2> goodGraph = DiaryData.GetLastGoodRateGraphPoint(); Log.Write("LevelClearEvent goodGraph Count = " + goodGraph.Count.ToString()); floatingScreenForScore.rootViewController.gameObject.SetActive(true); floatingScreenForScore.GetComponent <GraphContainer>().gameObject.SetActive(true); floatingScreenForScore.GetComponent <GraphContainer>().Draw(DiaryData.GetLastGoodRateGraphPoint()); }
/// <summary> /// Only ever called once, mainly used to initialize variables. /// </summary> private void Awake() { // For this particular MonoBehaviour, we only want one instance to exist at any time, so store a reference to it in a static property // and destroy any that are created while one already exists. if (instance != null) { Logger.log?.Warn($"Instance of {this.GetType().Name} already exists, destroying."); GameObject.DestroyImmediate(this); return; } GameObject.DontDestroyOnLoad(this); // Don't destroy this object on scene changes instance = this; Logger.log?.Debug($"{name}: Awake()"); DiaryData.Init(); BSEvents.levelCleared += LevelClearEvent; BSEvents.levelFailed += LevelClearEvent; BSEvents.noteWasCut += HandleScoreControllerNoteWasCut; BSEvents.noteWasMissed += HandleScoreControllerNoteWasMissed; /* call only one time */ BSEvents.lateMenuSceneLoadedFresh += SetGoodRateChart; BSEvents.lateMenuSceneLoadedFresh += SetDiaryButton; SceneManager.sceneLoaded += SceneManager_sceneLoaded; Log.Write("Stats OnLoad"); }
public void SetActiveGoodRateChart(bool onoff, Transform transform) { if (floatingScreenForScore == null) { Log.Write("floatingScreenForScore is Null"); return; } if (onoff) { floatingScreenForScore.transform.position = transform.position + new Vector3(0f, 0f, -2.2f); floatingScreenForScore.transform.rotation = Quaternion.Euler(new Vector3(0, 105, 0)); } else { Vector3 ChartStandardLevelPosition = new Vector3(0, 0.25f, 2.25f); /* Original: 0, -0.4, 2.25 */ Vector3 ChartStandardLevelRotation = new Vector3(35, 0, 0); var pos = ChartStandardLevelPosition; var rot = Quaternion.Euler(ChartStandardLevelRotation); floatingScreenForScore.transform.position = pos; floatingScreenForScore.transform.rotation = rot; } floatingScreenForScore.rootViewController.gameObject.SetActive(onoff); floatingScreenForScore.GetComponent <GraphContainer>().gameObject.SetActive(onoff); floatingScreenForScore.GetComponent <GraphContainer>().Draw(DiaryData.GetLastGoodRateGraphPoint()); }
private void Awake() { var assembly = Assembly.GetExecutingAssembly(); using (var stream = assembly.GetManifestResourceStream("BeatSaberDiary.UI.linegraph")) assetBundle = AssetBundle.LoadFromStream(stream); var prefab = assetBundle.LoadAsset <GameObject>("LineGraph"); var sprite = assetBundle.LoadAsset <Sprite>("Circle"); var go = Instantiate(prefab, transform); winGraph = go.AddComponent <WindowGraph>(); winGraph.circleSprite = sprite; winGraph.transform.localScale /= 10; List <Vector2> goodGraph = DiaryData.GetLastGoodRateGraphPoint(); Log.Write("GraphContainer goodGraph Count = " + goodGraph.Count.ToString()); if (goodGraph.Count > 0) { Draw(goodGraph); } else { //Draw(new List<Vector2> { new Vector2(0f, 1f), new Vector2(1f, 2f), new Vector2(3f, 0f), new Vector2(4f, 5f) }); } }
private void HandleScoreControllerNoteWasMissed(NoteData noteData, int multiplier) { DiaryData.NoteWasMissed(noteData, multiplier); }
private void HandleScoreControllerNoteWasCut(NoteData noteData, NoteCutInfo noteCutInfo, int multiplier) { DiaryData.NoteWasCut(noteData, noteCutInfo, multiplier); }