示例#1
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);
        }
        public static void CreateViewAsset(SerializedProperty property, AbstractView view)
        {
            string assetPath = AssetDatabase.GetAssetPath(view);

            SerializedProperty propertyViewTypeID   = property.FindPropertyRelative("viewTypeID");
            SerializedProperty propertyResourcePath = property.FindPropertyRelative("resourcePath");
            SerializedProperty propertyAssetID      = property.FindPropertyRelative("assetID");

            propertyViewTypeID.stringValue   = view.GetType().AssemblyQualifiedName;
            propertyResourcePath.stringValue = UViewEditorUtils.GetResourcePath(assetPath);
            propertyAssetID.stringValue      = AssetDatabase.AssetPathToGUID(assetPath);
        }
示例#3
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)
                {
                    CreateViewAsOverlay(_targetOverlay, _targetOverlayData);

                    // clear data
                    _targetOverlay     = null;
                    _targetOverlayData = null;
                }
            }
            else if (view.displayMode == ViewDisplayMode.Location)
            {
                // process next location is one is queued
                if (view == _currentLocation && _targetLocation != null)
                {
                    CreateViewAsLocation(_targetLocation, _targetLocationData);

                    // clear data
                    _targetLocation     = null;
                    _targetLocationData = null;
                }
            }
        }
示例#4
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);
            }
        }
示例#5
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);
            }
        }
示例#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
        public void UpdateLoadedViews()
        {
            _loadedViews.Clear();

            Object[] gameObjects = Resources.FindObjectsOfTypeAll(typeof(AbstractView));
            int      i = 0, l = gameObjects.Length;

            for (; i < l; ++i)
            {
                AbstractView view = gameObjects[i] as AbstractView;
                if (!EditorUtility.IsPersistent(view))
                {
                    _loadedViews.Add(view.GetType(), view);
                }
            }
        }
示例#8
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);
                }
            }
        }