bon odori hotfixes + semitones (#752)

* started working on bon odori

* bon odori is now playable, just no animations and sounds

* bon odori is functional now, just missing the art, better audio and animations

* nothing new, my git is always 1 commit behind

* Revert "nothing new, my git is always 1 commit behind"

This reverts commit b96a70004de5964902f7bc87d819a9e6047e77fb.

* changed the background

im only commiting because saladplainzone is gonna do the anims now

* Accurate BG

* Good prefab

* finalized player prefab

* Finalize Prefab

* More animation stuff

* Bow anim done

* text is now functional, passing the project to AstrlJelly

* merging w master branch

* text scrolling is ALMOST functional

* scrolling is ALMOST ALMOST functional

* FINALLY!!!! TEXT SCOLLING IS DONE!!!!!

* TEXT SCROLLING IS (almost) PERFECT!!!! now we gotta wait for the animations

* minor bug fixes

* TEXT SCROLLING IS ACTUALLY PERFECT NOW. also updated the font

* i forgor to change the outline on the fonts

* some bon odori changes (please dont break anything please)

* LAST COMMIT BEFORE PUSHING!!!!!!!

* forgot fix some minor things lol

* organized the folders and made the dark bg an ease and not an animation

* super cool commit

* bug fixes

* added pitching to pans and dons

* changing Clap() and Sound() to a prefunction

* prefunctions done 👍

---------

Co-authored-by: saladplainzone <chocolate2890mail@gmail.com>
Co-authored-by: wookywok <62037083+wookywok@users.noreply.github.com>
Co-authored-by: minenice55 <star.elementa@gmail.com>
This commit is contained in:
streitixy 2024-03-06 19:35:58 -03:00 committed by GitHub
parent 2e11dbf6a9
commit 05219009f6
1 changed files with 360 additions and 335 deletions

View File

@ -34,10 +34,10 @@ namespace HeavenStudio.Games.Loaders
new GameAction("pan", "Pan")
{
function = delegate {
preFunction = delegate {
var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Pan", "Pa", "Pa_n" })[e["type"]];
BonOdori.instance.Clap(e.beat, e[variation], e["type"], e["mute"],e["clapType"]);
BonOdori.instance.PreClap(e.beat, e[variation], e["type"], e["mute"],e["clapType"], e["semitone"]);
},
defaultLength = 1f,
parameters = new List<Param>()
@ -51,7 +51,8 @@ namespace HeavenStudio.Games.Loaders
new Param("variationPan", BonOdori.variationPan.PanC, "Pan Type", "Set the variation of the voice line."),
new Param("variationPa", BonOdori.variationPa.PaG, "Pa Type", "Set the variation of the voice line."),
new Param("variationPa_n", BonOdori.variationPa_n.Pa_nA , "Pa-n Type", "Set the variation of the voice line."),
new Param("clapType", BonOdori.typeClap.SideClap, "Clap Type", "Set the type of clap.")
new Param("clapType", BonOdori.typeClap.SideClap, "Clap Type", "Set the type of clap."),
new Param("semitone", new EntityTypes.Integer(-24, 24, 0), "Semitone", "Set the number of semitones up or down this note should be pitched."),
}
},
@ -61,7 +62,7 @@ namespace HeavenStudio.Games.Loaders
function = delegate {
var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Don", "Do", "Do_n" })[e["type"]];
BonOdori.instance.Sound(e.beat, e[variation], e["type"]);
BonOdori.instance.Sound(e.beat, e[variation], e["type"], e["semitone"]);
},
defaultLength = 1f,
parameters = new List<Param>()
@ -74,6 +75,7 @@ namespace HeavenStudio.Games.Loaders
new Param("variationDon", BonOdori.variationDon.DonA, "Don Type", "Set the variation of the voice line."),
new Param("variationDo", BonOdori.variationDo.DoC, "Do Type", "Set the variation of the voice line."),
new Param("variationDo_n", BonOdori.variationDo_n.Do_nA, "Do-n Type", "Set the variation of the voice line."),
new Param("semitone", new EntityTypes.Integer(-24, 24, 0), "Semitone", "Set the number of semitones up or down this note should be pitched."),
}
},
@ -170,6 +172,7 @@ namespace HeavenStudio.Games
public class BonOdori : Minigame
{
string prefix;
double beatUniversal;
string suffix;
@ -227,6 +230,19 @@ namespace HeavenStudio.Games
{
SideClap = 0,
FrontClap = 1
}
private static List<QueuedClaps> queuedClaps = new();
private struct QueuedClaps
{
public double beat;
public int variation;
public int typeSpeak;
public bool muted;
public int clapType;
public int semitone;
}
public enum typePan
{
@ -342,7 +358,8 @@ namespace HeavenStudio.Games
if (PlayerInput.GetIsAction(BonOdori.InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress)){
if (PlayerInput.GetIsAction(BonOdori.InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
ScoreMiss();
SoundByte.PlayOneShotGame("bonOdori/clap");
if (clapTypeGlobal == 0)
@ -361,7 +378,7 @@ namespace HeavenStudio.Games
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");}),
});
}
@ -372,12 +389,41 @@ namespace HeavenStudio.Games
}
}
public override void OnGameSwitch(double beat)
{
if (queuedClaps.Count > 0)
{
foreach (var clap in queuedClaps) Clap(clap.beat, clap.variation, clap.typeSpeak, clap.muted, clap.clapType, clap.semitone);
queuedClaps.Clear();
}
}
public void Clap(double beat, int variation, int typeSpeak, bool muted, int clapType)
public void PreClap(double beat, int variation, int typeSpeak, bool muted, int clapType, int semitone)
{
if (GameManager.instance.currentGame == "bonOdori")
{
instance.Clap(beat, variation, typeSpeak, muted, clapType, semitone);
}
else
{
queuedClaps.Add(new QueuedClaps()
{
beat = beat,
variation = variation,
typeSpeak = typeSpeak,
muted = muted,
clapType = clapType,
semitone = semitone
});
}
}
public void Clap(double beat, int variation, int typeSpeak, bool muted, int clapType, int semitone)
{
if (clapType == 1)
@ -396,88 +442,37 @@ namespace HeavenStudio.Games
{
switch (typeSpeak){
case 0:
switch (variation){
case 0:
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;
string clip = typeSpeak switch
{
0 => "pan",
1 => "pa_n",
2 or _ => "pa",
};
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
}
beatUniversal = beat;
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;
ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);
}
}
public void Sound(double beat, int variation, int typeSpeak, int semitone)
{
string clip = typeSpeak switch
{
0 => "don",
1 => "do_n",
2 or _ => "do",
};
var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
}
public void Success(PlayerActionEvent caller, float state)
{
@ -552,8 +547,10 @@ namespace HeavenStudio.Games
}
string ChangeColor(string text, bool isScroll)
{
if (text.Contains("r|") | text.Contains("y|") | text.Contains("g|")){
if (!isScroll){
if (text.Contains("r|") | text.Contains("y|") | text.Contains("g|"))
{
if (!isScroll)
{
return text.Replace("r|", "<color=#ff0000>")
@ -568,7 +565,8 @@ namespace HeavenStudio.Games
.Replace("y|", "<color=#ffffff>")
+ "</color>";
}}
}
}
return text;
}
@ -576,7 +574,8 @@ namespace HeavenStudio.Games
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)
{
StopCoroutine(Scroll1);
@ -592,7 +591,8 @@ namespace HeavenStudio.Games
Text6.text = ChangeColor(originalText1, true);
}
if (text2 is not ""){
if (text2 is not "")
{
if (Scroll2 is not null)
{
StopCoroutine(Scroll2);
@ -605,7 +605,8 @@ namespace HeavenStudio.Games
Text7.text = ChangeColor(originalText2, true);
}
if (text3 is not ""){
if (text3 is not "")
{
if (Scroll3 is not null)
{
StopCoroutine(Scroll3);
@ -620,7 +621,8 @@ namespace HeavenStudio.Games
Text8.text = ChangeColor(originalText3, true);
}
if (text4 is not ""){
if (text4 is not "")
{
if (Scroll4 is not null)
{
StopCoroutine(Scroll4);
@ -635,7 +637,8 @@ namespace HeavenStudio.Games
Text9.text = ChangeColor(originalText4, true);
}
if (text5 is not ""){
if (text5 is not "")
{
if (Scroll5 is not null)
{
StopCoroutine(Scroll5);
@ -651,8 +654,10 @@ namespace HeavenStudio.Games
}
public void DeleteText(bool text1, bool text2, bool text3, bool text4, bool text5){
if (text1 == true){
public void DeleteText(bool text1, bool text2, bool text3, bool text4, bool text5)
{
if (text1 == true)
{
if (Scroll1 is not null)
{
StopCoroutine(Scroll1);
@ -662,7 +667,8 @@ namespace HeavenStudio.Games
Text1.text = "";
Text6.text = "";
}
if (text2 == true){
if (text2 == true)
{
if (Scroll2 is not null)
{
StopCoroutine(Scroll2);
@ -672,7 +678,8 @@ namespace HeavenStudio.Games
Text2.text = "";
Text7.text = "";
}
if (text3 == true){
if (text3 == true)
{
if (Scroll3 is not null)
{
StopCoroutine(Scroll3);
@ -682,7 +689,8 @@ namespace HeavenStudio.Games
Text3.text = "";
Text8.text = "";
}
if (text4 == true){
if (text4 == true)
{
if (Scroll4 is not null)
{
StopCoroutine(Scroll4);
@ -692,7 +700,8 @@ namespace HeavenStudio.Games
Text4.text = "";
Text9.text = "";
}
if (text5 == true){
if (text5 == true)
{
if (Scroll5 is not null)
{
StopCoroutine(Scroll5);
@ -729,25 +738,33 @@ namespace HeavenStudio.Games
}
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));}
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;
if (autoBop) { return;}
goBopDonpans = autoBop; goBopJudge = autoBop;
if (autoBop && shouldBop) { return; }
if (shouldBop)
{
for (int i = 0; i < length; i++)
@ -777,6 +794,10 @@ namespace HeavenStudio.Games
}
else
{
return;
}
}
public void Bow(double beat, float length)
@ -852,7 +873,9 @@ IEnumerator DarkBGCoroutine(double beat, bool toggle, float length)
}}}
}
}
}
else
{
if (!darkBgIsOn)
@ -885,4 +908,6 @@ IEnumerator DarkBGCoroutine(double beat, bool toggle, float length)
}
}}}
}
}
}