예제 #1
0
    public void Awake()
    {
        m_Context = new GlobalMenuContext();
        gameObject.GetComponentInChildren <Canvas>().enabled = false;
        GetComponent <M4uContextRoot>().Context = m_Context;

        GameObject _panel = UnityUtil.GetChildNode(gameObject, "PagePanel");

        m_Panel = _panel.GetComponent <MenuPartsBase>();

        m_SeqArray = new SeqData[(int)GLOBALMENU_SEQ.MAX];
        MasterGlobalMenuSeq[] _masters = Resources.LoadAll <MasterGlobalMenuSeq>("MasterData/GlobalMenuSeq");
        for (int i = 0; i < _masters.Length; i++)
        {
            if (_masters[i].Sequence == GLOBALMENU_SEQ.NONE)
            {
                continue;
            }

            m_SeqArray[(int)_masters[i].Sequence]          = new SeqData();
            m_SeqArray[(int)_masters[i].Sequence].m_Master = _masters[i];
        }

        // TODO : レイアウトデータとしてprefabを用意したら消す
        m_UIRoot = UnityUtil.GetChildNode(gameObject, "UIRoot");
        Debug.Assert(m_UIRoot != null, "The UIRoot node not found in GlobalMenu prefab");
        Transform transform = m_UIRoot.transform.Find("RetuenButton");

        if (SafeAreaControl.HasInstance)
        {
            SafeAreaControl.Instance.addLocalYPos(transform);
        }

        m_UIView = m_UIRoot.GetComponent <GlobalMenuUIView>();
        Debug.Assert(m_UIView != null, "The GlobalMenuUIView node not found in m_UIRoot node");

        AndroidBackKeyManager.Instance.StackPush(gameObject, OnPushBackKey);
    }