wangguan
2020-12-10 5f6fb6dccd1330b5b0bcb2d721167a6ac062f3ad
Assets/Scripts/Guide/GuidePanel.cs
@@ -25,7 +25,6 @@
    private RectTransform image_Tip_Rect;//可以移动的提示框
    private Text text_Tip;//可以移动的提示框文字
    private Image image_SkillRim;//技能释放区域
    Vector2 rimOffset = new Vector2(30, 30);//边框要比按钮大一些
    Image tmpMask;//自身的遮罩
@@ -40,10 +39,9 @@
    ParticleSystem woodPS1, woodPS2;
    ImageSkill skill;
    ImageTowerPos towerPos;//塔位标识
    ImageTowerPos2 towerPos2;//塔位标识
    ImageTowerPos towerPos2;//塔位标识
    GameObject towerBuyBtn;//购买宝石按钮
    Vector2 towerBuyBtnPos;
@@ -62,9 +60,10 @@
    {
        CloseMask();
        SetRimActive(false);
        image_SkillRim.gameObject.SetActive(false);
    }
    private GuideBox boxPanel;//宝箱面板
    // Start is called before the first frame update
    void Awake()
@@ -114,11 +113,10 @@
        image_Tip_Rect = transform.Find("Image_Tip").GetComponent<RectTransform>();
        text_Tip = image_Tip_Rect.transform.Find("Text").GetComponent<Text>();
        image_SkillRim = transform.Find("Image_SkillRim").GetComponent<Image>();
        image_SkillRim.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
        SetRimActive(false);
        image_SkillRim.gameObject.SetActive(false);
        fire1 = transform.Find("Image_Fire1").GetComponent<ImageFire1>();
        fire1.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
@@ -138,7 +136,7 @@
        towerPos.enabled = false;
        towerPos2 = transform.Find("Image_TowerPos2").GetComponent<ImageTowerPos2>();
        towerPos2 = transform.Find("Image_TowerPos2").GetComponent<ImageTowerPos>();
        towerPos2.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
        towerPos2.enabled = false;
@@ -150,16 +148,13 @@
        wood1.gameObject.SetActive(false);
        skill = transform.Find("Image_Skill").GetComponent<ImageSkill>();
        skill.GetComponent<RectTransform>().anchoredPosition *= tmpScale;
        skill.gameObject.SetActive(false);
        dragHandImg = transform.Find("ImageHand").GetComponent<RectTransform>();
        dragHandImg.gameObject.SetActive(false);
        warningImg = transform.Find("Image_Warning").GetComponent<Image>();
        warningImg.gameObject.SetActive(false);
        boxPanel = transform.Find("BoxPanel").GetComponent<GuideBox>();
    }
@@ -174,40 +169,15 @@
        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;
        wood1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
        skill.GetComponent<RectTransform>().anchoredPosition -= tmpOffect;
    }
    /// <summary>
    /// 设置引导框
    /// </summary>
    /// <param name="active"></param>
    public void SetGuideUI(bool active)
    {
        if (backgroundImg.enabled != active)
            backgroundImg.enabled = active;
        if (tipsUI.activeSelf != active)
            tipsUI.SetActive(active);
    }
    //开始打印文字
    public void StartShowWord(string str, Action cb)
    {
        charForeach.StartShowWord(str, cb);
    }
    /// <summary>
    /// 立刻完成打印
    /// </summary>
    public void ShowWordImmediately()
    {
        charForeach.ShowWordImmediately();
    }
    /// <summary>
    /// 第二步,购买宝石
@@ -290,7 +260,7 @@
            fire1.enabled = true;
            fire2.enabled = true;
            image_Tip_Rect.gameObject.SetActive(false);
            ShowDragPath(fire2.GetStartP, fire1.GetRect);
            //ShowDragPath(fire2.GetStartP, fire1.GetRect);
            StartCoroutine(ShowRimTip(str));
        }
    }
@@ -405,54 +375,6 @@
    }
    //生成一个技能宝石
    public void Step10()
    {
        //SetGuideUI(false);
        image_SkillRim.gameObject.SetActive(true);
        skill.gameObject.SetActive(true);
    }
    /// <summary>
    /// 第12步,弃用
    /// </summary>
    public void Step11(int currentIndex, string str)
    {
        if (currentIndex == 0)
        {
            tmpMask.enabled = true;
            tmpMask.color = new Color(1.0f, 1.0f, 1.0f, 0);
            SetGuideUI(false);
            SetRimActive(true);
            SetRimPos(skill.gameObject);
            image_Tip_Rect.gameObject.SetActive(false);
            //StartCoroutine(ShowRimTip(str));
            ShowDragPath(skill.GetStartP, image_SkillRim.rectTransform);
            InitRectGuidance(image_SkillRim, 79, 265, tmpOffect);
        }
        else if (currentIndex == 1)
        {
            SetRimActive(false);
            //SetRimPos(image_SkillRim.gameObject);
            //StartCoroutine(ShowRimTip(str));
        }
    }
    public void SkillRelease()
    {
        StopShowDragPath(true);
        CloseMask();
        image_SkillRim.gameObject.SetActive(false);
        tmpMask.enabled = false;
        SetRimActive(false);
    }
    /// <summary>
    /// 第12步,交换水火塔 
    /// </summary>
@@ -524,7 +446,6 @@
        }
    }
    public void Step12()
    {
        SetGuideUI(true);
@@ -561,9 +482,35 @@
    public void FinishGuide()
    {
        towerBuyBtn.gameObject.SetActive(true);
    }
    #region 设置对话框
    /// <summary>
    /// 设置引导框
    /// </summary>
    /// <param name="active"></param>
    public void SetGuideUI(bool active)
    {
        if (backgroundImg.enabled != active)
            backgroundImg.enabled = active;
        if (tipsUI.activeSelf != active)
            tipsUI.SetActive(active);
    }
    //开始打印文字
    public void StartShowWord(string str, Action cb)
    {
        charForeach.StartShowWord(str, cb);
    }
    /// <summary>
    /// 立刻完成打印
    /// </summary>
    public void ShowWordImmediately()
    {
        charForeach.ShowWordImmediately();
    }
    #endregion
    #region 按钮以及提示
@@ -611,7 +558,6 @@
        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;
        }
    }
@@ -670,9 +616,6 @@
    #endregion
    #region 遮罩,以及按钮添加删除事件
    /// <summary>
    /// 抠出来一个区域
    /// </summary>
@@ -683,8 +626,7 @@
        {
            maskObj.gameObject.SetActive(true);
        }
        //maskObj.Init(target);
        //maskObj.ShowImmediately();
        if (target.gameObject.name == "TowerBuyBtn")
        {
            maskObj.InitForCamera(target, towerBuyBtnPos, x, y);
@@ -761,4 +703,10 @@
    #endregion
    public void OpenDialogBox(){
    }
}