Skip to content

Commit

Permalink
- mod:when open a new page,make sure open complete and hide the previ…
Browse files Browse the repository at this point in the history
…ous one. wont see the empty scene.
  • Loading branch information
chiuan committed Dec 11, 2015
1 parent 09e30da commit 8b2722e
Showing 1 changed file with 33 additions and 7 deletions.
40 changes: 33 additions & 7 deletions Assets/UIFramework/Source/TTUIPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -500,42 +500,68 @@ public static void ClosePage()

TTUIPage closePage = m_currentPageNodes[m_currentPageNodes.Count - 1];
m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);
closePage.Hide();

//show older page.
//TODO:Sub pages.belong to root node.
if (m_currentPageNodes.Count > 0)
{
TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1];
if (page.isAsyncUI)
ShowPage(page.name, page, null);
ShowPage(page.name, page, () =>
{
closePage.Hide();
});
else
{
ShowPage(page.name, page);

//after show to hide().
closePage.Hide();
}
}
}

/// <summary>
/// 关闭指定的页面
/// Close target page
/// </summary>
public static void ClosePage(TTUIPage target)
{
if (target == null || target.isActive() == false) return;
if (target == null) return;
if (target.isActive() == false)
{
if (m_currentPageNodes != null)
{
for (int i = 0; i < m_currentPageNodes.Count; i++)
{
if (m_currentPageNodes[i] == target)
{
m_currentPageNodes.RemoveAt(i);
break;
}
}
return;
}
}

//如果这个是nodes里面的最顶部
if (m_currentPageNodes != null && m_currentPageNodes.Count >= 1 && m_currentPageNodes[m_currentPageNodes.Count - 1] == target)
{
m_currentPageNodes.RemoveAt(m_currentPageNodes.Count - 1);
target.Hide();

//show older page.
//TODO:Sub pages.belong to root node.
if (m_currentPageNodes.Count > 0)
{
TTUIPage page = m_currentPageNodes[m_currentPageNodes.Count - 1];
if (page.isAsyncUI)
ShowPage(page.name, page, null);
ShowPage(page.name, page, () =>
{
target.Hide();
});
else
{
ShowPage(page.name, page);
target.Hide();
}
}
}
else if (target.CheckIfNeedBack())
Expand Down

0 comments on commit 8b2722e

Please sign in to comment.