From df178fec76b6f6fed0326ff9f07bef2206dd75f9 Mon Sep 17 00:00:00 2001 From: liuzhiwei <liuzhiwei@qq.com> Date: Fri, 04 Dec 2020 18:11:17 +0800 Subject: [PATCH] Merge branch 'master' of http://172.16.1.52:8090/r/GemBattle into master --- Assets/Scripts/Guide/GuideBox.cs | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 56 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Guide/GuideBox.cs b/Assets/Scripts/Guide/GuideBox.cs index a9fe780..5526274 100644 --- a/Assets/Scripts/Guide/GuideBox.cs +++ b/Assets/Scripts/Guide/GuideBox.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; +using DG.Tweening; public enum GuideBoxType { @@ -36,11 +37,16 @@ Action callBack; + GameObject images; + Transform btnImageTS; + // Start is called before the first frame update void Awake() { bgBtn = transform.Find("BackGround").GetComponent<Button>(); bgBtn.onClick.AddListener(OnClickBtn); + + images = transform.Find("Images").gameObject; srImage = transform.Find("SRImage").gameObject; @@ -57,6 +63,8 @@ infoTxt = transform.Find("InfoTxt/Text").GetComponent<Text>(); myType = GuideBoxType.None; + + btnImageTS = transform.Find("BtnImage"); gameObject.SetActive(false); } @@ -93,6 +101,7 @@ private void Fire() { + images.SetActive(true); tmpPS = firePS; tmpPS.SetActive(true); //tmpPS.Play(); @@ -111,6 +120,8 @@ } private void Wood() { + images.SetActive(true); + tmpPS = woodPS; tmpPS.SetActive(true); @@ -122,6 +133,8 @@ } private void Water() { + images.SetActive(true); + tmpPS = waterPS; tmpPS.SetActive(true); @@ -137,9 +150,49 @@ if (callBack != null) { if (tmpPS != null) tmpPS.SetActive(false); - if (tmpObj != null) tmpObj.SetActive(false); - gameObject.SetActive(false); - callBack(); + //if (tmpObj != null) tmpObj.SetActive(false); + images.SetActive(false); + srImage.SetActive(false); + infoImage.SetActive(false); + PlayClosePs(); } } + + Vector3 endScale = new Vector3(0.2f, 0.2f, 0.2f); + private void PlayClosePs() + { + tmpObj.transform.Find("Images").gameObject.SetActive(false); + tmpObj.transform.Find("Icon").GetComponent<Image>().enabled = true; + + //RectTransform ts = tmpObj.GetComponent<RectTransform>(); + + tmpObj.transform.DOScale(endScale, 1.0f); + // isRotate = true; + // offect = 0; + tmpObj.transform.DOMove(btnImageTS.transform.position, 1f).SetEase(Ease.OutQuad).OnComplete(Close); + //ts.DOAnchorPos(btnImageRectTS.anchoredPosition, 1.0f).OnComplete(Close); + } + + // bool isRotate = false; + // float offect = 0; + // /// <summary> + // /// LateUpdate is called every frame, if the Behaviour is enabled. + // /// It is called after all Update functions have been called. + // /// </summary> + // void LateUpdate() + // { + // if (isRotate) + // { + // offect += Time.deltaTime; + // tmpObj.transform.localRotation = Quaternion.Euler(0, 0, offect * 1000); + // } + // } + + private void Close() + { + //isRotate = false; + tmpObj.gameObject.SetActive(false); + gameObject.SetActive(false); + callBack(); + } } -- Gitblit v1.9.1