11using System ;
22using System . Collections . Generic ;
3- using System . IO ;
43using System . Linq ;
5- using System . Threading . Tasks ;
64using UnityEditor ;
75using UnityEngine ;
86
@@ -20,30 +18,25 @@ class SettingsView : Subview
2018 private const string MetricsOptInLabel = "Help us improve by sending anonymous usage data" ;
2119 private const string DefaultRepositoryRemoteName = "origin" ;
2220
21+ [ NonSerialized ] private bool currentLocksHasUpdate ;
22+ [ NonSerialized ] private bool currentRemoteHasUpdate ;
2323 [ NonSerialized ] private bool isBusy ;
24+ [ NonSerialized ] private bool metricsHasChanged ;
2425
26+ [ SerializeField ] private GitPathView gitPathView = new GitPathView ( ) ;
27+ [ SerializeField ] private bool hasRemote ;
28+ [ SerializeField ] private CacheUpdateEvent lastCurrentRemoteChangedEvent ;
29+ [ SerializeField ] private CacheUpdateEvent lastLocksChangedEvent ;
2530 [ SerializeField ] private List < GitLock > lockedFiles = new List < GitLock > ( ) ;
31+ [ SerializeField ] private int lockedFileSelection = - 1 ;
2632 [ SerializeField ] private Vector2 lockScrollPos ;
33+ [ SerializeField ] private bool metricsEnabled ;
34+ [ SerializeField ] private string newRepositoryRemoteUrl ;
2735 [ SerializeField ] private string repositoryRemoteName ;
2836 [ SerializeField ] private string repositoryRemoteUrl ;
2937 [ SerializeField ] private Vector2 scroll ;
30- [ SerializeField ] private int lockedFileSelection = - 1 ;
31- [ SerializeField ] private bool hasRemote ;
32-
33- [ SerializeField ] private string newRepositoryRemoteUrl ;
34-
35- [ SerializeField ] private bool metricsEnabled ;
36- [ NonSerialized ] private bool metricsHasChanged ;
37-
38- [ SerializeField ] private GitPathView gitPathView = new GitPathView ( ) ;
3938 [ SerializeField ] private UserSettingsView userSettingsView = new UserSettingsView ( ) ;
4039
41- [ SerializeField ] private CacheUpdateEvent lastCurrentRemoteChangedEvent ;
42- [ NonSerialized ] private bool currentRemoteHasUpdate ;
43-
44- [ SerializeField ] private CacheUpdateEvent lastLocksChangedEvent ;
45- [ NonSerialized ] private bool currentLocksHasUpdate ;
46-
4740 public override void InitializeView ( IView parent )
4841 {
4942 base . InitializeView ( parent ) ;
@@ -91,10 +84,39 @@ public override void Refresh()
9184 userSettingsView . Refresh ( ) ;
9285 }
9386
87+ public override void OnGUI ( )
88+ {
89+ scroll = GUILayout . BeginScrollView ( scroll ) ;
90+ {
91+ userSettingsView . OnGUI ( ) ;
92+
93+ GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
94+
95+ if ( Repository != null )
96+ {
97+ OnRepositorySettingsGUI ( ) ;
98+
99+ GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
100+
101+ OnGitLfsLocksGUI ( ) ;
102+
103+ GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
104+ }
105+
106+ gitPathView . OnGUI ( ) ;
107+ OnPrivacyGui ( ) ;
108+ OnLoggingSettingsGui ( ) ;
109+ }
110+
111+ GUILayout . EndScrollView ( ) ;
112+ }
113+
94114 private void AttachHandlers ( IRepository repository )
95115 {
96116 if ( repository == null )
117+ {
97118 return ;
119+ }
98120
99121 repository . CurrentRemoteChanged += RepositoryOnCurrentRemoteChanged ;
100122 repository . LocksChanged += RepositoryOnLocksChanged ;
@@ -104,61 +126,32 @@ private void RepositoryOnLocksChanged(CacheUpdateEvent cacheUpdateEvent)
104126 {
105127 if ( ! lastLocksChangedEvent . Equals ( cacheUpdateEvent ) )
106128 {
107- new ActionTask ( TaskManager . Token , ( ) =>
108- {
129+ new ActionTask ( TaskManager . Token , ( ) => {
109130 lastLocksChangedEvent = cacheUpdateEvent ;
110131 currentLocksHasUpdate = true ;
111132 Redraw ( ) ;
112- } )
113- { Affinity = TaskAffinity . UI } . Start ( ) ;
133+ } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
114134 }
115135 }
116136
117137 private void RepositoryOnCurrentRemoteChanged ( CacheUpdateEvent cacheUpdateEvent )
118138 {
119139 if ( ! lastCurrentRemoteChangedEvent . Equals ( cacheUpdateEvent ) )
120140 {
121- new ActionTask ( TaskManager . Token , ( ) =>
122- {
141+ new ActionTask ( TaskManager . Token , ( ) => {
123142 lastCurrentRemoteChangedEvent = cacheUpdateEvent ;
124143 currentRemoteHasUpdate = true ;
125144 Redraw ( ) ;
126- } )
127- { Affinity = TaskAffinity . UI } . Start ( ) ;
145+ } ) { Affinity = TaskAffinity . UI } . Start ( ) ;
128146 }
129147 }
130148
131149 private void DetachHandlers ( IRepository repository )
132150 {
133151 if ( repository == null )
134- return ;
135- }
136-
137- public override void OnGUI ( )
138- {
139- scroll = GUILayout . BeginScrollView ( scroll ) ;
140152 {
141- userSettingsView . OnGUI ( ) ;
142-
143- GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
144-
145- if ( Repository != null )
146- {
147- OnRepositorySettingsGUI ( ) ;
148-
149- GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
150-
151- OnGitLfsLocksGUI ( ) ;
152-
153- GUILayout . Space ( EditorGUIUtility . standardVerticalSpacing ) ;
154- }
155-
156- gitPathView . OnGUI ( ) ;
157- OnPrivacyGui ( ) ;
158- OnLoggingSettingsGui ( ) ;
153+ return ;
159154 }
160-
161- GUILayout . EndScrollView ( ) ;
162155 }
163156
164157 private void MaybeUpdateData ( )
0 commit comments