| | |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using System; |
| | | using KTGMGemClient; |
| | | using DG.Tweening; |
| | | /// <summary> |
| | | /// 新手引导UI脚本 |
| | |
| | | Vector2 rimOffset = new Vector2(30, 30);//边框要比按钮大一些 |
| | | |
| | | Image tmpMask;//自身的遮罩 |
| | | |
| | | GameObject offectBackground;//适配需要的黑色背景 |
| | | ImageFire1 fire1; |
| | | ImageFire2 fire2;//两个用来合成的火元素 |
| | | |
| | |
| | | ImageTowerPos2 towerPos2;//塔位标识 |
| | | |
| | | GameObject towerBuyBtn;//购买宝石按钮 |
| | | |
| | | Vector2 towerBuyBtnPos; |
| | | Image backgroundImg;//用来接受空白点击事件的图片 |
| | | |
| | | RectTransform dragHandImg;//拖动标识手指 |
| | |
| | | { |
| | | tmpMask = GetComponent<Image>(); |
| | | tmpMask.enabled = false; |
| | | offectBackground = transform.Find("OffectImage").gameObject; |
| | | offectBackground.SetActive(false); |
| | | |
| | | backgroundImg = transform.Find("Button").GetComponent<Image>(); |
| | | |
| | | towerBuyBtn = GameObject.Find("MainUI/TowerBuyBtn"); |
| | | 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); |
| | | towerBuyBtnPos = new Vector2(215, tmpOffect); |
| | | //towerBuyBtnPos = new Vector2(215, -862); |
| | | Debug.Log(tmpOffect); |
| | | |
| | | |
| | | tipsUI = transform.Find("Tips").gameObject; |
| | | tipsUI.transform.SetAsLastSibling();//把tips放在最下面 |
| | | |
| | |
| | | SetRimActive(true); |
| | | AddButtonListener(towerBuyBtn, ac); |
| | | Image btnImg = towerBuyBtn.GetComponent<Image>(); |
| | | InitRectGuidance(btnImg, 189, 73.5f); |
| | | InitRectGuidance(btnImg, 159, 73.5f); |
| | | SetRimPos(towerBuyBtn); |
| | | //maskObj.ShowImmediately(); |
| | | |
| | |
| | | fire1.gameObject.SetActive(true); |
| | | fire1.transform.Find("Image_2").gameObject.SetActive(false); |
| | | fire1.enabled = false; |
| | | |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire1.transform.position); |
| | | } |
| | | } |
| | | public void Step1_2() |
| | |
| | | DestoryButtonListener(towerBuyBtn); |
| | | SetRimActive(false); |
| | | CloseMask(); |
| | | EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.PlayAppearEffect, fire2.transform.position); |
| | | |
| | | //RemoveButtonListener(towerBuyBtn); |
| | | } |
| | | |
| | |
| | | { |
| | | |
| | | tmpMask.enabled = true; |
| | | offectBackground.SetActive(true); |
| | | |
| | | SetGuideUI(false); |
| | | |
| | |
| | | if (currentIndex == 0) |
| | | { |
| | | tmpMask.enabled = false; |
| | | offectBackground.SetActive(false); |
| | | |
| | | SetRimActive(true); |
| | | Image btnImg = transform.Find("Image_TowerPos").GetComponent<Image>(); |
| | |
| | | AddButtonListener(towerBuyBtn, ac); |
| | | |
| | | Image btnImg = towerBuyBtn.GetComponent<Image>(); |
| | | InitRectGuidance(btnImg, 189, 73.5f); |
| | | InitRectGuidance(btnImg, 159, 73.5f); |
| | | SetRimPos(towerBuyBtn); |
| | | //maskObj.ShowImmediately(); |
| | | } |
| | |
| | | SetRimActive(true); |
| | | RectTransform rt = target.GetComponent<RectTransform>(); |
| | | image_Rim_Rect.anchoredPosition = rt.anchoredPosition; |
| | | if (target.gameObject.name == "TowerBuyBtn") |
| | | { |
| | | image_Rim_Rect.anchoredPosition = towerBuyBtnPos; |
| | | } |
| | | image_Rim_Rect.sizeDelta = (rt.sizeDelta * rt.localScale) + rimOffset; |
| | | if (image_Rim_Rect.sizeDelta.x > 200) |
| | | { |
| | |
| | | } |
| | | //maskObj.Init(target); |
| | | //maskObj.ShowImmediately(); |
| | | maskObj.InitForCamera(target, x, y); |
| | | if (target.gameObject.name == "TowerBuyBtn") |
| | | { |
| | | maskObj.InitForCamera(target, towerBuyBtnPos, x, y); |
| | | } |
| | | else |
| | | { |
| | | maskObj.InitForCamera(target, x, y); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region 拖动效果 |
| | | private float dragTimer = 1f; |
| | | private void ShowDragPath(Vector2 startP, RectTransform endP) |
| | | { |
| | | if (!dragHandImg.gameObject.activeSelf) |