HeavenStudioPlus/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs
AstrlJelly ec78a150a7 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!!
2024-02-26 01:46:23 +00:00

60 lines
No EOL
1.9 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
using System.Linq;
using TMPro;
using Jukebox;
namespace HeavenStudio.Editor
{
public class EventPropertyPrefab : MonoBehaviour
{
public TMP_Text caption;
protected string _captionText;
public EventParameterManager parameterManager;
public RiqEntity entity;
public string propertyName;
public List<PropertyCollapse> propertyCollapses = new List<PropertyCollapse>();
public virtual void SetProperties(string propertyName, object type, string caption)
{
this.parameterManager = EventParameterManager.instance;
entity = parameterManager.entity;
this.propertyName = propertyName;
this.caption.text = _captionText = caption;
}
public virtual void SetCollapses(object type) { }
public void UpdateCollapse(object type)
{
foreach (var p in propertyCollapses)
{
if (p.collapseables.Count > 0) { // there could be a better way to do it, but for now this works
foreach (var c in p.collapseables) {
if (c != null) c.SetActive(p.collapseOn(type, p.entity) && gameObject.activeSelf);
}
} else {
_ = p.collapseOn(type, p.entity);
}
}
}
public class PropertyCollapse
{
public List<GameObject> collapseables;
public Func<object, RiqEntity, bool> collapseOn;
public RiqEntity entity;
public PropertyCollapse(List<GameObject> collapseables, Func<object, RiqEntity, bool> collapseOn, RiqEntity entity)
{
this.collapseables = collapseables;
this.collapseOn = collapseOn;
this.entity = entity;
}
}
}
}