示例#1
0
        public override void OnGUI(Rect rect)
        {
            GUIStyle collabButtonStyle = "AppCommand";
            var      disable           = EditorApplication.isPlaying;

            using (new EditorGUI.DisabledScope(disable))
            {
                if (m_CurrentState == ToolbarButtonState.Plastic)
                {
                    var icon = GetIconForPlastic(PlasticWindow.HasNotification);
                    EditorGUIUtility.SetIconSize(new Vector2(16, 16));
                    if (GUI.Button(rect, icon, collabButtonStyle))
                    {
                        PlasticWindow.Open();
                    }
                    EditorGUIUtility.SetIconSize(Vector2.zero);
                }
                else
                {
                    var icon = GetIconForState();
                    EditorGUIUtility.SetIconSize(new Vector2(16, 16));
                    if (GUI.Button(rect, icon, collabButtonStyle))
                    {
                        CollaborateWindow.Init();
                    }
                    EditorGUIUtility.SetIconSize(Vector2.zero);
                }
            }
        }
示例#2
0
        void DoCollabDropDown(Rect rect)
        {
            UpdateCollabToolbarState();
            GUIStyle plasticButtonStyle = "ToolbarButton";
            GUIStyle collabButtonStyle  = "OffsetDropDown";
            bool     openPlastic        = false;
            bool     showPopup          = Toolbar.requestShowCollabToolbar;

            Toolbar.requestShowCollabToolbar = false;

            bool enable = !EditorApplication.isPlaying;

            using (new EditorGUI.DisabledScope(!enable))
            {
                bool animate = m_CollabToolbarState == CollabToolbarState.InProgress;

                EditorGUIUtility.SetIconSize(new Vector2(12, 12));

                if (m_CollabToolbarState == CollabToolbarState.Plastic)
                {
                    GUIContent content = currentCollabContent;
                    content.image = PlasticWindow.GetWindowIcon();

                    Width = kPlasticButtonWidth;
                    if (GUI.Button(rect, content, plasticButtonStyle))
                    {
                        openPlastic = true;
                    }
                }
                else
                {
                    Width = kCollabButtonWidth;
                    if (GetCollabButton().OnGUI(rect, currentCollabContent, animate, collabButtonStyle))
                    {
                        showPopup = true;
                    }
                }
                EditorGUIUtility.SetIconSize(Vector2.zero);
            }

            if (m_CollabToolbarState == CollabToolbarState.Disabled)
            {
                return;
            }

            if (openPlastic)
            {
                PlasticWindow.Open();
            }

            if (showPopup)
            {
                ShowPopup(rect);
            }
        }