示例#1
0
    protected void SetAndroidQuit()
    {
#if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.Escape))
#else
        if (Application.platform == RuntimePlatform.Android && Input.GetKeyDown(KeyCode.Escape))
#endif
        {
            if (GlobalDataManager.GetInstance().playerData.playerZoo.isGuide)
            {
                return;
            }

            var activePages = PageMgr.GetActivePages();
            if (activePages.Count == 1 && activePages[0].name == "UIMainPage")
            {
                //只有主界面存在,并且点了返回键
                PageMgr.ShowPage <UIQuitGamePage>();
                return;
            }

            foreach (var item in PageMgr.allPages)
            {
                if (item.Key != "UIMainPage")
                {
                    item.Value.Hide();
                }
            }
        }
    }