Advanced Blocks (#720)

* play sfx and play animation blocks

i also changed prescheduleFunction to preFunction, and removed the unused preFunction argument in GameAction
i can revert this if need be but it just seemed vestigial

* count in rework + preloading, multisound addition

multisound was using an array that was converted to a list..?
very silly when you consider it's a list first so sometimes it's list -> array -> list lol

new Count-In and Play SFX block preloads sfx now!! epic.

* prefab-ify event properties, Button EntityType

* things are very nearly working!

however i just hit an insane hurdle. how do i modify a dropdown while still being able to access the index/int value of that param directly. UGHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH

* okay it's WORKING now

i just need to do some better dropdown stuff

* ITS WORKING ITS WORKING ITS WORKING

arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!

* about to make a struct + class, tooltip improvements

gonna make the struct define it, then the class will actually be the dropdown
this is gonna make things so so so so much easier to comprehend

* finishing up, probably one more commit after this

* split up Dropdown into Dropdown and DropdownObj, which basically fixed all of my problems lol
* fixed a count bug
* added param tooltip toggle

* grah it's ALMOST DONE

* it's 99.9% finished.

just some touch ups, i don't think i even know of any bugs

* alright, looks like that's all the bugs gone

* EVERYTHING IS FINISHED!!
This commit is contained in:
AstrlJelly
2024-02-25 20:46:23 -05:00
committed by GitHub
parent bdbe5c9c9c
commit caf124a8cd
45 changed files with 7877 additions and 6212 deletions

View File

@ -888,23 +888,18 @@ namespace HeavenStudio.Editor.Track
{
for (int i = 0; i < ep.Count; i++)
{
object returnVal = ep[i].parameter;
object returnVal = ep[i].parameter switch {
EntityTypes.Integer intVal => intVal.val,
EntityTypes.Float floatVal => floatVal.val,
EntityTypes.Button buttonVal => buttonVal.defaultLabel,
EntityTypes.Dropdown ddVal => new EntityTypes.DropdownObj(ddVal),
_ => ep[i].parameter,
};
var propertyType = returnVal.GetType();
if (propertyType == typeof(EntityTypes.Integer))
{
returnVal = ((EntityTypes.Integer)ep[i].parameter).val;
}
else if (propertyType == typeof(EntityTypes.Float))
{
returnVal = ((EntityTypes.Float)ep[i].parameter).val;
}
else if (propertyType.IsEnum)
{
if (returnVal.GetType().IsEnum) {
returnVal = (int)ep[i].parameter;
}
//tempEntity[ep[i].propertyName] = returnVal;
tempEntity.CreateProperty(ep[i].propertyName, returnVal);
}
}
@ -956,7 +951,14 @@ namespace HeavenStudio.Editor.Track
foreach (RiqEntity entity in original)
{
CopiedEntities.Add(entity.DeepCopy());
var newEntity = entity.DeepCopy();
// 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);
}
}
CopiedEntities.Add(newEntity);
}
}

View File

@ -388,20 +388,19 @@ namespace HeavenStudio.Editor.Track
}
else if (Input.GetMouseButton(2))
{
// var mgs = EventCaller.instance.minigames;
string[] datamodels = entity.datamodel.Split('/');
Debug.Log("Selected entity's datamodel : " + entity.datamodel);
bool isSwitchGame = datamodels[1] == "switchGame";
// int gameIndex = mgs.FindIndex(c => c.name == datamodels[isSwitchGame ? 2 : 0]);
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);