Ejemplo n.º 1
0
        static void RunGetVersion(
            PackageManager.Requests.ListRequest listRequest,
            Action <string> onGetVersionCompleted)
        {
            EditorDispatcher.Dispatch(() =>
            {
                if (!listRequest.IsCompleted)
                {
                    RunGetVersion(listRequest, onGetVersionCompleted);
                    return;
                }

                string pluginVersion = string.Empty;

                if (listRequest.Status == PackageManager.StatusCode.Success &&
                    listRequest.Result != null)
                {
                    PackageManager.PackageInfo collabPackage = listRequest.Result
                                                               .FirstOrDefault(package => package.name == mCollabPackageName);

                    if (collabPackage != null)
                    {
                        pluginVersion = collabPackage.version;
                    }
                }

                onGetVersionCompleted.Invoke(pluginVersion);
            });
        }
 public void Setup()
 {
     _messageDispatcher = new Fake_MessageDispatcher();
     _pluginFactory = MockRepository.GenerateMock<IPluginLoader>();
     _editor = MockRepository.GenerateMock<IEditor>();
     _fileWriter = MockRepository.GenerateMock<IFileWriter>();
     _dispatcher = new EditorDispatcher(_pluginFactory, _messageDispatcher, _fileWriter);
     _dispatcher.SetEditor(_editor);
 }
Ejemplo n.º 3
0
        static PlasticPlugin()
        {
            CloudProjectDownloader.Initialize();
            MigrateCollabProject.Initialize();
            EditorDispatcher.Initialize();

            CooldownWindowDelayer cooldownInitializeAction = new CooldownWindowDelayer(
                Enable, UnityConstants.PLUGIN_DELAYED_INITIALIZE_INTERVAL);

            cooldownInitializeAction.Ping();
        }
Ejemplo n.º 4
0
        public virtual void Run()
        {
            var src = Script;

            runner = new ReactUnityRunner();

            dispatcher = new EditorDispatcher();

            ScriptWatchDisposable = src.GetScript((sc, isDevServer) =>
            {
                context = new EditorContext(this, Globals, src, dispatcher, new UnityScheduler(dispatcher), isDevServer, () => Restart());
                runner.RunScript(sc, context);
            }, dispatcher, true, true);
        }
Ejemplo n.º 5
0
    static void AutoInit()
    {
        if (!MidiINPlugin.initialized)
        {
            EditorDispatcher.StartThread((a) => {
                MidiINPlugin.Init();
                MidiINPlugin.Refresh();
                EditorDispatcher.Dispatch((b) => {
                    MidiINPlugin.RestoreEditorConnections();
                    midiINInitialized = true;
                }, new { a = "" });
            }, new { a = "" });
        }
        else
        {
            midiINInitialized = true;
        }

        if (!MidiOUTPlugin.initialized)
        {
            EditorDispatcher.StartThread((a) => {
                MidiOUTPlugin.Init();
                MidiOUTPlugin.Refresh();
                EditorDispatcher.Dispatch((b) => {
                    MidiOUTPlugin.RestoreEditorConnections();
                    midiOUTInitialized = true;
                }, new { a = "" });
            }, new { a = "" });
        }
        else
        {
            midiOUTInitialized = true;
        }

        EditorApplication.update -= EditorUpdate;
        EditorApplication.update += EditorUpdate;
    }
Ejemplo n.º 6
0
    void OnEnable()
    {
        // Create database cache
        _databaseCache = new DatabaseCache();

        var onInsert = new Action <DatabaseEntry>(entry =>
        {
            if (entry is ItemData itemData)
            {
                if (!_itemBlueprints.ContainsKey(itemData.ID))
                {
                    _itemBlueprints[itemData.ID] = new HashSet <Guid>();
                }
            }
            if (entry is BlueprintData blueprintData)
            {
                if (!_itemBlueprints.ContainsKey(blueprintData.Item))
                {
                    _itemBlueprints[blueprintData.Item] = new HashSet <Guid>();
                }
                _itemBlueprints[blueprintData.Item].Add(blueprintData.ID);
            }
        });

        _databaseCache.OnDataInsertLocal  += onInsert;
        _databaseCache.OnDataInsertRemote += onInsert;

        var onDelete = new Action <DatabaseEntry>(entry =>
        {
            if (entry is BlueprintData blueprintData)
            {
                _itemBlueprints[blueprintData.Item].Remove(blueprintData.ID);
            }
        });

        _databaseCache.OnDataDeleteLocal  += onDelete;
        _databaseCache.OnDataDeleteRemote += onDelete;

        _databaseCache.OnDataUpdateLocal  += _ => Repaint();
        _databaseCache.OnDataInsertLocal  += _ => Repaint();
        _databaseCache.OnDataDeleteLocal  += _ => Repaint();
        _databaseCache.OnDataUpdateRemote += _ => EditorDispatcher.Dispatch(Repaint);
        _databaseCache.OnDataInsertRemote += _ => EditorDispatcher.Dispatch(Repaint);
        _databaseCache.OnDataDeleteRemote += _ => EditorDispatcher.Dispatch(Repaint);

        DatabaseInspector.DatabaseCache = _databaseCache;
        _inspector = DatabaseInspector.ShowWindow();

        _itemTypes = typeof(ItemData).GetAllChildClasses()
                     .Where(t => t.GetCustomAttribute <InspectableAttribute>() != null).ToArray();
        _entryTypes = typeof(DatabaseEntry).GetAllChildClasses()
                      .Where(t => t.GetCustomAttribute <InspectableAttribute>() != null && !typeof(ItemData).IsAssignableFrom(t)).ToArray();

        _itemTypeFoldouts = new bool[_itemTypes.Length];
        _entryFoldouts    = new bool[_entryTypes.Length];

        if (EditorPrefs.HasKey("RethinkDB.URL"))
        {
            _connectionString = EditorPrefs.GetString("RethinkDB.URL");
        }
        else
        {
            _connectionString = "Enter DB URL";
        }

        InitStyles();
    }