Exemple #1
0
 public UnityEditorFindUsageResultCreator(ISolution solution, UnitySceneProcessor sceneProcessor, UnityHost unityHost)
 {
     mySolution              = solution;
     mySceneProcessor        = sceneProcessor;
     myUnityHost             = unityHost;
     mySolutionDirectoryPath = solution.SolutionDirectory;
 }
 public UnityEditorFindUsageResultCreator(Lifetime lifetime, ISolution solution, SearchDomainFactory searchDomainFactory, IShellLocks locks,
                                          UnitySceneProcessor sceneProcessor, UnityHost unityHost, UnityExternalFilesModuleFactory externalFilesModuleFactory, [CanBeNull] RiderBackgroundTaskHost backgroundTaskHost = null)
 {
     myLifetime              = lifetime;
     mySolution              = solution;
     myLocks                 = locks;
     myBackgroundTaskHost    = backgroundTaskHost;
     mySceneProcessor        = sceneProcessor;
     myYamlSearchDomain      = searchDomainFactory.CreateSearchDomain(externalFilesModuleFactory.PsiModule);
     myUnityHost             = unityHost;
     mySolutionDirectoryPath = solution.SolutionDirectory;
 }
 // IconHost is optional so that we don't fail if we're in tests
 public UnityYamlExtraGroupingRulesProvider(UnitySceneProcessor sceneProcessor = null, UnitySolutionTracker unitySolutionTracker = null, IconHost iconHost = null)
 {
     if (unitySolutionTracker != null && unitySolutionTracker.IsUnityProject.HasValue() && unitySolutionTracker.IsUnityProject.Value &&
         iconHost != null && sceneProcessor != null)
     {
         ExtraRules = new IRiderUsageGroupingRule[]
         {
             new GameObjectUsageGroupingRule(sceneProcessor, iconHost),
             new ComponentUsageGroupingRule(iconHost)
         };
     }
     else
     {
         ExtraRules = new IRiderUsageGroupingRule[0];
     }
 }
 public GameObjectUsageGroupingRule([NotNull] UnitySceneProcessor sceneProcessor, [NotNull] IconHost iconHost)
     : base("Unity Game Object", UnityObjectTypeThemedIcons.UnityGameObject.Id, iconHost, 7.0)
 {
     mySceneProcessor = sceneProcessor;
 }
        private static FindUsageResultElement CreateRequest([NotNull] FileSystemPath solutionDirPath, [NotNull] UnitySceneProcessor sceneProcessor,
                                                            [NotNull] IUnityYamlReference currentReference, [CanBeNull] IUnityYamlReference selectedReference)
        {
            var monoScriptDocument = currentReference.ComponentDocument;

            var sourceFile = monoScriptDocument?.GetSourceFile();

            if (sourceFile == null)
            {
                return(null);
            }

            var pathElements = UnityObjectPsiUtil.GetGameObjectPathFromComponent(sceneProcessor, currentReference.ComponentDocument).RemoveEnd("\\").Split("\\");

            // Constructing path of child indices
            var consumer = new UnityChildPathSceneConsumer();

            sceneProcessor.ProcessSceneHierarchyFromComponentToRoot(monoScriptDocument, consumer);


            if (!GetPathFromAssetFolder(solutionDirPath, sourceFile, out var pathFromAsset, out var fileName, out var extension))
            {
                return(null);
            }
            bool needExpand = currentReference == selectedReference;
            bool isPrefab   = extension.Equals(UnityYamlConstants.Prefab, StringComparison.OrdinalIgnoreCase);

            return(new FindUsageResultElement(isPrefab, needExpand, pathFromAsset, fileName, pathElements, consumer.RootIndices.ToArray().Reverse().ToArray()));
        }
 public UnityUsagesFinderConsumer(UnitySceneProcessor sceneProcessor, FileSystemPath solutionDirectoryPath, IUnityYamlReference selectedReference)
 {
     mySceneProcessor        = sceneProcessor;
     mySolutionDirectoryPath = solutionDirectoryPath;
     mySelectedReference     = selectedReference;
 }