Beispiel #1
0
    /// <summary>
    /// 设置面板位置
    /// </summary>
    /// <param name="astrictScope"></param>
    public void SetPoint(RectTransform tageRect, RectTransform astrictScope)
    {
        Vector3 locaPoint  = transform.InverseTransformPoint(tageRect.position);
        float   x          = locaPoint.x + _contentRect.rect.width / 2;
        float   y          = locaPoint.y - _contentRect.rect.height / 2;
        Vector3 newVector3 = new Vector3(x, y);

        _contentRect.localPosition  = newVector3;
        _asteriskRect.localPosition = new Vector3(_contentRect.localPosition.x - (_contentRect.rect.width / 2) + 5, (_contentRect.localPosition.y + _contentRect.rect.height / 2) - 5);
        bool isBottomOut = ChatTool.AstrictScope(_contentRect, astrictScope);

        if (isBottomOut)
        {
            float yTwo = locaPoint.y + _contentRect.rect.height / 2;
            Debug.Log("触底y轴:" + yTwo);
            _contentRect.localPosition  = new Vector3(x, yTwo);
            _asteriskRect.localPosition = new Vector3(_asteriskRect.localPosition.x, (_contentRect.localPosition.y - _contentRect.rect.height / 2) + 5);
        }
        _thisCanvasGroup.alpha = 1;
    }