Esempio n. 1
0
    public static string assetsPath              = Path.Combine(Application.dataPath, Assets_Package);                                      //资源目录

    public static void RunCheckAssetBundle(bool _is_atlas_model = true)
    {
        EditorUserSettings.SetConfigValue(is_atlas_model, _is_atlas_model ? "1" : "0");

        //先把之前的config删除
        clear(assetspackageConfigPath);

        AddressableAssetSettings settings = AASUtility.GetSettings();

        foreach (var group in settings.groups)
        {
            if (group == null)
            {
                Debug.LogError("addressable坏了");
            }
        }

        //动态增加 addressables groups
        addAddressablesGroups();

        //动态增加 config
        refreshConfig();

        CheckAssetBundles.Run();

        string assetFolder = Path.Combine(Application.dataPath, AssetBundleConfig.AssetsFolderName);

        //特殊文件
        string app_version    = Path.Combine(assetFolder, BuildUtils.AppVersionFileName);
        string assets_map     = Path.Combine(assetFolder, AssetBundleConfig.AssetsPathMapFileName);
        string channel_name   = Path.Combine(assetFolder, BuildUtils.ChannelNameFileName);
        string notice_version = Path.Combine(assetFolder, BuildUtils.NoticeVersionFileName);
        string res_version    = Path.Combine(assetFolder, BuildUtils.ResVersionFileName);
        string ifix_map       = Path.Combine(assetFolder, BuildUtils.IfixMapFileName);
        string config         = Path.Combine(assetFolder, BuildUtils.ConfigFileName);

        SingleFileAddress("global", app_version);
        SingleFileAddress("global", assets_map);
        SingleFileAddress("global", channel_name);
        SingleFileAddress("global", notice_version);
        SingleFileAddress("global", res_version);
        SingleFileAddress("global", ifix_map);
        SingleFileAddress("global", config);

        //设置AssetBundle Provider
        SetAllGroupsToAssetBundleEncryptProvider();
        //设置Asset Address
        SetAssetAddressAndLabel();
        //将资源全部打成远程模式
        SetAllGroupsToRemoteNoStatic();
    }
        void UpdateSerializedWindowLayout()
        {
            if (m_FloatingWindowsLayout == null)
            {
                m_FloatingWindowsLayout = new FloatingWindowsLayout();
            }

            m_FloatingWindowsLayout.blackboardLayout.CalculateDockingCornerAndOffset(m_BlackboardProvider.blackboard.layout, m_GraphView.layout);
            m_FloatingWindowsLayout.blackboardLayout.ClampToParentWindow();

            string serializedWindowLayout = JsonUtility.ToJson(m_FloatingWindowsLayout);

            EditorUserSettings.SetConfigValue(k_FloatingWindowsLayoutKey, serializedWindowLayout);
        }
Esempio n. 3
0
        private void OnGUI()
        {
            EditorGUILayout.LabelField("JSON Path");
            using (new GUILayout.VerticalScope(GUI.skin.box)) {
                EditorGUILayout.LabelField(jsonPath ?? "");
            }

            if (GUILayout.Button("Select JSON"))
            {
                jsonPath = EditorUtility.OpenFilePanel("Select JSON", Application.dataPath, "json");
            }

            EditorUserSettings.SetConfigValue("ReplaceOnAssetsUpdate/jsonPath", jsonPath);
        }
Esempio n. 4
0
        static void OnInspectorGUI(Editor editor)
        {
            if (editor.targets.Length == 1)
            {
                string assetPath = AssetDatabase.GetAssetPath(editor.target);
                if ((assetPath?.Contains("Assets/") ?? false) != false)
                {
                    AssetImporter importer = AssetImporter.GetAtPath(assetPath);
                    bool          foldout, plus, save, info = false;
                    UserData      userData = null;

                    if (bool.TryParse(EditorUserSettings.GetConfigValue("MetaNote.Foldout"), out foldout) == false)
                    {
                        foldout = false;
                    }
                    if (string.IsNullOrEmpty(importer.userData) == false)
                    {
                        userData = JsonUtility.FromJson <UserData>(importer.userData);
                    }
                    if ((userData?.Count ?? 0) == 0)
                    {
                        userData = new UserData
                        {
                            { string.Empty, string.Empty }
                        };
                    }
                    foreach (var item in userData)
                    {
                        if (string.IsNullOrEmpty(item.Value) == false)
                        {
                            info = true;
                            break;
                        }
                    }
                    bool result = Foldout(foldout, "Meta", info, importer, out plus, out save);
                    if (foldout != result)
                    {
                        EditorUserSettings.SetConfigValue("MetaNote.Foldout", result.ToString());
                        foldout = result;
                    }
                    if (foldout != false)
                    {
                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                        OnNoteGUI(importer, userData, plus, save);
                        EditorGUILayout.EndVertical();
                    }
                }
            }
        }
