grah it's ALMOST DONE
This commit is contained in:
parent
1a1ae0135d
commit
e2a544f154
|
|
@ -55,6 +55,9 @@ MonoBehaviour:
|
|||
caption: {fileID: 161819469598736649}
|
||||
parameterManager: {fileID: 0}
|
||||
propertyName:
|
||||
minButtonSize: 100
|
||||
buttonTextRect: {fileID: 1122443660375095479}
|
||||
buttonRect: {fileID: 1122443659071379076}
|
||||
buttonText: {fileID: 1122443660375095464}
|
||||
--- !u!114 &1492239408036616687
|
||||
MonoBehaviour:
|
||||
|
|
@ -233,8 +236,6 @@ GameObject:
|
|||
- component: {fileID: 1122443659071379079}
|
||||
- component: {fileID: 1122443659071379078}
|
||||
- component: {fileID: 1122443659071379077}
|
||||
- component: {fileID: 3024171755225952565}
|
||||
- component: {fileID: 5920247012653829200}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
|
|
@ -260,8 +261,8 @@ RectTransform:
|
|||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 527.08514, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 30}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 213.47, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1122443659071379079
|
||||
CanvasRenderer:
|
||||
|
|
@ -357,46 +358,6 @@ MonoBehaviour:
|
|||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &3024171755225952565
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1122443659071379075}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 3
|
||||
m_Spacing: 0
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 1
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 1
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
||||
--- !u!114 &5920247012653829200
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1122443659071379075}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 0
|
||||
--- !u!1 &1122443660375095478
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
@ -408,6 +369,7 @@ GameObject:
|
|||
- component: {fileID: 1122443660375095479}
|
||||
- component: {fileID: 1122443660375095465}
|
||||
- component: {fileID: 1122443660375095464}
|
||||
- component: {fileID: 1641598248478253416}
|
||||
m_Layer: 5
|
||||
m_Name: Text (TMP)
|
||||
m_TagString: Untagged
|
||||
|
|
@ -430,9 +392,9 @@ RectTransform:
|
|||
m_Father: {fileID: 1122443659071379076}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: -0.2649994, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1122443660375095465
|
||||
|
|
@ -534,3 +496,17 @@ MonoBehaviour:
|
|||
m_hasFontAssetChanged: 0
|
||||
m_baseMaterial: {fileID: 0}
|
||||
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
|
||||
--- !u!114 &1641598248478253416
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1122443660375095478}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_HorizontalFit: 2
|
||||
m_VerticalFit: 0
|
||||
|
|
|
|||
|
|
@ -1480,3 +1480,4 @@ MonoBehaviour:
|
|||
parameterManager: {fileID: 0}
|
||||
propertyName:
|
||||
dropdown: {fileID: 2779900777391844534}
|
||||
scrollbar: {fileID: 2779900776400187972}
|
||||
|
|
|
|||
|
|
@ -620,9 +620,9 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
|
||||
public static void PlaySFXArbitrary(double beat, string game, string name, float pitch, float offset)
|
||||
public static void PlaySFXArbitrary(double beat, string game, string name, float pitch, int offset)
|
||||
{
|
||||
if (string.IsNullOrEmpty(game) || string.IsNullOrEmpty(name)) return;
|
||||
if (string.IsNullOrEmpty(name)) return;
|
||||
if (string.IsNullOrEmpty(game)) {
|
||||
SoundByte.PlayOneShot(name, beat, pitch, offset: offset);
|
||||
} else {
|
||||
|
|
@ -633,7 +633,6 @@ namespace HeavenStudio
|
|||
|
||||
public void PlayAnimationArbitrary(string animator, string animation, float scale)
|
||||
{
|
||||
// if possible (efficient enough) id like to find the object recursively, but for now this works
|
||||
Transform animTrans = minigameObj.transform.Find(animator);
|
||||
if (animTrans != null && animTrans.TryGetComponent(out Animator anim)) {
|
||||
anim.DoScaledAnimationAsync(animation, scale);
|
||||
|
|
|
|||
|
|
@ -140,13 +140,11 @@ namespace HeavenStudio.Editor
|
|||
}
|
||||
print(propertyPrefab.name);
|
||||
|
||||
GameObject input = Instantiate(propertyPrefab);
|
||||
input.transform.SetParent(this.gameObject.transform);
|
||||
GameObject input = Instantiate(propertyPrefab, transform);
|
||||
input.SetActive(true);
|
||||
input.transform.localScale = Vector3.one;
|
||||
|
||||
if (tooltip != string.Empty) {
|
||||
Debug.Log(PersistentDataManager.gameSettings.showParamTooltips);
|
||||
if (PersistentDataManager.gameSettings.showParamTooltips) {
|
||||
Tooltip.AddTooltip(input, tooltip);
|
||||
} else {
|
||||
|
|
@ -160,20 +158,6 @@ namespace HeavenStudio.Editor
|
|||
return input;
|
||||
}
|
||||
|
||||
// private GameObject InitPrefab(GameObject prefab, string tooltip = "")
|
||||
// {
|
||||
// GameObject input = Instantiate(prefab);
|
||||
// input.transform.SetParent(this.gameObject.transform);
|
||||
// input.SetActive(true);
|
||||
// input.transform.localScale = Vector3.one;
|
||||
|
||||
// if (tooltip != string.Empty) {
|
||||
// Tooltip.AddTooltip(input, "", tooltip);
|
||||
// }
|
||||
|
||||
// return input;
|
||||
// }
|
||||
|
||||
private void DestroyParams()
|
||||
{
|
||||
Editor.instance.editingInputField = false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
|
|
@ -8,7 +9,9 @@ namespace HeavenStudio.Editor
|
|||
{
|
||||
[Header("Boolean")]
|
||||
[Space(10)]
|
||||
// public Button buttonObj;
|
||||
public float minButtonSize;
|
||||
public RectTransform buttonTextRect;
|
||||
public RectTransform buttonRect;
|
||||
public TMP_Text buttonText;
|
||||
public EntityTypes.Button button;
|
||||
|
||||
|
|
@ -31,15 +34,30 @@ namespace HeavenStudio.Editor
|
|||
if (text != null) {
|
||||
buttonText.text = entity[propertyName] = text;
|
||||
}
|
||||
UpdateCollapse(entity[propertyName]);
|
||||
}
|
||||
|
||||
// OnClick() already handles this.
|
||||
// if somebody wants to uncomment this for their thing feel free but it's unused for now -AJ
|
||||
// private void LateUpdate()
|
||||
// {
|
||||
// if (entity[propertyName] != buttonText.text) {
|
||||
// buttonText.text = 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];
|
||||
// }
|
||||
|
||||
Debug.Log(buttonTextRect.sizeDelta.x > minButtonSize ? "buttonTextRect.sizeDelta.x : " + buttonTextRect.sizeDelta.x : "minButtonSize : " + minButtonSize);
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ namespace HeavenStudio.Editor
|
|||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public LeftClickTMP_Dropdown dropdown;
|
||||
public Scrollbar scrollbar;
|
||||
|
||||
private int _defaultValue;
|
||||
|
||||
|
|
@ -32,20 +33,23 @@ namespace HeavenStudio.Editor
|
|||
{
|
||||
case EntityTypes.Dropdown dropdownEntity:
|
||||
// entity[propertyName].ChangeValues(dropdownEntity.Values);
|
||||
_defaultValue = dropdownEntity.defaultValue;
|
||||
EntityTypes.DropdownObj dropdownObj = entity[propertyName];
|
||||
selected = dropdownObj.currentIndex;
|
||||
selected = dropdownObj.value;
|
||||
dropdown.AddOptions(dropdownObj.Values);
|
||||
dropdown.onValueChanged.AddListener(newVal => dropdownObj.currentIndex = newVal);
|
||||
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]);
|
||||
|
||||
|
|
@ -76,9 +80,6 @@ namespace HeavenStudio.Editor
|
|||
|
||||
private void Update()
|
||||
{
|
||||
var scrollbar = GetComponentInChildren<ScrollRect>()?.verticalScrollbar;
|
||||
|
||||
// This is bad but we'll fix it later.
|
||||
if (scrollbar != null)
|
||||
{
|
||||
if (openedDropdown == false)
|
||||
|
|
|
|||
|
|
@ -891,7 +891,7 @@ namespace HeavenStudio.Editor.Track
|
|||
object returnVal = ep[i].parameter switch {
|
||||
EntityTypes.Integer intVal => intVal.val,
|
||||
EntityTypes.Float floatVal => floatVal.val,
|
||||
EntityTypes.Button buttonVal => buttonVal.label,
|
||||
EntityTypes.Button buttonVal => buttonVal.defaultLabel,
|
||||
EntityTypes.Dropdown ddVal => new EntityTypes.DropdownObj(ddVal.defaultValue, ddVal.values),
|
||||
_ => ep[i].parameter,
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1176,14 +1176,17 @@ namespace HeavenStudio
|
|||
}).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!)"),
|
||||
}), "Get Animators", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)", new() {
|
||||
new((x, _) => { Debug.Log(x.GetType()); return (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;
|
||||
Debug.Log(animPath);
|
||||
Animator animator = null;
|
||||
if (animPath != null) {
|
||||
if (!string.IsNullOrEmpty(animPath)) {
|
||||
var animObj = gm.minigameObj.transform.Find(animPath);
|
||||
if (animObj != null && animObj.TryGetComponent(out animator) && animator != null) {
|
||||
var animations = animator
|
||||
|
|
@ -1194,8 +1197,10 @@ namespace HeavenStudio
|
|||
((EntityTypes.DropdownObj)e["animation"]).SetValues(animations);
|
||||
}
|
||||
}
|
||||
return animator != null ? animator.name : "N/A";
|
||||
}), "Get Animations", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)"),
|
||||
return animator != null ? animator.name : "";
|
||||
}), "Get Animations", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)", 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."),
|
||||
},
|
||||
|
|
@ -1207,33 +1212,22 @@ namespace HeavenStudio
|
|||
new GameAction("play sfx", "Play SFX", 0.5f, false,
|
||||
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() {
|
||||
new((x, e) => {
|
||||
// Minigame game = eventCaller.minigames[((EntityTypes.DropdownObj)x).CurrentValue];
|
||||
string gameName = ((EntityTypes.DropdownObj)e["game"]).CurrentValue;
|
||||
Minigame game = eventCaller.minigames[gameName];
|
||||
int startFrom = "assets/resources/sfx/".Length - 1;
|
||||
foreach (var thing in game.GetCommonAssetBundle().GetAllAssetNames())
|
||||
{
|
||||
Debug.Log(thing);
|
||||
}
|
||||
List<string> clips = new() { "" };
|
||||
foreach (var clip in game.GetCommonAssetBundle().GetAllAssetNames().Concat(game.GetLocalizedAssetBundle().GetAllAssetNames()))
|
||||
{
|
||||
string[] splitClip = clip[startFrom..].Split('/');
|
||||
if (splitClip[0] == "games" && splitClip[1] == gameName) {
|
||||
clips.Add(splitClip[2]);
|
||||
Debug.Log(splitClip[2]);
|
||||
}
|
||||
}
|
||||
EntityTypes.DropdownObj sfxDD = e["sfxName"];
|
||||
sfxDD.SetValues(clips);
|
||||
return true;
|
||||
}),
|
||||
}),
|
||||
new Param("game", new EntityTypes.Dropdown(), "Which Game", "Specify the game's sfx to play. An empty input will play global sfx."),
|
||||
new Param("getAnimations", new EntityTypes.Button("", e => {
|
||||
string gameName = ((EntityTypes.DropdownObj)e["game"]).CurrentValue;
|
||||
Minigame game = eventCaller.minigames[gameName];
|
||||
IEnumerable<AudioClip> audioClips = game.GetCommonAssetBundle().LoadAllAssets<AudioClip>();
|
||||
var localAssBun = game.GetLocalizedAssetBundle();
|
||||
if (localAssBun != null) {
|
||||
audioClips = audioClips.Concat(localAssBun.LoadAllAssets<AudioClip>());
|
||||
}
|
||||
EntityTypes.DropdownObj sfxDD = e["sfxName"];
|
||||
sfxDD.SetValues(audioClips.Select(x => x.name).ToList());
|
||||
return !string.IsNullOrEmpty(gameName) ? eventCaller.minigames[gameName]?.displayName : "N/A";
|
||||
}), "Get Animations", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)"),
|
||||
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.Float(-500, 500), "Offset (ms)", "The sfx's offset in milliseconds."),
|
||||
new Param("offset", new EntityTypes.Integer(-500, 500), "Offset (ms)", "The sfx's offset in milliseconds."),
|
||||
},
|
||||
preFunction : delegate {
|
||||
var e = eventCaller.currentEntity;
|
||||
|
|
@ -1250,8 +1244,9 @@ namespace HeavenStudio
|
|||
|
||||
LoadMinigames(eventCaller);
|
||||
|
||||
// im so sorry
|
||||
eventCaller.minigames["advanced"].actions
|
||||
.Find(a => a.actionName == "play sfx").parameters[0].parameter = new EntityTypes.Dropdown(0, eventCaller.minigames.Keys.Skip(defaultGames.Count).ToArray());
|
||||
.Find(a => a.actionName == "play sfx").parameters[0].parameter = new EntityTypes.Dropdown(0, eventCaller.minigames.Keys.Skip(defaultGames.Count).Concat(new string[] { "" }).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -64,12 +64,12 @@ namespace HeavenStudio
|
|||
|
||||
public struct Button
|
||||
{
|
||||
public string label;
|
||||
public string defaultLabel;
|
||||
public Func<RiqEntity, string> onClick;
|
||||
|
||||
public Button(string defaultLabel, Func<RiqEntity, string> onClick)
|
||||
{
|
||||
this.label = defaultLabel;
|
||||
this.defaultLabel = defaultLabel;
|
||||
this.onClick = onClick;
|
||||
}
|
||||
}
|
||||
|
|
@ -90,21 +90,19 @@ namespace HeavenStudio
|
|||
{
|
||||
public void SetValues(List<string> values)
|
||||
{
|
||||
this.Values = values ?? new();
|
||||
Values = values ?? new();
|
||||
onValueChanged?.Invoke(values);
|
||||
}
|
||||
public int value;
|
||||
public List<string> Values { get; private set; }
|
||||
public int currentIndex;
|
||||
public string CurrentValue => currentIndex < Values?.Count - 1 ? Values?[currentIndex] : null;
|
||||
[JsonIgnore] public string CurrentValue => value < Values?.Count - 1 ? Values?[value] : null;
|
||||
[JsonIgnore] public Action<List<string>> onValueChanged;
|
||||
|
||||
public DropdownObj(int value = 0, List<string> values = null)
|
||||
public DropdownObj(int defaultValue = 0, List<string> values = null)
|
||||
{
|
||||
this.value = value;
|
||||
this.Values = values ?? new();
|
||||
value = defaultValue;
|
||||
Values = values ?? new();
|
||||
|
||||
currentIndex = 0;
|
||||
onValueChanged = null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue