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

            editor = new VSCodeScriptEditor(discovery.Object, generator.Object);
        }
 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);
 }
Beispiel #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);
 }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #7
0
 public CodeEditor()
 {
     m_CurrentEditor       = m_DefaultEditor;
     m_CurrentInstallation = GetInstallationForPath(CurrentEditorPath);
 }
Beispiel #8
0
 public static void Unregister(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Remove(externalCodeEditor);
     CodeEditor.Editor.SetCodeEditor(Editor.m_CurrentInstallation.Path);
 }
 public static void Unregister(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Remove(externalCodeEditor);
 }
Beispiel #10
0
 public static void Register(IExternalCodeEditor externalCodeEditor)
 {
     Editor.m_ExternalCodeEditors.Add(externalCodeEditor);
 }