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.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
using HeavenStudio.Common;
|
||||
using Jukebox;
|
||||
|
||||
namespace HeavenStudio.Editor
|
||||
{
|
||||
|
|
@ -15,9 +17,7 @@ namespace HeavenStudio.Editor
|
|||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public LeftClickTMP_Dropdown dropdown;
|
||||
// private string[] values;
|
||||
private List<string> names;
|
||||
private List<(int, string)> values;
|
||||
private List<int> keys;
|
||||
|
||||
private int _defaultValue;
|
||||
|
||||
|
|
@ -34,21 +34,41 @@ namespace HeavenStudio.Editor
|
|||
|
||||
// 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 = values
|
||||
// .Cast<object>()
|
||||
// .ToList()
|
||||
// .FindIndex(val => (int) val == currentlySelected);
|
||||
// var currentlySelected = (int)parameterManager.entity[propertyName];
|
||||
RiqEntity entity = parameterManager.entity;
|
||||
int selected = 0;
|
||||
|
||||
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;
|
||||
dropdown.AddOptions(names);
|
||||
dropdown.value = (int)parameterManager.entity[propertyName];
|
||||
entity[propertyName].valueChanged = new Action<List<string>>(newValues =>
|
||||
{
|
||||
print(string.Join(", ", entity[propertyName].values));
|
||||
dropdown.ClearOptions();
|
||||
dropdown.AddOptions(newValues);
|
||||
});
|
||||
|
||||
dropdown.onValueChanged.AddListener(newValue =>
|
||||
{
|
||||
parameterManager.entity[propertyName] = newValue;
|
||||
parameterManager.entity[propertyName].currentIndex = newValue;
|
||||
Debug.Log("newValue : " + newValue);
|
||||
this.caption.text = (newValue != _defaultValue) ? (_captionText + "*") : _captionText;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -898,10 +898,6 @@ namespace HeavenStudio.Editor.Track
|
|||
{
|
||||
returnVal = floatVal.val;
|
||||
}
|
||||
else if (returnVal is EntityTypes.Dropdown dropdownVal)
|
||||
{
|
||||
returnVal = dropdownVal.defaultValue;
|
||||
}
|
||||
else if (returnVal.GetType().IsEnum)
|
||||
{
|
||||
returnVal = (int)ep[i].parameter;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using Cysharp.Threading.Tasks;
|
|||
|
||||
using UnityEngine;
|
||||
using UnityEngine.Networking;
|
||||
using DG.Tweening;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
|
@ -685,10 +684,7 @@ namespace HeavenStudio
|
|||
public Param(string propertyName, object parameter, string caption, string tooltip = "", List<CollapseParam> collapseParams = null)
|
||||
{
|
||||
this.propertyName = propertyName;
|
||||
this.parameter = parameter switch {
|
||||
// Enum param => new EntityTypes.Dropdown(param),
|
||||
_ => parameter,
|
||||
};
|
||||
this.parameter = parameter;
|
||||
this.caption = caption;
|
||||
this.tooltip = tooltip;
|
||||
this.collapseParams = collapseParams;
|
||||
|
|
@ -1167,7 +1163,18 @@ namespace HeavenStudio
|
|||
Minigame game = gm.GetGameInfo(gm.currentGame);
|
||||
if (game != null) {
|
||||
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;
|
||||
// string path = "/" + obj.name;
|
||||
List<string> path = new() { obj.name };
|
||||
|
|
@ -1177,33 +1184,33 @@ namespace HeavenStudio
|
|||
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 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 => {
|
||||
var gm = GameManager.instance;
|
||||
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;
|
||||
if (animObj != null && animObj.TryGetComponent(out animator)) {
|
||||
e["animations"] = string.Join(", ", animator.runtimeAnimatorController.animationClips.Select(x => x.name));
|
||||
if (animObj != null && animObj.TryGetComponent(out animator) && animator != null) {
|
||||
e["animation"].ChangeValues(animator.runtimeAnimatorController.animationClips.Select(x => x.name).ToList());
|
||||
}
|
||||
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!)"),
|
||||
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."),
|
||||
},
|
||||
delegate {
|
||||
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 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("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."),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Jukebox;
|
||||
using UnityEngine;
|
||||
|
|
@ -76,22 +77,23 @@ namespace HeavenStudio
|
|||
|
||||
public struct Dropdown
|
||||
{
|
||||
public void ChangeValues(List<string> values)
|
||||
{
|
||||
this.values = values;
|
||||
valueChanged?.Invoke(values);
|
||||
}
|
||||
public int defaultValue;
|
||||
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.values = values.ToList();
|
||||
}
|
||||
|
||||
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();
|
||||
currentIndex = 0;
|
||||
valueChanged = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue