Exemplo n.º 1
0
        public static void ShowWindow(Rect buttonRect, Type type, AddAssetWindow.AddCallbackDelegate addCallback, AddAssetWindow.CreateCallbackDelegate createCallback)
        {
            AddAssetWindow window = ScriptableObject.CreateInstance <AddAssetWindow>();

            buttonRect              = GUIToScreenRect(buttonRect);
            window.m_Type           = type;
            window.onAddCallback    = addCallback;
            window.onCreateCallback = createCallback;
            window.ShowAsDropDown(buttonRect, new Vector2(buttonRect.width, 280f));
        }
Exemplo n.º 2
0
        protected virtual void DoAddButton()
        {
            GUIStyle   buttonStyle   = new GUIStyle("AC Button");
            GUIContent buttonContent = new GUIContent("Add " + ObjectNames.NicifyVariableName(elementType.Name));
            Rect       buttonRect    = GUILayoutUtility.GetRect(buttonContent, buttonStyle, GUILayout.ExpandWidth(true));

            buttonRect.width = buttonStyle.fixedWidth;
            buttonRect.x     = position.width * 0.5f - buttonStyle.fixedWidth * 0.5f;
            if (GUI.Button(buttonRect, buttonContent, buttonStyle))
            {
                AddAssetWindow.ShowWindow(buttonRect, elementType, AddAsset, CreateScript);
            }
        }