Ejemplo n.º 1
0
        public static void RefreshTemplates()
        {
            var types = Shibari.Model.GetBindableDataTypes().Where(t => BindableData.HasSerializeableValuesInChilds(t));

            string[] splittedPath = Shibari.Model.SERIALIZATION_TEMPLATES.Split('/');
            string   builtFolders = splittedPath[0];

            for (int i = 1; i < splittedPath.Length - 1; i++)
            {
                if (!AssetDatabase.GetSubFolders(builtFolders).Contains(builtFolders + "/" + splittedPath[i]))
                {
                    AssetDatabase.CreateFolder(builtFolders, splittedPath[i]);
                }
                builtFolders += "/" + splittedPath[i];
            }

            foreach (var path in Directory.GetFiles(Shibari.Model.SERIALIZATION_TEMPLATES).Where(p => !types.Any(t => p == $"{Shibari.Model.SERIALIZATION_TEMPLATES}{t.FullName}.json")))
            {
                FileInfo file = new FileInfo($"{path}");
                file.Delete();
            }
            foreach (var type in types)
            {
                StreamWriter stream = File.CreateText($"{Shibari.Model.SERIALIZATION_TEMPLATES}{type.FullName}.json");
                stream.Flush();
                stream.Write(Shibari.Model.GenerateSerializationTemplate(type));
                stream.Close();
            }
            AssetDatabase.Refresh();
        }
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var bindableIds = PropertyDrawerUtility.GetActualObjectForSerializedProperty <BindableValueSerializedInfo>(fieldInfo, property);
            var path        = property.FindPropertyRelative("pathInModel");

            path.stringValue = MultiLevelDropDownUtility.DrawControl(
                position,
                label,
                property.FindPropertyRelative("pathInModel").stringValue,
                BindableData.GetBindableValuesPaths(Shibari.Model.RootNodeType, "", false, true, bindableIds.allowedValueType).ToList()
                );

            property.serializedObject.ApplyModifiedProperties();
        }
Ejemplo n.º 3
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            var value = property.FindPropertyRelative("value");

            value.stringValue = MultiLevelDropDownUtility.DrawControl(position, label, value.stringValue, BindableData.GetBindableHandlersPaths(Shibari.Model.RootNodeType, "").ToList());
        }