Exemple #1
0
        /// <summary>
        /// Creates the Add Component Menu Window if it doesn't already exist.
        /// </summary>
        /// <param name="inspector">   The inspector which contains the target. </param>
        /// <param name="target">	   Target onto which components should be added. </param>
        /// <param name="unrollPosition">The position above or below which the window should open. </param>
        /// <param name="onClosed">	   This action is invoked when the editor window is closed. </param>
        public static void Create(IInspector inspector, IGameObjectDrawer target, Rect unrollPosition, Action onClosed)
        {
            if (instance != null)
            {
                return;
            }
            instance = CreateInstance <AddComponentMenuWindow>();

                        #if DEV_MODE && PI_ASSERTATIONS
            Debug.Assert(instance.IsVisible());
                        #endif

            try
            {
                instance.Setup(inspector, target, unrollPosition, onClosed);
            }
                        #if DEV_MODE
            catch (Exception e)
            {
                Debug.LogError(e);
                        #else
            catch
            {
                        #endif
                if (instance != null)
                {
                    Destroy(instance);
                }
                RestoreClickControls();
            }
        }
Exemple #2
0
        private void Dispose()
        {
            if (instance != null)
            {
                instance = null;

                if (drawer != null)
                {
                    drawer.OnClosed();
                }

                if (onClosed != null)
                {
                    var callback = onClosed;
                    onClosed = null;
                    callback();
                }
            }
        }