full game loop

This commit is contained in:
minenice55 2023-11-25 19:46:53 -05:00
parent f64ec244f9
commit 79ec1449b8
9 changed files with 67 additions and 30 deletions

View file

@ -232,6 +232,9 @@ MonoBehaviour:
ambientBg: {fileID: 4779885053979786433} ambientBg: {fileID: 4779885053979786433}
ambientBgGO: {fileID: 487891016983371717} ambientBgGO: {fileID: 487891016983371717}
letterboxBgGO: {fileID: 3931965693507761463} letterboxBgGO: {fileID: 3931965693507761463}
overlayCanvas: {fileID: 8313606602379655831}
letterboxMask: {fileID: 9126116407185073410}
parentView: {fileID: 1850376182743320724}
camera: {fileID: 16338400879174842} camera: {fileID: 16338400879174842}
--- !u!1 &487891016983371717 --- !u!1 &487891016983371717
GameObject: GameObject:

View file

@ -22,7 +22,7 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Clips: m_Clips:
- m_Version: 1 - m_Version: 1
m_Start: 3 m_Start: 3.2333333333333325
m_ClipIn: 0 m_ClipIn: 0
m_Asset: {fileID: 2796815243102601463} m_Asset: {fileID: 2796815243102601463}
m_Duration: 2 m_Duration: 2
@ -133,7 +133,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3} m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3}
m_Name: Signal Emitter m_Name: Signal Emitter
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Time: 3.6666666666666665 m_Time: 3.899999999999999
m_Retroactive: 0 m_Retroactive: 0
m_EmitOnce: 0 m_EmitOnce: 0
m_Asset: {fileID: 11400000, guid: 425447af5e3be6844b683556e28151b9, type: 2} m_Asset: {fileID: 11400000, guid: 425447af5e3be6844b683556e28151b9, type: 2}
@ -176,7 +176,7 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Clips: m_Clips:
- m_Version: 1 - m_Version: 1
m_Start: 0.016666666666666666 m_Start: 0.25
m_ClipIn: 0 m_ClipIn: 0
m_Asset: {fileID: 3869086833221261789} m_Asset: {fileID: 3869086833221261789}
m_Duration: 4.983333333333333 m_Duration: 4.983333333333333
@ -293,7 +293,7 @@ MonoBehaviour:
m_Children: [] m_Children: []
m_Clips: m_Clips:
- m_Version: 1 - m_Version: 1
m_Start: 0.016666666666666666 m_Start: 0.25
m_ClipIn: 0 m_ClipIn: 0
m_Asset: {fileID: -3297741380686258233} m_Asset: {fileID: -3297741380686258233}
m_Duration: 0.47421168418479587 m_Duration: 0.47421168418479587
@ -379,7 +379,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3} m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3}
m_Name: Signal Emitter m_Name: Signal Emitter
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Time: 1.5 m_Time: 1.7333333333333325
m_Retroactive: 0 m_Retroactive: 0
m_EmitOnce: 0 m_EmitOnce: 0
m_Asset: {fileID: 11400000, guid: 91b18d308429fbd43b8ccc497a10451f, type: 2} m_Asset: {fileID: 11400000, guid: 91b18d308429fbd43b8ccc497a10451f, type: 2}
@ -407,7 +407,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3} m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3}
m_Name: Signal Emitter m_Name: Signal Emitter
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Time: 2 m_Time: 2.2333333333333325
m_Retroactive: 0 m_Retroactive: 0
m_EmitOnce: 0 m_EmitOnce: 0
m_Asset: {fileID: 11400000, guid: 57ca9bfe84a3d8e459c3acb8ae9d822a, type: 2} m_Asset: {fileID: 11400000, guid: 57ca9bfe84a3d8e459c3acb8ae9d822a, type: 2}
@ -435,7 +435,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3} m_Script: {fileID: 11500000, guid: 15c38f6fa1940124db1ab7f6fe7268d1, type: 3}
m_Name: Signal Emitter m_Name: Signal Emitter
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Time: 1 m_Time: 1.2333333333333325
m_Retroactive: 0 m_Retroactive: 0
m_EmitOnce: 0 m_EmitOnce: 0
m_Asset: {fileID: 11400000, guid: f5bc62bc9f451ed4a9ed997842113201, type: 2} m_Asset: {fileID: 11400000, guid: f5bc62bc9f451ed4a9ed997842113201, type: 2}

View file

