EVERYTHING IS FINISHED!!

This commit is contained in:
AstrlJelly 2024-02-24 22:00:09 -05:00
parent 2dc7678d8c
commit 1ac5d5a588
5 changed files with 31 additions and 15 deletions

View file

@ -770,7 +770,7 @@ RectTransform:
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 215, y: 0}
m_SizeDelta: {x: 160, y: 30}
m_SizeDelta: {x: 250, y: 30}
m_Pivot: {x: 0, y: 1}
--- !u!222 &2779900777391842116
CanvasRenderer:

View file

@ -620,14 +620,20 @@ namespace HeavenStudio
}
}
public static void PlaySFXArbitrary(double beat, string game, string name, float pitch, int offset)
public static void PlaySFXArbitrary(double beat, float length, string game, string name, float pitch, float volume, bool looping, int offset)
{
if (string.IsNullOrEmpty(name)) return;
Sound sound;
if (game == "common") {
SoundByte.PlayOneShot(name, beat, pitch, offset: offset);
sound = SoundByte.PlayOneShot(name, beat, pitch, volume, looping, null, (offset / 1000f));
} else {
SoundByte.PreloadGameAudioClips(game);
SoundByte.PlayOneShotGame(game + "/" + name, beat, pitch, forcePlay: true, offset: (offset / 1000f));
sound = SoundByte.PlayOneShotGame(game + "/" + name, beat, pitch, volume, looping, true, (offset / 1000f));
}
if (looping) {
BeatAction.New(null, new() {
new(beat + length, () => sound.KillLoop(0)),
});
}
}

View file

@ -952,8 +952,9 @@ namespace HeavenStudio.Editor.Track
foreach (RiqEntity entity in original)
{
var newEntity = entity.DeepCopy();
foreach (var key in newEntity.dynamicData.Keys) {
if (newEntity[key] is EntityTypes.DropdownObj dd) {
// there's gotta be a better way to do this. i just don't know how... -AJ
foreach ((var key, var value) in new Dictionary<string, dynamic>(newEntity.dynamicData)) {
if (value is EntityTypes.DropdownObj dd) {
newEntity[key] = new EntityTypes.DropdownObj(dd.value, dd.Values);
}
}

View file

@ -392,14 +392,15 @@ namespace HeavenStudio.Editor.Track
Debug.Log("Selected entity's datamodel : " + entity.datamodel);
bool isSwitchGame = datamodels[1] == "switchGame";
int block = isSwitchGame ? 0 : EventCaller.instance.minigames[datamodels[isSwitchGame ? 2 : 0]].actions.FindIndex(c => c.actionName == datamodels[1]) + 1;
var game = EventCaller.instance.minigames[datamodels[isSwitchGame ? 2 : 0]];
int block = isSwitchGame ? 0 : game.actions.FindIndex(c => c.actionName == datamodels[1]) + 1;
if (!isSwitchGame)
{
// hardcoded stuff
// needs to happen because hidden blocks technically change the event index
if (datamodels[0] == "gameManager") block -= 2;
else if (datamodels[0] is "countIn" or "vfx") block -= 1;
if (game.fxOnly) block--;
if (datamodels[0] == "gameManager") block --;
}
GridGameSelector.instance.SelectGame(datamodels[isSwitchGame ? 2 : 0], block);

View file

@ -1194,7 +1194,6 @@ namespace HeavenStudio
var gm = GameManager.instance;
Minigame game = gm.GetGameInfo(gm.currentGame);
string animPath = ((EntityTypes.DropdownObj)e["animator"]).CurrentValue;
Debug.Log(animPath);
Animator animator = null;
if (!string.IsNullOrEmpty(animPath)) {
var animObj = gm.minigameObj.transform.Find(animPath);
@ -1220,7 +1219,7 @@ namespace HeavenStudio
GameManager.instance.PlayAnimationArbitrary(e["animator"].CurrentValue, e["animation"].CurrentValue, e["scale"]);
}
),
new GameAction("play sfx", "Play SFX", 0.5f, false,
new GameAction("play sfx", "Play SFX", 0.5f, true,
new List<Param>()
{
new Param("game", new EntityTypes.Dropdown(), "Which Game", "Specify the game's sfx to play. An empty input will play global sfx."),
@ -1238,17 +1237,26 @@ namespace HeavenStudio
// this is probably the best way to do it?
clips = new() { "applause", "metronome", "miss", "nearMiss", "perfectMiss", "skillStar" };
}
clips.Sort((s1, s2) => s1.CompareTo(s2));
EntityTypes.DropdownObj sfxDD = e["sfxName"];
sfxDD.SetValues(clips);
return game != null ? game.displayName : "Common";
return clips.Count > 0 ? (game != null ? game.displayName : "Common") : "Empty!";
}), "Get SFX", "Get all the sfx in the selected minigame."),
new Param("sfxName", new EntityTypes.Dropdown(), "SFX Name", "The name of the sfx to play."),
new Param("pitch", new EntityTypes.Float(0, 5, 1), "Pitch", "The sfx's pitch."),
new Param("offset", new EntityTypes.Integer(-500, 500), "Offset (ms)", "The sfx's offset in milliseconds."),
new Param("useSemitones", false, "Use Semitones", "Toggle to use semitones instead of straight pitch.", new() {
new((x, e) => (bool)x, "semitones"),
new((x, e) => !(bool)x, "pitch"),
}),
new Param("semitones", new EntityTypes.Integer(-24, 24, 0), "Semitones", "The semitones of the sfx."),
new Param("pitch", new EntityTypes.Float(0, 5, 1), "Pitch", "The pitch of the sfx."),
new Param("volume", new EntityTypes.Float(0, 2, 1), "Volume", "The volume of the sfx."),
new Param("offset", new EntityTypes.Integer(-500, 500), "Offset (ms)", "The offset of the sfx in milliseconds."),
new Param("loop", false, "Loop", "Loop the sfx for the length of the block."),
},
preFunction : delegate {
var e = eventCaller.currentEntity;
GameManager.PlaySFXArbitrary(e.beat, e["game"].CurrentValue, e["sfxName"].CurrentValue, e["pitch"], e["offset"]);
float pitch = e["useSemitones"] ? SoundByte.GetPitchFromSemiTones(e["semitones"], true) : e["pitch"];
GameManager.PlaySFXArbitrary(e.beat, e.length, e["game"].CurrentValue, e["sfxName"].CurrentValue, pitch, e["volume"], e["loop"], e["offset"]);
}
),
}),