Esempio n. 5
0
    //=================================================================================
    //シンボルの保存
    //=================================================================================

    /// <summary>
    /// 指定したプラットフォームにシンボルを保存
    /// </summary>
    public static void Save(BuildTargetGroup targetGroup, bool needToCreateDefineValue = true)
    {
        _isEdited = false;

        //シンボルのkeyを空白を無視かつ重複しないようにに取得
        List <string> symbolKeyList = _symbolList
                                      .Select(symbol => symbol.Key).Where(symbolKey => !string.IsNullOrEmpty(symbolKey))
                                      .Distinct().ToList();

        //シンボルを一つの文字列にまとめ、EditorUserSettingsに保存
        EditorUserSettings.SetConfigValue(SYMBOL_KEY_LIST_SAVE_KEY, string.Join(SYMBOL_SEPARATOR, symbolKeyList.ToArray()));

        //各シンボルの対応した設定を保存
        string enabledSymbols = "";
        Dictionary <string, string> _defineValueDic = new Dictionary <string, string>();

        foreach (DefineSymbol symbol in _symbolList)
        {
            symbol.Save();

            //valueが設定されている場合は定数クラスに書き出すためにDictにまとめる
            if (needToCreateDefineValue && !string.IsNullOrEmpty(symbol.Value))
            {
                _defineValueDic[symbol.Key] = symbol.Value;
            }

            //有効になっているシンボルは設定するように;区切りでenabledSymbolsにまとめる
            if (symbol.IsEnabled)
            {
                if (!string.IsNullOrEmpty(enabledSymbols))
                {
                    enabledSymbols += SYMBOL_SEPARATOR;
                }
                enabledSymbols += symbol.Key;
            }
        }

        //設定するグループが不明だとエラーがでるので設定しないように
        if (targetGroup != BuildTargetGroup.Unknown)
        {
            PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, enabledSymbols);
        }

        //Symbolに対応した値を定数クラス、DefineValueを書き出す
        if (needToCreateDefineValue)
        {
            ConstantsClassCreator.Create <string>("DefineValue", "Symbolに対応した値を定数で管理するクラス", _defineValueDic);
        }
    }
Esempio n. 6
0
        static void SetLuaProjectRoot()
        {
            string path = EditorUserSettings.GetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY);

            path = EditorUtility.OpenFolderPanel(
                "Select Editor",
                path,
                "");

            if (path != "")
            {
                EditorUserSettings.SetConfigValue(LUA_PROJECT_ROOT_FOLDER_PATH_KEY, path);
                Debug.Log("Set Editor Path: " + path);
            }
        }
Esempio n. 7
0
    static void SetExternalEditorPath()
    {
        string path = EditorUserSettings.GetConfigValue(EXTERNAL_EDITOR_PATH_KEY);

        path = EditorUtility.OpenFilePanel(
            "Select Editor",
            path,
            "exe");

        if (path != "")
        {
            EditorUserSettings.SetConfigValue(EXTERNAL_EDITOR_PATH_KEY, path);
            Debug.Log("设置lua编辑器路径: " + path);
        }
    }
Esempio n. 8
0
        private void GetDefineSymbolSettings()
        {
            // Get from EditorUserSettings
            string defineSymbolsStr = EditorUserSettings.GetConfigValue(SIGVerseScriptingDefineSymbolsKey);

            if (defineSymbolsStr == null)
            {
                defineSymbolsStr = string.Empty;

                EditorUserSettings.SetConfigValue(SIGVerseScriptingDefineSymbolsKey, defineSymbolsStr);
            }

            string[] defineSymbols = defineSymbolsStr.Split(SymbolSeparator);

            this.isUsingMySQL = Array.IndexOf(defineSymbols, DefineSIGVerseMySQL) >= 0;
        }
