/// <summary>
        /// Show this screen with the specified properties.
        /// </summary>
        /// <param name="props">The data for the screen.</param>
        public void Show(IScreenProperties props = null)
        {
            if (props != null)
            {
                if (props is TProps)
                {
                    SetProperties((TProps)props);
                }
                else
                {
                    Debug.LogError("Properties passed have wrong type! (" + props.GetType() + " instead of " +
                                   typeof(TProps) + ")");
                    return;
                }
            }

            HierarchyFixOnShow();
            OnPropertiesSet();

            if (!gameObject.activeSelf)
            {
                DoAnimation(animIn, OnTransitionInFinished, true);
            }
            else
            {
                if (InTransitionFinished != null)
                {
                    InTransitionFinished(this);
                }
            }
        }
Пример #2
0
    /// <summary>
    /// Show this screen with specified properties.
    /// </summary>
    /// <param name="properties"></param>
    public void Show(IScreenProperties properties = null)
    {
        if (properties != null)
        {
            if (properties is TProps)
            {
                SetProperties((TProps)properties);
            }
            else
            {
                return;
            }
        }

        HierarchyFixOnShow();
        OnPropertiesSet();

        if (!gameObject.activeSelf)
        {
            DoAnimation(openingAnim, OnClosingTransitionFinished, true);
        }
        else
        {
            OpeningTransitionFinished?.Invoke(this);
        }
    }
Пример #3
0
 public WindowOpenProperties(string id, IScreenProperties properties)
 {
     Id         = id;
     Properties = properties;
 }
Пример #4
0
        public IEnumerator ShowWindowById(string windowId, IScreenProperties properties)
        {
            IWindow window;

            if (IsWindowLoading(windowId))
            {
                // may be can update model view after that
                yield break;
            }

            if (IsWindowLoaded(windowId))
            {
                loadedWindow.TryGetValue(windowId, out window);
            }
            else
            {
                loadingWindow.Enqueue(new WindowOpenProperties(windowId, properties));

                var locator = context.GetService <IUIViewLocator>();

                var result = locator.LoadWindowAsync <IWindow>(windowId);

                while (!result.IsDone)
                {
                    Debug.LogFormat("Percentage: {0}% ", result.Progress);
                    yield return(null);
                }

                Debug.LogFormat("IsDone:{0} Result:{1}", result.IsDone, result.Result);

                window = result.Result;

                window.Create();

                var lastWindowOpenProperties = loadingWindow.Dequeue();

                if (lastWindowOpenProperties.Id != windowId)
                {
                    log.ErrorFormat("Window is valid: {0} != {1}", lastWindowOpenProperties.Id, windowId);
                    yield break;
                }

                loadedWindow.Add(windowId, window);
            }

            if (window != null && window.Visibility == false)
            {
                showingWindow.Add(window);

                ITransition transition = window.Show(properties).OnStateChanged((w, state) =>
                {
                    // log.DebugFormat("Window Show:{0} State{1}", w.Name, state);
                });

                yield return(transition.WaitForDone());
            }

            if (loadingWindow.Count > 0)
            {
                var nextWindowOpenProperties = loadingWindow.Peek();
                yield return(ShowWindowById(nextWindowOpenProperties.Id, nextWindowOpenProperties.Properties));
            }
        }
Пример #5
0
 /// <summary>
 /// Opens the Window with the given id, passing in Properties.
 /// </summary>
 /// <param name="windowId">Identifier.</param>
 /// <param name="properties">Properties.</param>
 /// <seealso cref="AWindowProperties"/>
 public void OpenWindow(string windowId, IScreenProperties properties)
 {
     StartCoroutine(ShowWindowById(windowId, properties));
 }