コード例 #1
0
ファイル: UIEventManager.cs プロジェクト: zhoulk/Lufy
        public void OnUpdate()
        {
            if (isPause)
            {
                return;
            }

            if (m_UIInput == null)
            {
                return;
            }

            if (m_SelectedGameObject == null)
            {
                //m_SelectedGameObject = UINaviManager.Instance.DefaultObject;
                //m_SelectedGameObject.AddOutLine();
                return;
            }
            if (m_UIInput.ClickUpDown())
            {
                if (m_SelectedGameObject && m_SelectedGameObject.GetUpNavi())
                {
                    if (m_SelectedGameObject.GetUnSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetUnSelectedAction()(m_SelectedGameObject);
                    }
                    m_SelectedGameObject = m_SelectedGameObject.GetUpNavi();
                    if (m_SelectedGameObject.GetSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetSelectedAction()(m_SelectedGameObject);
                    }
                }
            }
            else if (m_UIInput.ClickLeftDown())
            {
                if (m_SelectedGameObject && m_SelectedGameObject.GetLeftNavi())
                {
                    if (m_SelectedGameObject.GetUnSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetUnSelectedAction()(m_SelectedGameObject);
                    }
                    m_SelectedGameObject = m_SelectedGameObject.GetLeftNavi();
                    if (m_SelectedGameObject.GetSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetSelectedAction()(m_SelectedGameObject);
                    }
                }
            }
            else if (m_UIInput.ClickRightDown())
            {
                if (m_SelectedGameObject && m_SelectedGameObject.GetRightNavi())
                {
                    if (m_SelectedGameObject.GetUnSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetUnSelectedAction()(m_SelectedGameObject);
                    }
                    m_SelectedGameObject = m_SelectedGameObject.GetRightNavi();
                    if (m_SelectedGameObject.GetSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetSelectedAction()(m_SelectedGameObject);
                    }
                }
            }
            else if (m_UIInput.ClickDownDown())
            {
                if (m_SelectedGameObject && m_SelectedGameObject.GetDownNavi())
                {
                    if (m_SelectedGameObject.GetUnSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetUnSelectedAction()(m_SelectedGameObject);
                    }
                    m_SelectedGameObject = m_SelectedGameObject.GetDownNavi();
                    if (m_SelectedGameObject.GetSelectedAction() != null)
                    {
                        m_SelectedGameObject.GetSelectedAction()(m_SelectedGameObject);
                    }
                }
            }
            else if (m_UIInput.ClickEnterDown())
            {
                //Debug.Log("KeyCode2.A  click" + Time.frameCount);
                if (m_SelectedGameObject)
                {
                    if (m_ClickHandlerDic.ContainsKey(m_SelectedGameObject))
                    {
                        m_ClickHandlerDic[m_SelectedGameObject](m_SelectedGameObject);
                    }
                }
            }
        }