Esempio n. 9
0
        /// <summary>
        /// エディタ上に保存してあるデータをセーブ
        /// </summary>
        protected virtual void Save()
        {
            string str = BinaryUtil.BinaryWriteToString(writer => SerializedObjectHelper.WriteAllVisibleProperties(writer));

            switch (EditorSaveType)
            {
            case SaveType.EditorPrefs:
                EditorPrefs.SetString(SaveKey(), str);
                break;

            case SaveType.EditorUserSettings:
            default:
                EditorUserSettings.SetConfigValue(SaveKey(), str);
                break;
            }
        }
Esempio n. 10
0
        public static void Open()
        {
            EditorUserSettings.SetConfigValue("Opened", "1");

            var window = GetWindow <Tutorial>();

            window.maxSize = new Vector2(400, 400);
            window.minSize = window.maxSize;

            anim.value        = 0.001f;
            anim.speed        = 10f;
            anim.target       = 0.001f;
            anim.valueChanged = null;
            page    = 1;
            texture = null;
        }
Esempio n. 11
0
        void UpdateSerializedWindowLayout()
        {
            if (m_FloatingWindowsLayout == null)
            {
                m_FloatingWindowsLayout = new FloatingWindowsLayout();
            }
            m_FloatingWindowsLayout.previewLayout.CalculateDockingCornerAndOffset(m_MasterPreviewView.layout, layout);
            m_FloatingWindowsLayout.blackboardLayout.CalculateDockingCornerAndOffset(m_BlackboardProvider.blackboard.layout, layout);
            m_FloatingWindowsLayout.masterPreviewSize = m_MasterPreviewView.Q("preview").layout.size;

            string serializedWindowLayout = JsonUtility.ToJson(m_FloatingWindowsLayout);

            EditorUserSettings.SetConfigValue(k_FloatingWindowsLayoutKey, serializedWindowLayout);

            m_MasterPreviewView.RefreshRenderTextureSize();
        }
Esempio n. 12
0
        void UpdateSerializedWindowLayout()
        {
            m_FloatingWindowsLayout.previewLayout.CalculateDockingCornerAndOffset(m_MasterPreviewView.layout, m_GraphView.layout);
            m_FloatingWindowsLayout.previewLayout.ClampToParentWindow();

            m_FloatingWindowsLayout.blackboardLayout.CalculateDockingCornerAndOffset(m_BlackboardProvider.blackboard.layout, m_GraphView.layout);
            m_FloatingWindowsLayout.blackboardLayout.ClampToParentWindow();

            if (m_MasterPreviewView.expanded)
            {
                m_FloatingWindowsLayout.masterPreviewSize = m_MasterPreviewView.previewTextureView.layout.size;
            }

            string serializedWindowLayout = JsonUtility.ToJson(m_FloatingWindowsLayout);

            EditorUserSettings.SetConfigValue(k_FloatingWindowsLayoutKey, serializedWindowLayout);
        }
Esempio n. 13
0
        bool SettingsModePopup()
        {
            EditorGUI.showMixedValue = blendMode.hasMixedValue;
            var mode = (int)m_SettingsMode;

            EditorGUI.BeginChangeCheck();
            mode = EditorGUILayout.Popup(Styles.settingsMode, mode, Styles.settingNames);
            bool result = EditorGUI.EndChangeCheck();
            if (result)
            {
                EditorUserSettings.SetConfigValue("filamented_settings_mode", mode.ToString());
                m_SettingsMode = mode;
            }

            EditorGUI.showMixedValue = false;

            return result;
        }
