public void OneTimeSetUp()
        {
            var discovery = new Mock <IDiscovery>();
            var generator = new Mock <IGenerator>();

            editor = new VSCodeScriptEditor(discovery.Object, generator.Object);
        }
Esempio n. 2
0
 public static void Register(IExternalCodeEditor externalCodeEditor)
 {
     if (Editor.m_ExternalCodeEditors.Select(editor => editor.GetType()).Where(editorType => editorType == externalCodeEditor.GetType()).Any())
     {
         return;
     }
     Editor.m_ExternalCodeEditors.Add(externalCodeEditor);
 }
Esempio n. 3
0
 public static void Register(IExternalCodeEditor externalCodeEditor)
 {
     if (Editor.m_ExternalCodeEditors.Select(editor => editor.GetType()).Any(editorType => editorType == externalCodeEditor.GetType()))
     {
         return;
     }
     Editor.m_ExternalCodeEditors.Add(externalCodeEditor);
     CodeEditor.Editor.SetCodeEditor(Editor.m_CurrentInstallation.Path);
 }
Esempio n. 4
0
        public void SetCodeEditor(string editorPath)
        {
            if (editorPath == null)
            {
                throw new ArgumentException("SetCodeEditor: Does not allow null editorPath");
            }

            EditorPrefs.SetString("kScriptsDefaultApp", editorPath);
            m_CurrentEditor       = ComputeCurrentEditor(editorPath);
            m_CurrentInstallation = GetInstallationForPath(editorPath);
            m_CurrentEditor.Initialize(editorPath);
        }
        public static void SendCodeEditorUsage(IExternalCodeEditor codeEditor)
        {
            if (!UnityEngine.Analytics.Analytics.enabled)
            {
                return;
            }

            if (!EnableAnalytics())
            {
                return;
            }

            var data = new AnalyticsData()
            {
                code_editor = codeEditor.GetType().FullName
            };

            EditorAnalytics.SendEventWithLimit(k_EventName, data);
        }
Esempio n. 6
0
        private IExternalCodeEditor ComputeCurrentEditor(string editorPath)
        {
            if (m_ExternalCodeEditors.Count() == 0)
            {
                TypeCollection collection = TypeCache.GetTypesDerivedFrom <IExternalCodeEditor>();
                for (int i = 0; i < collection.Count(); i++)
                {
                    var codeEditorType = collection[i];
                    if (codeEditorType == typeof(DefaultExternalCodeEditor))
                    {
                        continue;
                    }

                    if (codeEditorType.GetConstructor(BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null) != null)
                    {
                        IExternalCodeEditor codeEditor = (IExternalCodeEditor)Activator.CreateInstance(codeEditorType);
                        m_ExternalCodeEditors.Add(codeEditor);
                    }
                }
            }

            return(GetCodeEditorForPath(editorPath));
        }
Esempio n. 7
0
 public CodeEditor()
 {
     m_CurrentEditor       = m_DefaultEditor;
     m_CurrentInstallation = GetInstallationForPath(CurrentEditorPath);
 }
Esempio n. 8
0
 public static void Unregister(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Remove(externalCodeEditor);
     CodeEditor.Editor.SetCodeEditor(Editor.m_CurrentInstallation.Path);
 }
Esempio n. 9
0
 public static void Unregister(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Remove(externalCodeEditor);
 }
Esempio n. 10
0
 public static void Register(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Add(externalCodeEditor);
 }