Exemplo n.º 1
0
    private void Start()
    {
        // PanelFade
        Fader.FadeOut();

        // ButtonMenu
        Transform _ObjButton = Canvas.transform.Find(NAME_BUTTON_MENU);

        if (_ObjButton == null)
        {
            Debug.Log("require " + NAME_BUTTON_MENU + " gameobject");
            return;
        }

        m_ButtonMenu = _ObjButton.GetComponent <MyButton>();
        if (m_ButtonMenu == null)
        {
            Debug.Log("require MyButton component");
            return;
        }

        // PanelMenu
        Transform _Menu = Canvas.transform.Find(NAME_PANEL_MENU);

        if (_Menu == null)
        {
            Debug.Log("require " + NAME_PANEL_MENU + " gameobject");
            return;
        }

        m_PanelMenu = _Menu.GetComponent <PanelMenu>();
        if (m_PanelMenu == null)
        {
            Debug.Log("require PanelMenu component");
            return;
        }

        m_ButtonMenu.RxOnClick.Subscribe(_ => {
            m_ButtonMenu.Inactive();
            m_PanelMenu.Active();
        }).AddTo(this);

        m_PanelMenu.RxClose.Subscribe(_ => {
            InactiveMenu();
        }).AddTo(this);

        InactiveMenu();
    }