Beispiel #1
0
        /// <summary>
        /// Change location to the specified view. <c>currentLocation</c> will first be hidden, and the specified view will become the <c>targetLocation</c>, once
        /// <c>currentLocation</c> is hidden the specified view is created and shown.
        /// </summary>
        /// <param name="view">The type of view to change location to.</param>
        /// <param name="data">Data to pass onto the specified view when it begins to show <c>OnShowStart</c>.</param>
        /// <param name="immediate">If set to <c>true</c> the <c>ViewController</c> won't wait for <c>currentLocation</c> to hide before creating the specified view.</param>
        public void ChangeLocation(System.Type view, object data, bool immediate = false)
        {
            if (!HasView(view))
            {
                throw new UnityException(string.Format("Invalid view type: {0}", view));
            }

            if (_debug)
            {
                Debug.LogFormat("[ViewController] Requesting Location: {0}, immediate: {1}", view.Name, immediate);
            }

            if (EventViewRequested != null)
            {
                EventViewRequested(this, view, ViewDisplayMode.Location);
            }

            if (_currentLocation == null)
            {
                CreateViewAsLocation(view, data);
            }
            else if (immediate)
            {
                _currentLocation._Hide();
                CreateViewAsLocation(view, data);
            }
            else
            {
                _targetLocation     = view;
                _targetLocationData = data;
                _currentLocation._Hide();
            }
        }
Beispiel #2
0
 /// <summary>
 /// Close the specified view.
 /// </summary>
 /// <param name="view">The view to close.</param>
 public void CloseOverlay(AbstractView view)
 {
     if (IsOverlayOpen(view))
     {
         view._Hide();
     }
 }