using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using Jukebox;
namespace HeavenStudio.Games.Loaders
{
using static Minigames;
public static class AgbBonOdoriLoader
{
public static Minigame AddGame(EventCaller eventCaller)
{
return new Minigame("bonOdori", "The☆Bon Odori \n(Za☆Bon Odori)", "312B9F", false, false, new List()
{
new GameAction("bop", "Bop")
{
function = delegate { var e = eventCaller.currentEntity; BonOdori.instance.ToggleBop(e.beat, e.length, e["toggle"], e["auto"]);},
resizable = true,
parameters = new List()
{
new Param("toggle", true, "Bop", "Toggle if the Donpans and Yagura-chan should bop for the duration of this event."),
new Param("auto", false, "Bop (Auto)", "Toggle if the Donpans and Yagura-chan should automatically bop until another Bop event is reached."),
},
},
new GameAction("pan", "Pan")
{
preFunction = delegate
{
var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Pan", "Pa", "Pa_n" })[e["type"]];
BonOdori.instance.PreClap(e.beat, e[variation], e["type"], e["mute"],e["clapType"], e["semitone"]);
},
defaultLength = 1f,
parameters = new List()
{
new Param("mute", false, "Mute Sound", "Mute the voice line."),
new Param("type",BonOdori.typePan.Pan, "Type", "Set the type of voice line.", new(){
new((x, _) => (int)x == 0, new string[] { "variationPan"}),
new((x, _) => (int)x == 1, new string[] { "variationPa"}),
new((x, _) => (int)x == 2, new string[] { "variationPa_n"}),
}),
new Param("variationPan", new EntityTypes.NoteSampleDropdown(BonOdori.variationPan.PanC, BonOdori.GetSample, "semitone"), "Pan Type", "Set the variation of the voice line."),
new Param("variationPa", new EntityTypes.NoteSampleDropdown(BonOdori.variationPa.PaG, BonOdori.GetSample, "semitone"), "Pa Type", "Set the variation of the voice line."),
new Param("variationPa_n", new EntityTypes.NoteSampleDropdown(BonOdori.variationPa_n.Pa_nA, BonOdori.GetSample, "semitone") , "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("semitone", new EntityTypes.Note(offsetToC: false), "Semitone", "Set the number of semitones up or down this note should be pitched."),
},
},
new GameAction("don", "Don")
{
function = delegate {
var e = eventCaller.currentEntity;
string variation = "variation" + (new string[] { "Don", "Do", "Do_n" })[e["type"]];
BonOdori.instance.PlayDon(e.beat, e[variation], e["type"], e["semitone"]);
},
defaultLength = 1f,
parameters = new List()
{
new Param("type",BonOdori.typeDon.Don, "Type", "Set the type of voiceline", new(){
new((x, _) => (int)x == 0, new string[] { "variationDon"}),
new((x, _) => (int)x == 1, new string[] { "variationDo"}),
new((x, _) => (int)x == 2, new string[] { "variationDo_n"}),
}),
new Param("variationDon", new EntityTypes.NoteSampleDropdown(BonOdori.variationDon.DonA, BonOdori.GetSample, "semitone"), "Don Type", "Set the variation of the voice line."),
new Param("variationDo", new EntityTypes.NoteSampleDropdown(BonOdori.variationDo.DoC, BonOdori.GetSample, "semitone"), "Do Type", "Set the variation of the voice line."),
new Param("variationDo_n", new EntityTypes.NoteSampleDropdown(BonOdori.variationDo_n.Do_nA, BonOdori.GetSample, "semitone"), "Do-n Type", "Set the variation of the voice line."),
new Param("semitone", new EntityTypes.Note(offsetToC: false), "Semitone", "Set the number of semitones up or down this note should be pitched."),
},
},
new GameAction("show text", "Show Text")
{
function = delegate { var e = eventCaller.currentEntity; BonOdori.instance.ShowText(e["line 1"], e["line 2"], e["line 3"], e["line 4"], e["line 5"]);},
defaultLength = 1f,
parameters = new List()
{
new Param("whichLine", new EntityTypes.Integer(1,5,1), "Line", "Which line to modify.", new()
{
new((x, _) => (int)x == 1, new string[] { "line 1"}),
new((x, _) => (int)x == 2, new string[] { "line 2"}),
new((x, _) => (int)x == 3, new string[] { "line 3"}),
new((x, _) => (int)x == 4, new string[] { "line 4"}),
new((x, _) => (int)x == 5, new string[] { "line 5"}),
}),
new Param("line 1", "Type r| for red text, g| for green text and y| for yellow text. These can be used multiple times in a single line.", "Line 1", "Set the text for line 1."),
new Param("line 2", "", "Line 2", "Set the text for line 2."),
new Param("line 3", "", "Line 3", "Set the text for line 3."),
new Param("line 4", "", "Line 4", "Set the text for line 4."),
new Param("line 5", "", "Line 5", "Set the text for line 5."),
},
priority = 1
},
new GameAction("delete text", "Delete Text")
{
function = delegate { var e = eventCaller.currentEntity; BonOdori.instance.DeleteText(e["line 1"], e["line 2"], e["line 3"], e["line 4"], e["line 5"]);},
defaultLength = 1f,
parameters = new List()
{
new Param("line 1", false, "Line 1", "Delete the contents of line 1."),
new Param("line 2", false, "Line 2", "Delete the contents of line 2."),
new Param("line 3", false, "Line 3", "Delete the contents of line 3."),
new Param("line 4", false, "Line 4", "Delete the contents of line 4."),
new Param("line 5", false, "Line 5", "Delete the contents of line 5."),
},
},
new GameAction("scroll text", "Scroll Text")
{
function = delegate { var e = eventCaller.currentEntity; BonOdori.instance.ScrollText(e.beat, e.length, e["line 1"], e["line 2"], e["line 3"], e["line 4"], e["line 5"]);},
defaultLength = 1f,
resizable = true,
parameters = new List()
{
new Param("line 1", false, "Line 1", "Scroll the contents of line 1."),
new Param("line 2", false, "Line 2", "Scroll the contents of line 2."),
new Param("line 3", false, "Line 3", "Scroll the contents of line 3."),
new Param("line 4", false, "Line 4", "Scroll the contents of line 4."),
new Param("line 5", false, "Line 5", "Scroll the contents of line 5."),
},
},
new GameAction("bow", "Bow")
{
function = delegate { BonOdori.instance.Bow(eventCaller.currentEntity.beat, eventCaller.currentEntity.length);},
defaultLength = 2f,
resizable = true,
},
// new GameAction("spin", "Spin")
// {
// function = delegate { BonOdori.instance.Spin(eventCaller.currentEntity.beat, eventCaller.currentEntity.length);},
// defaultLength = 1f,
// },
new GameAction("toggle bg", "Toggle Darker Background")
{
function = delegate { BonOdori.instance.DarkBG(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"], eventCaller.currentEntity.length);},
defaultLength = 1f,
parameters = new List()
{
new Param("toggle", true, "Darken Background", "Darkens the background."),
}
},
},
new List() { "agb", "normal" }, "agbBonOdori", "en", new List() { },
chronologicalSortKey: 10
);
}
};
};
namespace HeavenStudio.Games
{
public class BonOdori : Minigame
{
string prefix;
double beatUniversal;
bool noBopPlayer = false;
bool noBopDonpans = false;
List noBopBeatsPlayer = new ();
List noBopBeatsDonpans = new ();
string suffix;
SpriteRenderer darkPlane;
string clapTypeString = "ClapFront";
string[] originalTexts = new string[5];
Coroutine[] Scrolls = new Coroutine[5];
Coroutine DarkerBG;
bool darkBgIsOn = false;
[SerializeField] TMP_Text[] Texts;
[SerializeField] TMP_Text[] TextsBlue;
[SerializeField] Animator[] Donpans;
[SerializeField] Animator[] DonpansFace;
[SerializeField] Animator Judge;
[SerializeField] Animator JudgeFace;
[SerializeField] GameObject DarkPlane;
public enum typeClap
{
SideClap = 0,
FrontClap = 1
}
private static List 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
{
Pan = 0,
Pa = 1,
Pa_n = 2
}
public enum typeDon
{
Don = 0,
Do = 1,
Do_n = 2
}
public enum variationPan
{
PanC = 0,
PanE = 1,
PanA = 2
}
public enum variationPa_n
{
Pa_nA = 0,
Pa_nC = 1
}
public enum variationPa
{
PaG = 0
}
public enum variationDon
{
DonA = 0,
DonD = 1,
DonC = 2,
DonG = 3
}
public enum variationDo_n
{
Do_nA = 0,
Do_nG = 1
}
public enum variationDo
{
DoC = 0,
DoG = 1
}
public static readonly Dictionary