示例#1
0
        private void DrawDefaultMenu()
        {
            if (windowSettings == null)
            {
                windowSettings = OrbWindowSettings.Load();
                //Check to see if we had a language we were working on
                if (windowSettings.languageName != "")
                {
                    //Attempt to load it
                }
            }



            EditorGUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Load"))
                {
                    //Attempt to load.
                }
                if (windowSettings.language != null && GUILayout.Button("Save"))
                {
                    //Save the file.
                }
                if (GUILayout.Button("New"))
                {
                    windowSettings.language = OrbNonCompiledLanguage.GenerateNewLanguageStructure();
                    //Look for non colliding name for language
                    //Create file strucuture
                }
                if (GUILayout.Button("Close"))
                {
                    windowSettings.language = null;
                    //Look for non colliding name for language
                    //Create file strucuture
                }
            }
            EditorGUILayout.EndHorizontal();

            //File loading options
            //File saving options
            //New language button

            if (windowSettings.language != null)
            {
                //Name
                EditorGUILayout.BeginHorizontal();
                {
                    windowSettings.language.name = EditorGUILayout.TextField("Name:", windowSettings.language.name);
                }
                EditorGUILayout.EndHorizontal();

                //Package Manager
                HorizontalLine(Color.grey);
                if (windowSettings.m_PackageManager = EditorGUILayout.Foldout(windowSettings.m_PackageManager, "Package manager"))
                {
                    DrawPackageManger();
                }

                //Using Segment
                HorizontalLine(Color.grey);
                if (windowSettings.m_UsingDirectives = EditorGUILayout.Foldout(windowSettings.m_UsingDirectives, "Using Directives"))
                {
                    DrawUsingSegment();
                }

                //Static data segment
                HorizontalLine(Color.grey);
                if (windowSettings.m_Enviroment = EditorGUILayout.Foldout(windowSettings.m_Enviroment, "Global Enviroment"))
                {
                    DrawEnviromentManager();
                }

                //Pre execution code
                HorizontalLine(Color.grey);
                if (windowSettings.m_Preexecution = EditorGUILayout.Foldout(windowSettings.m_Preexecution, "Pre-execution"))
                {
                    DrawPreExecution();
                }

                //Terminal Tokens and Regex
                HorizontalLine(Color.grey);
                if (windowSettings.m_Terminals = EditorGUILayout.Foldout(windowSettings.m_Terminals, "Terminal Tokens"))
                {
                    DrawTerminalTokens();
                }

                //Non terminal Tokens and RHS
                HorizontalLine(Color.grey);
                if (windowSettings.m_Nonterminals = EditorGUILayout.Foldout(windowSettings.m_Nonterminals, "Nonterminal Tokens"))
                {
                    DrawNonerminalTokens();
                    //Display a dropdown of all other tokens
                }
            }

            OrbWindowSettings.Save(windowSettings);
        }
示例#2
0
        public static void Save(OrbWindowSettings file)
        {
            string jsonData = JsonUtility.ToJson(file, true);

            File.WriteAllText(Application.persistentDataPath + fileName, jsonData);
        }