internal static void RunOnceWhenAccessTokenAndProjectIdAreInitialized() { if (string.IsNullOrEmpty(CloudProjectSettings.accessToken)) return; if (!SetupCloudProjectId.HasCloudProjectId()) return; if (!SessionState.GetBool( CloudProjectDownloader.IS_PROJECT_DOWNLOADER_ALREADY_EXECUTED_KEY, false)) return; EditorApplication.update -= RunOnceWhenAccessTokenAndProjectIdAreInitialized; string projectPath = ProjectPath.FromApplicationDataPath( Application.dataPath); string projectGuid = SetupCloudProjectId.GetCloudProjectId(); if (!ShouldProjectBeMigrated(projectPath, projectGuid)) { SessionState.SetInt( IS_PROJECT_MIGRATED_ALREADY_CALCULATED_KEY, MIGRATED_NOTHING_TO_DO); return; } Execute( CloudProjectSettings.accessToken, projectPath, projectGuid); }
static void AfterWorkspaceMigrated() { SessionState.SetInt( IS_PROJECT_MIGRATED_ALREADY_CALCULATED_KEY, MIGRATED_NOTHING_TO_DO); CollabPlugin.Disable(); mLog.DebugFormat( "Disabled Collab Plugin after the migration for Project: {0}", ProjectPath.FromApplicationDataPath(Application.dataPath)); }
CreateWorkspaceView GetCreateWorkspaceView() { if (mCreateWorkspaceView != null) { return(mCreateWorkspaceView); } string workspacePath = ProjectPath.FromApplicationDataPath( Application.dataPath); mCreateWorkspaceView = new CreateWorkspaceView( mParentWindow, mCreateWorkspaceListener, mPlasticApi, mPlasticWebRestApi, workspacePath); return(mCreateWorkspaceView); }
static void Execute( string unityAccessToken, string projectGuid) { string projectPath = ProjectPath.FromApplicationDataPath( Application.dataPath); string headCommitSha = GetCollabHeadCommitSha(projectGuid, projectPath); if (string.IsNullOrEmpty(headCommitSha)) { return; } PlasticApp.InitializeIfNeeded(); LaunchMigrationIfProjectIsArchivedAndMigrated( unityAccessToken, projectPath, projectGuid, headCommitSha); }
void OnGUI() { if (mException != null) { DoExceptionErrorArea(); return; } try { // IMPORTANT: disable collab (if needed) // must be executed before the next if statement // where we check if collab is enabled if (mDisableCollabIfEnabledWhenLoaded) { mDisableCollabIfEnabledWhenLoaded = false; DisableCollabIfEnabled(ProjectPath.FromApplicationDataPath( Application.dataPath)); } if (CollabPlugin.IsEnabled()) { // execute Close() once after all inspectors update // to avoid our window to be drawn in back color EditorApplication.delayCall = Close; return; } bool isPlasticExeAvailable = IsExeAvailable.ForMode(mIsGluonMode); bool clientNeedsConfiguration = UnityConfigurationChecker.NeedsConfiguration(); var welcomeView = GetWelcomeView(); if (clientNeedsConfiguration && welcomeView.autoLoginState == AutoLogin.State.Off) { welcomeView.autoLoginState = AutoLogin.State.Started; } if (welcomeView.autoLoginState == AutoLogin.State.OrganizationChoosed) { OnEnable(); welcomeView.autoLoginState = AutoLogin.State.InitializingPlastic; } if (NeedsToDisplayWelcomeView(clientNeedsConfiguration, mWkInfo)) { welcomeView.OnGUI(clientNeedsConfiguration); return; } //TODO: Codice - beta: hide the switcher until the update dialog is implemented //DrawGuiModeSwitcher.ForMode( // isGluonMode, plasticClient, changesTreeView, editorWindow); DoTabToolbar( isPlasticExeAvailable, mWkInfo, mViewSwitcher, mIsGluonMode); mViewSwitcher.TabViewGUI(); if (mWorkspaceWindow.IsOperationInProgress()) { DrawProgressForOperations.For( mWorkspaceWindow, mWorkspaceWindow.Progress, position.width); } mStatusBar.OnGUI( mWkInfo, mWorkspaceWindow, mViewSwitcher, mViewSwitcher, mIncomingChangesNotifier, mIsGluonMode); } catch (Exception ex) { if (IsExitGUIException(ex)) { throw; } GUI.enabled = true; if (IsIMGUIPaintException(ex)) { ExceptionsHandler.LogException("PlasticWindow", ex); return; } mException = ex; DoExceptionErrorArea(); ExceptionsHandler.HandleException("OnGUI", ex); } }
void OnGUI() { if (mException != null) { DoExceptionErrorArea(); return; } try { // IMPORTANT: disable collab (if needed) // must be executed before the next if statement // where we check if collab is enabled if (mDisableCollabIfEnabledWhenLoaded) { mDisableCollabIfEnabledWhenLoaded = false; DisableCollabIfEnabled(ProjectPath.FromApplicationDataPath( Application.dataPath)); } if (CollabPlugin.IsEnabled()) { // execute Close() once after all inspectors update // to avoid our window to be drawn in back color EditorApplication.delayCall = Close; return; } bool isPlasticExeAvailable = IsExeAvailable.ForMode(mIsGluonMode); bool clientNeedsConfiguration = UnityConfigurationChecker.NeedsConfiguration(); if (NeedsToDisplayWelcomeView( isPlasticExeAvailable, clientNeedsConfiguration, mWkInfo)) { GetWelcomeView().OnGUI( isPlasticExeAvailable, clientNeedsConfiguration, mIsGluonMode); return; } DoHeader( mWkInfo, mPlasticClient, mViewSwitcher, mViewSwitcher, mIsGluonMode, mIncomingChangesNotificationPanel); DoTabToolbar( mWkInfo, mPlasticClient, mViewSwitcher, mIsGluonMode); mViewSwitcher.TabViewGUI(); if (mPlasticClient.IsOperationInProgress()) { DrawProgressForOperations.For( mPlasticClient, mPlasticClient.Progress, position.width); } } catch (Exception ex) { if (IsExitGUIException(ex)) { throw; } GUI.enabled = true; if (IsIMGUIPaintException(ex)) { ExceptionsHandler.LogException("PlasticWindow", ex); return; } mException = ex; DoExceptionErrorArea(); ExceptionsHandler.HandleException("OnGUI", ex); } }