Esempio n. 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (!cache)
            {
                hash            = property.FindPropertyRelative("hash");
                serializedValue = property.FindPropertyRelative("serializedValue");
                cache           = true;
            }

            UInt64 hashValue = (ulong)hash.longValue;
            string strValue  = IdTable.Find(hashValue);


            EditorGUI.BeginProperty(position, label, property);

            // Draw label
            position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);

            var    strRect  = new Rect(position.x, position.y, position.width - 90, position.height);
            string newValue = EditorGUI.TextField(strRect, strValue);

            // If value changed, assign the hash
            if (!strValue.Equals(newValue))
            {
                serializedValue.stringValue = newValue;
            }

            EditorGUI.EndProperty();
        }
Esempio n. 2
0
 public override string ToString()
 {
     return(IdTable.Find(hash));
 }
Esempio n. 3
0
 public void Set(string str)
 {
     hash = IdTable.Register(str);
 }