Exemple #1
0
    // Bind Component
    void Awake()
    {
        Button btn = GetComponent <Button>();

        btn.onClick.AddListener(() =>
        {
            if (!isOpen)
            {
                view.Open();
            }
            else
            {
                view.Close();
            }

            isOpen = !isOpen;
        });
    }
Exemple #2
0
    public static void CloseView(ViewID key)
    {
        ViewBase view = GetView(key);

        if (view != null)
        {
            if (view.isOpen)
            {
                view.Close();
                UINavigation.RemoveLastItem(view);
            }
            else
            {
                GameLog.LogWarning("[UIModule]界面关闭失败,已经关闭!" + key.ToString());
            }
        }
        else
        {
            GameLog.LogError("[UIModule]界面关闭失败,没有找到指定界面!" + key.ToString());
        }
    }