Example #1
0
        /// <summary>
        ///     Opens the menu.
        /// </summary>
        private void Open()
        {
            // fade menu in if already open
            if (flightMenu != null)
            {
                flightMenu.FadeIn();
                return;
            }

            if (menuPrefab == null || menuObject != null)
            {
                return;
            }

            // create object
            menuObject = Instantiate(menuPrefab, GetAnchor(), Quaternion.identity) as GameObject;
            if (menuObject == null)
            {
                return;
            }

            StyleManager.Process(menuObject);

            // set object as a child of the main canvas
            menuObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform);

            // set menu's reference to this object for cross-communication
            flightMenu = menuObject.GetComponent <FlightMenu>();
            if (flightMenu != null)
            {
                flightMenu.SetFlightAppLauncher(this);
            }
        }
        /// <summary>
        ///     Opens the menu.
        /// </summary>
        private void Open()
        {
            // fade menu in if already open
            if (m_FlightMenu != null)
            {
                m_FlightMenu.FadeIn();
                return;
            }

            if (m_MenuPrefab == null || m_MenuObject != null)
            {
                return;
            }

            // create object
            m_MenuObject = Instantiate(m_MenuPrefab, GetAnchor(), Quaternion.identity) as GameObject;
            if (m_MenuObject == null)
            {
                return;
            }

            StyleManager.Process(m_MenuObject);

            // set object as a child of the main canvas
            m_MenuObject.transform.SetParent(MainCanvasUtil.MainCanvas.transform);

            // set menu's reference to this object for cross-communication
            m_FlightMenu = m_MenuObject.GetComponent<FlightMenu>();
            if (m_FlightMenu != null)
            {
                m_FlightMenu.SetFlightAppLauncher(this);
            }
        }