Ejemplo n.º 1
0
        public void UpdateCollabToolbarState()
        {
            var  currentCollabState = CollabToolbarState.UpToDate;
            bool networkAvailable   = UnityConnect.instance.connectInfo.online && UnityConnect.instance.connectInfo.loggedIn;

            m_DynamicTooltip = "";

            if (networkAvailable)
            {
                Collab     collab         = Collab.instance;
                CollabInfo currentInfo    = collab.collabInfo;
                int        errorCode      = 0;
                int        errorPriority  = (int)UnityConnect.UnityErrorPriority.None;
                int        errorBehaviour = (int)UnityConnect.UnityErrorBehaviour.Hidden;
                string     errorMsg       = "";
                string     errorShortMsg  = "";
                bool       error          = false;
                if (collab.GetError((int)(UnityConnect.UnityErrorFilter.ByContext | UnityConnect.UnityErrorFilter.ByChild), out errorCode, out errorPriority, out errorBehaviour, out errorMsg, out errorShortMsg))
                {
                    error            = (errorPriority <= (int)UnityConnect.UnityErrorPriority.Error);
                    m_DynamicTooltip = errorShortMsg;
                }

                if (!currentInfo.ready)
                {
                    currentCollabState = CollabToolbarState.InProgress;
                }
                else if (error)
                {
                    currentCollabState = CollabToolbarState.OperationError;
                }
                else if (currentInfo.inProgress)
                {
                    currentCollabState = CollabToolbarState.InProgress;
                }
                else
                {
                    bool collabEnable = Collab.instance.IsCollabEnabledForCurrentProject();

                    if (UnityConnect.instance.projectInfo.projectBound == false || !collabEnable)
                    {
                        currentCollabState = CollabToolbarState.NeedToEnableCollab;
                    }
                    else if (currentInfo.update)
                    {
                        currentCollabState = CollabToolbarState.ServerHasChanges;
                    }
                    else if (currentInfo.conflict)
                    {
                        currentCollabState = CollabToolbarState.Conflict;
                    }
                    else if (currentInfo.publish)
                    {
                        currentCollabState = CollabToolbarState.FilesToPush;
                    }
                }
            }
            else
            {
                currentCollabState = CollabToolbarState.Offline;
            }

            if (currentCollabState != m_CollabToolbarState ||
                CollabToolbarWindow.s_ToolbarIsVisible == m_ShowCollabTooltip)
            {
                m_CollabToolbarState = currentCollabState;
                m_ShowCollabTooltip  = !CollabToolbarWindow.s_ToolbarIsVisible;
                RepaintToolbar();
            }
        }
Ejemplo n.º 2
0
        public void UpdateCollabToolbarState()
        {
            var  currentCollabState = CollabToolbarState.UpToDate;
            bool networkAvailable   = UnityConnect.instance.connectInfo.online && UnityConnect.instance.connectInfo.loggedIn;

            m_DynamicTooltip = "";

            if (UnityConnect.instance.isDisableCollabWindow)
            {
                currentCollabState = CollabToolbarState.Disabled;
            }
            else if (networkAvailable)
            {
                Collab         collab      = Collab.instance;
                CollabInfo     currentInfo = collab.collabInfo;
                UnityErrorInfo errInfo;
                bool           error = false;
                if (collab.GetError(UnityConnect.UnityErrorFilter.ByContext | UnityConnect.UnityErrorFilter.ByChild, out errInfo))
                {
                    error            = errInfo.priority <= (int)UnityConnect.UnityErrorPriority.Error;
                    m_DynamicTooltip = errInfo.shortMsg;
                }

                if (!currentInfo.ready)
                {
                    currentCollabState = CollabToolbarState.InProgress;
                }
                else if (error)
                {
                    currentCollabState = CollabToolbarState.OperationError;
                }
                else if (currentInfo.inProgress)
                {
                    currentCollabState = CollabToolbarState.InProgress;
                }
                else if (m_IsGettingChanges)
                {
                    currentCollabState = CollabToolbarState.InProgress;
                }
                else
                {
                    bool collabEnable = Collab.instance.IsCollabEnabledForCurrentProject();

                    if (UnityConnect.instance.projectInfo.projectBound == false || !collabEnable)
                    {
                        currentCollabState = CollabToolbarState.NeedToEnableCollab;
                    }
                    else if (currentInfo.update)
                    {
                        currentCollabState = CollabToolbarState.ServerHasChanges;
                    }
                    else if (currentInfo.conflict)
                    {
                        currentCollabState = CollabToolbarState.Conflict;
                    }
                    else if (currentInfo.publish)
                    {
                        currentCollabState = CollabToolbarState.FilesToPush;
                    }
                }
            }
            else
            {
                currentCollabState = CollabToolbarState.Offline;
            }
            if (Collab.IsToolbarVisible == null || currentCollabState == m_CollabToolbarState &&
                Collab.IsToolbarVisible() != m_ShowCollabTooltip)
            {
                return;
            }
            m_CollabToolbarState = currentCollabState;
            m_ShowCollabTooltip  = !Collab.IsToolbarVisible();
            Toolbar.RepaintToolbar();
        }
Ejemplo n.º 3
0
 public CollabToolbarContent(CollabToolbarState state, string iconName, string toolTip)
 {
     m_state = state;
     m_iconName = iconName;
     m_toolTip = toolTip;
 }