Пример #1
0
        private static string CheckAndUpdatePath(string riderPath)
        {
            if (IsRiderAndExists(riderPath))
            {
                return(riderPath);
            }

            var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
            var paths          = RiderPathLocator.GetAllRiderPaths();

            if (!paths.Any())
            {
                return(null);
            }

            string newPath = paths.Last().Path;

            editorSettings.SetSetting(EditorPathSettingName, newPath);
            Globals.EditorDef(EditorPathSettingName, newPath);
            return(newPath);
        }
Пример #2
0
        public static void Initialize()
        {
            var editorSettings = GodotSharpEditor.Instance.GetEditorInterface().GetEditorSettings();
            var editor         = (ExternalEditorId)editorSettings.GetSetting("mono/editor/external_editor");

            if (editor == ExternalEditorId.Rider)
            {
                if (!editorSettings.HasSetting(EditorPathSettingName))
                {
                    Globals.EditorDef(EditorPathSettingName, "Optional");
                    editorSettings.AddPropertyInfo(new Godot.Collections.Dictionary
                    {
                        ["type"]        = Variant.Type.String,
                        ["name"]        = EditorPathSettingName,
                        ["hint"]        = PropertyHint.File,
                        ["hint_string"] = ""
                    });
                }

                var riderPath = (string)editorSettings.GetSetting(EditorPathSettingName);
                if (IsRiderAndExists(riderPath))
                {
                    Globals.EditorDef(EditorPathSettingName, riderPath);
                    return;
                }

                var paths = RiderPathLocator.GetAllRiderPaths();

                if (!paths.Any())
                {
                    return;
                }

                string newPath = paths.Last().Path;
                Globals.EditorDef(EditorPathSettingName, newPath);
                editorSettings.SetSetting(EditorPathSettingName, newPath);
            }
        }