示例#1
0
        internal void _OnHideComplete(AbstractView view, bool destroy = true)
        {
            if (view == null)
            {
                throw new UnityException("View cannot be null");
            }

            if (_debug)
            {
                Debug.LogFormat("[ViewController] Hide Complete: {0}, destroy: {1}", view.ToString(), destroy);
            }

            if (EventHideComplete != null)
            {
                EventHideComplete(this, view.GetType(), view.displayMode);
            }

            if (destroy)
            {
                view.DestroyView();
            }

            if (view.displayMode == ViewDisplayMode.Overlay)
            {
                // remove overlay from showing list
                if (_showingOverlays.Contains(view))
                {
                    _showingOverlays.Remove(view);
                }

                // process next overlay if one is queued
                if (_targetOverlay != null)
                {
                    System.Type location = _targetOverlay;
                    object      data     = _targetOverlayData;

                    // clear data
                    _targetOverlay     = null;
                    _targetOverlayData = null;

                    CreateViewAsOverlay(location, data);
                }
            }
            else if (view.displayMode == ViewDisplayMode.Location)
            {
                // process next location is one is queued
                if (view == _currentLocation && _targetLocation != null)
                {
                    System.Type location = _targetLocation;
                    object      data     = _targetLocationData;

                    // clear data
                    _targetLocation     = null;
                    _targetLocationData = null;

                    CreateViewAsLocation(location, data);
                }
            }
        }
示例#2
0
        private void CreateViewAsLocation(System.Type view, object data)
        {
            // remove last location
            if (_currentLocation != null)
            {
                _lastLocation = _currentLocation.GetType();
            }

            // create next location
            _currentLocation = CreateView(_assetLookup[view], ViewDisplayMode.Location);
            _currentLocation._Show(data);
        }
示例#3
0
        internal void _OnHideStart(AbstractView view)
        {
            if (_debug)
            {
                Debug.LogFormat("[ViewController] Hide Start: {0}", view.ToString());
            }

            if (view != null && EventHideStart != null)
            {
                EventHideStart(this, view.GetType(), view.displayMode);
            }
        }
示例#4
0
        internal void _OnShowComplete(AbstractView view)
        {
            if (_debug)
            {
                Debug.LogFormat("[ViewController] Show Complete: {0}", view.ToString());
            }

            if (view != null && EventShowComplete != null)
            {
                EventShowComplete(this, view.GetType(), view.displayMode);
            }
        }
示例#5
0
        public AbstractView GetOverlay(System.Type view)
        {
            int i = 0, l = _showingOverlays.Count;

            for (; i < l; ++i)
            {
                AbstractView overlay = _showingOverlays[i];
                if (overlay.GetType() == view)
                {
                    return(overlay);
                }
            }

            return(null);
        }
示例#6
0
        /// <returns><c>true</c> if the specified view type is open as an overlay.</returns>
        /// <param name="view">Type of view.</param>
        public bool IsOverlayOpen(System.Type view)
        {
            int i = 0, l = _showingOverlays.Count;

            for (; i < l; ++i)
            {
                AbstractView overlay = _showingOverlays[i];
                if (overlay.GetType() == view)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#7
0
        /// <summary>
        /// Close the specified view.
        /// </summary>
        /// <param name="view">The type of view to close.</param>
        public void CloseOverlay(System.Type view)
        {
            if (!HasView(view))
            {
                throw new UnityException(string.Format("Invalid view type: {0}", view));
            }

            int i = _showingOverlays.Count - 1;

            for (; i >= 0; --i)
            {
                AbstractView o = _showingOverlays[i];
                if (o.GetType() == view)
                {
                    CloseOverlay(o);
                }
            }
        }