public void ChangeToPreviousScreen(object sender, IUIStateTransition transition = null) { var nextScreenType = !this.previousScreenStack.IsEmpty() ? this.previousScreenStack.Pop() : this.GetFirstScreenType(); base.ChangeScreen(sender, nextScreenType, transition); }
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); }
/// <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); }
/// <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); }
/// <inheritdoc cref="UIScreenController.ChangeScreen"/> protected virtual void ChangeScreen(Type screenType, IUIStateTransition transition = null) { this.Parent.ChangeScreen(this, screenType, transition); }
/// <inheritdoc cref="UIScreenController.ChangeScreen"/> protected virtual void ChangeScreen <T>(IUIStateTransition transition = null) where T : UIScreen { this.Parent.ChangeScreen <T>(this, transition); }
/// <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); }
public void ChangeScreen <T>(object sender, IUIStateTransition transition = null) where T : UIScreen { this.ChangeScreen(sender, typeof(T), transition); }
public T ShowPopup <T>(object sender, IUIStateTransition transition = null) where T : UIPopup { return((T)this.ShowPopup(sender, typeof(T), transition)); }