public PassthroughHost(Lifetime lifetime, ISolution solution, IThreading threading, IEditorManager editorManager, UnitySolutionTracker unitySolutionTracker, BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost) { mySolution = solution; myThreading = threading; myEditorManager = editorManager; myBackendUnityHost = backendUnityHost; myFrontendBackendHost = frontendBackendHost; if (!frontendBackendHost.IsAvailable) { return; } unitySolutionTracker.IsUnityProject.View(lifetime, (unityProjectLifetime, args) => { var model = frontendBackendHost.Model; if (args && model != null) { AdviseFrontendToUnityModel(unityProjectLifetime, model); // Advise the backend/Unity model as high priority so we can add our subscriptions first using (Signal.PriorityAdviseCookie.Create()) { backendUnityHost.BackendUnityModel.ViewNotNull(unityProjectLifetime, AdviseUnityToFrontendModel); } } }); }
public PassthroughHost(Lifetime lifetime, ISolution solution, IThreading threading, IEditorManager editorManager, UnitySolutionTracker unitySolutionTracker, BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost) { mySolution = solution; myThreading = threading; myEditorManager = editorManager; myBackendUnityHost = backendUnityHost; myFrontendBackendHost = frontendBackendHost; if (!frontendBackendHost.IsAvailable) { return; } unitySolutionTracker.IsUnityProject.View(lifetime, (unityProjectLifetime, args) => { var model = frontendBackendHost.Model; if (args && model != null) { AdviseFrontendToUnityModel(unityProjectLifetime, model); // Advise the backend/Unity model as high priority so we get called back before other subscribers. // This allows us to populate the protocol on reconnection before other subscribes start to advise using (Signal.PriorityAdviseCookie.Create()) { backendUnityHost.BackendUnityModel.ViewNotNull(unityProjectLifetime, AdviseUnityToFrontendModel); } backendUnityHost.BackendUnityModel.Advise(lifetime, backendUnityModel => { // https://github.com/JetBrains/resharper-unity/pull/2023 if (backendUnityModel == null) { frontendBackendHost.Model?.PlayControlsInitialized.SetValue(false); } }); } }); }
public BackendUnityProtocol(Lifetime lifetime, ILogger logger, BackendUnityHost backendUnityHost, FrontendBackendHost frontendBackendHost, IScheduler dispatcher, IShellLocks locks, ISolution solution, IApplicationWideContextBoundSettingStore settingsStore, UnitySolutionTracker unitySolutionTracker, UnityVersion unityVersion, NotificationsModel notificationsModel, IHostProductInfo hostProductInfo, IFileSystemTracker fileSystemTracker) { myPluginInstallations = new JetHashSet <FileSystemPath>(); myLifetime = lifetime; myLogger = logger; myBackendUnityHost = backendUnityHost; myDispatcher = dispatcher; myLocks = locks; mySolution = solution; myUnityVersion = unityVersion; myNotificationsModel = notificationsModel; myHostProductInfo = hostProductInfo; myFrontendBackendHost = frontendBackendHost; myBoundSettingsStore = settingsStore.BoundSettingsStore; mySessionLifetimes = new SequentialLifetimes(lifetime); if (solution.GetData(ProjectModelExtensions.ProtocolSolutionKey) == null) { return; } unitySolutionTracker.IsUnityProject.View(lifetime, (lf, args) => { if (!args) { return; } var solFolder = mySolution.SolutionDirectory; // todo: consider non-Unity Solution with Unity-generated projects var protocolInstancePath = solFolder.Combine("Library/ProtocolInstance.json"); fileSystemTracker.AdviseFileChanges(lf, protocolInstancePath, OnProtocolInstanceJsonChange); // connect on start of Rider CreateProtocol(protocolInstancePath); }); }