bug fixes

This commit is contained in:
streitixy 2024-02-26 08:40:42 -03:00
parent 88265bbb15
commit 9758ebaf16
2 changed files with 312 additions and 333 deletions

View file

@ -159,7 +159,7 @@ namespace HeavenStudio.Games.Loaders
}); });
} }
}; };
}; };
namespace HeavenStudio.Games namespace HeavenStudio.Games
@ -170,8 +170,8 @@ namespace HeavenStudio.Games
public class BonOdori : Minigame public class BonOdori : Minigame
{ {
string prefix; string prefix;
double beatUniversal; double beatUniversal;
string suffix; string suffix;
SpriteRenderer darkPlane; SpriteRenderer darkPlane;
bool goBopDonpans; bool goBopDonpans;
@ -342,7 +342,8 @@ namespace HeavenStudio.Games
if (PlayerInput.GetIsAction(BonOdori.InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)){ if (PlayerInput.GetIsAction(BonOdori.InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
ScoreMiss(); ScoreMiss();
SoundByte.PlayOneShotGame("bonOdori/clap"); SoundByte.PlayOneShotGame("bonOdori/clap");
if (clapTypeGlobal == 0) if (clapTypeGlobal == 0)
@ -354,14 +355,14 @@ namespace HeavenStudio.Games
clapTypeString = "ClapFront"; clapTypeString = "ClapFront";
} }
Player.Play(clapTypeString); Player.Play(clapTypeString);
if (!goBopDonpans) if (!goBopDonpans)
{ {
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped"); goBopDonpans = true;}) new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped");}),
}); });
} }
@ -369,7 +370,7 @@ namespace HeavenStudio.Games
} }
} }
@ -396,123 +397,69 @@ namespace HeavenStudio.Games
{ {
string clip = typeSpeak switch
{
switch (typeSpeak){ 0 => "pan",
case 0: 1 => "pa_n",
2 or _ => "pa",
switch (variation){ };
case 0: SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1));
SoundByte.PlayOneShotGame("bonOdori/pan1");
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/pan2"); break;
case 2:
SoundByte.PlayOneShotGame("bonOdori/pan3");
break;}
break;
case 2:
switch (variation){
case 0:
SoundByte.PlayOneShotGame("bonOdori/pa_n1");
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/pa_n2");
break;}
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/pa1");
break;
} beatUniversal = beat;
beatUniversal = beat; ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);
ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);}
}
public void Sound(double beat, int variation, int typeSpeak )
{ switch (typeSpeak){
case 0:
switch (variation){
case 0:
SoundByte.PlayOneShotGame("bonOdori/don1");
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/don2");
break;
case 2:
SoundByte.PlayOneShotGame("bonOdori/don3");
break;
case 3:
SoundByte.PlayOneShotGame("bonOdori/don4");
break;
}
break;
case 2:
switch (variation) {
case 0:
SoundByte.PlayOneShotGame("bonOdori/do_n1");
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/do_n2");
break;
}
break;
case 1:
switch (variation){
case 0:
SoundByte.PlayOneShotGame("bonOdori/do1");
break;
case 1:
SoundByte.PlayOneShotGame("bonOdori/do2");
break;
}
break;
} }
} }
public void Sound(double beat, int variation, int typeSpeak)
{
string clip = typeSpeak switch
{
0 => "don",
1 => "do_n",
2 or _ => "do",
};
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1));
}
public void Success(PlayerActionEvent caller, float state) public void Success(PlayerActionEvent caller, float state)
{ {
if (clapTypeGlobal == 0) if (clapTypeGlobal == 0)
{ {
clapTypeString = "ClapSide"; clapTypeString = "ClapSide";
} }
else else
{ {
clapTypeString = "ClapFront"; clapTypeString = "ClapFront";
} }
Player.Play(clapTypeString); Player.Play(clapTypeString);
CPU1.Play(clapTypeString); CPU1.Play(clapTypeString);
CPU2.Play(clapTypeString); CPU2.Play(clapTypeString);
CPU3.Play(clapTypeString); CPU3.Play(clapTypeString);
if (!goBopDonpans) if (!goBopDonpans)
{ {
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped");}), new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped");}),
}); });
} }
SoundByte.PlayOneShotGame("bonOdori/clap") SoundByte.PlayOneShotGame("bonOdori/clap");
} }
public void Miss(PlayerActionEvent caller) public void Miss(PlayerActionEvent caller)
{ {
CPU1.Play(clapTypeString); CPU1.Play(clapTypeString);
CPU2.Play(clapTypeString); CPU2.Play(clapTypeString);
CPU3.Play(clapTypeString); CPU3.Play(clapTypeString);
SoundByte.PlayOneShot("miss"); SoundByte.PlayOneShot("miss");
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beatUniversal + 1d, delegate { Face.Play("Sad");}), new BeatAction.Action(beatUniversal + 1d, delegate { Face.Play("Sad");}),
new BeatAction.Action(beatUniversal + 3d, delegate {Face.Play("Neutral");}) new BeatAction.Action(beatUniversal + 3d, delegate {Face.Play("Neutral");})
@ -524,59 +471,63 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
public void Empty(PlayerActionEvent caller) public void Empty(PlayerActionEvent caller)
{ {
if (clapTypeGlobal == 0) if (clapTypeGlobal == 0)
{ {
clapTypeString = "ClapSide"; clapTypeString = "ClapSide";
}
else
{
clapTypeString = "ClapFront";
}
Player.Play(clapTypeString);
CPU1.Play(clapTypeString);
CPU2.Play(clapTypeString);
CPU3.Play(clapTypeString);
if (!goBopDonpans)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped");}),
});
}
SoundByte.PlayOneShot("nearMiss");
}
string ChangeColor(string text, bool isScroll)
{
if (text.Contains("r|") | text.Contains("y|") | text.Contains("g|")){
if (!isScroll){
return text.Replace("r|", "<color=#ff0000>")
.Replace("g|", "<color=#00ff00>")
.Replace("y|", "<color=#ffff00>")
+ "</color>";
} }
else else
{ {
return text.Replace("r|", "<color=#ff00ff>") clapTypeString = "ClapFront";
.Replace("g|", "<color=#00ffff>") }
.Replace("y|", "<color=#ffffff>")
+ "</color>";
}} Player.Play(clapTypeString);
CPU1.Play(clapTypeString);
CPU2.Play(clapTypeString);
CPU3.Play(clapTypeString);
if (!goBopDonpans)
{
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beatUniversal + 1d, delegate { Player.Play("NeutralClapped"); CPU1.Play("NeutralClapped"); CPU2.Play("NeutralClapped"); CPU3.Play("NeutralClapped");}),
});
}
SoundByte.PlayOneShot("nearMiss");
}
string ChangeColor(string text, bool isScroll)
{
if (text.Contains("r|") | text.Contains("y|") | text.Contains("g|"))
{
if (!isScroll)
{
return text.Replace("r|", "<color=#ff0000>")
.Replace("g|", "<color=#00ff00>")
.Replace("y|", "<color=#ffff00>")
+ "</color>";
}
else
{
return text.Replace("r|", "<color=#ff00ff>")
.Replace("g|", "<color=#00ffff>")
.Replace("y|", "<color=#ffffff>")
+ "</color>";
}
}
return text; return text;
} }
public void ShowText(string text1, string text2, string text3, string text4, string text5) public void ShowText(string text1, string text2, string text3, string text4, string text5)
{ {
if (text1 is not "" && text1 is not "Type r| for red text, g| for green text and y| for yellow text. These can be used multiple times in a single line."){ if (text1 is not "" && text1 is not "Type r| for red text, g| for green text and y| for yellow text. These can be used multiple times in a single line.")
{
if (Scroll1 is not null) if (Scroll1 is not null)
{ {
StopCoroutine(Scroll1); StopCoroutine(Scroll1);
@ -591,8 +542,9 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text6.text = ChangeColor(originalText1, true); Text6.text = ChangeColor(originalText1, true);
} }
if (text2 is not ""){ if (text2 is not "")
{
if (Scroll2 is not null) if (Scroll2 is not null)
{ {
StopCoroutine(Scroll2); StopCoroutine(Scroll2);
@ -604,8 +556,9 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text2.text = text2; Text2.text = text2;
Text7.text = ChangeColor(originalText2, true); Text7.text = ChangeColor(originalText2, true);
} }
if (text3 is not ""){ if (text3 is not "")
{
if (Scroll3 is not null) if (Scroll3 is not null)
{ {
StopCoroutine(Scroll3); StopCoroutine(Scroll3);
@ -619,8 +572,9 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text3.text = text3; Text3.text = text3;
Text8.text = ChangeColor(originalText3, true); Text8.text = ChangeColor(originalText3, true);
} }
if (text4 is not ""){ if (text4 is not "")
{
if (Scroll4 is not null) if (Scroll4 is not null)
{ {
StopCoroutine(Scroll4); StopCoroutine(Scroll4);
@ -634,8 +588,9 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text9.text = text4; Text9.text = text4;
Text9.text = ChangeColor(originalText4, true); Text9.text = ChangeColor(originalText4, true);
} }
if (text5 is not ""){ if (text5 is not "")
{
if (Scroll5 is not null) if (Scroll5 is not null)
{ {
StopCoroutine(Scroll5); StopCoroutine(Scroll5);
@ -647,12 +602,14 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text5.text = text5; Text5.text = text5;
Text10.text = ChangeColor(originalText5, true); Text10.text = ChangeColor(originalText5, true);
} }
} }
public void DeleteText(bool text1, bool text2, bool text3, bool text4, bool text5){ public void DeleteText(bool text1, bool text2, bool text3, bool text4, bool text5)
if (text1 == true){ {
if (text1 == true)
{
if (Scroll1 is not null) if (Scroll1 is not null)
{ {
StopCoroutine(Scroll1); StopCoroutine(Scroll1);
@ -662,7 +619,8 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text1.text = ""; Text1.text = "";
Text6.text = ""; Text6.text = "";
} }
if (text2 == true){ if (text2 == true)
{
if (Scroll2 is not null) if (Scroll2 is not null)
{ {
StopCoroutine(Scroll2); StopCoroutine(Scroll2);
@ -672,7 +630,8 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text2.text = ""; Text2.text = "";
Text7.text = ""; Text7.text = "";
} }
if (text3 == true){ if (text3 == true)
{
if (Scroll3 is not null) if (Scroll3 is not null)
{ {
StopCoroutine(Scroll3); StopCoroutine(Scroll3);
@ -682,7 +641,8 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text3.text = ""; Text3.text = "";
Text8.text = ""; Text8.text = "";
} }
if (text4 == true){ if (text4 == true)
{
if (Scroll4 is not null) if (Scroll4 is not null)
{ {
StopCoroutine(Scroll4); StopCoroutine(Scroll4);
@ -692,7 +652,8 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Text4.text = ""; Text4.text = "";
Text9.text = ""; Text9.text = "";
} }
if (text5 == true){ if (text5 == true)
{
if (Scroll5 is not null) if (Scroll5 is not null)
{ {
StopCoroutine(Scroll5); StopCoroutine(Scroll5);
@ -705,49 +666,57 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
} }
IEnumerator SmoothText(TMP_Text text, float length, double beat) IEnumerator SmoothText(TMP_Text text, float length, double beat)
{
Conductor conductor = new Conductor();
float startTime = Time.time;
float endTime = startTime + length;
float duration = ((length / conductor.GetBpmAtBeat(beat)) * 60);
while (Time.time < endTime)
{ {
float t = ((Time.time - startTime) / duration); Conductor conductor = new Conductor();
float startTime = Time.time;
float endTime = startTime + length;
float duration = ((length / conductor.GetBpmAtBeat(beat)) * 60);
float maskValue = Mathf.Lerp(-10f, -7f, t); while (Time.time < endTime)
{
float t = ((Time.time - startTime) / duration);
text.GetComponent<TextMeshPro>().SetMask(0, new Vector4(-10, -10, maskValue, 10)); float maskValue = Mathf.Lerp(-10f, -7f, t);
yield return null; text.GetComponent<TextMeshPro>().SetMask(0, new Vector4(-10, -10, maskValue, 10));
yield return null;
}
}
public void ScrollText(bool text1, bool text2, bool text3, bool text4, bool text5, float length, double beat)
{
if (text1)
{
Scroll1 = StartCoroutine(SmoothText(Text6, length, beat));
}
if (text2)
{
Scroll2 = StartCoroutine(SmoothText(Text7, length, beat));
}
if (text3)
{
Scroll3 = StartCoroutine(SmoothText(Text8, length, beat));
}
if (text4)
{
Scroll4 = StartCoroutine(SmoothText(Text9, length, beat));
}
if (text5)
{
Scroll5 = StartCoroutine(SmoothText(Text10, length, beat));
}
} }
public void Bop(double beat, float length, bool shouldBop, bool autoBop)
}
public void ScrollText(bool text1, bool text2, bool text3, bool text4, bool text5, float length, double beat)
{
if (text1){
Scroll1 = StartCoroutine(SmoothText(Text6, length, beat));}
if (text2){
Scroll2 = StartCoroutine(SmoothText(Text7, length, beat));}
if (text3){
Scroll3 = StartCoroutine(SmoothText(Text8, length, beat));}
if (text4){
Scroll4 = StartCoroutine(SmoothText(Text9, length, beat));}
if (text5){
Scroll5 = StartCoroutine(SmoothText(Text10, length, beat));}
}
public void Bop(double beat, float length, bool shouldBop, bool autoBop)
{ {
if (!shouldBop) { goBopDonpans = false; goBopJudge = false; return; } goBopDonpans = autoBop; goBopJudge = autoBop;
goBopDonpans = autoBop; if (autoBop && shouldBop) { return;}
goBopJudge = autoBop;
if (autoBop) { return;}
if (shouldBop) if (shouldBop)
{ {
for (int i = 0; i < length; i++) for (int i = 0; i < length; i++)
@ -776,34 +745,38 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
} }
} }
else
{
return;
}
} }
public void Bow(double beat, float length) public void Bow(double beat, float length)
{
if (goBopDonpans == true)
{ {
bopDonpans = true; if (goBopDonpans == true)
} {
else bopDonpans = true;
{ }
bopDonpans = false; else
{
bopDonpans = false;
} }
goBopDonpans = false; goBopDonpans = false;
Player.Play("Bow"); Player.Play("Bow");
CPU1.Play("Bow"); CPU1.Play("Bow");
CPU2.Play("Bow"); CPU2.Play("Bow");
CPU3.Play("Bow"); CPU3.Play("Bow");
BeatAction.New(instance, new List<BeatAction.Action>() BeatAction.New(instance, new List<BeatAction.Action>()
{ {
new BeatAction.Action(beat + length, delegate { Player.Play("NeutralBopped"); CPU1.Play("NeutralBopped");CPU2.Play("NeutralBopped"); CPU3.Play("NeutralBopped"); if (bopDonpans) {goBopDonpans = true;}}) new BeatAction.Action(beat + length, delegate { Player.Play("NeutralBopped"); CPU1.Play("NeutralBopped");CPU2.Play("NeutralBopped"); CPU3.Play("NeutralBopped"); if (bopDonpans) {goBopDonpans = true;}})
}); });
} }
// public void Spin(double beat, float length) // public void Spin(double beat, float length)
// { // {
// } // }
public override void OnBeatPulse(double beat) public override void OnBeatPulse(double beat)
{ {
@ -820,69 +793,73 @@ SoundByte.PlayOneShotGame("bonOdori/clap")
Judge.Play("Bop"); Judge.Play("Bop");
} }
} }
public void DarkBG(double beat, bool toggle, float length) public void DarkBG(double beat, bool toggle, float length)
{
DarkerBG = StartCoroutine(DarkBGCoroutine(beat, toggle, length));
}
IEnumerator DarkBGCoroutine(double beat, bool toggle, float length)
{
if (toggle)
{
if (darkBgIsOn)
{ {
yield return null; DarkerBG = StartCoroutine(DarkBGCoroutine(beat, toggle, length));
} }
else IEnumerator DarkBGCoroutine(double beat, bool toggle, float length)
{ {
if (toggle)
{
if (darkBgIsOn)
{
yield return null;
}
else
{
float startTime = Time.time; float startTime = Time.time;
Conductor con = new Conductor(); Conductor con = new Conductor();
float realLength = length / con.GetBpmAtBeat(beat) * 60; float realLength = length / con.GetBpmAtBeat(beat) * 60;
while (Time.time < realLength + startTime) while (Time.time < realLength + startTime)
{ {
darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 0.4666f, (Time.time - startTime) / realLength)); darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 0.4666f, (Time.time - startTime) / realLength));
darkBgIsOn = true; darkBgIsOn = true;
yield return null; yield return null;
}}} }
else }
{ }
if (!darkBgIsOn) else
{ {
yield return null; if (!darkBgIsOn)
{
yield return null;
}
else
{
float startTime = Time.time;
Conductor con = new Conductor();
float realLength = length / con.GetBpmAtBeat(beat) * 60;
while (Time.time < realLength + startTime)
{
darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0.4666f, 0f, (Time.time - startTime) / realLength));
darkBgIsOn = true;
yield return null;
}
}
}
} }
else
{
float startTime = Time.time;
Conductor con = new Conductor();
float realLength = length / con.GetBpmAtBeat(beat) * 60;
while (Time.time < realLength + startTime)
{
darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0.4666f,0f, (Time.time - startTime) / realLength));
darkBgIsOn = true;
yield return null;
} }
} }
}
}}}

View file

@ -17,6 +17,8 @@ MonoBehaviour:
DenseViewWidthThreshold: 512 DenseViewWidthThreshold: 512
_disableAutoReloadInBackground: 0 _disableAutoReloadInBackground: 0
ImportedScriptPaths: ImportedScriptPaths:
- Assets/Scripts/Games/Tunnel/Tunnel.cs - Assets/Scripts/USG.g/LoadMinigames.Minigames.MinigameLoaderGenerator.g.cs
- Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs
- Assets/Scripts/Games/BonOdori/BonOdori.cs
PathsToSkipImportEvent: [] PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: [] PathsToIgnoreOverwriteSettingOnAttribute: []