Esempio n. 14
0
        private static void LoadClothParam(MonoBehaviour owner, ClothParams clothParam)
        {
            // フォルダを読み込み
            string folder = EditorUserSettings.GetConfigValue(configName);

            // 読み込みダイアログ
            string path = UnityEditor.EditorUtility.OpenFilePanel("Load Preset", folder, "json");

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // フォルダを記録
            folder = Path.GetDirectoryName(path);
            EditorUserSettings.SetConfigValue(configName, folder);

            // json
            Debug.Log("Load preset file:" + path);
            string json = File.ReadAllText(path);

            if (string.IsNullOrEmpty(json) == false)
            {
                // 上書きしないプロパティを保持
                Transform influenceTarget          = clothParam.GetInfluenceTarget();
                Transform disableReferenceObject   = clothParam.DisableReferenceObject;
                Transform directionalDampingObject = clothParam.DirectionalDampingObject;

                // undo
                Undo.RecordObject(owner, "Load preset");

                JsonUtility.FromJsonOverwrite(json, clothParam);

                // 上書きしないプロパティを書き戻し
                clothParam.SetInfluenceTarget(influenceTarget);
                clothParam.DisableReferenceObject   = disableReferenceObject;
                clothParam.DirectionalDampingObject = directionalDampingObject;

                Debug.Log("Complete.");
            }
        }
        /// <summary>
        /// SettingsProvider の GUI を描画する時に呼び出されます
        /// </summary>
        private static void OnGuiHandler
        (
            Action <SerializedObject> onGUI,
            Action <SerializedObject> onGUIExtra
        )
        {
            var instance = GetInstance();
            var editor   = Editor.CreateEditor(instance);

            using (var scope = new EditorGUI.ChangeCheckScope())
            {
                var serializedObject = editor.serializedObject;

                serializedObject.Update();

                // onGUI が指定されている場合はそれを描画する
                if (onGUI != null)
                {
                    onGUI(serializedObject);
                }
                else
                {
                    // onGUI が指定されていない場合はデフォルトの Inspector を描画する
                    editor.DrawDefaultInspector();
                }

                onGUIExtra?.Invoke(serializedObject);

                if (!scope.changed)
                {
                    return;
                }

                // パラメータが編集された場合は インスタンスに反映して
                // なおかつ EditorUserSettings にも保存する
                serializedObject.ApplyModifiedProperties();

                var json = EditorJsonUtility.ToJson(editor.target);
                EditorUserSettings.SetConfigValue(ConfigName, json);
            }
        }
Esempio n. 16
0
 void OnGUI()
 {
     if (_scenesWindow != null)
     {
         EditorGUILayout.LabelField("Valid Scenes Directories");
         _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos);
         var           directories = _scenesWindow.validDirectories;
         List <string> keys        = new List <string>();
         List <bool>   values      = new List <bool>();
         foreach (var d in directories)
         {
             keys.Add(d.Key);
             values.Add(d.Value);
         }
         bool dirty = false;
         for (int i = 0; i < keys.Count; i++)
         {
             EditorGUILayout.BeginHorizontal();
             directories[keys[i]] = EditorGUILayout.Toggle(directories[keys[i]], GUILayout.MaxWidth(15));
             if (directories[keys[i]] != values[i])
             {
                 dirty = true;
             }
             EditorGUILayout.LabelField(keys[i]);
             EditorGUILayout.EndHorizontal();
         }
         if (dirty)
         {
             StringBuilder sb = new StringBuilder();
             foreach (var d in directories)
             {
                 sb.Append(d.Key);
                 sb.Append(";");
                 sb.AppendLine(d.Value.ToString());
             }
             EditorUserSettings.SetConfigValue("ScenesWindowSettings", sb.ToString());
         }
         EditorGUILayout.EndScrollView();
     }
 }
Esempio n. 17
0
        /// <summary>
        /// プリセットファイル保存
        /// </summary>
        /// <param name="clothParam"></param>
        private static void SavePreset(MonoBehaviour owner, ClothParams clothParam)
        {
            // フォルダを読み込み
            string folder = EditorUserSettings.GetConfigValue(configName);

            // 接頭語
            string presetTypeName = GetComponentTypeName(owner);

            // 保存ダイアログ
            string path = UnityEditor.EditorUtility.SaveFilePanelInProject(
                "Save Preset",
                $"{presetTypeName}_xxx",
                "json",
                "Enter a name for the preset json.",
                folder
                );

            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // フォルダを記録
            folder = Path.GetDirectoryName(path);
            EditorUserSettings.SetConfigValue(configName, folder);

            Debug.Log("Save preset file:" + path);

            // json
            string json = JsonUtility.ToJson(clothParam);

            // save
            File.WriteAllText(path, json);

            AssetDatabase.Refresh();

            Debug.Log("Complete.");
        }
        void OnGUI()
        {
            if (GUILayout.Button("Get Access Code"))
            {
                string authUrl = oAuth2.GetAuthURL();
                Application.OpenURL(authUrl);
            }
            accessCode = EditorGUILayout.TextField("Access Code", accessCode);
            if (GUILayout.Button("Authentication with Acceess Code"))
            {
                string refreshToken = oAuth2.AuthWithAccessCode(accessCode);
                EditorUserSettings.SetConfigValue(PREF_STR, refreshToken); //save refresh token
            }

            if (GUILayout.Button("Load Spread Sheet"))
            {
                if (EditorUserSettings.GetConfigValue(PREF_STR) == "")
                {
                    Debug.LogError("Refresh Token is not set. You need above authentication steps.");
                    return;
                }
                Load();
            }
        }
