From b5460cd3e55d1c5120bf5567502c051e0c7cdb2b Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Thu, 19 Nov 2020 16:07:43 +0800 Subject: [PATCH] 动态修改背景 --- Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs | 27 ++++++++++++++++++++++----- 1 files changed, 22 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs index 2f2227c..c57ef4d 100644 --- a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs +++ b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs @@ -58,8 +58,7 @@ bGameStart = false; bFirstLoaded = false; - //darkGroundImg = transform.Find("Image_DarkGround").gameObject; - darkGroundImg.SetActive(false); + bVibrate = new bool[4]; bVibrate[0] = bVibrate[1] = bVibrate[2] = bVibrate[3] = false; @@ -71,10 +70,25 @@ EndlessBossHPManager.instance.HideHP(); EndlessScoreManager.instance.HideScore(); + + float ratio = 0.06666667f; + RectTransform ts = GetComponent<RectTransform>(); + float tmpScale = ratio / ts.localScale.x - 1.0f; + float offect = tmpScale * (ts.sizeDelta.y * 0.5f); + //Debug.Log($"tmpScale:{tmpScale} offect:{offect}"); + Vector2 tmpOffect = new Vector2(0, offect); + transform.Find("Panel/Bottom").GetComponent<RectTransform>().anchoredPosition += tmpOffect; + transform.Find("Panel/TowerBuyBtn").GetComponent<RectTransform>().anchoredPosition += tmpOffect; + + //darkGroundImg = transform.Find("Image_DarkGround").gameObject; + darkGroundImg.GetComponent<RectTransform>().offsetMin += tmpOffect; + darkGroundImg.GetComponent<RectTransform>().offsetMax -= tmpOffect*0.5f; + + darkGroundImg.SetActive(false); //查询是否已经做过了新手引导 int guide = PlayerPrefs.GetInt("GemBattleGuide"); GameConfig.IsNewbie = guide == 0; - + //GameConfig.IsNewbie = false; if (GameConfig.IsNewbie) { Debug.Log("开始新手引导"); @@ -83,7 +97,8 @@ countDownTextNew.text = ""; countDownTextNew.gameObject.SetActive(false); - Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), transform); + GameObject guideObj = Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), transform.Find("Panel")); + guideObj.GetComponent<RectTransform>().offsetMin += tmpOffect; AddGuideEvent(); } @@ -92,6 +107,8 @@ GameConfig.EndlessPortUseSkillTowerCount = 0; AudioSourceManager.Ins.Play(AudioEnum.BGM2); + + } /// <summary> @@ -194,7 +211,7 @@ /// </summary> private void GuidePlayAppearEffect(Vector3 worldPos) { - EndlessGameUI.instance.PlayAppearEffect(worldPos); + EndlessGameUI.instance.PlayAppearEffectGuide(worldPos); } /// <summary> -- Gitblit v1.9.1