@ -120,6 +120,8 @@ namespace HeavenStudio
} }
} }
JudgementManager.JudgementInfo judgementInfo;
private void Awake() private void Awake()
{ {
// autoplay = true; // autoplay = true;
@ -326,11 +328,20 @@ namespace HeavenStudio
} }
} }
public void ScoreInputAccuracy(double beat, double accuracy, bool late, double time, double weight = 1, bool doDisplay = true, int category = 0) public void ScoreInputAccuracy(double beat, double accuracy, bool late, double time, float weight = 1, bool doDisplay = true, int category = 0)
{ {
totalInputs += weight; totalInputs += weight;
totalPlayerAccuracy += accuracy * weight; totalPlayerAccuracy += accuracy * weight;
judgementInfo.inputs.Add(new JudgementManager.InputInfo
{
beat = beat,
accuracyState = accuracy,
timeOffset = time,
weight = weight,
category = category
});
if (accuracy < Minigame.rankOkThreshold && weight > 0) if (accuracy < Minigame.rankOkThreshold && weight > 0)
{ {
SkillStarManager.instance.KillStar(); SkillStarManager.instance.KillStar();
@ -615,6 +626,12 @@ namespace HeavenStudio
SectionMedalsManager.instance.Reset(); SectionMedalsManager.instance.Reset();
clearedSections.Clear(); clearedSections.Clear();
judgementInfo = new JudgementManager.JudgementInfo
{
inputs = new List<JudgementManager.InputInfo>(),
medals = new List<JudgementManager.MedalInfo>()
};
} }
StartCoroutine(PlayCo(beat, delay)); StartCoroutine(PlayCo(beat, delay));
@ -674,16 +691,16 @@ namespace HeavenStudio
SectionMedalsManager.instance.OnRemixEnd(); SectionMedalsManager.instance.OnRemixEnd();
// pass this data to rating screen + stats // pass this data to rating screen + stats
Debug.Log($"== Playthrough statistics of {Beatmap["remixtitle"]} (played at {System.DateTime.Now:yyyy-MM-dd HH:mm:ss}) =="); // Debug.Log($"== Playthrough statistics of {Beatmap["remixtitle"]} (played at {System.DateTime.Now:yyyy-MM-dd HH:mm:ss}) ==");
Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms"); // Debug.Log($"Average input offset for playthrough: {averageInputOffset}ms");
Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100): 0.00}"); // Debug.Log($"Accuracy for playthrough: {(PlayerAccuracy * 100): 0.00}");
Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.SectionMarkers.Count}"); // Debug.Log($"Cleared {clearedSections.FindAll(c => c).Count} sections out of {Beatmap.SectionMarkers.Count}");
if (SkillStarManager.instance.IsCollected) // if (SkillStarManager.instance.IsCollected)
Debug.Log($"Skill Star collected"); // Debug.Log($"Skill Star collected");
else // else
Debug.Log($"Skill Star not collected"); // Debug.Log($"Skill Star not collected");
if (GoForAPerfect.instance.perfect) // if (GoForAPerfect.instance.perfect)
Debug.Log($"Perfect Clear!"); // Debug.Log($"Perfect Clear!");
KillAllSounds(); KillAllSounds();
if (restart) if (restart)
@ -692,8 +709,13 @@ namespace HeavenStudio
} }
else if (playMode) else if (playMode)
{ {
// when rating screen gets added playOnStart will instead move to that scene judgementInfo.finalScore = (float)PlayerAccuracy;
GlobalGameManager.LoadScene("Title", 0.35f, 0.5f); judgementInfo.star = skillStarCollected;
judgementInfo.perfect = GoForAPerfect.instance.perfect;
judgementInfo.time = DateTime.Now;
JudgementManager.SetPlayInfo(judgementInfo, Beatmap);
GlobalGameManager.LoadScene("Judgement", 0.35f, 0f);
CircleCursor.LockCursor(false); CircleCursor.LockCursor(false);
} }
Application.backgroundLoadingPriority = ThreadPriority.Normal; Application.backgroundLoadingPriority = ThreadPriority.Normal;

View file

@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Scripts_LaunchParty
SoundByte.PlayOneShotGame("launchParty/rocket_endBad"); SoundByte.PlayOneShotGame("launchParty/rocket_endBad");
string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right"; string leftOrRight = (UnityEngine.Random.Range(1, 3) == 1) ? "Left" : "Right";
if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0); if (!anim.IsPlayingAnimationName("RocketBarelyLeft") && !anim.IsPlayingAnimationName("RocketBarelyRight")) anim.Play("RocketBarely" + leftOrRight, 0, 0);
game.ScoreMiss(0.5); game.ScoreMiss(0.5f);
} }
} }

View file

