mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 12:07:41 +02:00
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:
@ -620,6 +620,31 @@ namespace HeavenStudio
|
||||
}
|
||||
}
|
||||
|
||||
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") {
|
||||
sound = SoundByte.PlayOneShot(name, beat, pitch, volume, looping, null, (offset / 1000f));
|
||||
} else {
|
||||
SoundByte.PreloadGameAudioClips(game);
|
||||
sound = SoundByte.PlayOneShotGame(game + "/" + name, beat, pitch, volume, looping, true, (offset / 1000f));
|
||||
}
|
||||
if (looping) {
|
||||
BeatAction.New(null, new() {
|
||||
new(beat + length, () => sound.KillLoop(0)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayAnimationArbitrary(string animator, string animation, float scale)
|
||||
{
|
||||
Transform animTrans = minigameObj.transform.Find(animator);
|
||||
if (animTrans != null && animTrans.TryGetComponent(out Animator anim)) {
|
||||
anim.DoScaledAnimationAsync(animation, scale);
|
||||
}
|
||||
}
|
||||
|
||||
public void ToggleInputs(bool inputs)
|
||||
{
|
||||
canInput = inputs;
|
||||
|
@ -8,67 +8,73 @@ namespace HeavenStudio.Games
|
||||
{
|
||||
public class SoundEffects : MonoBehaviour
|
||||
{
|
||||
|
||||
public enum CountNumbers { One, Two, Three, Four }
|
||||
public static string[] countNames = { "one", "two", "three", "four" };
|
||||
public static void Count(int type, bool alt)
|
||||
{
|
||||
string sound = countNames[type];
|
||||
if (!alt)
|
||||
sound += "1";
|
||||
else
|
||||
sound += "2";
|
||||
SoundByte.PlayOneShot("count-ins/" + sound);
|
||||
}
|
||||
// public readonly static string[] countNames = { "one", "two", "one", "two", "three", "four" };
|
||||
public readonly static string[] countNames = { "one", "two", "one", "two", "three", "four" };
|
||||
public readonly static float[] timings = { 0f, 2f, 4f, 5f, 6f, 7f };
|
||||
|
||||
public enum CountInType { Normal, Alt, Cowbell }
|
||||
public static string[] GetCountInSounds(string[] sounds, CountInType type)
|
||||
public static string GetCountInSound(int type)
|
||||
{
|
||||
for (int i = 0; i < sounds.Length; i++)
|
||||
return (CountInType)type switch {
|
||||
CountInType.Normal => "1",
|
||||
CountInType.Alt => "2",
|
||||
CountInType.Cowbell or _ => "cowbell",
|
||||
};
|
||||
}
|
||||
|
||||
public static void PreloadCounts()
|
||||
{
|
||||
foreach (string load in new string[] { "one", "two", "three", "four", "cowbell", "ready1", "ready2" })
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CountInType.Normal:
|
||||
sounds[i] += "1";
|
||||
break;
|
||||
case CountInType.Alt:
|
||||
sounds[i] += "2";
|
||||
break;
|
||||
case CountInType.Cowbell:
|
||||
sounds[i] = "cowbell";
|
||||
break;
|
||||
SoundByte.PreloadAudioClipAsync(load);
|
||||
}
|
||||
}
|
||||
|
||||
public static void CountIn(double beat, float length, bool alt, bool go)
|
||||
{
|
||||
PreloadCounts();
|
||||
string countType = alt ? "2" : "1";
|
||||
double startBeat = beat + length - 8;
|
||||
|
||||
List<MultiSound.Sound> sfx = new();
|
||||
for (int i = 0; i < countNames.Length; i++) {
|
||||
if (startBeat + timings[i] >= beat) {
|
||||
sfx.Add(new MultiSound.Sound("count-ins/" + countNames[i] + countType, startBeat + timings[i]));
|
||||
}
|
||||
}
|
||||
return sounds;
|
||||
if (go) sfx[^1].name = "count-ins/go" + countType;
|
||||
MultiSound.Play(sfx, false);
|
||||
}
|
||||
|
||||
public static void FourBeatCountIn(double beat, float length, int type)
|
||||
{
|
||||
string[] sounds = { "one", "two", "three", "four" };
|
||||
sounds = GetCountInSounds(sounds, (CountInType)type);
|
||||
PreloadCounts();
|
||||
string countType = GetCountInSound(type);
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("count-ins/" + sounds[0], beat),
|
||||
new MultiSound.Sound("count-ins/" + sounds[1], beat + 1f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[2], beat + 2f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[3], beat + 3f * length)
|
||||
}, false);
|
||||
List<MultiSound.Sound> sfx = new();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sfx.Add(new MultiSound.Sound("count-ins/" + countNames[i + 2] + countType, beat + (i * length)));
|
||||
}
|
||||
MultiSound.Play(sfx, false);
|
||||
}
|
||||
|
||||
public static void EightBeatCountIn(double beat, float length, int type)
|
||||
{
|
||||
PreloadCounts();
|
||||
string[] sounds = { "one", "two", "one", "two", "three", "four" };
|
||||
sounds = GetCountInSounds(sounds, (CountInType)type);
|
||||
string sound = GetCountInSound(type);
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
new MultiSound.Sound("count-ins/" + sounds[0], beat),
|
||||
new MultiSound.Sound("count-ins/" + sounds[1], beat + 2f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[2], beat + 4f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[3], beat + 5f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[4], beat + 6f * length),
|
||||
new MultiSound.Sound("count-ins/" + sounds[5], beat + 7f * length)
|
||||
}, false);
|
||||
List<MultiSound.Sound> sfx = new();
|
||||
for (int i = 0; i < sounds.Length; i++) {
|
||||
sfx.Add(new MultiSound.Sound("count-ins/" + sounds[i] + sound, beat + (timings[i] * length)));
|
||||
}
|
||||
MultiSound.Play(sfx, false);
|
||||
}
|
||||
|
||||
public static void Count(int type, bool alt)
|
||||
{
|
||||
SoundByte.PlayOneShot("count-ins/" + (CountNumbers)type + (!alt ? "1" : "2"));
|
||||
}
|
||||
|
||||
public static void Cowbell()
|
||||
@ -78,10 +84,9 @@ namespace HeavenStudio.Games
|
||||
|
||||
public static void Ready(double beat, float length)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[]
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("count-ins/ready1", beat),
|
||||
new MultiSound.Sound("count-ins/ready2", beat + 1f * length),
|
||||
new MultiSound.Sound("count-ins/ready2", beat + (1f * length)),
|
||||
}, false);
|
||||
}
|
||||
|
||||
@ -92,12 +97,7 @@ namespace HeavenStudio.Games
|
||||
|
||||
public static void Go(bool alt)
|
||||
{
|
||||
string sound = "count-ins/go";
|
||||
if (!alt)
|
||||
sound += "1";
|
||||
else
|
||||
sound += "2";
|
||||
SoundByte.PlayOneShot(sound);
|
||||
SoundByte.PlayOneShot("count-ins/go" + (!alt ? "1" : "2"));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,14 @@ namespace HeavenStudio.Editor.Commands
|
||||
|
||||
foreach (var entity in entities)
|
||||
{
|
||||
dupEntityData.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);
|
||||
}
|
||||
}
|
||||
dupEntityData.Add(newEntity);
|
||||
}
|
||||
|
||||
for (var i = 0; i < original.Count; i++)
|
||||
|
@ -2,10 +2,11 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Editor.Track;
|
||||
using Jukebox;
|
||||
using Jukebox.Legacy;
|
||||
using System.Linq;
|
||||
using System;
|
||||
using static HeavenStudio.EntityTypes;
|
||||
using HeavenStudio.Common;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
@ -18,10 +19,12 @@ namespace HeavenStudio.Editor
|
||||
[Header("Property Prefabs")]
|
||||
[SerializeField] private GameObject IntegerP;
|
||||
[SerializeField] private GameObject FloatP;
|
||||
[SerializeField] private GameObject ButtonP;
|
||||
[SerializeField] private GameObject BooleanP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
[SerializeField] private GameObject ColorP;
|
||||
[SerializeField] private GameObject StringP;
|
||||
private static Dictionary<Type, GameObject> PropertyPrefabs;
|
||||
|
||||
public RiqEntity entity;
|
||||
|
||||
@ -36,6 +39,18 @@ namespace HeavenStudio.Editor
|
||||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
if (PropertyPrefabs == null) {
|
||||
PropertyPrefabs = new() {
|
||||
{ typeof(Integer), IntegerP },
|
||||
{ typeof(Float), FloatP },
|
||||
{ typeof(Dropdown), DropdownP },
|
||||
{ typeof(Button), ButtonP },
|
||||
{ typeof(Color), ColorP },
|
||||
{ typeof(bool), BooleanP },
|
||||
{ typeof(string), StringP },
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@ -70,15 +85,6 @@ namespace HeavenStudio.Editor
|
||||
AddParams(entity);
|
||||
}
|
||||
|
||||
static string TrackToThemeColour(int track) => track switch
|
||||
{
|
||||
1 => EditorTheme.theme.properties.Layer2Col,
|
||||
2 => EditorTheme.theme.properties.Layer3Col,
|
||||
3 => EditorTheme.theme.properties.Layer4Col,
|
||||
4 => EditorTheme.theme.properties.Layer5Col,
|
||||
_ => EditorTheme.theme.properties.Layer1Col
|
||||
};
|
||||
|
||||
private void AddParams(RiqEntity entity)
|
||||
{
|
||||
string[] split = entity.datamodel.Split('/');
|
||||
@ -91,7 +97,14 @@ namespace HeavenStudio.Editor
|
||||
eventSelector.SetActive(false);
|
||||
this.entity = entity;
|
||||
|
||||
string col = TrackToThemeColour((int)entity["track"]);
|
||||
string col = (int)entity["track"] switch
|
||||
{
|
||||
1 => EditorTheme.theme.properties.Layer2Col,
|
||||
2 => EditorTheme.theme.properties.Layer3Col,
|
||||
3 => EditorTheme.theme.properties.Layer4Col,
|
||||
4 => EditorTheme.theme.properties.Layer5Col,
|
||||
_ => EditorTheme.theme.properties.Layer1Col
|
||||
};
|
||||
Editor.instance.SetGameEventTitle($"Properties for <color=#{col}>{action.displayName}</color> on Beat {entity.beat.ToString("F2")} on <color=#{col}>Track {(int)entity["track"] + 1}</color>");
|
||||
|
||||
DestroyParams();
|
||||
@ -100,11 +113,8 @@ namespace HeavenStudio.Editor
|
||||
|
||||
for (int i = 0; i < action.parameters.Count; i++)
|
||||
{
|
||||
object param = action.parameters[i].parameter;
|
||||
string caption = action.parameters[i].propertyCaption;
|
||||
string propertyName = action.parameters[i].propertyName;
|
||||
string tooltip = action.parameters[i].tooltip;
|
||||
ePrefabs.Add(propertyName, AddParam(propertyName, param, caption, tooltip));
|
||||
var p = action.parameters[i];
|
||||
ePrefabs.Add(p.propertyName, AddParam(p.propertyName, p.parameter, p.caption, p.tooltip));
|
||||
}
|
||||
|
||||
foreach (var p in action.parameters)
|
||||
@ -129,70 +139,27 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private GameObject AddParam(string propertyName, object type, string caption, string tooltip = "")
|
||||
{
|
||||
GameObject prefab = IntegerP;
|
||||
GameObject input;
|
||||
|
||||
var objType = type.GetType();
|
||||
|
||||
if (objType == typeof(EntityTypes.Integer))
|
||||
{
|
||||
prefab = IntegerP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<NumberPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else if (objType == typeof(EntityTypes.Float))
|
||||
{
|
||||
prefab = FloatP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<NumberPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else if(type is bool)
|
||||
{
|
||||
prefab = BooleanP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<BoolPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else if (objType.IsEnum)
|
||||
{
|
||||
prefab = DropdownP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<EnumPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else if (objType == typeof(Color))
|
||||
{
|
||||
prefab = ColorP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<ColorPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else if(objType == typeof(string))
|
||||
{
|
||||
prefab = StringP;
|
||||
input = InitPrefab(prefab, tooltip);
|
||||
var property = input.GetComponent<StringPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("Can't make property interface of type: " + type.GetType());
|
||||
Type typeType = type.GetType();
|
||||
GameObject propertyPrefab = DropdownP; // enum check is hardcoded because enums are awesome (lying)
|
||||
if (!typeType.IsEnum && !PropertyPrefabs.TryGetValue(typeType, out propertyPrefab)) {
|
||||
Debug.LogError("Can't make property interface of type: " + typeType);
|
||||
return null;
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
private GameObject InitPrefab(GameObject prefab, string tooltip = "")
|
||||
{
|
||||
GameObject input = Instantiate(prefab);
|
||||
input.transform.SetParent(this.gameObject.transform);
|
||||
GameObject input = Instantiate(propertyPrefab, transform);
|
||||
input.SetActive(true);
|
||||
input.transform.localScale = Vector3.one;
|
||||
|
||||
if(tooltip != string.Empty)
|
||||
Tooltip.AddTooltip(input, "", tooltip);
|
||||
if (tooltip != string.Empty) {
|
||||
if (PersistentDataManager.gameSettings.showParamTooltips) {
|
||||
Tooltip.AddTooltip(input, tooltip);
|
||||
} else {
|
||||
Tooltip.AddTooltip(input, "", tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
EventPropertyPrefab property = input.GetComponent<EventPropertyPrefab>();
|
||||
property.SetProperties(propertyName, type, caption);
|
||||
|
||||
return input;
|
||||
}
|
||||
|
@ -6,8 +6,6 @@ using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
@ -17,29 +15,30 @@ namespace HeavenStudio.Editor
|
||||
public TMP_Text caption;
|
||||
protected string _captionText;
|
||||
public EventParameterManager parameterManager;
|
||||
public RiqEntity entity;
|
||||
public string propertyName;
|
||||
public List<PropertyCollapse> propertyCollapses = new List<PropertyCollapse>();
|
||||
|
||||
public void SetProperties(string propertyName, object type, string caption) {}
|
||||
public virtual void SetCollapses(object type) { }
|
||||
|
||||
public void InitProperties(string propertyName, string caption)
|
||||
public virtual void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
this.parameterManager = EventParameterManager.instance;
|
||||
|
||||
entity = parameterManager.entity;
|
||||
this.propertyName = propertyName;
|
||||
|
||||
_captionText = caption;
|
||||
|
||||
this.caption.text = _captionText;
|
||||
this.caption.text = _captionText = caption;
|
||||
}
|
||||
public virtual void SetCollapses(object type) { }
|
||||
|
||||
public void UpdateCollapse(object type)
|
||||
{
|
||||
foreach (var p in propertyCollapses)
|
||||
{
|
||||
foreach (var c in p.collapseables)
|
||||
{
|
||||
if (c != null) c.SetActive(p.collapseOn(type, p.entity) && gameObject.activeSelf);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,6 @@ using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class BoolPropertyPrefab : EventPropertyPrefab
|
||||
@ -20,27 +16,18 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private bool _defaultValue;
|
||||
|
||||
new public void SetProperties(string propertyName, object type, string caption)
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
InitProperties(propertyName, caption);
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
_defaultValue = (bool)type;
|
||||
toggle.isOn = Convert.ToBoolean(parameterManager.entity[propertyName]);
|
||||
toggle.isOn = Convert.ToBoolean(entity[propertyName]);
|
||||
|
||||
toggle.onValueChanged.AddListener(
|
||||
_ =>
|
||||
{
|
||||
parameterManager.entity[propertyName] = toggle.isOn;
|
||||
if (toggle.isOn != _defaultValue)
|
||||
{
|
||||
this.caption.text = _captionText + "*";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.caption.text = _captionText;
|
||||
}
|
||||
}
|
||||
);
|
||||
toggle.onValueChanged.AddListener(_ =>
|
||||
{
|
||||
entity[propertyName] = toggle.isOn;
|
||||
this.caption.text = (toggle.isOn != _defaultValue) ? (_captionText + "*") : _captionText;
|
||||
});
|
||||
}
|
||||
|
||||
public void ResetValue()
|
||||
@ -50,9 +37,7 @@ namespace HeavenStudio.Editor
|
||||
|
||||
public override void SetCollapses(object type)
|
||||
{
|
||||
toggle.onValueChanged.AddListener(
|
||||
_ => UpdateCollapse(toggle.isOn)
|
||||
);
|
||||
toggle.onValueChanged.AddListener(newVal => UpdateCollapse(newVal));
|
||||
UpdateCollapse(toggle.isOn);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class ButtonPropertyPrefab : EventPropertyPrefab
|
||||
{
|
||||
[Header("Boolean")]
|
||||
[Space(10)]
|
||||
public float minButtonSize;
|
||||
public RectTransform buttonTextRect;
|
||||
public RectTransform buttonRect;
|
||||
public TMP_Text buttonText;
|
||||
public EntityTypes.Button button;
|
||||
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
if (type is EntityTypes.Button button) {
|
||||
this.button = button;
|
||||
buttonText.text = entity[propertyName];
|
||||
} else {
|
||||
Debug.LogError("ButtonPropertyPrefab was unable to use " + type.GetType() + " as a Button.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClick()
|
||||
{
|
||||
string text = button.onClick.Invoke(entity);
|
||||
if (text != null) {
|
||||
buttonText.text = entity[propertyName] = text;
|
||||
}
|
||||
UpdateCollapse(entity[propertyName]);
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
// OnClick() already handles this.
|
||||
// if somebody wants to uncomment this for their thing feel free but it's unused for now -AJ
|
||||
// if (entity[propertyName] != buttonText.text) {
|
||||
// buttonText.text = entity[propertyName];
|
||||
// }
|
||||
|
||||
buttonRect.sizeDelta = new(Mathf.Max(buttonTextRect.sizeDelta.x, minButtonSize), buttonRect.sizeDelta.y);
|
||||
}
|
||||
|
||||
public void ResetValue()
|
||||
{
|
||||
buttonText.text = entity[propertyName] = button.defaultLabel;
|
||||
}
|
||||
|
||||
public override void SetCollapses(object type)
|
||||
{
|
||||
UpdateCollapse(entity[propertyName]);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8ada001011e54c74b87c04d7186d5f3c
|
||||
guid: 7891bc13f0b17734e9a197bf22818300
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
@ -6,10 +6,6 @@ using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class ColorPropertyPrefab : EventPropertyPrefab
|
||||
@ -24,9 +20,9 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private Color _defaultColor;
|
||||
|
||||
new public void SetProperties(string propertyName, object type, string caption)
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
InitProperties(propertyName, caption);
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
hex.onSelect.AddListener(
|
||||
_ =>
|
||||
|
@ -0,0 +1,100 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
using HeavenStudio.Common;
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class DropdownPropertyPrefab : EventPropertyPrefab
|
||||
{
|
||||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public LeftClickTMP_Dropdown dropdown;
|
||||
public Scrollbar scrollbar;
|
||||
|
||||
private int _defaultValue;
|
||||
|
||||
private bool openedDropdown = false;
|
||||
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
int selected = 0;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case EntityTypes.Dropdown dropdownEntity:
|
||||
// entity[propertyName].ChangeValues(dropdownEntity.Values);
|
||||
_defaultValue = dropdownEntity.defaultValue;
|
||||
EntityTypes.DropdownObj dropdownObj = entity[propertyName];
|
||||
selected = dropdownObj.value;
|
||||
dropdown.AddOptions(dropdownObj.Values);
|
||||
dropdown.onValueChanged.AddListener(newVal => dropdownObj.value = newVal);
|
||||
dropdownObj.onValueChanged = new Action<List<string>>(newValues =>
|
||||
{
|
||||
if (dropdown == null) return;
|
||||
dropdown.ClearOptions();
|
||||
dropdown.AddOptions(newValues);
|
||||
dropdown.enabled = newValues.Count > 0;
|
||||
dropdownObj.value = _defaultValue;
|
||||
});
|
||||
break;
|
||||
case Enum enumEntity:
|
||||
Type enumType = enumEntity.GetType();
|
||||
_defaultValue = (int)type;
|
||||
int[] keys = Enum.GetValues(enumType).Cast<int>().ToArray();
|
||||
selected = Array.FindIndex(keys, val => val == (int)entity[propertyName]);
|
||||
|
||||
dropdown.AddOptions(Enum.GetNames(enumType).ToList());
|
||||
dropdown.onValueChanged.AddListener(val => entity[propertyName] = keys[val]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dropdown.value = selected;
|
||||
dropdown.enabled = dropdown.options.Count > 0;
|
||||
|
||||
dropdown.onValueChanged.AddListener(newValue => {
|
||||
this.caption.text = (newValue != _defaultValue) ? (_captionText + "*") : _captionText;
|
||||
});
|
||||
}
|
||||
|
||||
public void ResetValue()
|
||||
{
|
||||
dropdown.value = _defaultValue;
|
||||
}
|
||||
|
||||
public override void SetCollapses(object type)
|
||||
{
|
||||
dropdown.onValueChanged.AddListener(_ => UpdateCollapse(type));
|
||||
UpdateCollapse(type);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (scrollbar != null)
|
||||
{
|
||||
if (openedDropdown == false)
|
||||
{
|
||||
openedDropdown = true;
|
||||
|
||||
var valuePos = (float)dropdown.value / (dropdown.options.Count - 1);
|
||||
var scrollVal = scrollbar.direction == Scrollbar.Direction.TopToBottom ? valuePos : 1.0f - valuePos;
|
||||
scrollbar.value = Mathf.Max(0.001f, scrollVal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
openedDropdown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dbe69d785c445e41a3096329bda742d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,95 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
using HeavenStudio.Common;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class EnumPropertyPrefab : EventPropertyPrefab
|
||||
{
|
||||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public LeftClickTMP_Dropdown dropdown;
|
||||
private Array enumVals;
|
||||
|
||||
private int _defaultValue;
|
||||
|
||||
private bool openedDropdown = false;
|
||||
|
||||
new public void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
InitProperties(propertyName, caption);
|
||||
|
||||
var enumType = type.GetType();
|
||||
enumVals = Enum.GetValues(enumType);
|
||||
var enumNames = Enum.GetNames(enumType).ToList();
|
||||
_defaultValue = (int)type;
|
||||
|
||||
// Can we assume non-holey enum?
|
||||
// If we can we can simplify to dropdown.value = (int) parameterManager.entity[propertyName]
|
||||
var currentlySelected = (int) parameterManager.entity[propertyName];
|
||||
var selected = enumVals
|
||||
.Cast<object>()
|
||||
.ToList()
|
||||
.FindIndex(val => (int) val == currentlySelected);
|
||||
|
||||
dropdown.AddOptions(enumNames);
|
||||
dropdown.value = selected;
|
||||
|
||||
dropdown.onValueChanged.AddListener(_ =>
|
||||
{
|
||||
parameterManager.entity[propertyName] = (int)enumVals.GetValue(dropdown.value);
|
||||
if ((int)enumVals.GetValue(dropdown.value) != _defaultValue)
|
||||
{
|
||||
this.caption.text = _captionText + "*";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.caption.text = _captionText;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
public void ResetValue()
|
||||
{
|
||||
dropdown.value = _defaultValue;
|
||||
}
|
||||
|
||||
public override void SetCollapses(object type)
|
||||
{
|
||||
dropdown.onValueChanged.AddListener(_ => UpdateCollapse((int)enumVals.GetValue(dropdown.value)));
|
||||
UpdateCollapse((int)enumVals.GetValue(dropdown.value));
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
var scrollbar = GetComponentInChildren<ScrollRect>()?.verticalScrollbar;
|
||||
|
||||
// This is bad but we'll fix it later.
|
||||
if (scrollbar != null)
|
||||
{
|
||||
if (openedDropdown == false)
|
||||
{
|
||||
openedDropdown = true;
|
||||
|
||||
var valuePos = (float)dropdown.value / (dropdown.options.Count - 1);
|
||||
var scrollVal = scrollbar.direction == Scrollbar.Direction.TopToBottom ? valuePos : 1.0f - valuePos;
|
||||
scrollbar.value = Mathf.Max(0.001f, scrollVal);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
openedDropdown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -6,11 +6,6 @@ using System;
|
||||
using System.Linq;
|
||||
using TMPro;
|
||||
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor;
|
||||
using static HeavenStudio.EntityTypes;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
public class NumberPropertyPrefab : EventPropertyPrefab
|
||||
@ -22,9 +17,9 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private float _defaultValue;
|
||||
|
||||
new public void SetProperties(string propertyName, object type, string caption)
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
InitProperties(propertyName, caption);
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
switch (type)
|
||||
{
|
||||
@ -141,42 +136,18 @@ namespace HeavenStudio.Editor
|
||||
switch (type)
|
||||
{
|
||||
case EntityTypes.Integer integer:
|
||||
slider.onValueChanged.AddListener(
|
||||
_ =>
|
||||
{
|
||||
UpdateCollapse((int)slider.value);
|
||||
}
|
||||
);
|
||||
|
||||
inputField.onEndEdit.AddListener(
|
||||
_ =>
|
||||
{
|
||||
UpdateCollapse((int)slider.value);
|
||||
}
|
||||
);
|
||||
slider.onValueChanged.AddListener(_ => UpdateCollapse((int)slider.value));
|
||||
inputField.onEndEdit.AddListener(_ => UpdateCollapse((int)slider.value));
|
||||
|
||||
UpdateCollapse((int)slider.value);
|
||||
|
||||
break;
|
||||
|
||||
case EntityTypes.Float fl:
|
||||
slider.onValueChanged.AddListener(
|
||||
_ =>
|
||||
{
|
||||
var newValue = (float)Math.Round(slider.value, 4);
|
||||
UpdateCollapse(newValue);
|
||||
}
|
||||
);
|
||||
slider.onValueChanged.AddListener(newVal => UpdateCollapse((float)Math.Round(newVal, 4)));
|
||||
inputField.onEndEdit.AddListener(_ => UpdateCollapse(slider.value));
|
||||
|
||||
var newValue = (float)Math.Round(slider.value, 4);
|
||||
UpdateCollapse(newValue);
|
||||
|
||||
inputField.onEndEdit.AddListener(
|
||||
_ =>
|
||||
{
|
||||
UpdateCollapse(slider.value);
|
||||
}
|
||||
);
|
||||
UpdateCollapse((float)Math.Round(slider.value, 4));
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -21,13 +21,13 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private string _defaultValue;
|
||||
|
||||
new public void SetProperties(string propertyName, object type, string caption)
|
||||
public override void SetProperties(string propertyName, object type, string caption)
|
||||
{
|
||||
InitProperties(propertyName, caption);
|
||||
base.SetProperties(propertyName, type, caption);
|
||||
|
||||
_defaultValue = (string)type;
|
||||
|
||||
inputFieldString.text = (string) parameterManager.entity[propertyName];
|
||||
inputFieldString.text = (string)entity[propertyName];
|
||||
|
||||
inputFieldString.onSelect.AddListener(
|
||||
_ =>
|
||||
@ -36,21 +36,14 @@ namespace HeavenStudio.Editor
|
||||
inputFieldString.onValueChanged.AddListener(
|
||||
_ =>
|
||||
{
|
||||
parameterManager.entity[propertyName] = inputFieldString.text;
|
||||
if (inputFieldString.text != _defaultValue)
|
||||
{
|
||||
this.caption.text = _captionText + "*";
|
||||
}
|
||||
else
|
||||
{
|
||||
this.caption.text = _captionText;
|
||||
}
|
||||
entity[propertyName] = inputFieldString.text;
|
||||
this.caption.text = (inputFieldString.text != _defaultValue) ? (_captionText + "*") : _captionText;
|
||||
}
|
||||
);
|
||||
|
||||
inputFieldString.onEndEdit.AddListener(
|
||||
_ =>
|
||||
{;
|
||||
{
|
||||
Editor.instance.editingInputField = false;
|
||||
}
|
||||
);
|
||||
@ -63,16 +56,15 @@ namespace HeavenStudio.Editor
|
||||
|
||||
public override void SetCollapses(object type)
|
||||
{
|
||||
inputFieldString.onValueChanged.AddListener(
|
||||
_ =>
|
||||
{
|
||||
UpdateCollapse(inputFieldString.text);
|
||||
});
|
||||
inputFieldString.onValueChanged.AddListener(newVal => UpdateCollapse(newVal));
|
||||
UpdateCollapse(inputFieldString.text);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (entity[propertyName] != inputFieldString.text) {
|
||||
inputFieldString.text =entity[propertyName];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -71,8 +71,15 @@ namespace HeavenStudio.Editor
|
||||
private void OnEnterPrivate(string tooltipText, string altTooltipText)
|
||||
{
|
||||
group.alpha = 1;
|
||||
SetText(tooltipText);
|
||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n","");
|
||||
|
||||
text.text = tooltipText;
|
||||
text.ForceMeshUpdate();
|
||||
|
||||
Vector2 textSize = text.GetRenderedValues(false);
|
||||
Vector2 paddingSize = new Vector2(8, 8);
|
||||
|
||||
background.sizeDelta = textSize + paddingSize;
|
||||
Editor.instance.tooltipText.text = altTooltipText.Replace("\n", "");
|
||||
Editor.instance.tooltipText.ForceMeshUpdate();
|
||||
}
|
||||
|
||||
@ -92,10 +99,9 @@ namespace HeavenStudio.Editor
|
||||
background.sizeDelta = textSize + paddingSize;
|
||||
}
|
||||
|
||||
public static void AddTooltip(GameObject g, string tooltipText, string altTooltipText = "")
|
||||
public static void AddTooltip(GameObject g, string tooltipText, string altTooltipText = null)
|
||||
{
|
||||
if (altTooltipText == "")
|
||||
altTooltipText = tooltipText;
|
||||
altTooltipText ??= tooltipText;
|
||||
|
||||
EventTrigger et = g.AddComponent<EventTrigger>();
|
||||
|
||||
|
@ -5,7 +5,6 @@ using Cysharp.Threading.Tasks;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using DG.Tweening;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
@ -15,9 +14,10 @@ using Jukebox;
|
||||
using SatorImaging.UnitySourceGenerator;
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using UnityEngine.Assertions.Must;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
@ -267,6 +267,13 @@ namespace HeavenStudio
|
||||
e.dynamicData[param.propertyName] = (int)e[param.propertyName];
|
||||
else if (type == typeof(EntityTypes.Float))
|
||||
e.dynamicData[param.propertyName] = (float)e[param.propertyName];
|
||||
else if (type == typeof(EntityTypes.Button))
|
||||
e.dynamicData[param.propertyName] = (string)e[param.propertyName];
|
||||
else if (type == typeof(EntityTypes.Dropdown)) {
|
||||
JValue value = e[param.propertyName]["value"];
|
||||
JArray values = e[param.propertyName]["Values"];
|
||||
e.dynamicData[param.propertyName] = new EntityTypes.DropdownObj((int)value, values.Select(x => (string)x).ToList());
|
||||
}
|
||||
else if (type == typeof(EntityTypes.Resource))
|
||||
e.dynamicData[param.propertyName] = (EntityTypes.Resource)e[param.propertyName];
|
||||
else if (type.IsEnum)
|
||||
@ -635,11 +642,10 @@ namespace HeavenStudio
|
||||
/// <param name="function"><para>What the block does when read during playback</para>
|
||||
/// <para>Only does this if the game that it is associated with is loaded.</para></param>
|
||||
/// <param name="inactiveFunction">What the block does when read while the game it's associated with isn't loaded.</param>
|
||||
/// <param name="prescheduleFunction">What the block does when the GameManager seeks to this cue for pre-scheduling.</param>
|
||||
/// <param name="preFunction">What the block does when the GameManager seeks to this cue for pre-scheduling.</param>
|
||||
/// <param name="hidden">Prevents the block from being shown in the game list. Block will still function normally if it is in the timeline.</param>
|
||||
/// <param name="preFunction">Runs two beats before this event is reached.</param>
|
||||
/// <param name="priority">Priority of this event. Higher priority events will be run first.</param>
|
||||
public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List<Param> parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback prescheduleFunction = null, bool hidden = false, EventCallback preFunction = null, int priority = 0, float preFunctionLength = 2.0f)
|
||||
public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List<Param> parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback preFunction = null, bool hidden = false, int priority = 0, float preFunctionLength = 2.0f)
|
||||
{
|
||||
this.actionName = actionName;
|
||||
if (displayName == String.Empty) this.displayName = actionName;
|
||||
@ -651,7 +657,7 @@ namespace HeavenStudio
|
||||
|
||||
this.function = function ?? delegate { };
|
||||
this.inactiveFunction = inactiveFunction ?? delegate { };
|
||||
this.preFunction = prescheduleFunction ?? delegate { };
|
||||
this.preFunction = preFunction ?? delegate { };
|
||||
this.priority = priority;
|
||||
this.preFunctionLength = preFunctionLength;
|
||||
}
|
||||
@ -674,7 +680,7 @@ namespace HeavenStudio
|
||||
{
|
||||
public string propertyName;
|
||||
public object parameter;
|
||||
public string propertyCaption;
|
||||
public string caption;
|
||||
public string tooltip;
|
||||
public List<CollapseParam> collapseParams;
|
||||
|
||||
@ -683,12 +689,12 @@ namespace HeavenStudio
|
||||
/// </summary>
|
||||
/// <param name="propertyName">The name of the variable that's being changed.</param>
|
||||
/// <param name="parameter">The value of the parameter</param>
|
||||
/// <param name="propertyCaption">The name shown in the editor. Can be anything you want.</param>
|
||||
public Param(string propertyName, object parameter, string propertyCaption, string tooltip = "", List<CollapseParam> collapseParams = null)
|
||||
/// <param name="caption">The name shown in the editor. Can be anything you want.</param>
|
||||
public Param(string propertyName, object parameter, string caption, string tooltip = "", List<CollapseParam> collapseParams = null)
|
||||
{
|
||||
this.propertyName = propertyName;
|
||||
this.parameter = parameter;
|
||||
this.propertyCaption = propertyCaption;
|
||||
this.caption = caption;
|
||||
this.tooltip = tooltip;
|
||||
this.collapseParams = collapseParams;
|
||||
}
|
||||
@ -702,7 +708,7 @@ namespace HeavenStudio
|
||||
/// </summary>
|
||||
/// <param name="collapseOn">What values should make it collapse/uncollapse?</param>
|
||||
/// <param name="collapseables">IDs of the parameters to collapse</param>
|
||||
public CollapseParam(Func<object, RiqEntity, bool> collapseOn, string[] collapseables)
|
||||
public CollapseParam(Func<object, RiqEntity, bool> collapseOn, params string[] collapseables)
|
||||
{
|
||||
CollapseOn = collapseOn;
|
||||
this.collapseables = collapseables;
|
||||
@ -758,19 +764,36 @@ namespace HeavenStudio
|
||||
|
||||
new Minigame("countIn", "Count-Ins", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("count-in", "Count-In", 4f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("alt", false, "Alt", "Set the type of sounds to use for the count-in."),
|
||||
new Param("go", false, "Go!", "Toggle to end the count-in with \"Go!\""),
|
||||
},
|
||||
preFunction : delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
SoundEffects.CountIn(e.beat, e.length, e["alt"], e["go"]);
|
||||
}
|
||||
),
|
||||
new GameAction("4 beat count-in", "4 Beat Count-In", 4f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("type", SoundEffects.CountInType.Normal, "Type", "Set the type of sounds to use for the count-in.")
|
||||
},
|
||||
delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length / 4f, e["type"]); }
|
||||
delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
SoundEffects.FourBeatCountIn(e.beat, e.length / 4f, e["type"]);
|
||||
}
|
||||
),
|
||||
new GameAction("8 beat count-in", "8 Beat Count-In", 8f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("type", SoundEffects.CountInType.Normal, "Type", "Set the type of sounds to use for the count-in.")
|
||||
},
|
||||
delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length / 8f, e["type"]); }
|
||||
delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
SoundEffects.EightBeatCountIn(e.beat, e.length / 8f, e["type"]);
|
||||
}
|
||||
),
|
||||
new GameAction("count", "Count", 1f, false,
|
||||
new List<Param>()
|
||||
@ -778,13 +801,16 @@ namespace HeavenStudio
|
||||
new Param("type", SoundEffects.CountNumbers.One, "Type", "Set the number to say."),
|
||||
new Param("toggle", false, "Alt", "Toggle if the alternate version of this voice line should be used.")
|
||||
},
|
||||
delegate { var e = eventCaller.currentEntity; SoundEffects.Count(e["type"], e["toggle"]); }
|
||||
delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
SoundEffects.Count(e["type"], e["toggle"]);
|
||||
}
|
||||
),
|
||||
new GameAction("cowbell", "Cowbell",
|
||||
function: delegate { SoundEffects.Cowbell(); }
|
||||
),
|
||||
new GameAction("ready!", "Ready!", 2f, true,
|
||||
function: delegate { var e = eventCaller.currentEntity; SoundEffects.Ready(e.beat, e.length / 2f); }
|
||||
function: delegate { var e = eventCaller.currentEntity; SoundEffects.Ready(e.beat, (e.length / 2f)); }
|
||||
),
|
||||
new GameAction("and", "And", 0.5f,
|
||||
function: delegate { SoundEffects.And(); }
|
||||
@ -816,7 +842,7 @@ namespace HeavenStudio
|
||||
|
||||
new Minigame("vfx", "Visual Effects", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("flash", "Flash", 1f, true,
|
||||
new GameAction("flash", "Flash/Fade", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("colorA", Color.white, "Start Color", "Set the color at the start of the event."),
|
||||
@ -853,7 +879,7 @@ namespace HeavenStudio
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left", "Set the position on the X axis."),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down", "Set the position on the Y axis."),
|
||||
new Param("valC", new EntityTypes.Float(-0, 250, 10), "In / Out", "Set the position on the Z axis."),
|
||||
new Param("valC", new EntityTypes.Float(-250, 250, 10), "In / Out", "Set the position on the Z axis."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action."),
|
||||
new Param("axis", GameCamera.CameraAxis.All, "Axis", "Set if only a specific axis should be modified." )
|
||||
}
|
||||
@ -883,8 +909,8 @@ namespace HeavenStudio
|
||||
),
|
||||
new GameAction("scale view", "Scale Viewport", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(0, 50, 1), "Width", "Set the width of the viewport."),
|
||||
new Param("valB", new EntityTypes.Float(0, 50, 1), "Height", "Set the height of the viewport."),
|
||||
new Param("valA", new EntityTypes.Float(-50f, 50, 1), "Width", "Set the width of the viewport."),
|
||||
new Param("valB", new EntityTypes.Float(-50f, 50, 1), "Height", "Set the height of the viewport."),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action."),
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "Set if only a specific axis should be modified." )
|
||||
}
|
||||
@ -894,10 +920,10 @@ namespace HeavenStudio
|
||||
resizable = true,
|
||||
parameters = new()
|
||||
{
|
||||
new("x1", new EntityTypes.Float(0f, 50f, 1f), "Start Width", "Set the width at the start of the event."),
|
||||
new("x2", new EntityTypes.Float(0f, 50f, 1f), "End Width", "Set the width at the end of the event."),
|
||||
new("y1", new EntityTypes.Float(0f, 50f, 1f), "Start Height", "Set the height at the start of the event."),
|
||||
new("y2", new EntityTypes.Float(0f, 50f, 1f), "End Height", "Set the height at the end of the event."),
|
||||
new("x1", new EntityTypes.Float(-50f, 50f, 1f), "Start Width", "Set the width at the start of the event."),
|
||||
new("x2", new EntityTypes.Float(-50f, 50f, 1f), "End Width", "Set the width at the end of the event."),
|
||||
new("y1", new EntityTypes.Float(-50f, 50f, 1f), "Start Height", "Set the height at the start of the event."),
|
||||
new("y2", new EntityTypes.Float(-50f, 50f, 1f), "End Height", "Set the height at the end of the event."),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "x1", "y1" })
|
||||
@ -1111,7 +1137,7 @@ namespace HeavenStudio
|
||||
new("xEnd", new EntityTypes.Float(1, 100, 1), "End Horizontal Tiles", "Set the amount of horizontal tiles at the end of the event."),
|
||||
new("yStart", new EntityTypes.Float(1, 100, 1), "Start Vertical Tiles", "Set the amount of vertical tiles at the start of the event."),
|
||||
new("yEnd", new EntityTypes.Float(1, 100, 1), "End Vertical Tiles", "Set the amount of vertical tiles at the end of the event."),
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "Set if only a specific axis should be modified."),
|
||||
new("axis", StaticCamera.ViewAxis.All, "Axis", "Set if only a specific axis should be modified."),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xStart", "yStart" })
|
||||
@ -1127,7 +1153,7 @@ namespace HeavenStudio
|
||||
new("xScrollEnd", new EntityTypes.Float(-100, 100, 0), "End Horizontal Scroll", "Set the horizontal scroll at the end of the event."),
|
||||
new("yScrollStart", new EntityTypes.Float(-100, 100, 0), "Start Vertical Scroll", "Set the vertical scroll at the start of the event."),
|
||||
new("yScrollEnd", new EntityTypes.Float(-100, 100, 0), "End Vertical Scroll", "Set the vertical scroll at the end of the event."),
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "Set if only a specific axis should be modified."),
|
||||
new("axis", StaticCamera.ViewAxis.All, "Axis", "Set if only a specific axis should be modified."),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xScrollStart", "yScrollStart" })
|
||||
@ -1135,6 +1161,105 @@ namespace HeavenStudio
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
new Minigame("advanced", "Advanced", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("play animation", "Play Animation", 0.5f, false,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("getAnimators", new EntityTypes.Button("No Game", e => {
|
||||
var gm = GameManager.instance;
|
||||
Minigame game = gm.GetGameInfo(gm.currentGame);
|
||||
if (game != null) {
|
||||
var animators = gm.minigameObj.transform.GetComponentsInChildren<Animator>();
|
||||
// not in an update loop so it's fine :3
|
||||
((EntityTypes.DropdownObj)e["animator"]).SetValues(animators.Select(anim => {
|
||||
var obj = anim.gameObject;
|
||||
List<string> path = new() { obj.name };
|
||||
for (int i = 0; i < 10; i++)
|
||||
{
|
||||
if (obj.transform.parent == null || obj.transform.parent.name == game.name) break;
|
||||
obj = obj.transform.parent.gameObject;
|
||||
path.Add(obj.name);
|
||||
}
|
||||
return string.Join('/', path);
|
||||
}).ToList());
|
||||
}
|
||||
return game?.displayName ?? "No Game";
|
||||
}), "Get Animators", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)", new() {
|
||||
new((x, _) => (string)x != "No Game", "animator", "getAnimations")
|
||||
}),
|
||||
new Param("animator", new EntityTypes.Dropdown(), "Animator", "Specify which animator in the scene to play an animation on."),
|
||||
new Param("getAnimations", new EntityTypes.Button("", e => {
|
||||
var gm = GameManager.instance;
|
||||
Minigame game = gm.GetGameInfo(gm.currentGame);
|
||||
string animPath = ((EntityTypes.DropdownObj)e["animator"]).CurrentValue;
|
||||
Animator animator = null;
|
||||
if (!string.IsNullOrEmpty(animPath)) {
|
||||
var animObj = gm.minigameObj.transform.Find(animPath);
|
||||
if (animObj != null && animObj.TryGetComponent(out animator) && animator != null) {
|
||||
List<string> animationClips = new();
|
||||
foreach (var clip in animator.runtimeAnimatorController.animationClips) {
|
||||
if (clip != null) {
|
||||
animationClips.Add(clip.name);
|
||||
}
|
||||
}
|
||||
((EntityTypes.DropdownObj)e["animation"]).SetValues(animationClips);
|
||||
}
|
||||
}
|
||||
return animator != null ? animator.name : "";
|
||||
}), "Get Animations", "Get all the animations in the selected animator.", new() {
|
||||
new((x, _) => (string)x != "", "animation", "scale")
|
||||
}),
|
||||
new Param("animation", new EntityTypes.Dropdown(), "Animation", "Specify the name of the animation to play."),
|
||||
new Param("scale", new EntityTypes.Float(0, 5, 0.5f), "Animation Scale", "The time scale of the animation. Higher values are faster."),
|
||||
},
|
||||
delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
GameManager.instance.PlayAnimationArbitrary(e["animator"].CurrentValue, e["animation"].CurrentValue, e["scale"]);
|
||||
}
|
||||
),
|
||||
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."),
|
||||
new Param("getSfx", new EntityTypes.Button("", e => {
|
||||
string gameName = ((EntityTypes.DropdownObj)e["game"]).CurrentValue;
|
||||
List<string> clips;
|
||||
if (eventCaller.minigames.TryGetValue(gameName, out Minigame game) && game != null) {
|
||||
IEnumerable<AudioClip> audioClips = game.GetCommonAssetBundle().LoadAllAssets<AudioClip>();
|
||||
var localAssBun = game.GetLocalizedAssetBundle();
|
||||
if (localAssBun != null) {
|
||||
audioClips = audioClips.Concat(localAssBun.LoadAllAssets<AudioClip>());
|
||||
}
|
||||
clips = audioClips.Select(x => x.name).ToList();
|
||||
} else {
|
||||
// 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 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("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;
|
||||
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"]);
|
||||
}
|
||||
),
|
||||
}),
|
||||
};
|
||||
|
||||
foreach (var game in defaultGames)
|
||||
@ -1143,6 +1268,10 @@ namespace HeavenStudio
|
||||
}
|
||||
|
||||
LoadMinigames(eventCaller);
|
||||
|
||||
// im so sorry
|
||||
eventCaller.minigames["advanced"].actions
|
||||
.Find(a => a.actionName == "play sfx").parameters[0].parameter = new EntityTypes.Dropdown(0, new string[] { "common" }.Concat(eventCaller.minigames.Keys.Skip(defaultGames.Count)).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -29,7 +29,7 @@ namespace HeavenStudio.Common
|
||||
GlobalGameManager.DEFAULT_SCREEN_SIZES[1].width,
|
||||
GlobalGameManager.DEFAULT_SCREEN_SIZES[1].height,
|
||||
0.8f,
|
||||
512,
|
||||
340,
|
||||
48000,
|
||||
true,
|
||||
true,
|
||||
@ -37,6 +37,7 @@ namespace HeavenStudio.Common
|
||||
true,
|
||||
false,
|
||||
true,
|
||||
true,
|
||||
true
|
||||
);
|
||||
|
||||
@ -119,7 +120,7 @@ namespace HeavenStudio.Common
|
||||
int resolutionWidth = 1280,
|
||||
int resolutionHeight = 720,
|
||||
float masterVolume = 0.8f,
|
||||
int dspSize = 512,
|
||||
int dspSize = 340,
|
||||
int sampleRate = 44100,
|
||||
bool editorCursorEnable = true,
|
||||
bool discordRPCEnable = true,
|
||||
@ -130,7 +131,8 @@ namespace HeavenStudio.Common
|
||||
bool letterboxBgEnable = true,
|
||||
bool letterboxFxEnable = true,
|
||||
int editorScale = 0,
|
||||
bool scaleWScreenSize = false
|
||||
bool scaleWScreenSize = false,
|
||||
bool showParamTooltips = true
|
||||
)
|
||||
{
|
||||
this.showSplash = showSplash;
|
||||
@ -151,6 +153,7 @@ namespace HeavenStudio.Common
|
||||
this.discordRPCEnable = true;
|
||||
this.editorScale = editorScale;
|
||||
this.scaleWScreenSize = scaleWScreenSize;
|
||||
this.showParamTooltips = showParamTooltips;
|
||||
|
||||
this.perfectChallengeType = perfectChallengeType;
|
||||
this.isMedalOn = isMedalOn;
|
||||
@ -190,6 +193,8 @@ namespace HeavenStudio.Common
|
||||
public bool discordRPCEnable;
|
||||
public int editorScale;
|
||||
public bool scaleWScreenSize;
|
||||
public bool showParamTooltips;
|
||||
// public bool showCornerTooltips;
|
||||
|
||||
// Gameplay Settings
|
||||
public PerfectChallengeType perfectChallengeType;
|
||||
|
@ -8,17 +8,19 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
public class EditorSettings : TabsContent
|
||||
{
|
||||
public Toggle cursorCheckbox;
|
||||
public Toggle discordRPCCheckbox;
|
||||
public Button editorScaleDecre, editorScaleIncre;
|
||||
public Toggle scaleWSS;
|
||||
[SerializeField] Toggle cursorCheckbox;
|
||||
[SerializeField] Toggle discordRPCCheckbox;
|
||||
[SerializeField] Button editorScaleDecre, editorScaleIncre;
|
||||
[SerializeField] Toggle scaleWSS;
|
||||
[SerializeField] Toggle paramTooltipsToggle;
|
||||
// [SerializeField] Toggle cornerTooltipsToggle;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
cursorCheckbox.isOn = PersistentDataManager.gameSettings.editorCursorEnable;
|
||||
discordRPCCheckbox.isOn = PersistentDataManager.gameSettings.discordRPCEnable;
|
||||
scaleWSS.isOn = PersistentDataManager.gameSettings.scaleWScreenSize;
|
||||
|
||||
paramTooltipsToggle.isOn = PersistentDataManager.gameSettings.showParamTooltips;
|
||||
|
||||
SetDecreIncreInteractable();
|
||||
}
|
||||
@ -41,12 +43,7 @@ namespace HeavenStudio.Editor
|
||||
|
||||
public override void OnOpenTab()
|
||||
{
|
||||
cursorCheckbox.isOn = PersistentDataManager.gameSettings.editorCursorEnable;
|
||||
discordRPCCheckbox.isOn = PersistentDataManager.gameSettings.discordRPCEnable;
|
||||
scaleWSS.isOn = PersistentDataManager.gameSettings.scaleWScreenSize;
|
||||
|
||||
|
||||
SetDecreIncreInteractable();
|
||||
Start();
|
||||
}
|
||||
|
||||
public override void OnCloseTab()
|
||||
@ -59,6 +56,16 @@ namespace HeavenStudio.Editor
|
||||
scaleWSS.isOn = PersistentDataManager.gameSettings.scaleWScreenSize;
|
||||
}
|
||||
|
||||
public void OnParamTooltipsChanged()
|
||||
{
|
||||
PersistentDataManager.gameSettings.showParamTooltips = paramTooltipsToggle.isOn;
|
||||
}
|
||||
|
||||
// public void OnCornerTooltipsChanged()
|
||||
// {
|
||||
// PersistentDataManager.gameSettings.showParamTooltips = cornerTooltipsToggle.isOn;
|
||||
// }
|
||||
|
||||
public void OnEditorScaleDecre()
|
||||
{
|
||||
PersistentDataManager.gameSettings.editorScale--;
|
||||
|
@ -1,9 +1,9 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using System.Linq;
|
||||
using Jukebox;
|
||||
using Newtonsoft.Json;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
@ -29,7 +29,7 @@ namespace HeavenStudio
|
||||
public float val;
|
||||
public float max;
|
||||
|
||||
public Float(float min, float max, float val = 0f)
|
||||
public Float(float min, float max, float val = 0)
|
||||
{
|
||||
this.min = min;
|
||||
this.val = val;
|
||||
@ -37,6 +37,84 @@ namespace HeavenStudio
|
||||
}
|
||||
}
|
||||
|
||||
// this will eventually replace Float and Integer
|
||||
public struct Number
|
||||
{
|
||||
public float snap;
|
||||
public float min;
|
||||
public float val;
|
||||
public float max;
|
||||
|
||||
public Number(float snap, float min, float max, float val = 0)
|
||||
{
|
||||
this.snap = snap;
|
||||
this.min = min;
|
||||
this.val = val;
|
||||
this.max = max;
|
||||
}
|
||||
|
||||
public Number(float min, float max, float val = 0)
|
||||
{
|
||||
this.snap = 0.001f;
|
||||
this.min = min;
|
||||
this.val = val;
|
||||
this.max = max;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Button
|
||||
{
|
||||
public string defaultLabel;
|
||||
public Func<RiqEntity, string> onClick;
|
||||
|
||||
public Button(string defaultLabel, Func<RiqEntity, string> onClick)
|
||||
{
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.onClick = onClick;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Dropdown
|
||||
{
|
||||
public int defaultValue;
|
||||
public List<string> values;
|
||||
|
||||
public Dropdown(int defaultValue = 0, params string[] values)
|
||||
{
|
||||
this.defaultValue = defaultValue;
|
||||
this.values = values.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
public class DropdownObj
|
||||
{
|
||||
public void SetValues(List<string> values)
|
||||
{
|
||||
Values = values ?? new();
|
||||
onValueChanged?.Invoke(values);
|
||||
}
|
||||
public int value;
|
||||
public List<string> Values { get; private set; }
|
||||
[JsonIgnore] public string CurrentValue => value < Values?.Count ? Values?[value] : null;
|
||||
[JsonIgnore] public Action<List<string>> onValueChanged;
|
||||
|
||||
public DropdownObj(int defaultValue = 0, List<string> values = null)
|
||||
{
|
||||
value = defaultValue;
|
||||
Values = values ?? new();
|
||||
|
||||
onValueChanged = null;
|
||||
}
|
||||
|
||||
public DropdownObj(Dropdown dd)
|
||||
{
|
||||
value = dd.defaultValue;
|
||||
Values = dd.values ?? new();
|
||||
|
||||
onValueChanged = null;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Resource
|
||||
{
|
||||
public enum ResourceType
|
||||
|
@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Cysharp.Threading.Tasks.Triggers;
|
||||
|
||||
namespace HeavenStudio.Util
|
||||
{
|
||||
@ -36,12 +35,15 @@ namespace HeavenStudio.Util
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static MultiSound Play(Sound[] snds, bool game = true, bool forcePlay = false)
|
||||
{
|
||||
if (Conductor.instance == null) return null;
|
||||
return Play(snds.ToList(), game, forcePlay);
|
||||
}
|
||||
|
||||
public static MultiSound Play(List<Sound> sounds, bool game = true, bool forcePlay = false)
|
||||
{
|
||||
if (Conductor.instance == null || sounds.Count <= 0) return null;
|
||||
|
||||
List<Sound> sounds = snds.ToList();
|
||||
GameObject go = new GameObject("MultiSound");
|
||||
MultiSound ms = go.AddComponent<MultiSound>();
|
||||
|
||||
|
@ -14,7 +14,7 @@ namespace HeavenStudio.Util
|
||||
static AudioSource oneShotAudioSource;
|
||||
static int soundIdx = 0;
|
||||
|
||||
static Dictionary<string, AudioClip> audioClips = new Dictionary<string, AudioClip>();
|
||||
public static Dictionary<string, AudioClip> audioClips { get; private set; } = new Dictionary<string, AudioClip>();
|
||||
|
||||
public enum AudioType
|
||||
{
|
||||
|
Reference in New Issue
Block a user