From 056fe553764f4be5ea46f25b447d60042cae817b Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Wed, 18 Nov 2020 16:39:07 +0800 Subject: [PATCH] 修改新手指导适配 --- Assets/Scripts/Guide/GuidePanel.cs | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Guide/GuidePanel.cs b/Assets/Scripts/Guide/GuidePanel.cs index 3d1eafd..fa756b2 100644 --- a/Assets/Scripts/Guide/GuidePanel.cs +++ b/Assets/Scripts/Guide/GuidePanel.cs @@ -69,11 +69,9 @@ towerBuyBtn = GameObject.Find("UICamera/BottomCanvas/Panel/TowerBuyBtn"); RectTransform tmpTs = towerBuyBtn.GetComponent<RectTransform>(); - float tmpOffect = tmpTs.anchoredPosition.y - (transform.parent.parent.GetComponent<RectTransform>().sizeDelta.y * 0.5f); + RectTransform canvasUI = transform.parent.parent.GetComponent<RectTransform>(); + float tmpOffect = tmpTs.anchoredPosition.y - (canvasUI.sizeDelta.y * 0.5f); towerBuyBtnPos = new Vector2(215, tmpOffect); - //towerBuyBtnPos = new Vector2(215, -862); - Debug.Log(tmpOffect); - tipsUI = transform.Find("Tips").gameObject; tipsUI.transform.SetAsLastSibling();//把tips放在最下面 @@ -97,29 +95,44 @@ particle_1 = image_Rim_Rect.transform.Find("Particle System Small").gameObject; particle_2 = image_Rim_Rect.transform.Find("Particle System Big").gameObject; + float a = 0.06666667f; + float b = canvasUI.localScale.x; + float tmpScale = a / b; + //Debug.Log($"记录的比值:{a} 当前Canvas的Scale:{b} 计算得到的比值:{tmpScale}"); + 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; fire2 = transform.Find("Image_Fire2").GetComponent<ImageFire2>(); + fire2.GetComponent<RectTransform>().anchoredPosition *= tmpScale; fire1.gameObject.SetActive(false); fire2.gameObject.SetActive(false); towerPos = transform.Find("Image_TowerPos").GetComponent<ImageTowerPos>(); + towerPos.GetComponent<RectTransform>().anchoredPosition *= tmpScale; + towerPos.enabled = false; towerPos2 = transform.Find("Image_TowerPos2").GetComponent<ImageTowerPos2>(); + towerPos2.GetComponent<RectTransform>().anchoredPosition *= tmpScale; + towerPos2.enabled = false; water1 = transform.Find("Image_Water").GetComponent<ImageWater>(); + water1.GetComponent<RectTransform>().anchoredPosition *= tmpScale; water1.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>(); -- Gitblit v1.9.1