Esempio n. 19
0
        public GraphEditorView(EditorWindow editorWindow, GraphData graph, MessageManager messageManager)
        {
            m_Graph          = graph;
            m_MessageManager = messageManager;
            styleSheets.Add(Resources.Load <StyleSheet>("Styles/GraphEditorView"));
            previewManager = new PreviewManager(graph, messageManager);

            string serializedToggle = EditorUserSettings.GetConfigValue(k_ToggleSettings);

            if (!string.IsNullOrEmpty(serializedToggle))
            {
                m_ToggleSettings = JsonUtility.FromJson <ToggleSettings>(serializedToggle);
            }

            string serializedWindowLayout = EditorUserSettings.GetConfigValue(k_FloatingWindowsLayoutKey);

            if (!string.IsNullOrEmpty(serializedWindowLayout))
            {
                m_FloatingWindowsLayout = JsonUtility.FromJson <FloatingWindowsLayout>(serializedWindowLayout);
            }
            else
            {
                m_FloatingWindowsLayout = new FloatingWindowsLayout
                {
                    blackboardLayout =
                    {
                        dockingTop       = true,
                        dockingLeft      = true,
                        verticalOffset   =              16,
                        horizontalOffset =              16,
                        size             = new Vector2(200, 400)
                    }
                };
            }

            if (m_FloatingWindowsLayout.masterPreviewSize.x > 0f && m_FloatingWindowsLayout.masterPreviewSize.y > 0f)
            {
                previewManager.ResizeMasterPreview(m_FloatingWindowsLayout.masterPreviewSize);
            }

            previewManager.RenderPreviews();
            var toolbar = new IMGUIContainer(() =>
            {
                GUILayout.BeginHorizontal(EditorStyles.toolbar);
                if (GUILayout.Button("Save Asset", EditorStyles.toolbarButton))
                {
                    if (saveRequested != null)
                    {
                        saveRequested();
                    }
                }
                GUILayout.Space(6);
                if (GUILayout.Button("Show In Project", EditorStyles.toolbarButton))
                {
                    if (showInProjectRequested != null)
                    {
                        showInProjectRequested();
                    }
                }

                GUILayout.FlexibleSpace();

                EditorGUI.BeginChangeCheck();
                m_ToggleSettings.isBlackboardVisible = GUILayout.Toggle(m_ToggleSettings.isBlackboardVisible, "Blackboard", EditorStyles.toolbarButton);

                GUILayout.Space(6);

                m_ToggleSettings.isPreviewVisible = GUILayout.Toggle(m_ToggleSettings.isPreviewVisible, "Main Preview", EditorStyles.toolbarButton);
                if (EditorGUI.EndChangeCheck())
                {
                    m_MasterPreviewView.visible             = m_ToggleSettings.isPreviewVisible;
                    m_BlackboardProvider.blackboard.visible = m_ToggleSettings.isBlackboardVisible;
                    string serializedToggleables            = JsonUtility.ToJson(m_ToggleSettings);
                    EditorUserSettings.SetConfigValue(k_ToggleSettings, serializedToggleables);
                }
                GUILayout.EndHorizontal();
            });

            Add(toolbar);

            var content = new VisualElement {
                name = "content"
            };

            {
                m_GraphView = new MaterialGraphView(graph)
                {
                    name = "GraphView", viewDataKey = "MaterialGraphView"
                };
                m_GraphView.SetupZoom(0.05f, ContentZoomer.DefaultMaxScale);
                m_GraphView.AddManipulator(new ContentDragger());
                m_GraphView.AddManipulator(new SelectionDragger());
                m_GraphView.AddManipulator(new RectangleSelector());
                m_GraphView.AddManipulator(new ClickSelector());
                m_GraphView.RegisterCallback <KeyDownEvent>(OnSpaceDown);
                m_GraphView.groupTitleChanged        = OnGroupTitleChanged;
                m_GraphView.elementsAddedToGroup     = OnElementsAddedToGroup;
                m_GraphView.elementsRemovedFromGroup = OnElementsRemovedFromGroup;
                content.Add(m_GraphView);

                m_BlackboardProvider = new BlackboardProvider(graph);
                m_GraphView.Add(m_BlackboardProvider.blackboard);

                // Initialize toggle settings if it doesnt exist.
                if (m_ToggleSettings == null)
                {
                    m_ToggleSettings = new ToggleSettings();
                }
                m_BlackboardProvider.blackboard.visible = m_ToggleSettings.isBlackboardVisible;

                m_MasterPreviewView = new MasterPreviewView(previewManager, graph)
                {
                    name = "masterPreview"
                };

                WindowDraggable masterPreviewViewDraggable = new WindowDraggable(null, this);
                m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
                m_GraphView.Add(m_MasterPreviewView);

                //m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout;
                //m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout;
                masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout;
                m_MasterPreviewView.previewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;
                m_MasterPreviewView.visible = m_ToggleSettings.isPreviewVisible;

                m_GraphView.graphViewChanged = GraphViewChanged;

                RegisterCallback <GeometryChangedEvent>(ApplySerializewindowLayouts);
            }

            m_SearchWindowProvider = ScriptableObject.CreateInstance <SearchWindowProvider>();
            m_SearchWindowProvider.Initialize(editorWindow, m_Graph, m_GraphView);
            m_GraphView.nodeCreationRequest = (c) =>
            {
                m_SearchWindowProvider.connectedPort = null;
                SearchWindow.Open(new SearchWindowContext(c.screenMousePosition), m_SearchWindowProvider);
            };

            m_EdgeConnectorListener = new EdgeConnectorListener(m_Graph, m_SearchWindowProvider);

            foreach (var graphGroup in graph.groups)
            {
                AddGroup(graphGroup);
            }

            foreach (var node in graph.GetNodes <AbstractMaterialNode>())
            {
                AddNode(node);
            }

            foreach (var edge in graph.edges)
            {
                AddEdge(edge);
            }

            Add(content);
        }
 public static void MenuAutoMigrate()
 {
     AutoMigrate = !AutoMigrate;
     Menu.SetChecked(autoMigrateMenuPath, AutoMigrate);
     EditorUserSettings.SetConfigValue("select", AutoMigrate.ToString());
 }
 private void SaveSceneUnitList()
 {
     EditorUserSettings.SetConfigValue(SAVE_KEY, JsonUtility.ToJson(this));
 }
