public MmcButton(int bitmap, int commandId, ToolbarButtonState state, ToolbarStyle type, string buttonText, string tooltipText) { Bitmap = bitmap; CommandId = commandId; State = (byte)state; Type = (byte)type; ButtonText = buttonText; TooltipText = tooltipText; }
public void Update() { var currentState = GetCurrentState(); if (m_CurrentState == currentState) { return; } m_CurrentState = currentState; Toolbar.RepaintToolbar(); }
void UpdateToolbarButtonState() { var currentState = ToolbarButtonState.UpToDate; var networkAvailable = UnityConnect.instance.connectInfo.online && UnityConnect.instance.connectInfo.loggedIn; m_ErrorMessage = ""; if (UnityConnect.instance.isDisableCollabWindow) { currentState = ToolbarButtonState.Disabled; } else if (networkAvailable) { var collab = Collab.instance; var currentInfo = collab.collabInfo; var error = false; if (collab.GetError(UnityConnect.UnityErrorFilter.ByContext | UnityConnect.UnityErrorFilter.ByChild, out var errInfo)) { error = errInfo.priority <= (int)UnityConnect.UnityErrorPriority.Error; m_ErrorMessage = errInfo.shortMsg; } if (!currentInfo.ready) { currentState = ToolbarButtonState.InProgress; } else if (error) { currentState = ToolbarButtonState.OperationError; } else if (currentInfo.inProgress) { currentState = ToolbarButtonState.InProgress; } else { var collabEnabled = Collab.instance.IsCollabEnabledForCurrentProject(); if (UnityConnect.instance.projectInfo.projectBound == false || !collabEnabled) { currentState = ToolbarButtonState.NeedToEnableCollab; } else if (currentInfo.update) { currentState = ToolbarButtonState.ServerHasChanges; } else if (currentInfo.conflict) { currentState = ToolbarButtonState.Conflict; } else if (currentInfo.publish) { currentState = ToolbarButtonState.FilesToPush; } } } else { currentState = ToolbarButtonState.Offline; } if (m_CurrentState == currentState) { return; } m_CurrentState = currentState; Toolbar.RepaintToolbar(); }