wangguan
2020-11-23 e70a047e1d3a3b476212d49714264cf6871cd9fc
Assets/Scripts/Guide/GuidePanel.cs
@@ -139,6 +139,27 @@
        dragHandImg.gameObject.SetActive(false);
    }
    private Vector2 tmpOffect;
    /// <summary>
    /// Start is called on the frame when a script is enabled just before
    /// any of the Update methods is called the first time.
    /// </summary>
    void Start()
    {
        tmpOffect = GetComponent<RectTransform>().offsetMin;
        tmpOffect = new Vector2(tmpOffect.x, tmpOffect.y * 0.5f);
        image_SkillRim.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        fire1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        fire2.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        towerPos.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        towerPos2.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        water1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        skill.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
    }
    /// <summary>
    /// 设置引导框
    /// </summary>
@@ -179,7 +200,7 @@
            SetRimActive(true);
            AddButtonListener(towerBuyBtn, ac);
            Image btnImg = towerBuyBtn.GetComponent<Image>();
            InitRectGuidance(btnImg, 159, 73.5f);
            InitRectGuidance(btnImg, 159, 73.5f, Vector2.one);
            SetRimPos(towerBuyBtn);
            //maskObj.ShowImmediately();
@@ -269,7 +290,7 @@
            SetRimActive(true);
            Image btnImg = transform.Find("Image_TowerPos").GetComponent<Image>();
            towerPos.enabled = true;
            InitRectGuidance(btnImg, 75, 80);
            InitRectGuidance(btnImg, 75, 80, tmpOffect);
            SetRimPos(btnImg.gameObject);
            //maskObj.ShowImmediately();
            ShowDragPath(fire1.GetStartP, btnImg.rectTransform);
@@ -304,7 +325,7 @@
            Image btnImg = go.GetComponent<Image>();
            btnImg.raycastTarget = false;
            InitRectGuidance(btnImg, 75, 80);
            InitRectGuidance(btnImg, 75, 80, tmpOffect);
            SetRimPos(go);
            //maskObj.ShowImmediately();
            StartCoroutine(ShowRimTip(str));
@@ -337,7 +358,7 @@
            AddButtonListener(towerBuyBtn, ac);
            Image btnImg = towerBuyBtn.GetComponent<Image>();
            InitRectGuidance(btnImg, 159, 73.5f);
            InitRectGuidance(btnImg, 159, 73.5f, Vector2.one);
            SetRimPos(towerBuyBtn);
            //maskObj.ShowImmediately();
        }
@@ -346,7 +367,7 @@
            GameObject go = transform.Find("Image_TowerPos2").gameObject;
            Image btnImg = go.GetComponent<Image>();
            btnImg.raycastTarget = true;
            InitRectGuidance(btnImg, 75, 80);
            InitRectGuidance(btnImg, 75, 80, tmpOffect);
            SetRimPos(go);
            //maskObj.ShowImmediately();
            ShowDragPath(water1.GetStartP, btnImg.rectTransform);
@@ -390,7 +411,7 @@
            ShowDragPath(skill.GetStartP, image_SkillRim.rectTransform);
            InitRectGuidance(image_SkillRim, 79, 265);
            InitRectGuidance(image_SkillRim, 79, 265, tmpOffect);
        }
        else if (currentIndex == 1)
@@ -436,10 +457,13 @@
    {
        SetRimActive(true);
        RectTransform rt = target.GetComponent<RectTransform>();
        image_Rim_Rect.anchoredPosition = rt.anchoredPosition;
        if (target.gameObject.name == "TowerBuyBtn")
        {
            image_Rim_Rect.anchoredPosition = towerBuyBtnPos;
            image_Rim_Rect.anchoredPosition = towerBuyBtnPos - tmpOffect;
        }
        else
        {
            image_Rim_Rect.anchoredPosition = rt.anchoredPosition;
        }
        image_Rim_Rect.sizeDelta = (rt.sizeDelta * rt.localScale) + rimOffset;
        if (image_Rim_Rect.sizeDelta.x > 200)
@@ -454,7 +478,10 @@
        }
        if (changeTipPos)
        {
            image_Tip_Rect.anchoredPosition = new Vector2(image_Rim_Rect.anchoredPosition.x, image_Rim_Rect.anchoredPosition.y + 74 / 2 + image_Rim_Rect.sizeDelta.y / 2);
            //image_Tip_Rect.anchoredPosition -= tmpOffect;
        }
    }
@@ -484,7 +511,7 @@
    /// 抠出来一个区域
    /// </summary>
    /// <param name="target"></param>
    void InitRectGuidance(Image target, float x, float y)
    void InitRectGuidance(Image target, float x, float y, Vector2 offect)
    {
        if (!maskObj.gameObject.activeSelf)
        {
@@ -498,7 +525,7 @@
        }
        else
        {
            maskObj.InitForCamera(target, x, y);
            maskObj.InitForCamera(target, x, y, offect);
        }
    }