Esempio n. 22
0
 void SetUserSettings()
 {
     EditorUserSettings.SetConfigValue(Trello.KEY_TOKEN, trelloToken);
     EditorUserSettings.SetConfigValue(Trello.KEY_USERNAME, trelloUsername);
     EditorUserSettings.SetConfigValue(Trello.KEY_BOARD, trelloBoardId);
 }
Esempio n. 23
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();
            //}
        }
Esempio n. 24
0
        void OnGUI()
        {
            settings = EditorGUILayout.ObjectField("Settings", settings, typeof(GSPluginSettings), false) as GSPluginSettings;

            scrollPosition = GUILayout.BeginScrollView(scrollPosition);

            if (settings != null)
            {
                // セットされている settings 情報を EditorUserSettings に保存する.
                {
                    string guid;
                    long   localId;

                    if (AssetDatabase.TryGetGUIDAndLocalFileIdentifier(settings, out guid, out localId))
                    {
                        if (savedGUID != guid)
                        {
                            // Debug.Log("Save GUID(" + guid + ") at " + SETTINGS_KEY);
                            EditorPrefs.SetString(SETTINGS_KEY, guid);
                            EditorUserSettings.SetConfigValue(SETTINGS_KEY, guid);
                            savedGUID = guid;
                        }
                    }
                }

                for (int i = 0; i < settings.sheets.Length; i++)
                {
                    var sheet = settings.sheets[i];

                    GUILayout.BeginHorizontal("box");
                    GUILayout.Label(sheet.targetPath);

                    if (GUILayout.Button("Download", GUILayout.Width(80)) && !isDownloading)
                    {
                        isDownloading = true;
                        DownloadOne(sheet, settingDir);
                        isDownloading = false;

                        GUIUtility.ExitGUI();
                    }

                    if (GUILayout.Button("Open", GUILayout.Width(80)) && !isDownloading)
                    {
                        GSUtils.OpenURL(sheet.sheetId, sheet.gid);
                        GUIUtility.ExitGUI();
                    }

                    GUILayout.EndHorizontal();
                }

                if (GUILayout.Button("DownloadAll", "LargeButtonMid") && !isDownloading)
                {
                    isDownloading = true;

                    var sheets = new List <GSPluginSettings.Sheet>(settings.sheets);
                    DownloadAll(sheets, settingDir);
                    isDownloading = false;

                    GUIUtility.ExitGUI();
                }
            }

            GUILayout.EndScrollView();
        }
