Add string property value panel.
This commit is contained in:
Binary file not shown.
28
Assets/Cryville/Crtr/Browsing/PVPString.cs
Normal file
28
Assets/Cryville/Crtr/Browsing/PVPString.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
namespace Cryville.Crtr.Browsing {
|
||||||
|
public class PVPString : PropertyValuePanel {
|
||||||
|
string m_value;
|
||||||
|
public override object Value {
|
||||||
|
get {
|
||||||
|
return m_value;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
m_value = (string)value;
|
||||||
|
_inputField.text = m_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InputField _inputField;
|
||||||
|
|
||||||
|
void Awake() {
|
||||||
|
_inputField = GetComponent<InputField>();
|
||||||
|
_inputField.onValueChanged.AddListener(OnValueChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnValueChanged(string value) {
|
||||||
|
m_value = value;
|
||||||
|
Callback(Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/Cryville/Crtr/Browsing/PVPString.cs.meta
Normal file
11
Assets/Cryville/Crtr/Browsing/PVPString.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: aadf11739189bc94e9cb4f702eb7ccd3
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@@ -10,6 +10,8 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
GameObject m_bool;
|
GameObject m_bool;
|
||||||
[SerializeField]
|
[SerializeField]
|
||||||
GameObject m_number;
|
GameObject m_number;
|
||||||
|
[SerializeField]
|
||||||
|
GameObject m_string;
|
||||||
|
|
||||||
PropertyInfo _property;
|
PropertyInfo _property;
|
||||||
object _target;
|
object _target;
|
||||||
@@ -32,6 +34,7 @@ namespace Cryville.Crtr.Browsing {
|
|||||||
GameObject vp;
|
GameObject vp;
|
||||||
if (prop.PropertyType == typeof(bool)) vp = m_bool;
|
if (prop.PropertyType == typeof(bool)) vp = m_bool;
|
||||||
else if (prop.PropertyType == typeof(float) || prop.PropertyType == typeof(int)) vp = m_number;
|
else if (prop.PropertyType == typeof(float) || prop.PropertyType == typeof(int)) vp = m_number;
|
||||||
|
else if (prop.PropertyType == typeof(string)) vp = m_string;
|
||||||
else return;
|
else return;
|
||||||
_value = GameObject.Instantiate(vp, _valueContainer, false).GetComponent<PropertyValuePanel>();
|
_value = GameObject.Instantiate(vp, _valueContainer, false).GetComponent<PropertyValuePanel>();
|
||||||
if (_value is PVPNumber) {
|
if (_value is PVPNumber) {
|
||||||
|
BIN
Assets/Prefabs/PVString.prefab
Normal file
BIN
Assets/Prefabs/PVString.prefab
Normal file
Binary file not shown.
7
Assets/Prefabs/PVString.prefab.meta
Normal file
7
Assets/Prefabs/PVString.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: d3142009b74dda042a75e9b808dde66d
|
||||||
|
PrefabImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Binary file not shown.
Reference in New Issue
Block a user