Exemplo n.º 1
0
        void OnEnable()
        {
            this.conceptTexture = (Texture2D)Resources.Load(SIGVerseUtils.ConceptImageResourcePath);

            this.headerRect = new Rect(0, 0, 720, 100);

            ConfigInfo configInfo = ConfigManager.InitConfigFile();

            this.rosbridgeIP         = configInfo.rosbridgeIP;
            this.rosbridgePort       = configInfo.rosbridgePort;
            this.sigverseBridgePort  = configInfo.sigverseBridgePort;
            this.logFileName         = configInfo.logFileName;
            this.useSigverseMenu     = configInfo.useSigverseMenu;
            this.isAutoStartWithMenu = configInfo.isAutoStartWithMenu;
            this.setUpRosTimestamp   = configInfo.setUpRosTimestamp;

            // Get the define symbol settings from EditorUserSettings
            this.GetDefineSymbolSettings();
        }
Exemplo n.º 2
0
        void OnGUI()
        {
            EditorGUI.DrawPreviewTexture(this.headerRect, this.conceptTexture);

            GUILayout.Space(this.headerRect.height + 10);

            // Config file Settings
            GUILayout.Label("Config file Settings", EditorStyles.boldLabel);

            EditorGUI.indentLevel++;

            EditorGUIUtility.labelWidth = 240;

            EditorGUI.BeginChangeCheck();



            this.rosbridgeIP         = EditorGUILayout.TextField("Rosbridge IP", this.rosbridgeIP, GUILayout.Width(EditorGUIUtility.labelWidth + 120));
            this.rosbridgePort       = EditorGUILayout.IntField("Rosbridge Port", this.rosbridgePort, GUILayout.Width(EditorGUIUtility.labelWidth + 80));
            this.sigverseBridgePort  = EditorGUILayout.IntField("SIGVerse Bridge Port", this.sigverseBridgePort, GUILayout.Width(EditorGUIUtility.labelWidth + 80));
            this.logFileName         = EditorGUILayout.TextField("Log File Name", this.logFileName, GUILayout.Width(EditorGUIUtility.labelWidth + 300));
            this.useSigverseMenu     = EditorGUILayout.Toggle("Use SIGVerse menu", this.useSigverseMenu);
            this.isAutoStartWithMenu = EditorGUILayout.Toggle("     (option)  Auto Start", this.isAutoStartWithMenu);
            this.setUpRosTimestamp   = EditorGUILayout.Toggle("Set up Time stamps of ROS message", this.setUpRosTimestamp);

            if (EditorGUI.EndChangeCheck())
            {
                ConfigInfo configInfo = new ConfigInfo();

                configInfo.rosbridgeIP         = this.rosbridgeIP;
                configInfo.rosbridgePort       = this.rosbridgePort;
                configInfo.sigverseBridgePort  = this.sigverseBridgePort;
                configInfo.logFileName         = this.logFileName;
                configInfo.useSigverseMenu     = this.useSigverseMenu;
                configInfo.isAutoStartWithMenu = this.isAutoStartWithMenu;
                configInfo.setUpRosTimestamp   = this.setUpRosTimestamp;

                ConfigManager.InitConfigFile();                 // Create config file
                ConfigManager.SaveConfig(configInfo);
            }

            GUILayout.Space(10);
            GUILayout.Box("", GUILayout.Width(this.position.width), GUILayout.Height(2));


            // Scripting Define Symbols Settings
            GUILayout.Label("Define symbols Settings", EditorStyles.boldLabel);

            EditorGUI.BeginChangeCheck();

            EditorGUILayout.BeginHorizontal();
            {
                this.isUsingMySQL = EditorGUILayout.Toggle("Use MySQL", this.isUsingMySQL);
                GUILayout.Space(20);
                GUILayout.Label("* Please import MySQL library (MySql.Data.dll)");
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                this.isUsingOculus = EditorGUILayout.Toggle("Use Oculus", this.isUsingOculus);
                GUILayout.Space(20);
                GUILayout.Label("* Please import Oculus libraries");
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            {
                this.isUsingPun = EditorGUILayout.Toggle("Use PUN", this.isUsingPun);
                GUILayout.Space(20);
                GUILayout.Label("* Please import Photon Unity Networking libraries");
                GUILayout.FlexibleSpace();
            }
            EditorGUILayout.EndHorizontal();

            if (EditorGUI.EndChangeCheck())
            {
                foreach (BuildTargetGroup buildTargetGroup in BuildTargetGroupList)
                {
                    string[] scriptingDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(SymbolSeparator);

                    List <string> scriptingDefineSymbolList = new List <string>(scriptingDefineSymbols);

                    // Add/Remove MySQL define
                    this.UpdateScriptingDefineSymbolList(ref scriptingDefineSymbolList, this.isUsingMySQL, DefineSIGVerseMySQL);

                    // Add/Remove Oculus define
                    this.UpdateScriptingDefineSymbolList(ref scriptingDefineSymbolList, this.isUsingOculus, DefineSIGVerseOculus);

                    // Add/Remove PUN define
                    this.UpdateScriptingDefineSymbolList(ref scriptingDefineSymbolList, this.isUsingPun, DefineSIGVersePun);

                    string defineSymbolsStr = String.Join(SymbolSeparator.ToString(), scriptingDefineSymbolList.ToArray());

                    // Update ScriptingDefineSymbols of PlayerSettings
                    PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, defineSymbolsStr);

                    // Update SIGVerseScriptingDefineSymbols of EditorUserSettings
                    EditorUserSettings.SetConfigValue(SIGVerseScriptingDefineSymbolsKey, defineSymbolsStr);
                }
            }

            GUILayout.Space(10);
            GUILayout.Box("", GUILayout.Width(this.position.width), GUILayout.Height(2));


            //// Create Scripts
            //GUILayout.Label("Create Scripts", EditorStyles.boldLabel);

            //EditorGUI.indentLevel++;

            //if (GUILayout.Button ("Create '" +SIGVerseScriptCreator.ScriptName+ "'", GUILayout.Width(300)))
            //{
            //	SIGVerseScriptCreator.CreateScript();
            //}
        }
Exemplo n.º 3
0
 void Awake()
 {
     this.configInfo = InitConfigFile();
 }