コード例 #1
0
ファイル: GitCallbacks.cs プロジェクト: Amitkapadi/UniGit
 public void IssueOnPrefsChange(IGitPrefs prefs)
 {
     if (OnPrefsChange != null)
     {
         OnPrefsChange.Invoke(prefs);
     }
 }
コード例 #2
0
 public GitDiffWindowDiffElementRenderer(GitManager gitManager, GitOverlay gitOverlay, GitSettingsJson gitSettings, GitCallbacks gitCallbacks,
                                         IGitPrefs prefs)
 {
     this.gitManager   = gitManager;
     this.gitOverlay   = gitOverlay;
     this.gitSettings  = gitSettings;
     this.gitCallbacks = gitCallbacks;
     OnPrefsChange(prefs);
     gitCallbacks.OnPrefsChange += OnPrefsChange;
 }
コード例 #3
0
        public GitManager(string repoPath, GitCallbacks callbacks, GitSettingsJson settings, IGitPrefs prefs, GitAsyncManager asyncManager)
        {
            this.repoPath     = repoPath;
            this.callbacks    = callbacks;
            this.prefs        = prefs;
            this.asyncManager = asyncManager;
            gitSettings       = settings;
            gitPath           = UniGitPath.Combine(repoPath, ".git");

            Initialize();
        }
コード例 #4
0
 public GitDiffWindowToolbarRenderer(GitManager gitManager, GitDiffElementContextFactory contextFactory,
                                     UniGitData data, InjectionHelper injectionHelper, GitSettingsJson gitSettings, GitOverlay gitOverlay, IGitPrefs prefs)
 {
     this.gitManager      = gitManager;
     this.contextFactory  = contextFactory;
     this.data            = data;
     this.injectionHelper = injectionHelper;
     this.gitSettings     = gitSettings;
     this.gitOverlay      = gitOverlay;
     this.prefs           = prefs;
     searchField          = new SearchField();
 }
コード例 #5
0
        public GitManager(
            GitCallbacks callbacks,
            GitSettingsJson settings,
            IGitPrefs prefs,
            GitAsyncManager asyncManager,
            UniGitData gitData,
            ILogger logger,
            GitInitializer initializer,
            UniGitPaths paths)
        {
            this.paths        = paths;
            this.gitData      = gitData;
            this.callbacks    = callbacks;
            this.prefs        = prefs;
            this.asyncManager = asyncManager;
            this.logger       = logger;
            this.initializer  = initializer;
            gitSettings       = settings;

            Initialize();
        }
コード例 #6
0
 private void OnPrefsChange(IGitPrefs prefs)
 {
     smallElements = prefs.GetBool(SmallElementsKey, false);
 }
コード例 #7
0
        public GitProjectOverlay(GitManager gitManager,
                                 GitCallbacks gitCallbacks,
                                 GitSettingsJson gitSettings,
                                 GitAsyncManager asyncManager,
                                 GitReflectionHelper reflectionHelper,
                                 GitOverlay gitOverlay,
                                 IGitPrefs prefs,
                                 UniGitData data,
                                 ILogger logger,
                                 InjectionHelper injectionHelper,
                                 [UniGitInjectOptional] bool cullNonAssetPaths = true)
        {
            if (iconStyle == null)
            {
                iconStyle = new GUIStyle
                {
                    imagePosition = ImagePosition.ImageOnly,
                    alignment     = TextAnchor.LowerLeft,
                    padding       = new RectOffset(2, 2, 2, 2)
                };
                lineStyle = new GUIStyle(EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector).FindStyle("IN Title"))
                {
                    padding       = new RectOffset(),
                    margin        = new RectOffset(),
                    contentOffset = Vector2.zero,
                    fixedHeight   = 0,
                    fixedWidth    = 0,
                    border        = { left = 0, right = 0 }
                };
            }

            this.logger            = logger;
            this.data              = data;
            this.gitManager        = gitManager;
            this.gitSettings       = gitSettings;
            this.asyncManager      = asyncManager;
            this.gitCallbacks      = gitCallbacks;
            this.reflectionHelper  = reflectionHelper;
            this.gitOverlay        = gitOverlay;
            this.prefs             = prefs;
            this.cullNonAssetPaths = cullNonAssetPaths;
            this.injectionHelper   = injectionHelper;

            gitManager.AddWatcher(this);

            gitCallbacks.EditorUpdate           += OnEditorUpdate;
            gitCallbacks.ProjectWindowItemOnGUI += CustomIcons;
            gitCallbacks.UpdateRepository       += OnUpdateRepository;

            //project browsers only get created before delay call but not before constructor
            gitCallbacks.DelayCall += () =>
            {
                projectWindows = new List <EditorWindow>(Resources.FindObjectsOfTypeAll(reflectionHelper.ProjectWindowType).Cast <EditorWindow>());
            };

            //shortcut to getting instance id without loading asset
            var method = typeof(AssetDatabase).GetMethod("GetMainAssetOrInProgressProxyInstanceID", BindingFlags.NonPublic | BindingFlags.Static);

            if (method != null)
            {
                GetMainAssetOrInProgressProxyInstanceID = (Func <string, int>)Delegate.CreateDelegate(typeof(Func <string, int>), method);
            }
        }