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

@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Loaders
{ {
public static Minigame AddGame(EventCaller eventCaller) public static Minigame AddGame(EventCaller eventCaller)
{ {
return new Minigame("bonOdori", "The☆Bon Odori \n<color=#adadad>(Za☆Bon Odori)</color>", "312B9F", false, false, new List<GameAction>() return new Minigame("bonOdori", "The☆Bon Odori \n<color=#adadad>(Za☆Bon Odori)</color>", "312B9F", false, false, new List<GameAction>()
{ new GameAction("bop", "Bop") { new GameAction("bop", "Bop")
{ function = delegate {BonOdori.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["toggle"], eventCaller.currentEntity["auto"]);}, { function = delegate {BonOdori.instance.Bop(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["toggle"], eventCaller.currentEntity["auto"]);},
@ -30,14 +30,14 @@ namespace HeavenStudio.Games.Loaders
}, },
}, },
new GameAction("pan", "Pan") new GameAction("pan", "Pan")
{ {
function = delegate { preFunction = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Pan", "Pa", "Pa_n" })[e["type"]]; 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, defaultLength = 1f,
parameters = new List<Param>() parameters = new List<Param>()
@ -51,17 +51,18 @@ namespace HeavenStudio.Games.Loaders
new Param("variationPan", BonOdori.variationPan.PanC, "Pan Type", "Set the variation of the voice line."), 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", 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("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."),
} }
}, },
new GameAction("don", "Don") new GameAction("don", "Don")
{ {
function = delegate { function = delegate {
var e = eventCaller.currentEntity; var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Don", "Do", "Do_n" })[e["type"]]; 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, defaultLength = 1f,
parameters = new List<Param>() parameters = new List<Param>()
@ -74,9 +75,10 @@ namespace HeavenStudio.Games.Loaders
new Param("variationDon", BonOdori.variationDon.DonA, "Don Type", "Set the variation of the voice line."), 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", 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("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."),
} }
}, },
new GameAction("show text", "Show Text") new GameAction("show text", "Show Text")
{ {
function = delegate {BonOdori.instance.ShowText(eventCaller.currentEntity["line 1"], eventCaller.currentEntity["line 2"], eventCaller.currentEntity["line 3"], eventCaller.currentEntity["line 4"], eventCaller.currentEntity["line 5"]);}, function = delegate {BonOdori.instance.ShowText(eventCaller.currentEntity["line 1"], eventCaller.currentEntity["line 2"], eventCaller.currentEntity["line 3"], eventCaller.currentEntity["line 4"], eventCaller.currentEntity["line 5"]);},
@ -97,7 +99,7 @@ namespace HeavenStudio.Games.Loaders
}, },
priority = 1 priority = 1
}, },
@ -153,13 +155,13 @@ namespace HeavenStudio.Games.Loaders
} }
}, },
}); });
} }
}; };
}; };
namespace HeavenStudio.Games namespace HeavenStudio.Games
@ -170,8 +172,9 @@ namespace HeavenStudio.Games
public class BonOdori : Minigame public class BonOdori : Minigame
{ {
string prefix;
double beatUniversal; string prefix;
double beatUniversal;
string suffix; string suffix;
SpriteRenderer darkPlane; SpriteRenderer darkPlane;
bool goBopDonpans; bool goBopDonpans;
@ -209,7 +212,7 @@ namespace HeavenStudio.Games
[SerializeField] TMP_Text Text3; [SerializeField] TMP_Text Text3;
[SerializeField] TMP_Text Text4; [SerializeField] TMP_Text Text4;
[SerializeField] TMP_Text Text5; [SerializeField] TMP_Text Text5;
[SerializeField] TMP_Text Text6; [SerializeField] TMP_Text Text6;
[SerializeField] TMP_Text Text7; [SerializeField] TMP_Text Text7;
[SerializeField] TMP_Text Text8; [SerializeField] TMP_Text Text8;
@ -227,6 +230,19 @@ namespace HeavenStudio.Games
{ {
SideClap = 0, SideClap = 0,
FrontClap = 1 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 public enum typePan
{ {
@ -253,7 +269,7 @@ namespace HeavenStudio.Games
Pa_nC = 1 Pa_nC = 1
} }
public enum variationPa public enum variationPa
{ {
PaG = 0 PaG = 0
} }
@ -261,7 +277,7 @@ namespace HeavenStudio.Games
{ {
DonA = 0, DonA = 0,
DonD = 1, DonD = 1,
DonC = 2, DonC = 2,
DonG = 3 DonG = 3
} }
public enum variationDo_n public enum variationDo_n
@ -284,7 +300,7 @@ namespace HeavenStudio.Games
clapTypeGlobal = 0; clapTypeGlobal = 0;
instance = this; instance = this;
Text1_GUI = Text1.GetComponent<TextMeshProUGUI>(); Text1_GUI = Text1.GetComponent<TextMeshProUGUI>();
@ -298,14 +314,14 @@ namespace HeavenStudio.Games
Text9_GUI = Text9.GetComponent<TextMeshProUGUI>(); Text9_GUI = Text9.GetComponent<TextMeshProUGUI>();
Text10_GUI = Text10.GetComponent<TextMeshProUGUI>(); Text10_GUI = Text10.GetComponent<TextMeshProUGUI>();
} }
public void OnStop() public void OnStop()
{ {
DarkPlane.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f); DarkPlane.GetComponent<SpriteRenderer>().color = new Color(1f, 1f, 1f, 0f);
} }
public void Update() public void Update()
{ {
@ -339,47 +355,77 @@ 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)
{ {
clapTypeString = "ClapSide"; clapTypeString = "ClapSide";
} }
else else
{ {
clapTypeString = "ClapFront"; clapTypeString = "ClapFront";
} }
Player.Play(clapTypeString);
if (!goBopDonpans)
{
Player.Play(clapTypeString);
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");}),
}); });
} }
}
} }
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) if (clapType == 1)
{ {
clapTypeGlobal = 1; clapTypeGlobal = 1;
@ -391,192 +437,145 @@ namespace HeavenStudio.Games
if (muted) if (muted)
{ {
ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty); ScheduleInput(beat, 0f, InputAction_BasicPress, Success, Miss, Empty);
} }
else else
{ {
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){ string clip = typeSpeak switch
case 0: {
SoundByte.PlayOneShotGame("bonOdori/pa_n1"); 0 => "pan",
break; 1 => "pa_n",
case 1: 2 or _ => "pa",
SoundByte.PlayOneShotGame("bonOdori/pa_n2"); };
break;} var pitch = SoundByte.GetPitchFromSemiTones(semitone, true);
break; SoundByte.PlayOneShotGame($"bonOdori/" + clip + (variation + 1), beat, pitch);
case 1:
SoundByte.PlayOneShotGame("bonOdori/pa1");
break;
beatUniversal = beat;
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);
} }
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;
}
}
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);
CPU1.Play(clapTypeString);
CPU2.Play(clapTypeString);
CPU3.Play(clapTypeString);
if (!goBopDonpans)
{
Player.Play(clapTypeString);
BeatAction.New(instance, new List<BeatAction.Action>() 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");}), 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");})
}); });
} }
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);
@ -587,12 +586,13 @@ namespace HeavenStudio.Games
text1 = ChangeColor(text1, false); text1 = ChangeColor(text1, false);
Text1.text = text1; Text1.text = text1;
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);
@ -603,9 +603,10 @@ namespace HeavenStudio.Games
text2 = ChangeColor(text2, false); text2 = ChangeColor(text2, false);
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);
@ -613,14 +614,15 @@ namespace HeavenStudio.Games
} }
originalText3 = text3; originalText3 = text3;
Text8.GetComponent<TextMeshPro>().SetMask(0, new Vector4(-10f, -10f, -10f, 10)); Text8.GetComponent<TextMeshPro>().SetMask(0, new Vector4(-10f, -10f, -10f, 10));
text3 = ChangeColor(text3, false); text3 = ChangeColor(text3, false);
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);
@ -631,11 +633,12 @@ namespace HeavenStudio.Games
text4 = ChangeColor(text4, false); text4 = ChangeColor(text4, false);
Text4.text = text4; Text4.text = text4;
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 +650,14 @@ namespace HeavenStudio.Games
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 +667,8 @@ namespace HeavenStudio.Games
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 +678,8 @@ namespace HeavenStudio.Games
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 +689,8 @@ namespace HeavenStudio.Games
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 +700,8 @@ namespace HeavenStudio.Games
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 +714,57 @@ namespace HeavenStudio.Games
} }
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 maskValue = Mathf.Lerp(-10f, -7f, t); float endTime = startTime + length;
float duration = ((length / conductor.GetBpmAtBeat(beat)) * 60);
text.GetComponent<TextMeshPro>().SetMask(0, new Vector4(-10, -10, maskValue, 10)); while (Time.time < endTime)
{
float t = ((Time.time - startTime) / duration);
float maskValue = Mathf.Lerp(-10f, -7f, t);
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));
}
yield return null;
} }
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++)
@ -774,37 +791,41 @@ namespace HeavenStudio.Games
}) })
}); });
} }
}
else
{
return;
}
} }
public void Bow(double beat, float length)
{
if (goBopDonpans == true)
{
bopDonpans = true;
}
else
{
bopDonpans = false;
} }
public void Bow(double beat, float length) goBopDonpans = false;
{ Player.Play("Bow");
if (goBopDonpans == true) CPU1.Play("Bow");
{ CPU2.Play("Bow");
bopDonpans = true; CPU3.Play("Bow");
} BeatAction.New(instance, new List<BeatAction.Action>()
else
{
bopDonpans = false;
}
goBopDonpans = false;
Player.Play("Bow");
CPU1.Play("Bow");
CPU2.Play("Bow");
CPU3.Play("Bow");
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)
{ {
if (goBopDonpans) if (goBopDonpans)
@ -820,69 +841,73 @@ namespace HeavenStudio.Games
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)
{
float startTime = Time.time;
Conductor con = new Conductor();
float realLength = length / con.GetBpmAtBeat(beat) * 60;
while (Time.time < realLength + startTime)
{ {
if (toggle)
{
if (darkBgIsOn)
{
yield return null;
}
else
{
float startTime = Time.time;
Conductor con = new Conductor();
darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 0.4666f, (Time.time - startTime) / realLength)); float realLength = length / con.GetBpmAtBeat(beat) * 60;
darkBgIsOn = true; while (Time.time < realLength + startTime)
yield return null; {
}}}
else darkPlane.color = new Color(1f, 1f, 1f, Mathf.Lerp(0f, 0.4666f, (Time.time - startTime) / realLength));
{ darkBgIsOn = true;
if (!darkBgIsOn) yield return null;
{
yield return null;
}
}
}
else
{
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;
} }
}
}
}
}}}