public override void OnInspectorGUI()
        {
            EditorHelpers.CopyPastObjectButtons(serializedObject);

            var cachedGuiColor = GUI.color;

            serializedObject.Update();
            var  property = serializedObject.GetIterator();
            bool next     = property.NextVisible(true);

            if (next)
            {
                do
                {
                    GUI.color = cachedGuiColor;
                    HandleProperty(property);
                }while (property.NextVisible(false));
            }
            serializedObject.ApplyModifiedProperties();
            DrawGUI();
        }
Esempio n. 2
0
 public EditorEntry(SerializedProperty prop)
 {
     Property = prop;
     String   = prop.displayName;
     Length   = EditorHelpers.GetStringLengthinPix(String);
 }
Esempio n. 3
0
 public EditorEntry(string str, SerializedProperty prop)
 {
     Property = prop;
     String   = str;
     Length   = EditorHelpers.GetStringLengthinPix(String);
 }
Esempio n. 4
0
        public static void CreateCountEnum(string enumName, string nameSpace, IEnumerable <string> entries, string filepath = "", bool allowOverride = true)
        {
            var entriesList = entries.ToList();

            if (entriesList.Count == 0)
            {
                return;
            }
            var path = FileStrings.ASSETS_GENERATED_ENUM +
                       (filepath == ""? FileStrings.S : FileStrings.S + filepath + FileStrings.S) +
                       enumName +
                       FileStrings.SCRIPTS_FILE_EXTENSION;

            EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.GENERATED);
            EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS_GENERATED, FileStrings.ENUM);

            if (filepath != "")
            {
                EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS_GENERATED_ENUM, filepath);
            }

            if (!allowOverride)
            {
                if (File.Exists(path))
                {
                    return;
                }
            }
            using (var outfile = new StreamWriter(path))
            {
                outfile.WriteLine("#if {0}_DEFINE", enumName);
                outfile.WriteLine("//");
                outfile.WriteLine("//It is not recommended to edit this file, as there are no checks on if the user has changed it.");
                outfile.WriteLine("//THIS FILE IS OVER WITTEN REGUADLESS OF CHANGES, EDIT THIS IN THE EDITOR IT WAS GENERATED FROM");
                outfile.WriteLine("//");
                outfile.WriteLine("namespace Generated.{0}{1}", nameSpace, " {");

                outfile.WriteLine("\t/// <summary>");
                outfile.WriteLine("\t///This is an auto generated enum, created in the Unity editor, please don't edit.");
                outfile.WriteLine("\t///It will be overwritten on next change in the editor.");
                outfile.WriteLine("\t///</summary>");

                outfile.WriteLine("\tpublic enum " + enumName + "{");
                outfile.WriteLine("\t\tSTART = 0,");
                outfile.WriteLine("\t\t{0} = START,", entriesList[0]);
                for (var i = 1; i < entriesList.Count; i++)
                {
                    if (String.IsNullOrEmpty(entriesList[i]))
                    {
                        continue;
                    }
                    outfile.WriteLine("\t\t{0},", entriesList[i]);
                }
                outfile.WriteLine("\t\tEND = {0},", entriesList[entriesList.Count - 1]);
                outfile.WriteLine("\t\tCOUNT = END - START + 1,");
                outfile.WriteLine("\t}");
                outfile.WriteLine("}");
                outfile.WriteLine("#endif");
            }             //File written

            DefineManager.AddDefine(enumName + "_DEFINE");

            AssetDatabase.Refresh();
        }
Esempio n. 5
0
 public static void CreatePluginsFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.PLUGINS);
 }
Esempio n. 6
0
 public static void CreateEditorResourcesFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.EDITOR_RESOURCES);
 }
Esempio n. 7
0
 public static void CreateStreamingAssetsFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.STREAMINGASSETS);
 }
Esempio n. 8
0
 public static void CreateScriptFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.SCRIPTS);
 }
Esempio n. 9
0
 private static void CreatePrefabsFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.PREFABS);
 }
Esempio n. 10
0
 private static void CreateScenesFolder()
 {
     EditorHelpers.CreateAndCheckFolder(FileStrings.ASSETS, FileStrings.SCENES);
 }
Esempio n. 11
0
 public EditorString(string str)
 {
     String = str;
     Length = EditorHelpers.GetStringLengthinPix(String);
 }