123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class ButtonEffect : MonoBehaviour
- {
- bool isUp=false;
- public GameObject button;
- Vector3 localV3;
- public Transform BtnTip;
-
- public void buttonEnter()
- {
- if(!isUp)
- {
- LeanTween.cancel(button.gameObject);
- LeanTween.scale(button.gameObject, localV3 * 1.1f, 0.2f);
- }
- if (BtnTip)
- {
- BtnTip.gameObject.SetActive(true);
- }
- }
- public void buttonExit()
- {
- if (!isUp)
- {
- LeanTween.cancel(button.gameObject);
- LeanTween.scale(button.gameObject, localV3, 0.4f);
- }
- if (BtnTip)
- {
- BtnTip.gameObject.SetActive(false);
- }
- }
- public void buttonDown()
- {
- LeanTween.cancel(button.gameObject);
- LeanTween.scale(button.gameObject, localV3 * 0.9f, 0.2f);
- }
- public void buttonUp()
- {
- LeanTween.cancel(button.gameObject);
- LeanTween.scale(button.gameObject, localV3 * 1.5f, 0.25f);
- isUp = true;
- // UIModelManager.Instance.ZYKOnClick(true);
-
- }
- private void OnEnable()
- {
- isUp = false;
- if (localV3==Vector3.zero)
- localV3 = button.transform.localScale;
- button.transform.localScale = localV3 * 2.5f;
- LeanTween.cancel(button.gameObject);
- LeanTween.scale(button.gameObject, localV3, 0.4f);
- }
- }
|