;-;
This commit is contained in:
parent
fa0ab3dff8
commit
5c416852d1
|
@ -62,8 +62,6 @@ namespace HeavenStudio.Properties
|
||||||
public string levelCreator = "testCreator";
|
public string levelCreator = "testCreator";
|
||||||
public int Number;
|
public int Number;
|
||||||
|
|
||||||
public string datamodel;
|
|
||||||
|
|
||||||
public object this[string propertyName]
|
public object this[string propertyName]
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
|
@ -14,7 +14,6 @@ namespace HeavenStudio.Properties
|
||||||
{
|
{
|
||||||
Properties.instance.levelName = content;
|
Properties.instance.levelName = content;
|
||||||
Debug.Log(Properties.instance.levelName);
|
Debug.Log(Properties.instance.levelName);
|
||||||
content = Properties.instance.levelName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,128 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
using TMPro;
|
|
||||||
using Starpelly;
|
|
||||||
|
|
||||||
using HeavenStudio.Util;
|
|
||||||
|
|
||||||
namespace HeavenStudio.Properties
|
|
||||||
{
|
|
||||||
public class PropertyDefn : MonoBehaviour
|
|
||||||
{
|
|
||||||
|
|
||||||
public TMP_Text caption;
|
|
||||||
[SerializeField] private RemixParameterManager parameterManager;
|
|
||||||
|
|
||||||
[Header("Integer and Float")]
|
|
||||||
[Space(10)]
|
|
||||||
public Slider slider;
|
|
||||||
public TMP_InputField inputField;
|
|
||||||
|
|
||||||
[Header("Boolean")]
|
|
||||||
[Space(10)]
|
|
||||||
public Toggle toggle;
|
|
||||||
|
|
||||||
[Header("Dropdown")]
|
|
||||||
[Space(10)]
|
|
||||||
public TMP_Dropdown dropdown;
|
|
||||||
|
|
||||||
[Header("String")] //why wasn't this a thing before
|
|
||||||
[Space(10)]
|
|
||||||
public TMP_InputField inputFieldString;
|
|
||||||
|
|
||||||
private string propertyName;
|
|
||||||
|
|
||||||
public void SetProperties(string propertyName, object type, string caption)
|
|
||||||
{
|
|
||||||
this.propertyName = propertyName;
|
|
||||||
this.caption.text = caption;
|
|
||||||
|
|
||||||
var objType = type.GetType();
|
|
||||||
|
|
||||||
if (objType == typeof(EntityTypes.Integer))
|
|
||||||
{
|
|
||||||
var integer = ((EntityTypes.Integer)type);
|
|
||||||
|
|
||||||
slider.minValue = integer.min;
|
|
||||||
slider.maxValue = integer.max;
|
|
||||||
|
|
||||||
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(PropController.instance.properties[propertyName]));
|
|
||||||
inputField.text = slider.value.ToString();
|
|
||||||
|
|
||||||
slider.onValueChanged.AddListener(delegate
|
|
||||||
{
|
|
||||||
inputField.text = slider.value.ToString();
|
|
||||||
PropController.instance.properties[propertyName] = (int)slider.value;
|
|
||||||
});
|
|
||||||
|
|
||||||
inputField.onSelect.AddListener(delegate
|
|
||||||
{
|
|
||||||
EditInput.instance.editingInputField = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
inputField.onEndEdit.AddListener(delegate
|
|
||||||
{
|
|
||||||
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(System.Convert.ToSingle(inputField.text)));
|
|
||||||
PropController.instance.properties[propertyName] = (int)slider.value;
|
|
||||||
EditInput.instance.editingInputField = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (type is bool)
|
|
||||||
{
|
|
||||||
toggle.isOn = System.Convert.ToBoolean(PropController.instance.properties[propertyName]); // ' (bool)type ' always results in false
|
|
||||||
|
|
||||||
toggle.onValueChanged.AddListener(delegate
|
|
||||||
{
|
|
||||||
PropController.instance.properties[propertyName] = toggle.isOn;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else if (objType.IsEnum)
|
|
||||||
{
|
|
||||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
|
||||||
var vals = Enum.GetValues(objType);
|
|
||||||
var selected = 0;
|
|
||||||
for (int i = 0; i < vals.Length; i++)
|
|
||||||
{
|
|
||||||
string name = Enum.GetNames(objType)[i];
|
|
||||||
TMP_Dropdown.OptionData optionData = new TMP_Dropdown.OptionData();
|
|
||||||
|
|
||||||
optionData.text = name;
|
|
||||||
|
|
||||||
dropDownData.Add(optionData);
|
|
||||||
|
|
||||||
if ((int)vals.GetValue(i) == (int)PropController.instance.properties[propertyName])
|
|
||||||
selected = i;
|
|
||||||
}
|
|
||||||
dropdown.AddOptions(dropDownData);
|
|
||||||
dropdown.value = selected;
|
|
||||||
|
|
||||||
dropdown.onValueChanged.AddListener(delegate
|
|
||||||
{
|
|
||||||
PropController.instance.properties[propertyName] = (int)Enum.GetValues(objType).GetValue(dropdown.value);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
//why the FUCK wasn't this a thing before lmao
|
|
||||||
else if (objType == typeof(string))
|
|
||||||
{
|
|
||||||
// Debug.Log("entity " + propertyName + " is: " + (string)(PropController.instance.properties[propertyName]));
|
|
||||||
inputFieldString.text = (string)(PropController.instance.properties[propertyName]);
|
|
||||||
|
|
||||||
inputFieldString.onSelect.AddListener(delegate
|
|
||||||
{
|
|
||||||
EditInput.instance.editingInputField = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
inputFieldString.onEndEdit.AddListener(delegate
|
|
||||||
{
|
|
||||||
// Debug.Log("setting " + propertyName + " to: " + inputFieldString.text);
|
|
||||||
PropController.instance.properties[propertyName] = inputFieldString.text;
|
|
||||||
EditInput.instance.editingInputField = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 57aacc4c8dd07504a99999f7c13547e9
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,93 +0,0 @@
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
using HeavenStudio.Editor.Track;
|
|
||||||
|
|
||||||
namespace HeavenStudio.Properties
|
|
||||||
{
|
|
||||||
public class RemixParameterManager : MonoBehaviour
|
|
||||||
{
|
|
||||||
[Header("General References")]
|
|
||||||
[SerializeField] private GameObject eventSelector;
|
|
||||||
|
|
||||||
[Header("Property Prefabs")]
|
|
||||||
[SerializeField] private GameObject IntegerP;
|
|
||||||
[SerializeField] private GameObject FloatP;
|
|
||||||
[SerializeField] private GameObject BooleanP;
|
|
||||||
[SerializeField] private GameObject DropdownP;
|
|
||||||
[SerializeField] private GameObject ColorP;
|
|
||||||
[SerializeField] private GameObject StringP;
|
|
||||||
|
|
||||||
public bool active;
|
|
||||||
|
|
||||||
public void StartParams(Beatmap.Entity entity)
|
|
||||||
{
|
|
||||||
active = true;
|
|
||||||
AddParams(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddParams(Beatmap.Entity entity)
|
|
||||||
{
|
|
||||||
var minigame = EventCaller.instance.GetMinigame(Properties.instance.datamodel.Split(0));
|
|
||||||
int actionIndex = minigame.actions.IndexOf(minigame.actions.Find(c => c.actionName == Properties.instance.datamodel.Split(1)));
|
|
||||||
Minigames.GameAction action = minigame.actions[actionIndex];
|
|
||||||
|
|
||||||
if (action.parameters != null)
|
|
||||||
{
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
AddParam(propertyName, param, caption);
|
|
||||||
}
|
|
||||||
|
|
||||||
active = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AddParam(string propertyName, object type, string caption)
|
|
||||||
{
|
|
||||||
GameObject prefab = IntegerP;
|
|
||||||
|
|
||||||
var objType = type.GetType();
|
|
||||||
|
|
||||||
if (objType == typeof(EntityTypes.Integer))
|
|
||||||
{
|
|
||||||
prefab = IntegerP;
|
|
||||||
}
|
|
||||||
else if (objType == typeof(EntityTypes.Float))
|
|
||||||
{
|
|
||||||
prefab = FloatP;
|
|
||||||
}
|
|
||||||
else if(type is bool)
|
|
||||||
{
|
|
||||||
prefab = BooleanP;
|
|
||||||
}
|
|
||||||
else if (objType.IsEnum)
|
|
||||||
{
|
|
||||||
prefab = DropdownP;
|
|
||||||
}
|
|
||||||
else if (objType == typeof(Color))
|
|
||||||
{
|
|
||||||
prefab = ColorP;
|
|
||||||
}
|
|
||||||
else if(objType == typeof(string))
|
|
||||||
{
|
|
||||||
prefab = StringP;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameObject input = Instantiate(prefab);
|
|
||||||
input.transform.SetParent(this.gameObject.transform);
|
|
||||||
input.SetActive(true);
|
|
||||||
input.transform.localScale = Vector2.one;
|
|
||||||
|
|
||||||
var property = input.GetComponent<PropertyDefn>();
|
|
||||||
property.SetProperties(propertyName, type, caption);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 2cc967f6517b28a4ab115f44592f0784
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
Loading…
Reference in a new issue