示例#1
0
    private void UIBlockClick(PointerEventData pointerEventData)
    {
        if (m_IsMsgShowing)
        {
            SetMsgShow(false);
            if (m_IsStageInfoShowing)
            {
                m_IsStageInfoShowing = false;
                ShowStageTrunInfo();
            }
            //TODO call hide msg action
        }
        else
        {
            if (pointerEventData.button == PointerEventData.InputButton.Right)
            {
                GameManager.m_Instance.Cancel();
                UIBlockSwitch(false);
                HideMenu();
            }
            else if (pointerEventData.button == PointerEventData.InputButton.Left)
            {
                Vector3 clickPos = Input.mousePosition;
                Vector3 worldPos = m_MainCamera.ScreenToWorldPoint(clickPos);

                RaycastHit raycastHit;
                Ray        ray = new Ray(worldPos, m_MainCamera.transform.forward);
                if (Physics.Raycast(ray, out raycastHit, 100, m_TileMask))
                {
                    HexTile          hexTile   = raycastHit.transform.GetComponent <HexTile>();
                    PointerEventData eventData = new PointerEventData(EventSystem.current);
                    hexTile.ClickEventGame(eventData);
                }
            }
        }
    }