@ -433,7 +433,7 @@ namespace HeavenStudio.Games
return null; return null;
} }
public void ScoreMiss(double weight = 1f) public void ScoreMiss(float weight = 1f)
{ {
double beat = Conductor.instance?.songPositionInBeatsAsDouble ?? -1; double beat = Conductor.instance?.songPositionInBeatsAsDouble ?? -1;
GameManager.instance.ScoreInputAccuracy(beat, 0, true, NgLateTime(), weight, false); GameManager.instance.ScoreInputAccuracy(beat, 0, true, NgLateTime(), weight, false);

View file

@ -343,7 +343,7 @@ namespace HeavenStudio.Games
if (countsForAccuracy && !(noAutoplay || autoplayOnly)) if (countsForAccuracy && !(noAutoplay || autoplayOnly))
{ {
GameManager.instance.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, 1.0, false); GameManager.instance.ScoreInputAccuracy(startBeat + timer, 0, true, 2.0, 1, false);
GoForAPerfect.instance.Miss(); GoForAPerfect.instance.Miss();
SectionMedalsManager.instance.MakeIneligible(); SectionMedalsManager.instance.MakeIneligible();
} }

View file

@ -244,7 +244,7 @@ namespace HeavenStudio.Games
if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) if ((PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
|| (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !IsExpectingInputNow(InputAction_Alt))) || (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !IsExpectingInputNow(InputAction_Alt)))
{ {
Ringside.instance.ScoreMiss(0.5); Ringside.instance.ScoreMiss(0.5f);
wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f); wrestlerAnim.DoScaledAnimationAsync("YeMiss", 0.25f);
SoundByte.PlayOneShotGame($"ringside/confusedanswer"); SoundByte.PlayOneShotGame($"ringside/confusedanswer");
@ -254,7 +254,7 @@ namespace HeavenStudio.Games
if ( PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch if ( PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch
&& PlayerInput.GetIsAction(InputAction_FlickPress) && !IsExpectingInputNow(InputAction_FlickPress) && !shouldNotInput) && PlayerInput.GetIsAction(InputAction_FlickPress) && !IsExpectingInputNow(InputAction_FlickPress) && !shouldNotInput)
{ {
Ringside.instance.ScoreMiss(0.5); Ringside.instance.ScoreMiss(0.5f);
SoundByte.PlayOneShotGame($"ringside/muscles2"); SoundByte.PlayOneShotGame($"ringside/muscles2");
wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f); wrestlerAnim.DoScaledAnimationAsync("BigGuyTwo", 0.5f);
@ -263,7 +263,7 @@ namespace HeavenStudio.Games
} }
if (PlayerInput.GetIsAction(InputAction_Alt) && !IsExpectingInputNow(InputAction_Alt) && !shouldNotInput) if (PlayerInput.GetIsAction(InputAction_Alt) && !IsExpectingInputNow(InputAction_Alt) && !shouldNotInput)
{ {
Ringside.instance.ScoreMiss(0.5); Ringside.instance.ScoreMiss(0.5f);
int randomPose = UnityEngine.Random.Range(1, 7); int randomPose = UnityEngine.Random.Range(1, 7);
wrestlerAnim.Play($"Pose{randomPose}", 0, 0); wrestlerAnim.Play($"Pose{randomPose}", 0, 0);

View file

@ -209,6 +209,7 @@ namespace HeavenStudio
// The GameManager allows you to Input // The GameManager allows you to Input
public static bool PlayerHasControl() public static bool PlayerHasControl()
{ {
if (GameManager.instance == null || Conductor.instance == null) return true;
return !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput; return !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
} }

View file

@ -8,6 +8,7 @@ using TMPro;
using Jukebox; using Jukebox;
using UnityEngine.Playables; using UnityEngine.Playables;
using HeavenStudio.Games; using HeavenStudio.Games;
using HeavenStudio.InputSystem;
namespace HeavenStudio namespace HeavenStudio
{ {
@ -108,10 +109,10 @@ namespace HeavenStudio
// temp // temp
twoMessage = true; twoMessage = true;
judgementInfo = new() // judgementInfo = new()
{ // {
finalScore = 0.79, // finalScore = 0.79,
}; // };
header.text = "Rhythm League Notes"; header.text = "Rhythm League Notes";
// end temp // end temp
@ -185,6 +186,7 @@ namespace HeavenStudio
rankAnim.Play("Hi"); rankAnim.Play("Hi");
audioSource.PlayOneShot(rankHi); audioSource.PlayOneShot(rankHi);
} }
didRank = true;
} }
public void StartRankMusic() public void StartRankMusic()
@ -283,6 +285,15 @@ namespace HeavenStudio
} }
} }
} }
if (didRank)
{
InputController currentController = PlayerInput.GetInputController(1);
if (currentController.GetLastButtonDown() > 0)
{
GlobalGameManager.LoadScene("Title", 0.35f, 0.5f);
}
}
} }
} }
} }