Beispiel #1
0
        public void ChangeToPreviousScreen(object sender, IUIStateTransition transition = null)
        {
            var nextScreenType = !this.previousScreenStack.IsEmpty()
                ? this.previousScreenStack.Pop()
                : this.GetFirstScreenType();

            base.ChangeScreen(sender, nextScreenType, transition);
        }
Beispiel #2
0
        public virtual UIPopup ShowPopup(object sender, Type popupType, IUIStateTransition transition = null)
        {
            var popup = this.LoadPopup(popupType);

            popup.OnDisposeEvent += this.OnDisposePopup;
            ((IUIStateable)popup).OnEnter(sender, transition);
            this.DisplayedPopupMap.Add(popupType, popup);
            this.OnShowPopupEvent?.Invoke(sender, popup);
            return(popup);
        }
Beispiel #3
0
        /// <summary>
        ///     <para>Opens a new screen and closes this screen.</para>
        /// </summary>
        /// <param name="transition">Put args into transition for new screen.</param>
        /// <typeparam name="T">Type of a new screen.</typeparam>
        public sealed override void ChangeScreen(
            object sender,
            Type screenType,
            IUIStateTransition transition = null
            )
        {
            var previousScreen = this.CurrentScreen;

            if (!ReferenceEquals(previousScreen, null))
            {
                var previousScreenType = previousScreen.GetType();
                this.previousScreenStack.Push(previousScreenType);
            }

            base.ChangeScreen(sender, screenType, transition);
        }
Beispiel #4
0
        /// <summary>
        ///     <para>Changes screens.</para>
        ///     <para>Closes a previous screen and opens a new screen.</para>
        /// </summary>
        /// <param name="transition">Put args into transition for a new screen.</param>
        /// <typeparam name="T">Type of a new screen.</typeparam>
        public virtual void ChangeScreen(
            object sender,
            Type screenType,
            IUIStateTransition transition = null
            )
        {
            var previousScreen = this.CurrentScreen;

            if (!ReferenceEquals(previousScreen, null))
            {
                this.CurrentScreen = null;
                ((IUIStateable)previousScreen).OnExit(sender);
                this.UnloadScreen(previousScreen);
            }

            var nextScreen = this.LoadScreen(screenType);

            ((IUIStateable)nextScreen).OnEnter(sender, transition);
            this.CurrentScreen = nextScreen;
            this.OnScreenChangedEvent?.Invoke(sender, this.CurrentScreen);
        }
Beispiel #5
0
 /// <inheritdoc cref="UIScreenController.ChangeScreen"/>
 protected virtual void ChangeScreen(Type screenType, IUIStateTransition transition = null)
 {
     this.Parent.ChangeScreen(this, screenType, transition);
 }
Beispiel #6
0
 /// <inheritdoc cref="UIScreenController.ChangeScreen"/>
 protected virtual void ChangeScreen <T>(IUIStateTransition transition = null) where T : UIScreen
 {
     this.Parent.ChangeScreen <T>(this, transition);
 }
Beispiel #7
0
 /// <summary>
 ///     <para>Called when controller has loaded this screen.</para>
 /// </summary>
 /// <param name="sender">Who has started this screen.</param>
 /// <param name="transition">Input args.</param>
 void IUIStateable.OnEnter(object sender, IUIStateTransition transition)
 {
     this.transition = transition;
     this.OnEnter(sender);
 }
Beispiel #8
0
 public void ChangeScreen <T>(object sender, IUIStateTransition transition = null) where T : UIScreen
 {
     this.ChangeScreen(sender, typeof(T), transition);
 }
Beispiel #9
0
 public T ShowPopup <T>(object sender, IUIStateTransition transition = null) where T : UIPopup
 {
     return((T)this.ShowPopup(sender, typeof(T), transition));
 }