i'm so close i swear
This commit is contained in:
parent
852f0afb06
commit
d46319a813
|
@ -14,6 +14,8 @@ namespace HeavenStudio.Properties
|
|||
|
||||
public class EditInput
|
||||
{
|
||||
public static EditInput instance { get; private set; } = new EditInput();
|
||||
|
||||
[Header("Properties")]
|
||||
public bool editingInputField = false;
|
||||
}
|
||||
|
|
|
@ -61,14 +61,14 @@ namespace HeavenStudio.Properties
|
|||
|
||||
inputField.onSelect.AddListener(delegate
|
||||
{
|
||||
EditInput.editingInputField = true;
|
||||
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.editingInputField = false;
|
||||
EditInput.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
else if (type is bool)
|
||||
|
@ -113,14 +113,14 @@ namespace HeavenStudio.Properties
|
|||
|
||||
inputFieldString.onSelect.AddListener(delegate
|
||||
{
|
||||
EditInput.editingInputField = true;
|
||||
EditInput.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputFieldString.onEndEdit.AddListener(delegate
|
||||
{
|
||||
// Debug.Log("setting " + propertyName + " to: " + inputFieldString.text);
|
||||
PropController.instance.properties[propertyName] = inputFieldString.text;
|
||||
EditInput.editingInputField = false;
|
||||
EditInput.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Editor.Track;
|
||||
|
||||
namespace HeavenStudio.Properties
|
||||
{
|
||||
public class EventParameterManager : MonoBehaviour
|
||||
{
|
||||
[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;
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2cc967f6517b28a4ab115f44592f0784
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in a new issue