mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:27:39 +02:00
Feature: Textboxes and other text-related features (#90)
* Textboxes: setup prefab * Textboxes: basic functionality finished * Textbox: scaling * Textbox: open captions * Textbox: res edits * Textbox: song artist * Textbox: closed captions * Textbox: fix not being able to use multiple text events * I/O: save / load remixes using UTF-8 encoding * Textboxes: stop editor shortcuts while typing
This commit is contained in:
@ -18,6 +18,7 @@ namespace HeavenStudio.Editor
|
||||
[SerializeField] private GameObject BooleanP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
[SerializeField] private GameObject ColorP;
|
||||
[SerializeField] private GameObject StringP;
|
||||
|
||||
public Beatmap.Entity entity;
|
||||
|
||||
@ -120,6 +121,10 @@ namespace HeavenStudio.Editor
|
||||
{
|
||||
prefab = ColorP;
|
||||
}
|
||||
else if(objType == typeof(string))
|
||||
{
|
||||
prefab = StringP;
|
||||
}
|
||||
|
||||
GameObject input = Instantiate(prefab);
|
||||
input.transform.SetParent(this.gameObject.transform);
|
||||
@ -137,6 +142,7 @@ namespace HeavenStudio.Editor
|
||||
|
||||
private void DestroyParams()
|
||||
{
|
||||
Editor.instance.editingInputField = false;
|
||||
active = false;
|
||||
for (int i = childCountAtStart; i < transform.childCount; i++)
|
||||
{
|
||||
|
@ -36,6 +36,10 @@ namespace HeavenStudio.Editor
|
||||
public bool colorTableActive;
|
||||
public ColorPreview colorPreview;
|
||||
|
||||
[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)
|
||||
@ -61,10 +65,16 @@ namespace HeavenStudio.Editor
|
||||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
});
|
||||
|
||||
inputField.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
slider.value = Mathf.RoundToInt(System.Convert.ToSingle(System.Convert.ToSingle(inputField.text)));
|
||||
parameterManager.entity[propertyName] = (int)slider.value;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
else if (objType == typeof(EntityTypes.Float))
|
||||
@ -84,10 +94,16 @@ namespace HeavenStudio.Editor
|
||||
parameterManager.entity[propertyName] = newValue;
|
||||
});
|
||||
|
||||
inputField.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputField.onEndEdit.AddListener(delegate
|
||||
{
|
||||
slider.value = (float)System.Math.Round(System.Convert.ToSingle(inputField.text), 4);
|
||||
parameterManager.entity[propertyName] = slider.value;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
else if(type is bool)
|
||||
@ -143,6 +159,24 @@ namespace HeavenStudio.Editor
|
||||
colorPreview.ChangeColor(paramCol);
|
||||
ColorTable.gameObject.SetActive(false);
|
||||
}
|
||||
//why the FUCK wasn't this a thing before lmao
|
||||
else if(objType == typeof(string))
|
||||
{
|
||||
// Debug.Log("entity " + propertyName + " is: " + (string)(parameterManager.entity[propertyName]));
|
||||
inputFieldString.text = (string)(parameterManager.entity[propertyName]);
|
||||
|
||||
inputFieldString.onSelect.AddListener(delegate
|
||||
{
|
||||
Editor.instance.editingInputField = true;
|
||||
});
|
||||
|
||||
inputFieldString.onEndEdit.AddListener(delegate
|
||||
{
|
||||
// Debug.Log("setting " + propertyName + " to: " + inputFieldString.text);
|
||||
parameterManager.entity[propertyName] = inputFieldString.text;
|
||||
Editor.instance.editingInputField = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
Reference in New Issue
Block a user