From 925d4b4b286a5d8dff4b62be0ceb25db0c45fedc Mon Sep 17 00:00:00 2001 From: liuzhiwei <liuzhiwei@qq.com> Date: Wed, 25 Nov 2020 20:44:48 +0800 Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle into master --- Assets/Scripts/Guide/GuidePanel.cs | 122 +++++++++++++++++++++++++++++++++++----- 1 files changed, 106 insertions(+), 16 deletions(-) diff --git a/Assets/Scripts/Guide/GuidePanel.cs b/Assets/Scripts/Guide/GuidePanel.cs index d9ba262..cdb296b 100644 --- a/Assets/Scripts/Guide/GuidePanel.cs +++ b/Assets/Scripts/Guide/GuidePanel.cs @@ -31,9 +31,14 @@ Image tmpMask;//自身的遮罩 GameObject offectBackground;//适配需要的黑色背景 ImageFire1 fire1; - ImageFire2 fire2;//两个用来合成的火元素 + ParticleSystem fire1PS1, fire1PS2;//出现的特效 - ImageWater water1; + ImageFire2 fire2;//两个用来合成的火元素 + ParticleSystem fire2PS1, fire2PS2; + + ImageWater wood1; + + ParticleSystem woodPS1, woodPS2; ImageSkill skill; @@ -49,6 +54,7 @@ Button skillBtn;// Vector2 skillBtnPos = new Vector2(459, 280); + private Image warningImg;//大波敌人来袭提示 /// <summary> /// 关闭所有UI /// </summary> @@ -116,8 +122,13 @@ fire1 = transform.Find("Image_Fire1").GetComponent<ImageFire1>(); fire1.GetComponent<RectTransform>().anchoredPosition *= tmpScale; + fire1PS1 = fire1.transform.Find("Huo/Particle System").GetComponent<ParticleSystem>(); + fire1PS2 = fire1.transform.Find("Huo_02/Particle System").GetComponent<ParticleSystem>(); + fire2 = transform.Find("Image_Fire2").GetComponent<ImageFire2>(); fire2.GetComponent<RectTransform>().anchoredPosition *= tmpScale; + fire2PS1 = fire2.transform.Find("Huo/Particle System").GetComponent<ParticleSystem>(); + fire2PS2 = fire2.transform.Find("Huo_02/Particle System").GetComponent<ParticleSystem>(); fire1.gameObject.SetActive(false); fire2.gameObject.SetActive(false); @@ -132,9 +143,12 @@ towerPos2.enabled = false; - water1 = transform.Find("Image_Water").GetComponent<ImageWater>(); - water1.GetComponent<RectTransform>().anchoredPosition *= tmpScale; - water1.gameObject.SetActive(false); + wood1 = transform.Find("Image_Wood").GetComponent<ImageWater>(); + wood1.GetComponent<RectTransform>().anchoredPosition *= tmpScale; + woodPS1 = wood1.transform.Find("Mu/Particle System").GetComponent<ParticleSystem>(); + woodPS2 = wood1.transform.Find("Mu_02/Particle System").GetComponent<ParticleSystem>(); + + wood1.gameObject.SetActive(false); skill = transform.Find("Image_Skill").GetComponent<ImageSkill>(); skill.GetComponent<RectTransform>().anchoredPosition *= tmpScale; @@ -143,6 +157,9 @@ dragHandImg = transform.Find("ImageHand").GetComponent<RectTransform>(); dragHandImg.gameObject.SetActive(false); + + warningImg = transform.Find("Image_Warning").GetComponent<Image>(); + warningImg.gameObject.SetActive(false); } @@ -162,7 +179,7 @@ fire2.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; towerPos.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; towerPos2.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; - water1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; + wood1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; skill.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; } @@ -226,6 +243,8 @@ fire1.gameObject.SetActive(true); fire1.transform.Find("Image_2").gameObject.SetActive(false); fire1.enabled = false; + fire1PS1.Play(); + fire1PS2.Play(); EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire1.transform.position); } @@ -233,6 +252,8 @@ public void Step1_2() { fire2.gameObject.SetActive(true); + fire2PS1.Play(); + fire2PS2.Play(); fire2.enabled = false; DestoryButtonListener(towerBuyBtn); SetRimActive(false); @@ -346,7 +367,7 @@ /// <summary> - /// 第九步, + /// 第九步,购买水元素,第二步上阵 /// </summary> /// <param name="str"></param> /// <param name="currentIndex">当前第几步</param> @@ -369,13 +390,15 @@ btnImg.raycastTarget = true; InitRectGuidance(btnImg, 75, 80, tmpOffect); SetRimPos(go); - ShowDragPath(water1.GetStartP, btnImg.rectTransform); + ShowDragPath(wood1.GetStartP, btnImg.rectTransform); } } public void Step9_1() { - water1.gameObject.SetActive(true); + wood1.gameObject.SetActive(true); + woodPS1.Play(); + woodPS2.Play(); towerPos2.enabled = true; DestoryButtonListener(towerBuyBtn); } @@ -392,7 +415,7 @@ } /// <summary> - /// 第12步,引导释放技能 + /// 第12步,弃用 /// </summary> public void Step11(int currentIndex, string str) { @@ -430,7 +453,7 @@ /// <summary> - /// 第12步,引导释放技能 + /// 第12步,交换水火塔 /// </summary> public void Step11Drag(int currentIndex) { @@ -447,8 +470,9 @@ btnImg.raycastTarget = false; InitRectGuidance(btnImg, 75, 80, tmpOffect); - SetRimPos(towerPos2.gameObject); - StartCoroutine(ShowRimTip("拖动")); + //SetRimPos(towerPos2.gameObject); + SetRimPos(towerPos2.gameObject, new Vector2(0, 30)); + StartCoroutine(ShowRimTip("交换")); ShowDragPath(towerPos2.GetComponent<RectTransform>().anchoredPosition, towerPos.GetComponent<RectTransform>()); } @@ -458,8 +482,10 @@ btnImg.raycastTarget = false; InitRectGuidance(btnImg, 75, 80, tmpOffect); - SetRimPos(towerPos.gameObject); - StartCoroutine(ShowRimTip("拖动")); + //SetRimPos(towerPos.gameObject); + SetRimPos(towerPos.gameObject, new Vector2(0, 10)); + + StartCoroutine(ShowRimTip("交换")); } else if (currentIndex == 2) @@ -467,6 +493,33 @@ SetRimActive(false); StopShowDragPath(true); CloseMask(); + } + } + + /// <summary> + /// 一大波敌人 + /// </summary> + public void Step11_End() + { + warningImg.color = new Color(1.0f, 1.0f, 1.0f, 0); + warningImg.gameObject.SetActive(true); + colorCount = 0; + SetWarningColor(); + } + + int colorCount = 0; + private void SetWarningColor() + { + if (colorCount < 4) + { + colorCount++; + warningImg.DOFade(colorCount % 2, 1.0f).OnComplete(SetWarningColor); + CommonDebugHelper.Debug($"执行了{colorCount}次"); + } + else + { + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.CreateThirdWave); + warningImg.gameObject.SetActive(false); } } @@ -490,7 +543,9 @@ AddButtonListener(skillBtn.gameObject, ac); Image btnImg = skillBtn.GetComponent<Image>(); InitRectGuidance(btnImg, 79, 79f, Vector2.one); - SetRimPos(skillBtn.gameObject); + //SetRimPos(skillBtn.gameObject); + SetRimPos(skillBtn.gameObject, new Vector2(-15, -241)); + text_Tip.text = str;//动态改变长度 StartCoroutine(ShowRimTip(str)); } @@ -554,6 +609,41 @@ } + /// <summary> + /// 设置边框的大小和位置 + /// </summary> + /// <param name="target"></param> + private void SetRimPos(GameObject target, Vector2 offect) + { + SetRimActive(true); + RectTransform rt = target.GetComponent<RectTransform>(); + if (target.gameObject.name == "TowerBuyBtn") + { + image_Rim_Rect.anchoredPosition = towerBuyBtnPos - tmpOffect; + } + else if (target.gameObject.name == "FireSkillBtn") + { + image_Rim_Rect.anchoredPosition = skillBtnPos - tmpOffect; + } + else + { + image_Rim_Rect.anchoredPosition = rt.anchoredPosition; + } + image_Rim_Rect.sizeDelta = (rt.sizeDelta * rt.localScale) + rimOffset; + if (image_Rim_Rect.sizeDelta.x > 200) + { + particle_1.SetActive(false); + particle_2.SetActive(true); + } + else + { + particle_1.SetActive(true); + particle_2.SetActive(false); + } + 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 += offect; + } + IEnumerator ShowRimTip(string str) { text_Tip.text = str;//动态改变长度 -- Gitblit v1.9.1