Esempio n. 25
0
        void OnGUI()
        {
            EditorGUILayout.LabelField("Add to Record");
            using (new EditorGUILayout.VerticalScope("box"))
            {
                _addObject = EditorGUILayout.ObjectField(_addObject, typeof(UnityEngine.Object), true);

                using (new EditorGUILayout.HorizontalScope())
                {
                    using (new EditorGUI.DisabledScope(_addObject == null))
                    {
                        if (GUILayout.Button("Add"))
                        {
                            string path = "";
                            if (AssetDatabase.IsMainAsset(_addObject))
                            {
                                path = AssetDatabase.GetAssetPath(_addObject);
                            }
                            else
                            {
                                path = GetHierarchyPath(_addObject as GameObject);
                            }

                            if (!string.IsNullOrEmpty(path))
                            {
                                string value = EditorUserSettings.GetConfigValue(Key) ?? string.Empty;
                                value = string.IsNullOrEmpty(value) ? value : value + ",";
                                EditorUserSettings.SetConfigValue(Key, value + path);
                                Init();
                            }
                        }
                    }
                }
            }

            EditorGUILayout.Space();
            EditorGUILayout.Space();

            using (var scroll = new EditorGUILayout.ScrollViewScope(_scrollPos))
            {
                _scrollPos = scroll.scrollPosition;

                EditorGUILayout.LabelField("Record List");
                using (new EditorGUILayout.VerticalScope("box"))
                {
                    string deletePath = null;
                    foreach (var path in _paths)
                    {
                        using (new EditorGUILayout.HorizontalScope())
                        {
                            if (GUILayout.Button("×", GUILayout.Width(20)))
                            {
                                deletePath = path;
                            }

                            if (path.StartsWith("Assets"))
                            {
                                var obj = AssetDatabase.LoadMainAssetAtPath(path);
                                if (obj == null)
                                {
                                    EditorGUILayout.LabelField("Missing " + path);
                                }
                                else
                                {
                                    EditorGUILayout.ObjectField(obj, typeof(GameObject), true);
                                }
                            }
                            else
                            {
                                var obj = GameObject.Find(path);
                                if (obj == null)
                                {
                                    EditorGUILayout.LabelField("Missing " + path);
                                }
                                else
                                {
                                    EditorGUILayout.ObjectField(obj, typeof(GameObject), true);
                                }
                            }
                        }
                    }

                    if (_paths.Count == 0)
                    {
                        EditorGUILayout.LabelField("Empty");
                    }

                    if (!string.IsNullOrEmpty(deletePath))
                    {
                        _paths.Remove(deletePath);
                        EditorUserSettings.SetConfigValue(Key, string.Join(",", _paths));
                    }
                }

                EditorGUILayout.Space();
                EditorGUILayout.Space();
                if (GUILayout.Button("All Reset"))
                {
                    if (EditorUtility.DisplayDialog("UnityObjectRecord", "Are you sure you want to reset record?", "Reset", "Cancel"))
                    {
                        EditorUserSettings.SetConfigValue(Key, "");
                        Init();
                    }
                }
            }
        }
Esempio n. 26
0
 private static void SetConfigValue(string KeyName, string Value)
 {
     EditorUserSettings.SetConfigValue("DataTableEditor_" + KeyName, Value);
 }
Esempio n. 27
0
 private void SaveSettings()
 {
     EditorUserSettings.SetConfigValue("WindowController_IS_WARNING DISMISSED", isWarningDismissed ? "1" : "0");
 }