public static Page Replace(string pageName, string param = null, Admission admision = null) { if (AdmissionManager.busing) { return(null); } Debug.Log("Replace to: " + pageName); var oldPage = PageStack.Find(pageName); if (oldPage != null) { throw new Exception("page: " + pageName + " already in stack, can't replace, try use Backto"); } var fromPage = PageStack.Peek(); var page = TakeOrCreatePage(pageName); page.param = param; PageStack.RelpaceTop(page); RepositionMask(); if (admision != null) { AdmissionManager.Play(admision, fromPage, page); } return(page); }
public static void BackTo <T>() where T : Page { if (AdmissionManager.busing) { return; } var name = typeof(T).Name; var targetPage = PageStack.Find(name); if (targetPage == null) { // page not in stack, can't pop to return; } var popedList = PageStack.PopUtil(targetPage); // var top = Top; // while(typeof(T) != top.GetType()) // { // UIEngine.Back(); // top = Top; // if(top == null) // { // break; // } // } foreach (var p in popedList) { pagePool.Put(p.name, p); } }
public static Page Forward(string pageName, object param = null, Admission admision = null) { if (AdmissionManager.busing) { return(null); } Debug.Log("Navigate to: " + pageName); var oldPage = PageStack.Find(pageName); if (oldPage != null) { throw new Exception("page: " + pageName + " already in stack, can't navigate, try use BackTo"); } var fromPage = PageStack.Peek(); var page = TakeOrCreatePage(pageName); page.param = param; page.OnParamChanged(); PageStack.Push(page); RepositionMask(); if (admision != null) { AdmissionManager.Play(admision, fromPage, page); } return(page); }
public static T FindInStack <T>() where T : Page { var name = typeof(T).Name; var page = PageStack.Find(name); return(page as T); }
public static Page FindInStack(string pageName) { var page = PageStack.Find(pageName); return(page); }