From 0d6a2e6d4b9de57a13c2bcb32148e1eb97ef1b1f Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Tue, 15 Dec 2020 16:53:34 +0800 Subject: [PATCH] 玩家通关打点位置修改为结算的时候统计 --- Assets/Scripts/Guide/GuidePanel.cs | 190 ++++++++++++++++++++--------------------------- 1 files changed, 82 insertions(+), 108 deletions(-) diff --git a/Assets/Scripts/Guide/GuidePanel.cs b/Assets/Scripts/Guide/GuidePanel.cs index 5acb9c0..684560e 100644 --- a/Assets/Scripts/Guide/GuidePanel.cs +++ b/Assets/Scripts/Guide/GuidePanel.cs @@ -25,20 +25,23 @@ private RectTransform image_Tip_Rect;//可以移动的提示框 private Text text_Tip;//可以移动的提示框文字 - private Image image_SkillRim;//技能释放区域 Vector2 rimOffset = new Vector2(30, 30);//边框要比按钮大一些 Image tmpMask;//自身的遮罩 GameObject offectBackground;//适配需要的黑色背景 ImageFire1 fire1; + ParticleSystem fire1PS1, fire1PS2;//出现的特效 + ImageFire2 fire2;//两个用来合成的火元素 + ParticleSystem fire2PS1, fire2PS2; - ImageWater water1; + ImageWater wood1; - ImageSkill skill; + ParticleSystem woodPS1, woodPS2; + ImageTowerPos towerPos;//塔位标识 - ImageTowerPos2 towerPos2;//塔位标识 + ImageTowerPos towerPos2;//塔位标识 GameObject towerBuyBtn;//购买宝石按钮 Vector2 towerBuyBtnPos; @@ -47,7 +50,7 @@ RectTransform dragHandImg;//拖动标识手指 Button skillBtn;// - Vector2 skillBtnPos = new Vector2(459, 280); + Vector2 skillBtnPos = new Vector2(459, 44.6f); private Image warningImg;//大波敌人来袭提示 /// <summary> @@ -57,9 +60,10 @@ { CloseMask(); SetRimActive(false); - image_SkillRim.gameObject.SetActive(false); } + + private GuideBox boxPanel;//宝箱面板 // Start is called before the first frame update void Awake() @@ -71,7 +75,7 @@ backgroundImg = transform.Find("Button").GetComponent<Image>(); - skillBtn = GameObject.Find("UICamera/BottomCanvas/Panel/Energy/FireSkillBtn").GetComponent<Button>(); + skillBtn = GameObject.Find("UICamera/BottomCanvas/Panel/Energy/FireSkillBg/SkillBtn").GetComponent<Button>(); skillBtn.interactable = false; towerBuyBtn = GameObject.Find("UICamera/BottomCanvas/Panel/TowerBuyBtn"); RectTransform tmpTs = towerBuyBtn.GetComponent<RectTransform>(); @@ -109,16 +113,20 @@ 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; + 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); @@ -128,25 +136,25 @@ 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; - 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>(); - skill = transform.Find("Image_Skill").GetComponent<ImageSkill>(); - skill.GetComponent<RectTransform>().anchoredPosition *= tmpScale; - - skill.gameObject.SetActive(false); + wood1.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>(); } @@ -161,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; - water1.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; - skill.GetComponent<RectTransform>().anchoredPosition -= tmpOffect; + wood1.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> /// 第二步,购买宝石 @@ -230,18 +213,22 @@ 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); + //EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire1.transform.position); } } public void Step1_2() { fire2.gameObject.SetActive(true); + fire2PS1.Play(); + fire2PS2.Play(); fire2.enabled = false; DestoryButtonListener(towerBuyBtn); SetRimActive(false); CloseMask(); - EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire2.transform.position); + //EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire2.transform.position); //RemoveButtonListener(towerBuyBtn); } @@ -273,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)); } } @@ -373,63 +360,18 @@ 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); - } - - - //生成一个技能宝石 - 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); + towerBuyBtn.gameObject.SetActive(false); } @@ -504,7 +446,6 @@ } } - public void Step12() { SetGuideUI(true); @@ -525,7 +466,7 @@ Image btnImg = skillBtn.GetComponent<Image>(); InitRectGuidance(btnImg, 79, 79f, Vector2.one); //SetRimPos(skillBtn.gameObject); - SetRimPos(skillBtn.gameObject, new Vector2(-15, 10)); + SetRimPos(skillBtn.gameObject, new Vector2(-15, -241)); text_Tip.text = str;//动态改变长度 StartCoroutine(ShowRimTip(str)); @@ -538,6 +479,38 @@ RemoveButtonListener(skillBtn.gameObject); } + 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 按钮以及提示 @@ -562,7 +535,7 @@ { image_Rim_Rect.anchoredPosition = towerBuyBtnPos - tmpOffect; } - else if (target.gameObject.name == "FireSkillBtn") + else if (target.gameObject.name == "SkillBtn") { image_Rim_Rect.anchoredPosition = skillBtnPos - tmpOffect; } @@ -585,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; } } @@ -602,7 +574,7 @@ { image_Rim_Rect.anchoredPosition = towerBuyBtnPos - tmpOffect; } - else if (target.gameObject.name == "FireSkillBtn") + else if (target.gameObject.name == "SkillBtn") { image_Rim_Rect.anchoredPosition = skillBtnPos - tmpOffect; } @@ -644,9 +616,6 @@ #endregion #region 遮罩,以及按钮添加删除事件 - - - /// <summary> /// 抠出来一个区域 /// </summary> @@ -657,13 +626,12 @@ { maskObj.gameObject.SetActive(true); } - //maskObj.Init(target); - //maskObj.ShowImmediately(); + if (target.gameObject.name == "TowerBuyBtn") { maskObj.InitForCamera(target, towerBuyBtnPos, x, y); } - else if (target.gameObject.name == "FireSkillBtn") + else if (target.gameObject.name == "SkillBtn") { maskObj.InitForCamera(target, skillBtnPos, x, y); } @@ -735,4 +703,10 @@ #endregion + + public void OpenDialogBox(){ + + } + + } -- Gitblit v1.9.1