ITS WORKING ITS WORKING ITS WORKING
arbitrary animations, now accessible to those without prefab knowledge! and it's piss easy to use!!
This commit is contained in:
parent
e2b2f0aa62
commit
aeaad9dde0
BIN
Assets/Resources/Sprites/Editor/GameIcons/advanced.png
Normal file
BIN
Assets/Resources/Sprites/Editor/GameIcons/advanced.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 19 KiB |
123
Assets/Resources/Sprites/Editor/GameIcons/advanced.png.meta
Normal file
123
Assets/Resources/Sprites/Editor/GameIcons/advanced.png.meta
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5e8d7a42a8188ef42b113cab198f5aaa
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 12
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMasterTextureLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 1
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 3
|
||||||
|
buildTarget: Server
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
spritePackingTag:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
pSDShowRemoveMatteOption: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|
@ -1,12 +1,14 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
|
|
||||||
using HeavenStudio.Common;
|
using HeavenStudio.Common;
|
||||||
|
using Jukebox;
|
||||||
|
|
||||||
namespace HeavenStudio.Editor
|
namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
|
|
@ -15,9 +17,7 @@ namespace HeavenStudio.Editor
|
||||||
[Header("Dropdown")]
|
[Header("Dropdown")]
|
||||||
[Space(10)]
|
[Space(10)]
|
||||||
public LeftClickTMP_Dropdown dropdown;
|
public LeftClickTMP_Dropdown dropdown;
|
||||||
// private string[] values;
|
private List<int> keys;
|
||||||
private List<string> names;
|
|
||||||
private List<(int, string)> values;
|
|
||||||
|
|
||||||
private int _defaultValue;
|
private int _defaultValue;
|
||||||
|
|
||||||
|
|
@ -35,20 +35,40 @@ namespace HeavenStudio.Editor
|
||||||
// Can we assume non-holey enum?
|
// Can we assume non-holey enum?
|
||||||
// If we can we can simplify to dropdown.value = (int) parameterManager.entity[propertyName]
|
// If we can we can simplify to dropdown.value = (int) parameterManager.entity[propertyName]
|
||||||
// var currentlySelected = (int)parameterManager.entity[propertyName];
|
// var currentlySelected = (int)parameterManager.entity[propertyName];
|
||||||
// var selected = values
|
RiqEntity entity = parameterManager.entity;
|
||||||
// .Cast<object>()
|
int selected = 0;
|
||||||
// .ToList()
|
|
||||||
// .FindIndex(val => (int) val == currentlySelected);
|
|
||||||
|
|
||||||
if (type is not EntityTypes.Dropdown dropdownEntity) return;
|
switch (type)
|
||||||
|
{
|
||||||
|
case EntityTypes.Dropdown dropdownEntity:
|
||||||
|
entity[propertyName].values = dropdownEntity.values;
|
||||||
|
selected = dropdownEntity.defaultValue;
|
||||||
|
break;
|
||||||
|
case Enum enumEntity:
|
||||||
|
var enumType = enumEntity.GetType();
|
||||||
|
entity[propertyName] = Enum.GetNames(enumType).ToList();
|
||||||
|
keys = Enum.GetValues(enumType).Cast<int>().ToList();
|
||||||
|
for (int i = 0; i < keys.Count; i++) {
|
||||||
|
print("key " + (i + 1) + " : " + keys[i]);
|
||||||
|
}
|
||||||
|
selected = keys.FindIndex(val => val == (int)entity[propertyName]);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
dropdown.AddOptions(entity[propertyName].values);
|
||||||
|
dropdown.value = selected;
|
||||||
|
|
||||||
names = dropdownEntity.values;
|
entity[propertyName].valueChanged = new Action<List<string>>(newValues =>
|
||||||
dropdown.AddOptions(names);
|
{
|
||||||
dropdown.value = (int)parameterManager.entity[propertyName];
|
print(string.Join(", ", entity[propertyName].values));
|
||||||
|
dropdown.ClearOptions();
|
||||||
|
dropdown.AddOptions(newValues);
|
||||||
|
});
|
||||||
|
|
||||||
dropdown.onValueChanged.AddListener(newValue =>
|
dropdown.onValueChanged.AddListener(newValue =>
|
||||||
{
|
{
|
||||||
parameterManager.entity[propertyName] = newValue;
|
parameterManager.entity[propertyName].currentIndex = newValue;
|
||||||
Debug.Log("newValue : " + newValue);
|
Debug.Log("newValue : " + newValue);
|
||||||
this.caption.text = (newValue != _defaultValue) ? (_captionText + "*") : _captionText;
|
this.caption.text = (newValue != _defaultValue) ? (_captionText + "*") : _captionText;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -898,10 +898,6 @@ namespace HeavenStudio.Editor.Track
|
||||||
{
|
{
|
||||||
returnVal = floatVal.val;
|
returnVal = floatVal.val;
|
||||||
}
|
}
|
||||||
else if (returnVal is EntityTypes.Dropdown dropdownVal)
|
|
||||||
{
|
|
||||||
returnVal = dropdownVal.defaultValue;
|
|
||||||
}
|
|
||||||
else if (returnVal.GetType().IsEnum)
|
else if (returnVal.GetType().IsEnum)
|
||||||
{
|
{
|
||||||
returnVal = (int)ep[i].parameter;
|
returnVal = (int)ep[i].parameter;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ using Cysharp.Threading.Tasks;
|
||||||
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
using DG.Tweening;
|
|
||||||
|
|
||||||
using HeavenStudio.Util;
|
using HeavenStudio.Util;
|
||||||
using HeavenStudio.Editor.Track;
|
using HeavenStudio.Editor.Track;
|
||||||
|
|
@ -685,10 +684,7 @@ namespace HeavenStudio
|
||||||
public Param(string propertyName, object parameter, string caption, string tooltip = "", List<CollapseParam> collapseParams = null)
|
public Param(string propertyName, object parameter, string caption, string tooltip = "", List<CollapseParam> collapseParams = null)
|
||||||
{
|
{
|
||||||
this.propertyName = propertyName;
|
this.propertyName = propertyName;
|
||||||
this.parameter = parameter switch {
|
this.parameter = parameter;
|
||||||
// Enum param => new EntityTypes.Dropdown(param),
|
|
||||||
_ => parameter,
|
|
||||||
};
|
|
||||||
this.caption = caption;
|
this.caption = caption;
|
||||||
this.tooltip = tooltip;
|
this.tooltip = tooltip;
|
||||||
this.collapseParams = collapseParams;
|
this.collapseParams = collapseParams;
|
||||||
|
|
@ -1167,7 +1163,18 @@ namespace HeavenStudio
|
||||||
Minigame game = gm.GetGameInfo(gm.currentGame);
|
Minigame game = gm.GetGameInfo(gm.currentGame);
|
||||||
if (game != null) {
|
if (game != null) {
|
||||||
var animators = gm.minigameObj.transform.GetComponentsInChildren<Animator>();
|
var animators = gm.minigameObj.transform.GetComponentsInChildren<Animator>();
|
||||||
e["animator"] = string.Join(", ", animators.Select(anim => {
|
// e["animator"] = string.Join(", ", animators.Select(anim => {
|
||||||
|
// var obj = anim.gameObject;
|
||||||
|
// // string path = "/" + obj.name;
|
||||||
|
// List<string> path = new() { obj.name };
|
||||||
|
// while (obj.transform.parent != null && obj.transform.parent.name != game.name)
|
||||||
|
// {
|
||||||
|
// obj = obj.transform.parent.gameObject;
|
||||||
|
// path.Add(obj.name);
|
||||||
|
// }
|
||||||
|
// return string.Join('/', path);
|
||||||
|
// }));
|
||||||
|
e["animator"].ChangeValues(animators.Select(anim => {
|
||||||
var obj = anim.gameObject;
|
var obj = anim.gameObject;
|
||||||
// string path = "/" + obj.name;
|
// string path = "/" + obj.name;
|
||||||
List<string> path = new() { obj.name };
|
List<string> path = new() { obj.name };
|
||||||
|
|
@ -1177,33 +1184,33 @@ namespace HeavenStudio
|
||||||
path.Add(obj.name);
|
path.Add(obj.name);
|
||||||
}
|
}
|
||||||
return string.Join('/', path);
|
return string.Join('/', path);
|
||||||
}));
|
}).ToList());
|
||||||
}
|
}
|
||||||
return game?.displayName ?? "No Game";
|
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 Param("animator", "", "Animator", "Specify which animator in the scene to play an animation on."),
|
new Param("animator", new EntityTypes.Dropdown(0, "N/A"), "Animator", "Specify which animator in the scene to play an animation on."),
|
||||||
new Param("getAnimations", new EntityTypes.Button("N/A", e => {
|
new Param("getAnimations", new EntityTypes.Button("N/A", e => {
|
||||||
var gm = GameManager.instance;
|
var gm = GameManager.instance;
|
||||||
Minigame game = gm.GetGameInfo(gm.currentGame);
|
Minigame game = gm.GetGameInfo(gm.currentGame);
|
||||||
var animObj = gm.minigameObj.transform.Find((string)e["animator"]);
|
var animObj = gm.minigameObj.transform.Find(((EntityTypes.Dropdown)e["animator"]).currentValue);
|
||||||
Animator animator = null;
|
Animator animator = null;
|
||||||
if (animObj != null && animObj.TryGetComponent(out animator)) {
|
if (animObj != null && animObj.TryGetComponent(out animator) && animator != null) {
|
||||||
e["animations"] = string.Join(", ", animator.runtimeAnimatorController.animationClips.Select(x => x.name));
|
e["animation"].ChangeValues(animator.runtimeAnimatorController.animationClips.Select(x => x.name).ToList());
|
||||||
}
|
}
|
||||||
return animator != null ? animator.name : "N/A";
|
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!)"),
|
}), "Get Animations", "Get all the animators in the current minigame scene. (Make sure to have the minigame you want loaded!)"),
|
||||||
new Param("animations", "", "Animation", "Specify the name of the animation to play."),
|
new Param("animation", new EntityTypes.Dropdown(0, "N/A"), "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."),
|
new Param("scale", new EntityTypes.Float(0, 5, 0.5f), "Animation Scale", "The time scale of the animation. Higher values are faster."),
|
||||||
},
|
},
|
||||||
delegate {
|
delegate {
|
||||||
var e = eventCaller.currentEntity;
|
var e = eventCaller.currentEntity;
|
||||||
GameManager.instance.PlayAnimationArbitrary(e["animator"], e["animation"], e["scale"]);
|
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, false,
|
||||||
new List<Param>()
|
new List<Param>()
|
||||||
{
|
{
|
||||||
new Param("game", "", "Which Game", "Specify the game's sfx to play. An empty input will play global sfx."),
|
new Param("game", new EntityTypes.Dropdown(0, EventCaller.instance.minigames.Values.Select(x => x.displayName).ToArray()), "Which Game", "Specify the game's sfx to play. An empty input will play global sfx."),
|
||||||
new Param("sfxName", "", "SFX Name", "The name of the sfx to play."),
|
new Param("sfxName", "", "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("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.Float(-500, 500), "Offset (ms)", "The sfx's offset in milliseconds."),
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Jukebox;
|
using Jukebox;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
@ -76,22 +77,23 @@ namespace HeavenStudio
|
||||||
|
|
||||||
public struct Dropdown
|
public struct Dropdown
|
||||||
{
|
{
|
||||||
|
public void ChangeValues(List<string> values)
|
||||||
|
{
|
||||||
|
this.values = values;
|
||||||
|
valueChanged?.Invoke(values);
|
||||||
|
}
|
||||||
public int defaultValue;
|
public int defaultValue;
|
||||||
public List<string> values;
|
public List<string> values;
|
||||||
|
public int currentIndex;
|
||||||
|
public readonly string currentValue => values[currentIndex];
|
||||||
|
public Action<List<string>> valueChanged;
|
||||||
|
|
||||||
public Dropdown(int defaultValue, List<string> values)
|
public Dropdown(int defaultValue, params string[] values)
|
||||||
{
|
{
|
||||||
this.defaultValue = defaultValue;
|
this.defaultValue = defaultValue;
|
||||||
this.values = values.ToList();
|
this.values = values.ToList();
|
||||||
}
|
currentIndex = 0;
|
||||||
|
valueChanged = null;
|
||||||
public Dropdown(Enum value)
|
|
||||||
{
|
|
||||||
this.defaultValue = 0;
|
|
||||||
// Debug.Log(value);
|
|
||||||
// Debug.Log(value.GetType());
|
|
||||||
// Debug.Log(value.GetType().DeclaringType);
|
|
||||||
this.values = Enum.GetNames(value.GetType()).ToList();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue