From b6ec60ca927a431a78fab904aa4bc3d218010fd8 Mon Sep 17 00:00:00 2001 From: minenice55 Date: Tue, 16 Jan 2024 15:21:22 -0500 Subject: [PATCH] try to fix weird score bug controller only gets re-assigned on first boot don't stall the cpu to queue frames --- Assets/Scripts/GameManager.cs | 17 ----------------- Assets/Scripts/GlobalGameManager.cs | 2 +- .../ControllerTypes/InputKeyboard.cs | 2 +- Assets/Scripts/JudgementManager.cs | 15 +++++++++++++++ Assets/Scripts/TitleManager.cs | 7 +++++-- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index d301a3fc6..2fe4cb6f5 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -104,16 +104,6 @@ namespace HeavenStudio } // input accuracy (%) - double totalInputs = 0; - double totalPlayerAccuracy = 0; - public double PlayerAccuracy - { - get - { - if (totalInputs == 0) return 0; - return totalPlayerAccuracy / totalInputs; - } - } bool skillStarCollected = false; // cleared sections @@ -342,9 +332,6 @@ namespace HeavenStudio if (weight > 0 && MarkerWeight > 0) { - totalInputs += weight * MarkerWeight; - totalPlayerAccuracy += Math.Abs(accuracy) * weight * MarkerWeight; - judgementInfo.inputs.Add(new JudgementManager.InputInfo { beat = beat, @@ -675,9 +662,6 @@ namespace HeavenStudio inputOffsetSamples.Clear(); averageInputOffset = 0; - totalInputs = 0; - totalPlayerAccuracy = 0; - TimingAccuracyDisplay.instance.ResetArrow(); SkillStarManager.instance.Reset(); skillStarCollected = false; @@ -807,7 +791,6 @@ namespace HeavenStudio } else if (playMode) { - judgementInfo.finalScore = (float)PlayerAccuracy; judgementInfo.star = skillStarCollected; judgementInfo.perfect = GoForAPerfect.instance.perfect; judgementInfo.time = DateTime.Now; diff --git a/Assets/Scripts/GlobalGameManager.cs b/Assets/Scripts/GlobalGameManager.cs index 80a63fec6..109843371 100644 --- a/Assets/Scripts/GlobalGameManager.cs +++ b/Assets/Scripts/GlobalGameManager.cs @@ -114,7 +114,7 @@ namespace HeavenStudio Application.targetFrameRate = -1; QualitySettings.vSyncCount = 0; - QualitySettings.maxQueuedFrames = 2; + QualitySettings.maxQueuedFrames = 1; if (PersistentDataManager.gameSettings.isFullscreen) { Screen.SetResolution(Display.main.systemWidth, Display.main.systemHeight, FullScreenMode.FullScreenWindow); diff --git a/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs b/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs index 2e6295b9a..bb52b9d05 100644 --- a/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs +++ b/Assets/Scripts/InputSystem/ControllerTypes/InputKeyboard.cs @@ -55,7 +55,7 @@ namespace HeavenStudio.InputSystem (int)KeyCode.U, (int)KeyCode.I, (int)KeyCode.E, - (int)KeyCode.U, + (int)KeyCode.O, (int)KeyCode.Escape, }, PointerSensitivity = 3, diff --git a/Assets/Scripts/JudgementManager.cs b/Assets/Scripts/JudgementManager.cs index 0bf93344c..bf93c4b96 100644 --- a/Assets/Scripts/JudgementManager.cs +++ b/Assets/Scripts/JudgementManager.cs @@ -134,6 +134,21 @@ namespace HeavenStudio barSlider.fillRect.GetComponent().color = barColourNg; string propSuffix = "ng"; + double inputs = 0, score = 0; + foreach (var input in judgementInfo.inputs) + { + inputs += input.weight; + score += Math.Clamp(input.accuracyState, 0, 1) * input.weight; + } + if (inputs > 0) + { + score /= inputs; + } + else + { + score = 0; + } + judgementInfo.finalScore = score; if (judgementInfo.finalScore < Minigame.rankOkThreshold) { rank = Rank.Ng; diff --git a/Assets/Scripts/TitleManager.cs b/Assets/Scripts/TitleManager.cs index 3a57d6105..92077f881 100644 --- a/Assets/Scripts/TitleManager.cs +++ b/Assets/Scripts/TitleManager.cs @@ -56,6 +56,7 @@ namespace HeavenStudio [SerializeField] private RectTransform selectedDisplayRect; [SerializeField] private GameObject selectedDisplayIcon; [SerializeField] private GameObject[] otherHiddenOnMouse; + static bool firstBoot = true; private AudioSource musicSource; @@ -80,6 +81,7 @@ namespace HeavenStudio private RectTransform currentSelectableRect, lastSelectableRect; private float selectableLerpTimer; + private void Start() { exiting = false; @@ -151,15 +153,16 @@ namespace HeavenStudio var nextController = newController; var lastController = PlayerInput.GetInputController(1); - if ((newController is InputMouse) && (lastController is not InputMouse)) + if ((newController is InputMouse) && !(lastController is InputMouse)) { Debug.Log("Mouse used, selecting keyboard instead"); nextController = controllers[0]; } Debug.Log("Assigning controller: " + newController.GetDeviceName()); - if (lastController != nextController) + if (lastController != nextController && !firstBoot) { + firstBoot = false; if (nextController == null) { Debug.Log("invalid controller, using keyboard");