mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 03:35:10 +00:00
try to fix weird score bug
controller only gets re-assigned on first boot don't stall the cpu to queue frames
This commit is contained in:
parent
1a910be4c8
commit
1e4235bf91
5 changed files with 22 additions and 21 deletions
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -134,6 +134,21 @@ namespace HeavenStudio
|
|||
barSlider.fillRect.GetComponent<Image>().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;
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in a new issue