| | |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using DG.Tweening; |
| | | |
| | | public enum GuideBoxType |
| | | { |
| | |
| | | |
| | | 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; |
| | | |
| | |
| | | infoTxt = transform.Find("InfoTxt/Text").GetComponent<Text>(); |
| | | |
| | | myType = GuideBoxType.None; |
| | | |
| | | btnImageTS = transform.Find("BtnImage"); |
| | | |
| | | gameObject.SetActive(false); |
| | | } |
| | |
| | | { |
| | | Water(); |
| | | } |
| | | AudioSourceManager.Ins.Play(AudioEnum.GuideOpenBox); |
| | | } |
| | | } |
| | | |
| | | private void Fire() |
| | | { |
| | | images.SetActive(true); |
| | | tmpPS = firePS; |
| | | tmpPS.SetActive(true); |
| | | //tmpPS.Play(); |
| | |
| | | } |
| | | private void Wood() |
| | | { |
| | | images.SetActive(true); |
| | | |
| | | tmpPS = woodPS; |
| | | |
| | | tmpPS.SetActive(true); |
| | |
| | | } |
| | | private void Water() |
| | | { |
| | | images.SetActive(true); |
| | | |
| | | tmpPS = waterPS; |
| | | |
| | | tmpPS.SetActive(true); |
| | |
| | | { |
| | | if (callBack != null) |
| | | { |
| | | bgBtn.interactable = false; |
| | | 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(); |
| | | } |
| | | } |