示例#1
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    private void UpdatePreviewLabel()
    {
        if (m_noPic != null)
        {
            m_noPic.SetActive((m_preview == null) || (m_preview.texture == null));

            if ((m_noPic.activeSelf) && (m_noPicLabel != null))
            {
                m_noPic.transform.localScale = XForm.LocalScaleForWorldScale(Vector3.one, m_noPic.transform);

                object selection = (m_items != null) ? m_items.selection : null;

                m_noPicLabel.text = (selection != null) ? "No picture available" : "No selection";
            }
        }
    }
示例#2
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void UpdateMapObjectsSelection()
    {
        if (Focusable.any)
        {
            return;
        }

        if (DragDropOperation.pending)
        {
            if (m_objSelection != null)
            {
                m_objSelection.SetActive(false);
            }

            return;
        }


        m_selectables.Clear();

        for (int flag = 0; flag < m_flags.Count; ++flag)
        {
            m_flags[flag].UpdateSelectablesList(m_handpick.Point, m_selectables);
        }

        for (int pin = 0; pin < m_pins.Count; ++pin)
        {
            m_pins [pin].UpdateSelectablesList(m_handpick.Point, m_selectables);
        }


        float sqrMinDist = float.MaxValue;

        WebMapObjectBase selection = null;

        for (int sel = 0; sel < m_selectables.Count; ++sel)
        {
            if (sqrMinDist > m_selectables[sel].sqrDistFromCursor)
            {
                sqrMinDist = m_selectables[sel].sqrDistFromCursor;

                selection = m_selectables[sel];
            }
        }


        if (m_objSelection != null)
        {
            m_objSelection.SetActive(selection != null);

            if (m_objSelection.activeInHierarchy)
            {
                float selectionScaleModifier = 0.7f + (0.3f * Mathf.Sin(Mathf.PI * ((Time.time % 0.250f) / 0.250f)));

                Vector3 selectionAnchorPos = selection.transform.position;

                m_objSelection.transform.position = new Vector3(selectionAnchorPos.x, 2.0f, selectionAnchorPos.z);

                m_objSelection.transform.localScale = XForm.LocalScaleForWorldScale((Vector3.one * selection.bounds.size.x) * selectionScaleModifier, m_objSelection.transform);
            }
        }


        if (selection != null)
        {
            if (Input.GetMouseButtonDown(0))
            {
                if (HUDSites.Instance != null)
                {
                    HUDSites.Instance.items.SelectItemUserDatas(selection.localizable);
                }

                POPUPItem.Instance.Show(null, selection.localizable);
            }
        }
    }